Contract::dropdownAlert PHP Method

dropdownAlert() static public method

static public dropdownAlert ( array $options )
$options array array
    static function dropdownAlert(array $options)
    {
        $p['name'] = 'alert';
        $p['value'] = 0;
        $p['display'] = true;
        $p['inherit_parent'] = false;
        if (count($options)) {
            foreach ($options as $key => $val) {
                $p[$key] = $val;
            }
        }
        $tab = array();
        if ($p['inherit_parent']) {
            $tab[Entity::CONFIG_PARENT] = __('Inheritance of the parent entity');
        }
        $tab += self::getAlertName();
        return Dropdown::showFromArray($p['name'], $tab, $p);
    }

Usage Example

Example #1
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())
 {
     global $DB;
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     $options['display'] = false;
     switch ($field) {
         case 'use_licenses_alert':
         case 'use_contracts_alert':
         case 'use_infocoms_alert':
             $options['name'] = $name;
             $options['value'] = $values[$field];
             return Alert::dropdownYesNo($options);
         case 'cartridges_alert_repeat':
         case 'consumables_alert_repeat':
             $options['name'] = $name;
             $options['value'] = $values[$field];
             return Alert::dropdown($options);
         case 'send_contracts_alert_before_delay':
         case 'send_infocoms_alert_before_delay':
         case 'send_licenses_alert_before_delay':
             $options['unit'] = 'day';
             $options['never_string'] = __('No');
             return Alert::dropdownIntegerNever($name, $values[$field], $options);
         case 'use_reservations_alert':
             $options['unit'] = 'hour';
             return Alert::dropdownIntegerNever($name, $values[$field], $options);
         case 'notclosed_delay':
             $options['unit'] = 'hour';
             return Alert::dropdownIntegerNever($name, $values[$field], $options);
         case 'auto_assign_mode':
             $options['name'] = $name;
             $options['value'] = $values[$field];
             return self::dropdownAutoAssignMode($options);
         case 'tickettype':
             $options['value'] = $values[$field];
             $options['toadd'] = array(self::CONFIG_PARENT => __('Inheritance of the parent entity'));
             return Ticket::dropdownType($name, $options);
         case 'autofill_buy_date':
         case 'autofill_order_date':
         case 'autofill_delivery_date':
         case 'autofill_use_date':
             $tab[0] = __('No autofill');
             $tab[self::CONFIG_PARENT] = __('Inheritance of the parent entity');
             foreach (getAllDatasFromTable('glpi_states') as $state) {
                 $tab[Infocom::ON_STATUS_CHANGE . '_' . $state['id']] = sprintf(__('Fill when shifting to state %s'), $state['name']);
             }
             $tab[Infocom::COPY_WARRANTY_DATE] = __('Copy the start date of warranty');
             if ($field != 'autofill_buy_date') {
                 $tab[Infocom::COPY_BUY_DATE] = __('Copy the date of purchase');
                 if ($field != 'autofill_order_date') {
                     $tab[Infocom::COPY_ORDER_DATE] = __('Copy the order date');
                     if ($field != 'autofill_delivery_date') {
                         $options[Infocom::COPY_DELIVERY_DATE] = __('Copy the delivery date');
                     }
                 }
             }
             $options['value'] = $values[$field];
             return Dropdown::showFromArray($name, $tab, $options);
         case 'autofill_warranty_date':
             $tab = array(0 => __('No autofill'), Infocom::COPY_BUY_DATE => __('Copy the date of purchase'), Infocom::COPY_ORDER_DATE => __('Copy the order date'), Infocom::COPY_DELIVERY_DATE => __('Copy the delivery date'), self::CONFIG_PARENT => __('Inheritance of the parent entity'));
             $options['value'] = $values[$field];
             return Dropdown::showFromArray($name, $tab, $options);
         case 'inquest_config':
             $typeinquest = array(self::CONFIG_PARENT => __('Inheritance of the parent entity'), 1 => __('Internal survey'), 2 => __('External survey'));
             $options['value'] = $values[$field];
             return Dropdown::showFromArray($name, $typeinquest, $options);
         case 'default_contract_alert':
             $options['name'] = $name;
             $options['value'] = $values[$field];
             return Contract::dropdownAlert($options);
         case 'default_infocom_alert':
             $options['name'] = $name;
             $options['value'] = $values[$field];
             return Infocom::dropdownAlert($options);
         case 'entities_id_software':
             $options['toadd'] = array(self::CONFIG_NEVER => __('No change of entity'));
             // Keep software in PC entity
             $options['toadd'][self::CONFIG_PARENT] = __('Inheritance of the parent entity');
             return self::dropdown($options);
     }
     return parent::getSpecificValueToSelect($field, $name, $values, $options);
 }
All Usage Examples Of Contract::dropdownAlert