getStatus() static public method

Get Ticket validation status Name
static public getStatus ( $value )
$value status ID
 function getDatasForTemplate($event, $options = array())
 {
     $this->datas['##consumable.entity##'] = Dropdown::getDropdownName('glpi_entities', $options['entities_id']);
     $this->datas['##lang.consumable.entity##'] = __('Entity');
     $this->datas['##consumable.entity##'] = Dropdown::getDropdownName('glpi_entities', $options['entities_id']);
     $this->datas['##lang.consumable.entity##'] = __('Entity');
     switch ($event) {
         case self::CONSUMABLE_REQUEST:
             $this->datas['##consumable.action##'] = __('Consumable request', 'consumables');
             break;
         case self::CONSUMABLE_RESPONSE:
             $this->datas['##consumable.action##'] = __('Consumable validation', 'consumables');
             break;
     }
     // Consumable request
     $this->datas['##lang.consumablerequest.consumable##'] = _n('Consumable', 'Consumables', 1);
     $this->datas['##lang.consumablerequest.consumabletype##'] = _n('Consumable type', 'Consumable types', 1);
     $this->datas['##lang.consumablerequest.request_date##'] = __('Request date');
     $this->datas['##lang.consumablerequest.requester##'] = __('Requester');
     $this->datas['##lang.consumablerequest.status##'] = __('Status');
     $this->datas['##lang.consumablerequest.number##'] = __('Number of used consumables');
     $this->datas['##lang.consumablerequest.validator##'] = __('Approver');
     $this->datas['##lang.consumablerequest.comment##'] = __('Comments');
     $consumable = $options['consumablerequest'];
     $this->datas['##consumablerequest.consumable##'] = Dropdown::getDropdownName(ConsumableItem::getTable(), $consumable['consumables_id']);
     $this->datas['##consumablerequest.consumabletype##'] = Dropdown::getDropdownName(ConsumableItemType::getTable(), $consumable['consumableitemtypes_id']);
     $this->datas['##consumablerequest.request_date##'] = Html::convDateTime($consumable['date_mod']);
     $this->datas['##consumablerequest.end_date##'] = Html::convDateTime($consumable['end_date']);
     $this->datas['##consumablerequest.requester##'] = Html::clean(getUserName($consumable['requesters_id']));
     $this->datas['##consumablerequest.validator##'] = Html::clean(getUserName($consumable['validators_id']));
     $this->datas['##consumablerequest.number##'] = $consumable['number'];
     $this->datas['##consumablerequest.status##'] = CommonITILValidation::getStatus($consumable['status']);
     if (isset($options['comment'])) {
         $this->datas['##consumablerequest.comment##'] = Html::clean($options['comment']);
     }
 }
 /**
  * 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);
 }
Ejemplo n.º 3
0
 /**
  * Show consumable validation
  */
 function showConsumableValidation()
 {
     global $CFG_GLPI;
     if (!$this->canView()) {
         return false;
     }
     // Wizard title
     echo "<div class='consumables_wizard_title'><p>";
     echo "<img class='consumables_wizard_img' src='" . $CFG_GLPI['root_doc'] . "/plugins/consumables/pics/consumablevalidation.png' alt='consumablevalidation'/>&nbsp;";
     _e("Consumable validation", "consumables");
     echo "</p></div>";
     $rand = mt_rand();
     $fields = $this->find("`status` NOT IN ('" . CommonITILValidation::REFUSED . "','" . CommonITILValidation::ACCEPTED . "')", "`date_mod`");
     echo "<div class='center'>";
     if (!empty($fields)) {
         if ($this->canValidate()) {
             Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
             $massiveactionparams = array('item' => __CLASS__, 'container' => 'mass' . __CLASS__ . $rand);
             Html::showMassiveActions($massiveactionparams);
         }
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr>";
         echo "<th colspan='7'>" . self::getTypeName() . "</th>";
         echo "</tr>";
         echo "<tr>";
         echo "<th width='10'>";
         if ($this->canValidate()) {
             echo Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
         }
         echo "</th>";
         echo "<th>" . __('Requester') . "</th>";
         echo "<th>" . _n('Consumable type', 'Consumable types', 1) . "</th>";
         echo "<th>" . _n('Consumable', 'Consumables', 1) . "</th>";
         echo "<th>" . __('Number', 'consumables') . "</th>";
         echo "<th>" . __("Give to") . "</th>";
         echo "<th>" . _sx("item", "State") . "</th>";
         echo "</tr>";
         foreach ($fields as $field) {
             echo "<tr class='tab_bg_1'>";
             echo "<td width='10'>";
             if ($this->canValidate()) {
                 Html::showMassiveActionCheckBox(__CLASS__, $field['id']);
             }
             echo "</td>";
             echo "<td>";
             echo getUserName($field['requesters_id']);
             echo "</td>";
             echo "<td>";
             echo Dropdown::getDropdownName("glpi_consumableitemtypes", $field['consumableitemtypes_id']);
             echo "</td>";
             echo "<td>";
             echo Dropdown::getDropdownName("glpi_consumableitems", $field['consumables_id']);
             echo "</td>";
             echo "<td>";
             echo $field['number'];
             echo "</td>";
             echo "<td>";
             if (!empty($field['give_itemtype'])) {
                 $give_item = getItemForItemtype($field['give_itemtype']);
                 $give_item->getFromDB($field['give_items_id']);
                 echo $give_item->getLink();
             }
             echo "</td>";
             echo "<td>";
             $bgcolor = CommonITILValidation::getStatusColor($field['status']);
             $status = CommonITILValidation::getStatus($field['status']);
             echo "<div style='background-color:" . $bgcolor . ";'>" . $status . "</div>";
             echo "</td>";
             echo "</tr>";
         }
         if ($this->canValidate()) {
             $massiveactionparams['ontop'] = false;
             Html::showMassiveActions($massiveactionparams);
             Html::closeForm();
         }
         echo "</table>";
     } else {
         echo __("No item to display");
     }
     echo "</div>";
     // Footer
     if ($this->canCreate() && $this->canValidate()) {
         echo "<br/><table width='100%'>";
         echo "<tr>";
         echo "<td class='consumables_wizard_button'>";
         echo "<div id='dialog-confirm'></div>";
         echo "<input type=\"button\" class=\"consumable_previous_button submit\" name=\"previous\" value=\"" . _sx('button', 'Cancel') . "\" onclick=\"consumables_cancel('" . $CFG_GLPI['root_doc'] . "/plugins/consumables/front/wizard.php');\">";
         echo "<input type='hidden' name='requesters_id' value='" . Session::getLoginUserID() . "'>";
         echo "</td>";
         echo "</tr>";
         echo "</table>";
     }
     // Init consumable cart javascript
     echo "<script type='text/javascript'>";
     echo "consumables_initJs('" . $CFG_GLPI['root_doc'] . "');";
     echo "</script>";
 }
Ejemplo n.º 4
0
 /**
  * Show list of items
  * 
  * @param type $fields
  */
 function listItemsForUser($requesters_id, $options = array())
 {
     $params['begin_date'] = "NULL";
     $params['end_date'] = "NULL";
     foreach ($options as $key => $val) {
         $params[$key] = $val;
     }
     $data = $this->find('`requesters_id` = ' . $requesters_id . " " . "AND `end_date` >= '" . $params['begin_date'] . "' " . "AND (`end_date` <= '" . $params['end_date'] . "' OR `end_date` IS NULL)", "`end_date` DESC");
     $message = null;
     if (!empty($data)) {
         $message .= "<table class='tab_cadre_fixe'>";
         $message .= "<tr>";
         $message .= "<th colspan='7'>" . __('Consumable request report', 'consumables') . "</th>";
         $message .= "</tr>";
         $message .= "<tr>";
         $message .= "<th>" . _n('Consumable', 'Consumables', 1) . "</th>";
         $message .= "<th>" . _n('Consumable type', 'Consumable types', 1) . "</th>";
         $message .= "<th>" . __('Requester') . "</th>";
         $message .= "<th>" . __('Approver') . "</th>";
         $message .= "<th>" . __('Number of used consumables') . "</th>";
         $message .= "<th>" . __('Request date') . "</th>";
         $message .= "<th>" . __('Status') . "</th>";
         $message .= "</tr>";
         $consumable = new ConsumableItem();
         foreach ($data as $field) {
             $message .= "<tr class='tab_bg_1'>";
             $consumable->getFromDB($field['consumables_id']);
             $message .= "<td>" . $consumable->getLink() . "</td>";
             $message .= "<td>" . Dropdown::getDropdownName(ConsumableItemType::getTable(), $field['consumableitemtypes_id']) . "</td>";
             $message .= "<td>" . getUserName($field['requesters_id']) . "</td>";
             $message .= "<td>" . getUserName($field['validators_id']) . "</td>";
             $message .= "<td>" . $field['number'] . "</td>";
             $message .= "<td>" . Html::convDateTime($field['date_mod']) . "</td>";
             $message .= "<td>";
             $bgcolor = CommonITILValidation::getStatusColor($field['status']);
             $status = CommonITILValidation::getStatus($field['status']);
             $message .= "<div style='background-color:" . $bgcolor . ";'>" . $status . "</div>";
             $message .= "</td>";
             $message .= "</tr>";
         }
         $message .= "</table>";
         $message .= "</div>";
     } else {
         $message .= "<div class='center'>";
         $message .= "<table class='tab_cadre_fixe'>";
         $message .= "<tr>";
         $message .= "<th colspan='6'>" . __('Consumable request report', 'consumables') . "</th>";
         $message .= "</tr>";
         $message .= "<tr><td class='center'>" . __('No item found') . "</td></tr>";
         $message .= "</table>";
     }
     return array('success' => true, 'message' => $message);
 }