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

display a specific field selection system
static public getSpecificValueToSelect ( $field, $name = '', $values = '', array $options = [] ) : return
$field String name of the field
$name string name of the select (if empty use linkfield) (default '')
$values String/Array with the value to select or a Single value (default '')
$options array Array of options
Результат return the string to display
Пример #1
0
 /**
  * @since version 0.84
  *
  * @param $field
  * @param $name            (default '')
  * @param $values          (default '')
  * @param $options   array
  *
  * @return string
  **/
 static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     $options['display'] = false;
     switch ($field) {
         case 'priority':
             $options['name'] = $name;
             $options['value'] = $values[$field];
             $options['withmajor'] = 1;
             return CommonITILObject::dropdownPriority($options);
         case 'visibility':
             $options['name'] = $name;
             $options['value'] = $values[$field];
             return self::dropdownVisibility($options);
         case 'state':
             return Planning::dropdownState($name, $values[$field], false);
     }
     return parent::getSpecificValueToSelect($field, $name, $values, $options);
 }
 /**
  * @since version 0.84
  *
  * @param $field
  * @param $name            (default '')
  * @param $values          (default '')
  * @param $options   array
  **/
 static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     $options['display'] = false;
     switch ($field) {
         case 'status':
             $options['name'] = $name;
             $options['value'] = $values[$field];
             return self::dropdownStatus($options);
         case 'impact':
             $options['name'] = $name;
             $options['value'] = $values[$field];
             return self::dropdownImpact($options);
         case 'urgency':
             $options['name'] = $name;
             $options['value'] = $values[$field];
             return self::dropdownUrgency($options);
         case 'priority':
             $options['name'] = $name;
             $options['value'] = $values[$field];
             return self::dropdownPriority($options);
         case 'global_validation':
             $options['global'] = true;
             $options['value'] = $values[$field];
             return CommonITILValidation::dropdownStatus($name, $options);
     }
     return parent::getSpecificValueToSelect($field, $name, $values, $options);
 }
Пример #3
0
 /**
  * @since version 0.84
  *
  * @param $field
  * @param $name               (default '')
  * @param $values             (default '')
  * @param $options      array
  **/
 static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     $options['display'] = false;
     switch ($field) {
         case 'state':
             return Planning::dropdownState($name, $values[$field], false);
     }
     return parent::getSpecificValueToSelect($field, $name, $values, $options);
 }
Пример #4
0
 /**
  * @since version 0.84
  *
  * @param $field
  * @param $name               (default '')
  * @param $values             (default '')
  * @param $options      array
  **/
 static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     $options['display'] = 0;
     switch ($field) {
         case 'mode':
             $options['value'] = $values[$field];
             $tab[self::MODE_INTERNAL] = self::getModeName(self::MODE_INTERNAL);
             $tab[self::MODE_EXTERNAL] = self::getModeName(self::MODE_EXTERNAL);
             return Dropdown::showFromArray($name, $tab, $options);
         case 'state':
             return CronTask::dropdownState($name, $values[$field], false);
     }
     return parent::getSpecificValueToSelect($field, $name, $values, $options);
 }
Пример #5
0
 /**
  * @since version 0.84
  *
  * @param $field
  * @param $name            (default '')
  * @param $values          (default '')
  * @param $options   array
  **/
 static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     $options['display'] = false;
     switch ($field) {
         case 'alert':
             $options['name'] = $name;
             $options['value'] = $values[$field];
             return self::dropdownAlert($options);
         case 'renewal':
             $options['name'] = $name;
             return self::dropdownContractRenewal($name, $values[$field], false);
     }
     return parent::getSpecificValueToSelect($field, $name, $values, $options);
 }
Пример #6
0
 /**
  * @since version 0.84
  *
  * @param  $field
  * @param  $name              (default '')
  * @param  $values            (default('')
  * @param  $options   array
  **/
 static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     $options['display'] = false;
     switch ($field) {
         case 'group_search_type':
             $options['value'] = $values[$field];
             $options['name'] = $name;
             return self::dropdownGroupSearchType($options);
     }
     return parent::getSpecificValueToSelect($field, $name, $values, $options);
 }
Пример #7
0
 /**
  * Define how to display search field for a specific type
  *
  * @since version 0.84
  *
  * @param String $field           Name of the field as define in $this->getSearchOptions()
  * @param String $name            Name attribute for the field to be posted (default '')
  * @param Array  $values          Array of all values to display in search engine (default '')
  * @param Array  $options         Options (optional)
  *
  * @return String                 Html string to be displayed for the form field
  **/
 public static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     $options['display'] = false;
     switch ($field) {
         case 'is_active':
             $output = "<select name='" . $name . "'>";
             $output .= "<option value='0' " . ($values[$field] == 0 ? " selected " : "") . ">" . __('Inactive') . "</option>";
             $output .= "<option value='1' " . ($values[$field] == 1 ? " selected " : "") . ">" . __('Active') . "</option>";
             $output .= "</select>";
             return $output;
             break;
         case 'access_rights':
             $output = '<select name="' . $name . '">';
             $output .= '<option value="' . self::ACCESS_PUBLIC . '" ' . ($values[$field] == 0 ? ' selected ' : '') . '>' . __('Public access', 'formcreator') . '</option>';
             $output .= '<option value="' . self::ACCESS_PRIVATE . '" ' . ($values[$field] == 1 ? ' selected ' : '') . '>' . __('Private access', 'formcreator') . '</option>';
             $output .= '<option value="' . self::ACCESS_RESTRICTED . '" ' . ($values[$field] == 1 ? ' selected ' : '') . '>' . __('Restricted access', 'formcreator') . '</option>';
             $output .= '</select>';
             return $output;
             break;
         case 'language':
             return Dropdown::showLanguages('language', array('value' => $values[$field], 'display_emptychoice' => true, 'emptylabel' => '--- ' . __('All langages', 'formcreator') . ' ---', 'display' => false));
             break;
     }
     return parent::getSpecificValueToSelect($field, $name, $values, $options);
 }
 static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     $options['display'] = false;
     switch ($field) {
         case 'type':
             return self::dropdownGroupType($name, $values[$field]);
         default:
             break;
     }
     return parent::getSpecificValueToSelect($field, $name, $values, $options);
 }
 /**
  * @since version 0.84
  *
  * @param $field
  * @param $name               (default '')
  * @param $values             (default '')
  * @param $options      array
  **/
 static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     $options['display'] = false;
     switch ($field) {
         case 'event':
             if (isset($values['itemtype']) && !empty($values['itemtype'])) {
                 $options['value'] = $values[$field];
                 $options['name'] = $name;
                 return NotificationEvent::dropdownEvents($values['itemtype'], $options);
             }
             break;
         case 'mode':
             $options['value'] = $values[$field];
             $options['name'] = $name;
             return self::dropdownMode($options);
     }
     return parent::getSpecificValueToSelect($field, $name, $values, $options);
 }
 /**
  * @since version 0.84
  *
  * @param $field
  * @param $name                  (default '')
  * @param $values                (default '')
  * @param $options   array
  **/
 static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     $options['display'] = false;
     switch ($field) {
         case 'type':
             $options['value'] = $values[$field];
             $typeinquest = array(1 => __('Internal survey'), 2 => __('External survey'));
             return Dropdown::showFromArray($name, $typeinquest, $options);
     }
     return parent::getSpecificValueToSelect($field, $name, $values, $options);
 }
 /**
  * @since version 0.84
  *
  * @param $field
  * @param $name               (default '')
  * @param $values             (default '')
  * @param $options      array
  **/
 static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     $options['display'] = false;
     switch ($field) {
         case 'reason':
             $options['value'] = $values[$field];
             return Dropdown::showFromArray($name, self::getAllReasons(), $options);
     }
     return parent::getSpecificValueToSelect($field, $name, $values, $options);
 }
Пример #12
0
 /**
  * @since version 2.3.0
  *
  * @param $field
  * @param $name               (default '')
  * @param $values             (defaut '')
  * @param $options   array
  **/
 static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     $options['display'] = false;
     switch ($field) {
         case 'step':
             $options['value'] = $values[$field];
             return Dropdown::showFromArray($name, PluginDatainjectionDropdown::statusLabels(), $options);
         case 'port_unicity':
             $options['value'] = $values[$field];
             return Dropdown::showFromArray($name, PluginDatainjectionDropdown::portUnicityValues(), $options);
         case 'float_format':
             $options['value'] = $values[$field];
             return Dropdown::showFromArray($name, PluginDatainjectionDropdown::floatFormats(), $options);
         case 'date_format':
             $options['value'] = $values[$field];
             return Dropdown::showFromArray($name, PluginDatainjectionDropdown::dateFormats(), $options);
     }
     return parent::getSpecificValueToSelect($field, $name, $values, $options);
 }
Пример #13
0
 /**
  * Define how to display search field for a specific type
  *
  * @since version 0.84
  *
  * @param String $field           Name of the field as define in $this->getSearchOptions()
  * @param String $name            Name attribute for the field to be posted (default '')
  * @param Array  $values          Array of all values to display in search engine (default '')
  * @param Array  $options         Options (optional)
  *
  * @return String                 Html string to be displayed for the form field
  **/
 public static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     $options['display'] = false;
     switch ($field) {
         case 'is_active':
             return Dropdown::showFromArray('criteria[0][value]', array('0' => __('Inactive'), '1' => __('Active')), array('value' => $values[$field], 'display_emptychoice' => true, 'display' => false));
             break;
         case 'access_rights':
             return Dropdown::showFromArray('criteria[0][value]', array(Dropdown::EMPTY_VALUE => '--- ' . __('All langages', 'formcreator') . ' ---', self::ACCESS_PUBLIC => __('Public access', 'formcreator'), self::ACCESS_PRIVATE => __('Private access', 'formcreator'), self::ACCESS_RESTRICTED => __('Restricted access', 'formcreator')), array('value' => $values[$field], 'display_emptychoice' => true, 'display' => false));
             break;
         case 'language':
             return Dropdown::showLanguages('criteria[0][value]', array('value' => $values[$field], 'display_emptychoice' => true, 'emptylabel' => '--- ' . __('All langages', 'formcreator') . ' ---', 'display' => false));
             break;
     }
     return parent::getSpecificValueToSelect($field, $name, $values, $options);
 }
Пример #14
0
 /**
  * @since version 0.84
  *
  * @param $field
  * @param $name               (default '')
  * @param $values             (default '')
  * @param $options      array
  **/
 static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     $options['display'] = false;
     switch ($field) {
         case 'interface':
             $options['value'] = $values[$field];
             return Dropdown::showFromArray($name, self::getInterfaces(), $options);
         case 'helpdesk_hardware':
             $options['value'] = $values[$field];
             return Dropdown::showFromArray($name, self::getHelpdeskHardwareTypes(), $options);
         case "helpdesk_item_type":
             $options['values'] = explode(',', $values[$field]);
             $options['name'] = $name;
             return self::dropdownHelpdeskItemtypes($options);
     }
     return parent::getSpecificValueToSelect($field, $name, $values, $options);
 }
Пример #15
0
 /**
  * @param  $field
  * @param  $name              (default '')
  * @param  $values            (default '')
  * @param  $options   array
  **/
 static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     $options['display'] = false;
     switch ($field) {
         case 'match':
             if (isset($values['itemtype']) && !empty($values['itemtype'])) {
                 $options['value'] = $values[$field];
                 $options['name'] = $name;
                 $rule = new static();
                 return $rule->dropdownRulesMatch($options);
             }
             break;
     }
     return parent::getSpecificValueToSelect($field, $name, $values, $options);
 }
Пример #16
0
 /**
  * @since version 0.84
  *
  * @param $field
  * @param $name               (default '')
  * @param $values             (defaut '')
  * @param $options   array
  **/
 static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     $options['display'] = false;
     switch ($field) {
         case 'authtype':
             $options['name'] = $name;
             $options['value'] = $values[$field];
             return Auth::dropdown($options);
     }
     return parent::getSpecificValueToSelect($field, $name, $values, $options);
 }
Пример #17
0
 /**
  * @since version 0.84
  *
  * @param $field
  * @param $name               (default '')
  * @param $values             (defaut '')
  * @param $options   array
  **/
 static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     $options['display'] = false;
     switch ($field) {
         case 'replace_method':
             $options['value'] = $values[$field];
             return Dropdown::showFromArray($name, self::getReplacementMethods(), $options);
         case 'types_id':
             $types[self::TYPE_MODEL_UNINSTALL] = __('Uninstallation', 'uninstall');
             if (self::canReplace()) {
                 $types[self::TYPE_MODEL_REPLACEMENT] = __('Replacement', 'uninstall');
             }
             $options['value'] = $values[$field];
             return Dropdown::showFromArray($name, $types, $options);
         case 'groups_id':
             $options['name'] = $name;
             $options['value'] = $values[$field];
             $options['emptylabel'] = __('None');
             return Group::dropdown($options);
     }
     return parent::getSpecificValueToSelect($field, $name, $values, $options);
 }