From b8ffafc60337143c7b718412e476ed9e2206d532 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 1 Dec 2019 13:04:14 +0100 Subject: [PATCH] Look and feel v11 --- .../class/opensurveysondage.class.php | 51 +++++++------------ htdocs/opensurvey/list.php | 2 +- 2 files changed, 18 insertions(+), 35 deletions(-) diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index b1cdeac1f36..1b6d35e65a3 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -646,42 +646,25 @@ class Opensurveysondage extends CommonObject // phpcs:enable global $langs, $conf; - //print 'x'.$status.'-'.$billed; - if ($mode == 0) + if (empty($this->labelStatus) || empty($this->labelStatusShort)) { - if ($status==self::STATUS_DRAFT) return $langs->trans('Draft'); - elseif ($status==self::STATUS_VALIDATED) return $langs->trans('Opened'); - elseif ($status==self::STATUS_CLOSED) return $langs->trans('Closed'); + global $langs; + //$langs->load("mymodule"); + $this->labelStatus[self::STATUS_DRAFT] = $langs->trans('Draft'); + $this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('Opened'); + $this->labelStatus[self::STATUS_CLOSED] = $langs->trans('Closed'); + $this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('Draft'); + $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('Opened'); + $this->labelStatusShort[self::STATUS_CLOSED] = $langs->trans('Closed'); } - elseif ($mode == 1) - { - if ($status==self::STATUS_DRAFT) return $langs->trans('Draft'); - elseif ($status==self::STATUS_VALIDATED) return $langs->trans('Opened'); - elseif ($status==self::STATUS_CLOSED) return $langs->trans('Closed'); - } - elseif ($mode == 2) - { - if ($status==self::STATUS_DRAFT) return img_picto($langs->trans('Draft'), 'statut0').' '.$langs->trans('Draft'); - elseif ($status==self::STATUS_VALIDATED) return img_picto($langs->trans('Opened'), 'statut1').' '.$langs->trans('Opened'); - elseif ($status==self::STATUS_CLOSED) return img_picto($langs->trans('Closed'), 'statut6').' '.$langs->trans('Closed'); - } - elseif ($mode == 3) - { - if ($status==self::STATUS_DRAFT) return img_picto($langs->trans('Draft'), 'statut0'); - elseif ($status==self::STATUS_VALIDATED) return img_picto($langs->trans('Opened'), 'statut1'); - elseif ($status==self::STATUS_CLOSED) return img_picto($langs->trans('Closed'), 'statut6'); - } - elseif ($mode == 4) - { - if ($status==self::STATUS_DRAFT) return img_picto($langs->trans('Draft'), 'statut0').' '.$langs->trans('Draft'); - elseif ($status==self::STATUS_VALIDATED) return img_picto($langs->trans('Opened').$billedtext, 'statut1').' '.$langs->trans('Opened'); - elseif ($status==self::STATUS_CLOSED) return img_picto($langs->trans('Closed'), 'statut6').' '.$langs->trans('Closed'); - } - elseif ($mode == 5) - { - if ($status==self::STATUS_DRAFT) return ''.$langs->trans('Draft').' '.img_picto($langs->trans('Draft'), 'statut0'); - elseif ($status==self::STATUS_VALIDATED) return ''.$langs->trans('Opened').' '.img_picto($langs->trans('Opened'), 'statut1'); - elseif ($status==self::STATUS_CLOSED) return ''.$langs->trans('Closed').' '.img_picto($langs->trans('Closed'), 'statut6'); + + $statusType = 'status'.$status; + if ($status == self::STATUS_VALIDATED) { + if (0) $statusType = 'status1'; + else $statusType = 'status4'; } + if ($status == self::STATUS_CLOSED) $statusType = 'status6'; + + return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } } diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index 6f5fd824b06..a1d218e4e3c 100644 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -413,7 +413,7 @@ while ($i < min($num, $limit)) print ''; if (! $i) $totalarray['nbfield']++; - print''.$opensurvey_static->getLibStatut(5).''."\n"; + print ''.$opensurvey_static->getLibStatut(5).''."\n"; if (! $i) $totalarray['nbfield']++; // Extra fields