getGlobalSwitch() static public method

Get the label associated with a management type
static public getGlobalSwitch ( $value ) : the
return the label corresponding to it, or ""
 function showCacheRuleDetail($fields)
 {
     global $LANG;
     echo "<td class='tab_bg_2'>" . $fields["old_value"] . "</td>";
     echo "<td class='tab_bg_2'>" . $fields["manufacturer"] . "</td>";
     echo "<td class='tab_bg_2'>" . ($fields["new_value"] != '' ? $fields["new_value"] : $LANG['rulesengine'][106]) . "</td>";
     echo "<td class='tab_bg_2'>" . ($fields["is_global"] != '' ? Dropdown::getGlobalSwitch($fields["is_global"]) : $LANG['rulesengine'][106]) . "</td>";
     echo "<td class='tab_bg_2'>" . (isset($fields["new_manufacturer"]) && $fields["new_manufacturer"] != '' ? Dropdown::getDropdownName("glpi_manufacturers", $fields["new_manufacturer"]) : $LANG['rulesengine'][106]) . "</td>";
     echo "<td class='tab_bg_2'>";
     if ($fields["ignore_ocs_import"] == '') {
         echo "&nbsp;";
     } else {
         echo Dropdown::getYesNo($fields["ignore_ocs_import"]);
     }
     echo "</td>";
 }
Exemplo n.º 2
0
 /**
  * Return a "display" value associated with a pattern associated to a criteria
  *
  * @param $ID     the given action
  * @param $type   the type of action
  * @param $value  the value
  **/
 function getActionValue($ID, $type, $value)
 {
     $action = $this->getAction($ID);
     if (isset($action['type'])) {
         switch ($action['type']) {
             case "dropdown":
                 if ($type == 'fromuser' || $type == 'fromitem') {
                     return Dropdown::getYesNo($value);
                 }
                 // $type == assign
                 $tmp = Dropdown::getDropdownName($action["table"], $value);
                 return $tmp == '&nbsp;' ? NOT_AVAILABLE : $tmp;
             case "dropdown_status":
                 return Ticket::getStatus($value);
             case "dropdown_assign":
             case "dropdown_users":
             case "dropdown_users_validate":
                 return getUserName($value);
             case "dropdown_groups_validate":
                 return Dropdown::getDropdownName('glpi_groups', $value);
             case "dropdown_validation_percent":
                 return Dropdown::getValueWithUnit($value, '%');
             case "yesonly":
             case "yesno":
                 return Dropdown::getYesNo($value);
             case "dropdown_urgency":
                 return Ticket::getUrgencyName($value);
             case "dropdown_impact":
                 return Ticket::getImpactName($value);
             case "dropdown_priority":
                 return Ticket::getPriorityName($value);
             case "dropdown_tickettype":
                 return Ticket::getTicketTypeName($value);
             case "dropdown_management":
                 return Dropdown::getGlobalSwitch($value);
             default:
                 return $this->displayAdditionRuleActionValue($value);
         }
     }
     return $value;
 }
Exemplo n.º 3
0
 /**
  * Return a value associated with a pattern associated to a criteria
  *
  * @param $ID the given action
  * @param $value the value
  **/
 function getActionValue($ID, $value)
 {
     global $LANG;
     $action = $this->getAction($ID);
     if (isset($action['type'])) {
         switch ($action['type']) {
             case "dropdown":
                 return Dropdown::getDropdownName($action["table"], $value);
             case "dropdown_status":
                 return Ticket::getStatus($value);
             case "dropdown_assign":
             case "dropdown_users":
             case "dropdown_users_validate":
                 return getUserName($value);
             case "yesonly":
             case "yesno":
                 if ($value) {
                     return $LANG['choice'][1];
                 }
                 return $LANG['choice'][0];
             case "dropdown_urgency":
                 return Ticket::getUrgencyName($value);
             case "dropdown_impact":
                 return Ticket::getImpactName($value);
             case "dropdown_priority":
                 return Ticket::getPriorityName($value);
             case "dropdown_management":
                 return Dropdown::getGlobalSwitch($value);
             default:
                 return $this->displayAdditionRuleActionValue($value);
         }
     }
     return $value;
 }