getSpecificValueToDisplay() статический публичный Метод

display a specific field value
static public getSpecificValueToDisplay ( $field, $values, array $options = [] ) : return
$field String name of the field
$values String/Array with the value to display or a Single value
$options array Array of options
Результат return the string to display
Пример #1
0
 /**
  * @since version 0.84
  *
  * @param $field
  * @param $values
  * @param $options   array
  **/
 static function getSpecificValueToDisplay($field, $values, array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     switch ($field) {
         case 'alert':
             return self::getAlertName($values[$field]);
         case 'renewal':
             return self::getContractRenewalName($values[$field]);
     }
     return parent::getSpecificValueToDisplay($field, $values, $options);
 }
 static function getSpecificValueToDisplay($field, $values, array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     switch ($field) {
         case 'items_id':
             if (isset($values['itemtype'])) {
                 $itemtype = $values['itemtype'];
                 $item = new $itemtype();
                 $item->getFromDB($values[$field]);
                 return $item->getLink();
             }
             break;
         case 'users_id':
             $user = new User();
             $user->getFromDB($values[$field]);
             return $user->getName(1);
             break;
     }
     return parent::getSpecificValueToDisplay($field, $values, $options);
 }
 /**
  * @since version 0.85
  *
  * @param $field
  * @param $values
  * @param $options   array
  **/
 static function getSpecificValueToDisplay($field, $values, array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     switch ($field) {
         case 'resolution_time':
             switch ($values['definition_time']) {
                 case 'minute':
                     return sprintf(_n('%d minute', '%d minutes', $values[$field]), $values[$field]);
                 case 'hour':
                     return sprintf(_n('%d hour', '%d hours', $values[$field]), $values[$field]);
                 case 'day':
                     return sprintf(_n('%d day', '%d days', $values[$field]), $values[$field]);
             }
             break;
     }
     return parent::getSpecificValueToDisplay($field, $values, $options);
 }
Пример #4
0
 /**
  * @since version 0.84
  *
  * @param $field
  * @param $values
  * @param $options   array
  **/
 static function getSpecificValueToDisplay($field, $values, array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     switch ($field) {
         case 'interface':
             return self::getInterfaceName($values[$field]);
         case 'helpdesk_hardware':
             return self::getHelpdeskHardwareTypeName($values[$field]);
         case "helpdesk_item_type":
             $types = explode(',', $values[$field]);
             $message = array();
             foreach ($types as $type) {
                 if ($item = getItemForItemtype($type)) {
                     $message[] = $item->getTypeName();
                 }
             }
             return implode(', ', $message);
     }
     return parent::getSpecificValueToDisplay($field, $values, $options);
 }
Пример #5
0
 /**
  * @since version 0.84
  *
  * @param $field
  * @param $values
  * @param $options   array
  **/
 static function getSpecificValueToDisplay($field, $values, array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     switch ($field) {
         case 'replace_method':
             if ($values['replace_method'] != 0) {
                 return self::getMethodReplacement($values['replace_method']);
             }
             return Dropdown::EMPTY_VALUE;
             break;
         case 'types_id':
             if ($values['types_id'] == self::TYPE_MODEL_UNINSTALL) {
                 return __('Uninstallation', 'uninstall');
             }
             return __('Replacement', 'uninstall');
             break;
         case 'groups_id':
             if ($values['groups_id'] < 0) {
                 return __('Keep in the current group', 'uninstall');
             } else {
                 if (!$values['groups_id']) {
                     return __('None');
                 }
             }
             return Dropdown::getDropdownName('glpi_groups', $values['groups_id']);
             break;
     }
     return parent::getSpecificValueToDisplay($field, $values, $options);
 }
Пример #6
0
 static function getSpecificValueToDisplay($field, $values, array $options = array())
 {
     switch ($field) {
         case 'dolog_method':
             $methods = self::getLogMethod();
             return $methods[$values[$field]];
         case 'ipv4_range_start':
         case 'ipv4_range_end':
             return long2ip($values[$field]);
     }
     return parent::getSpecificValueToDisplay($field, $values, $options);
 }
Пример #7
0
 /**
  * display a value according to a field
  *
  * @since version 0.83
  *
  * @param $field     String         name of the field
  * @param $values    String / Array with the value to display
  * @param $options   Array          of option
  *
  * @return a string
  **/
 static function getSpecificValueToDisplay($field, $values, array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     switch ($field) {
         case 'priority':
             return CommonITILObject::getPriorityName($values[$field]);
         case 'visibility':
             return self::getVisibilityName($values[$field]);
         case 'state':
             return Planning::getState($values[$field]);
     }
     return parent::getSpecificValueToDisplay($field, $values, $options);
 }
Пример #8
0
 /**
  * @since version 0.84
  *
  * @param $field
  * @param $values
  * @param $options   array
  **/
 static function getSpecificValueToDisplay($field, $values, array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     switch ($field) {
         case 'reason':
             return self::getReason($values[$field]);
     }
     return parent::getSpecificValueToDisplay($field, $values, $options);
 }
 /**
  * @since version 0.84
  *
  * @param $field
  * @param $values
  * @param $options   array
  **/
 static function getSpecificValueToDisplay($field, $values, array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     switch ($field) {
         case 'reason':
             return self::getReason($values[$field]);
         case 'messageid':
             $clean = array('<' => '', '>' => '');
             return strtr($values[$field], $clean);
     }
     return parent::getSpecificValueToDisplay($field, $values, $options);
 }
Пример #10
0
 /**
  * @param $field
  * @param $values
  * @param $options   array
  **/
 static function getSpecificValueToDisplay($field, $values, array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     switch ($field) {
         case 'headers':
             $values[$field] = importArrayFromDB($values[$field]);
             $out = '';
             if (is_array($values[$field]) && count($values[$field])) {
                 foreach ($values[$field] as $key => $val) {
                     $out .= $key . ': ' . $val . '<br>';
                 }
             }
             return $out;
             break;
     }
     return parent::getSpecificValueToDisplay($field, $values, $options);
 }
 static function getSpecificValueToDisplay($field, $values, array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     switch ($field) {
         case 'date_expiration':
             if (empty($values[$field])) {
                 return __('infinite');
             } else {
                 return Html::convdate($values[$field]);
             }
             break;
     }
     return parent::getSpecificValueToDisplay($field, $values, $options);
 }
Пример #12
0
 /**
  * @since version 2.3.0
  *
  * @param $field
  * @param $values
  * @param $options   array
  **/
 static function getSpecificValueToDisplay($field, $values, array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     switch ($field) {
         case "port_unicity":
             return PluginDatainjectionDropdown::getPortUnicityValues($values['port_unicity']);
         case "float_format":
             return PluginDatainjectionDropdown::getFloatFormat($values['float_format']);
         case "date_format":
             return PluginDatainjectionDropdown::getDateFormat($values['date_format']);
         case "step":
             return PluginDatainjectionDropdown::getStatusLabel($values['step']);
     }
     return parent::getSpecificValueToDisplay($field, $values, $options);
 }
 static function getSpecificValueToDisplay($field, $values, array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     switch ($field) {
         case 'calendars_id':
             $calendar = new Calendar();
             $calendar->getFromDB($values[$field]);
             return $calendar->getName(1);
             break;
         case 'freshness_type':
             $a_freshness_type = array();
             $a_freshness_type['seconds'] = __('Second(s)', 'monitoring');
             $a_freshness_type['minutes'] = __('Minute(s)', 'monitoring');
             $a_freshness_type['hours'] = __('Hour(s)', 'monitoring');
             $a_freshness_type['days'] = __('Day(s)', 'monitoring');
             return $a_freshness_type[$values[$field]];
             break;
     }
     return parent::getSpecificValueToDisplay($field, $values, $options);
 }
Пример #14
0
 static function getSpecificValueToDisplay($field, $values, array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     switch ($field) {
         case 'type':
             return self::getQuestionTypeName($values[$field]);
             break;
     }
     return parent::getSpecificValueToDisplay($field, $values, $options);
 }
Пример #15
0
 /**
  * @param $field
  * @param $values
  * @param $options   array
  **/
 static function getSpecificValueToDisplay($field, $values, array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     switch ($field) {
         case 'refresh_rate':
             return Html::timestampToString($values[$field], false);
     }
     return parent::getSpecificValueToDisplay($field, $values, $options);
 }
 /**
  * @since version 0.84
  *
  * @param $field
  * @param $values
  * @param $options   array
  **/
 static function getSpecificValueToDisplay($field, $values, array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     switch ($field) {
         case 'event':
             if (isset($values['itemtype']) && !empty($values['itemtype'])) {
                 return NotificationEvent::getEventName($values['itemtype'], $values[$field]);
             }
             break;
         case 'mode':
             return self::getMode($values[$field]);
     }
     return parent::getSpecificValueToDisplay($field, $values, $options);
 }
Пример #17
0
 /**
  * @since version 0.84
  *
  * @param $field
  * @param $values
  * @param $options   array
  **/
 static function getSpecificValueToDisplay($field, $values, array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     switch ($field) {
         case 'group_search_type':
             return self::getGroupSearchTypeName($values[$field]);
     }
     return parent::getSpecificValueToDisplay($field, $values, $options);
 }
Пример #18
0
 /**
  * Define how to display a specific value in search result table
  *
  * @param  String $field   Name of the field as define in $this->getSearchOptions()
  * @param  Mixed  $values  The value as it is stored in DB
  * @param  Array  $options Options (optional)
  * @return Mixed           Value to be displayed
  */
 public static function getSpecificValueToDisplay($field, $values, array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     switch ($field) {
         case 'is_active':
             if ($values[$field] == 0) {
                 $output = '<div style="text-align: center"><img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/inactive.png"
                        height="16" width="16"
                        alt="' . __('Inactive') . '"
                        title="' . __('Inactive') . '" /></div>';
             } else {
                 $output = '<div style="text-align: center"><img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/active.png"
                        height="16" width="16"
                        alt="' . __('Active') . '"
                        title="' . __('Active') . '" /></div>';
             }
             return $output;
             break;
         case 'access_rights':
             switch ($values[$field]) {
                 case self::ACCESS_PUBLIC:
                     return __('Public access', 'formcreator');
                     break;
                 case self::ACCESS_PRIVATE:
                     return __('Private access', 'formcreator');
                     break;
                 case self::ACCESS_RESTRICTED:
                     return __('Restricted access', 'formcreator');
                     break;
             }
             return '';
             break;
         case 'language':
             if (empty($values[$field])) {
                 return __('All langages', 'formcreator');
             } else {
                 return Dropdown::getLanguageName($values[$field]);
             }
             break;
     }
     return parent::getSpecificValueToDisplay($field, $values, $options);
 }
Пример #19
0
 static function getSpecificValueToDisplay($field, $values, array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     switch ($field) {
         case 'mode':
             return self::getModeName($values[$field]);
         case 'state':
             return self::getStateName($values[$field]);
     }
     return parent::getSpecificValueToDisplay($field, $values, $options);
 }
 static function getSpecificValueToDisplay($field, $values, array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     switch ($field) {
         case 'plugin_monitoring_services_id':
             $pmService = new PluginMonitoringService();
             $pmService->getFromDB($values[$field]);
             return $pmService->getLink();
             break;
     }
     return parent::getSpecificValueToDisplay($field, $values, $options);
 }
 /**
  * display a value according to a field
  *
  * @since version 0.83
  *
  * @param $field     String         name of the field
  * @param $values    String / Array with the value to display
  * @param $options   Array          of option
  *
  * @return a string
  **/
 static function getSpecificValueToDisplay($field, $values, array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     switch ($field) {
         case 'status':
             return self::getStatus($values[$field]);
         case 'urgency':
             return self::getUrgencyName($values[$field]);
         case 'impact':
             return self::getImpactName($values[$field]);
         case 'priority':
             return self::getPriorityName($values[$field]);
         case 'global_validation':
             return CommonITILValidation::getStatus($values[$field]);
     }
     return parent::getSpecificValueToDisplay($field, $values, $options);
 }
Пример #22
0
 /**
  * @param  $field
  * @param  $values
  * @param  $options   array
  *
  * @return string
  **/
 static function getSpecificValueToDisplay($field, $values, array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     switch ($field) {
         case 'match':
             switch ($values[$field]) {
                 case self::AND_MATCHING:
                     return __('and');
                 case self::OR_MATCHING:
                     return __('or');
                 default:
                     return NOT_AVAILABLE;
             }
             break;
     }
     return parent::getSpecificValueToDisplay($field, $values, $options);
 }
Пример #23
0
 /**
  * @since ersion 0.84
  *
  * @param $field
  * @param $values
  * @param $options   array
  **/
 static function getSpecificValueToDisplay($field, $values, array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     switch ($field) {
         case 'authtype':
             $auths_id = 0;
             if (isset($values['auths_id']) && !empty($values['auths_id'])) {
                 $auths_id = $values['auths_id'];
             }
             return Auth::getMethodName($values[$field], $auths_id);
     }
     return parent::getSpecificValueToDisplay($field, $values, $options);
 }
 static function getSpecificValueToDisplay($field, $values, array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     switch ($field) {
         case 'plugin_monitoring_hosts_id':
             $pmHost = new PluginMonitoringHost();
             $pmHost->getFromDB($values[$field]);
             return $pmHost->getLink(array("monitoring" => "1"));
             break;
         case 'duration_type':
             $a_duration_type = array();
             $a_duration_type['seconds'] = __('Second(s)', 'monitoring');
             $a_duration_type['minutes'] = __('Minute(s)', 'monitoring');
             $a_duration_type['hours'] = __('Hour(s)', 'monitoring');
             $a_duration_type['days'] = __('Day(s)', 'monitoring');
             return $a_duration_type[$values[$field]];
             break;
         case 'users_id':
             $user = new User();
             $user->getFromDB($values[$field]);
             return $user->getName(1);
             break;
     }
     return parent::getSpecificValueToDisplay($field, $values, $options);
 }