showNumber() static public method

Dropdown numbers
static public showNumber ( $myname, $options = [] )
$myname select name
$options array of additionnal options : - value default value (default 0) - rand random value - min min value (default 0) - max max value (default 100) - step step used (default 1) - toadd array of values to add at the beginning - unit string unit to used - display boolean if false get string - width specific width needed (default 80%) - on_change string / value to transmit to "onChange" - used array / Already used items ID: not to display in dropdown (default empty)
コード例 #1
0
 function showForm($items_id, $options = array())
 {
     if ($items_id == '-1') {
         $items_id = '';
     }
     $this->initForm($items_id, $options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . " :</td>";
     echo "<td>";
     echo "<input type='text' name='name' value='" . $this->fields["name"] . "' size='30'/>";
     echo "</td>";
     echo "<td>" . __('Check definition', 'monitoring') . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::show("PluginMonitoringCheck", array('name' => 'plugin_monitoring_checks_id', 'value' => $this->fields['plugin_monitoring_checks_id']));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . _n('Comment', 'Comments', 2) . "&nbsp;: </td>";
     echo "<td>";
     echo "<textarea cols='45' rows='2' name='comment'>" . $this->fields["comment"] . "</textarea>";
     echo "</td>";
     echo "<td>" . __('Check period', 'monitoring') . "&nbsp;:</td>";
     echo "<td>";
     dropdown::show("Calendar", array('name' => 'calendars_id', 'value' => $this->fields['calendars_id']));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='2'></td>";
     echo "<td>" . __('Interval between 2 notifications', 'monitoring') . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::showNumber('notification_interval', array('value' => $this->fields['notification_interval'], 'min' => 0, 'max' => 2880, 'unit' => 'minute(s)'));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='2'></td>";
     echo "<td>" . __('Business priority level', 'monitoring') . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::showNumber('business_priority', array('value' => $this->fields['business_priority'], 'min' => 1, 'max' => 5));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='2'></td>";
     echo "<td>" . __('Services catalog template ?', 'monitoring') . "&nbsp;:</td>";
     echo "<td>";
     if (PluginMonitoringServicescatalog::canUpdate()) {
         Dropdown::showYesNo('is_generic', $this->fields['is_generic']);
     } else {
         echo Dropdown::getYesNo($this->fields['is_generic']);
     }
     echo "</td>";
     echo "</tr>";
     $this->showFormButtons($options);
     return true;
 }
コード例 #2
0
ファイル: item_devices.class.php プロジェクト: pvasener/glpi
 static function showForItem(CommonGLPI $item, $withtemplate = 0)
 {
     global $CFG_GLPI;
     $is_device = $item instanceof CommonDevice;
     $ID = $item->getField('id');
     if (!$item->can($ID, READ)) {
         return false;
     }
     $canedit = $withtemplate != 2 && $item->canEdit($ID) && Session::haveRightsOr('device', array(UPDATE, PURGE));
     echo "<div class='spaced'>";
     $rand = mt_rand();
     if ($canedit) {
         echo "\n<form id='form_device_add{$rand}' name='form_device_add{$rand}'\n                  action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "' method='post'>\n";
         echo "\t<input type='hidden' name='items_id' value='{$ID}'>\n";
         echo "\t<input type='hidden' name='itemtype' value='" . $item->getType() . "'>\n";
     }
     $table = new HTMLTableMain();
     $table->setTitle(_n('Component', 'Components', Session::getPluralNumber()));
     if ($canedit) {
         $delete_all_column = $table->addHeader('delete all', Html::getCheckAllAsCheckbox("form_device_action{$rand}", '__RAND__'));
         $delete_all_column->setHTMLClass('center');
     } else {
         $delete_all_column = NULL;
     }
     $column_label = $is_device ? _n('Item', 'Items', Session::getPluralNumber()) : __('Type of component');
     $common_column = $table->addHeader('common', $column_label);
     $specific_column = $table->addHeader('specificities', __('Specificities'));
     $specific_column->setHTMLClass('center');
     $dynamic_column = '';
     if ($item->isDynamic()) {
         $dynamic_column = $table->addHeader('is_dynamic', __('Automatic inventory'));
         $dynamic_column->setHTMLClass('center');
     }
     if ($canedit) {
         $massiveactionparams = array('container' => "form_device_action{$rand}", 'fixed' => false, 'display_arrow' => false);
         $content = array(array('function' => 'Html::showMassiveActions', 'parameters' => array($massiveactionparams)));
         $delete_column = $table->addHeader('delete one', $content);
         $delete_column->setHTMLClass('center');
     } else {
         $delete_column = NULL;
     }
     $table_options = array('canedit' => $canedit, 'rand' => $rand);
     if ($is_device) {
         Session::initNavigateListItems(static::getType(), sprintf(__('%1$s = %2$s'), $item->getTypeName(1), $item->getName()));
         foreach (array_merge(array(''), self::getConcernedItems()) as $itemtype) {
             $table_options['itemtype'] = $itemtype;
             $link = getItemForItemtype(static::getType());
             $link->getTableGroup($item, $table, $table_options, $delete_all_column, $common_column, $specific_column, $delete_column, $dynamic_column);
         }
     } else {
         $devtypes = array();
         foreach (self::getItemAffinities($item->getType()) as $link_type) {
             $devtypes[] = $link_type::getDeviceType();
             $link = getItemForItemtype($link_type);
             Session::initNavigateListItems($link_type, sprintf(__('%1$s = %2$s'), $item->getTypeName(1), $item->getName()));
             $link->getTableGroup($item, $table, $table_options, $delete_all_column, $common_column, $specific_column, $delete_column, $dynamic_column);
         }
     }
     if ($canedit) {
         echo "<table class='tab_cadre_fixe'><tr class='tab_bg_1'><td>";
         echo __('Add a new component') . "</td><td class=left width='70%'>";
         if ($is_device) {
             Dropdown::showNumber('number_devices_to_add', array('value' => 0, 'min' => 0, 'max' => 10));
         } else {
             Dropdown::showSelectItemFromItemtypes(array('itemtype_name' => 'devicetype', 'items_id_name' => 'devices_id', 'itemtypes' => $devtypes, 'entity_restrict' => $item->getEntityID(), 'showItemSpecificity' => $CFG_GLPI['root_doc'] . '/ajax/selectUnaffectedOrNewItem_Device.php'));
         }
         echo "</td><td>";
         echo "<input type='submit' class='submit' name='add' value='" . _sx('button', 'Add') . "'>";
         echo "</td></tr></table>";
         Html::closeForm();
     }
     if ($canedit) {
         echo "\n<form id='form_device_action{$rand}' name='form_device_action{$rand}'\n                  action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "' method='post'>\n";
         echo "\t<input type='hidden' name='items_id' value='{$ID}'>\n";
         echo "\t<input type='hidden' name='itemtype' value='" . $item->getType() . "'>\n";
     }
     $table->display(array('display_super_for_each_group' => false, 'display_title_for_each_group' => false));
     if ($canedit) {
         //          echo "<input type='submit' class='submit' name='updateall' value='" .
         //               _sx('button', 'Save')."'>";
         Html::closeForm();
     }
     echo "</div>";
     // Force disable selected items
     $_SESSION['glpimassiveactionselected'] = array();
 }
コード例 #3
0
 static function displayAjaxValues($config, $request_data, $rand, $mode)
 {
     global $CFG_GLPI;
     $pfDeployPackage = new PluginFusioninventoryDeployPackage();
     $pfDeployOrder = new PluginFusioninventoryDeployOrder();
     if (isset($request_data['orders_id'])) {
         $pfDeployOrder->getFromDB($request_data['orders_id']);
         $pfDeployPackage->getFromDB($pfDeployOrder->fields['plugin_fusioninventory_deploypackages_id']);
     } else {
         $pfDeployPackage->getEmpty();
     }
     $p2p = 0;
     $p2p_retention_duration = 0;
     $uncompress = 0;
     if ($mode === 'create') {
         $source = $request_data['value'];
         /**
          * No need to continue if there is no selected source
          */
         if ($source === '0') {
             return;
         }
     } else {
         $p2p = $config['data']['p2p'];
         $p2p_retention_duration = $config['data']['p2p-retention-duration'];
         $uncompress = $config['data']['uncompress'];
     }
     echo "<table class='package_item'>";
     /*
      * Display file upload input only in 'create' mode
      */
     echo "<tr>";
     echo "<th>" . __("File", 'fusioninventory') . "</th>";
     echo "<td>";
     if ($mode === 'create') {
         switch ($source) {
             case "Computer":
                 echo "<input type='file' name='file' value='" . __("filename", 'fusioninventory') . "' />";
                 echo "<i>" . self::getMaxUploadSize() . "</i>";
                 break;
             case "Server":
                 echo "<input type='text' name='filename' id='server_filename{$rand}'" . " style='width:120px;float:left' />";
                 echo "<input type='button' class='submit' value='" . __("Choose", 'fusioninventory') . "' onclick='fileModal{$rand}.dialog(\"open\");' />";
                 Ajax::createModalWindow("fileModal{$rand}", $CFG_GLPI['root_doc'] . "/plugins/fusioninventory/ajax/deployfilemodal.php", array('title' => __('Select the file on server', 'fusioninventory'), 'extraparams' => array('rand' => $rand)));
                 break;
         }
     } else {
         /*
          * Display only name in 'edit' mode
          */
         echo $config['data']['name'];
     }
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<th>" . __("Uncompress", 'fusioninventory') . "<img style='float:right' " . "src='" . $CFG_GLPI["root_doc"] . "/plugins/fusioninventory//pics/uncompress.png' /></th>";
     echo "<td>";
     Html::showCheckbox(array('name' => 'uncompress', 'checked' => $uncompress));
     echo "</td>";
     echo "</tr><tr>";
     echo "<th>" . __("P2P", 'fusioninventory') . "<img style='float:right' src='" . $CFG_GLPI["root_doc"] . "/plugins/fusioninventory//pics/p2p.png' /></th>";
     echo "<td>";
     Html::showCheckbox(array('name' => 'p2p', 'checked' => $p2p));
     echo "</td>";
     echo "</tr><tr>";
     echo "<th>" . __("retention days", 'fusioninventory') . "</th>";
     echo "<td>";
     /*
      * TODO: use task periodicity input to propose days, months and years
      */
     Dropdown::showNumber('p2p-retention-duration', array('value' => $p2p_retention_duration, 'min' => 0, 'max' => 400));
     echo "</td>";
     echo "</tr><tr>";
     echo "<td>";
     echo "</td><td>";
     if ($pfDeployPackage->can($pfDeployPackage->getID(), UPDATE)) {
         if ($mode === 'edit') {
             echo "<input type='submit' name='save_item' value=\"" . _sx('button', 'Save') . "\" class='submit' >";
         } else {
             echo "<input type='submit' name='add_item' value=\"" . _sx('button', 'Add') . "\" class='submit' >";
         }
     }
     echo "</td>";
     echo "</tr></table>";
 }
コード例 #4
0
ファイル: softwarelicense.class.php プロジェクト: kipman/glpi
 /**
  * Print the Software / license form
  *
  * @param $ID        integer  Id of the version or the template to print
  * @param $options   array    of possible options:
  *     - target form target
  *     - softwares_id ID of the software for add process
  *
  * @return true if displayed  false if item not found or not right to display
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     $softwares_id = -1;
     if (isset($options['softwares_id'])) {
         $softwares_id = $options['softwares_id'];
     }
     if ($ID < 0) {
         // Create item
         $this->fields['softwares_id'] = $softwares_id;
         $this->fields['number'] = 1;
         $soft = new Software();
         if ($soft->getFromDB($softwares_id) && in_array($_SESSION['glpiactive_entity'], getAncestorsOf('glpi_entities', $soft->getEntityID()))) {
             $options['entities_id'] = $soft->getEntityID();
         }
     }
     $this->initForm($ID, $options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . Software::getTypeName(1) . "</td>";
     echo "<td>";
     if ($ID > 0) {
         $softwares_id = $this->fields["softwares_id"];
     } else {
         echo "<input type='hidden' name='softwares_id' value='{$softwares_id}'>";
     }
     echo "<a href='software.form.php?id=" . $softwares_id . "'>" . Dropdown::getDropdownName("glpi_softwares", $softwares_id) . "</a>";
     echo "</td>";
     echo "<td>" . __('Type') . "</td>";
     echo "<td>";
     SoftwareLicenseType::dropdown(array('value' => $this->fields["softwarelicensetypes_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td>" . __('Serial number') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "serial");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Purchase version') . "</td>";
     echo "<td>";
     SoftwareVersion::dropdown(array('name' => "softwareversions_id_buy", 'softwares_id' => $this->fields["softwares_id"], 'value' => $this->fields["softwareversions_id_buy"]));
     echo "</td>";
     echo "<td>" . __('Inventory number') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "otherserial");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Version in use') . "</td>";
     echo "<td>";
     SoftwareVersion::dropdown(array('name' => "softwareversions_id_use", 'softwares_id' => $this->fields["softwares_id"], 'value' => $this->fields["softwareversions_id_use"]));
     echo "</td>";
     echo "<td rowspan='" . ($ID > 0 ? '4' : '3') . "' class='middle'>" . __('Comments') . "</td>";
     echo "<td class='center middle' rowspan='" . ($ID > 0 ? '4' : '3') . "'>";
     echo "<textarea cols='45' rows='5' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . _x('quantity', 'Number') . "</td>";
     echo "<td>";
     Dropdown::showNumber("number", array('value' => $this->fields["number"], 'min' => 1, 'max' => 10000, 'step' => 1, 'toadd' => array(-1 => __('Unlimited'))));
     if ($ID > 0) {
         echo "&nbsp;";
         if ($this->fields['is_valid']) {
             echo "<span class='green'>" . _x('adjective', 'Valid') . '<span>';
         } else {
             echo "<span class='red'>" . _x('adjective', 'Invalid') . '<span>';
         }
     }
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Expiration') . "</td>";
     echo "<td>";
     Html::showDateField('expire', array('value' => $this->fields["expire"]));
     if ($ID && is_null($this->fields["expire"])) {
         echo "<br>" . __('Never expire') . "&nbsp;";
         Html::showToolTip(__('On search engine, use "Expiration contains NULL" to search licenses with no expiration date'));
     }
     Alert::displayLastAlert('SoftwareLicense', $ID);
     echo "</td></tr>\n";
     if ($ID > 0) {
         echo "<tr class='tab_bg_1'>";
         echo "<td>" . __('Last update') . "</td>";
         echo "<td>" . ($this->fields["date_mod"] ? Html::convDateTime($this->fields["date_mod"]) : __('Never'));
         echo "</td></tr>";
     }
     $this->showFormButtons($options);
     return true;
 }
コード例 #5
0
ファイル: infocom.class.php プロジェクト: gaforeror/glpi
 /**
  * Show Infocom form for an item (not a standard showForm)
  *
  * @param $item                  CommonDBTM object
  * @param $withtemplate integer  template or basic item (default '')
  **/
 static function showForItem(CommonDBTM $item, $withtemplate = '')
 {
     global $CFG_GLPI;
     // Show Infocom or blank form
     if (!Session::haveRight("infocom", "r")) {
         return false;
     }
     if (!$item) {
         echo "<div class='spaced'>" . __('Requested item not found') . "</div>";
     } else {
         $date_tax = $CFG_GLPI["date_tax"];
         $dev_ID = $item->getField('id');
         $ic = new self();
         $option = "";
         if ($withtemplate == 2) {
             $option = " readonly ";
         }
         if (!strpos($_SERVER['PHP_SELF'], "infocoms-show") && in_array($item->getType(), array('CartridgeItem', 'ConsumableItem', 'Software'))) {
             echo "<div class='firstbloc center'>" . __('For this type of item, the financial and administrative information are only a model for the items which you should add.') . "</div>";
         }
         if (!$ic->getFromDBforDevice($item->getType(), $dev_ID)) {
             $input = array('itemtype' => $item->getType(), 'items_id' => $dev_ID, 'entities_id' => $item->getEntityID());
             if ($ic->can(-1, "w", $input) && $withtemplate != 2) {
                 echo "<div class='spaced b'>";
                 echo "<table class='tab_cadre_fixe'><tr class='tab_bg_1'><th>";
                 echo sprintf(__('%1$s - %2$s'), $item->getTypeName(1), $item->getName()) . "</th></tr>";
                 echo "<tr class='tab_bg_1'><td class='center'>";
                 Html::showSimpleForm($CFG_GLPI["root_doc"] . "/front/infocom.form.php", 'add', __('Enable the financial and administrative information'), array('itemtype' => $item->getType(), 'items_id' => $dev_ID));
                 echo "</td></tr></table></div>";
             }
         } else {
             // getFromDBforDevice
             $canedit = $ic->can($ic->fields['id'], "w") && $withtemplate != 2;
             if ($canedit) {
                 echo "<form name='form_ic' method='post' action='" . $CFG_GLPI["root_doc"] . "/front/infocom.form.php'>";
             }
             echo "<div class='spaced'>";
             echo "<table class='tab_cadre" . (!strpos($_SERVER['PHP_SELF'], "infocoms-show") ? "_fixe" : "") . "'>";
             echo "<tr><th colspan='4'>" . __('Financial and administrative information') . "</th></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . __('Supplier') . "</td>";
             echo "<td>";
             if ($withtemplate == 2) {
                 echo Dropdown::getDropdownName("glpi_suppliers", $ic->fields["suppliers_id"]);
             } else {
                 Supplier::dropdown(array('value' => $ic->fields["suppliers_id"], 'entity' => $item->getEntityID()));
             }
             echo "</td>";
             if (Session::haveRight("budget", "r")) {
                 echo "<td>" . __('Budget') . "</td><td >";
                 Budget::dropdown(array('value' => $ic->fields["budgets_id"], 'entity' => $item->getEntityID(), 'comments' => 1));
             } else {
                 echo "<td colspan='2'>";
             }
             echo "</td></tr>";
             // Can edit calendar ?
             $editcalendar = $withtemplate != 2;
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . __('Order number') . "</td>";
             echo "<td >";
             Html::autocompletionTextField($ic, "order_number", array('option' => $option));
             echo "</td>";
             echo "<td>" . __('Order date') . "</td><td>";
             Html::showDateFormItem("order_date", $ic->fields["order_date"], true, $editcalendar);
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             $istemplate = '';
             if ($item->isTemplate() || in_array($item->getType(), array('CartridgeItem', 'ConsumableItem', 'Software'))) {
                 $istemplate = '*';
             }
             echo "<td>" . sprintf(__('%1$s%2$s'), __('Immobilization number'), $istemplate) . "</td>";
             echo "<td>";
             $objectName = autoName($ic->fields["immo_number"], "immo_number", $withtemplate == 2, 'Infocom', $item->getEntityID());
             Html::autocompletionTextField($ic, "immo_number", array('value' => $objectName, 'option' => $option));
             echo "</td>";
             echo "<td>" . __('Date of purchase') . "</td><td>";
             Html::showDateFormItem("buy_date", $ic->fields["buy_date"], true, $editcalendar);
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . __('Invoice number') . "</td>";
             echo "<td>";
             Html::autocompletionTextField($ic, "bill", array('option' => $option));
             echo "</td>";
             echo "<td>" . __('Delivery date') . "</td><td>";
             Html::showDateFormItem("delivery_date", $ic->fields["delivery_date"], true, $editcalendar);
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . __('Delivery form') . "</td><td>";
             Html::autocompletionTextField($ic, "delivery_number", array('option' => $option));
             echo "</td>";
             echo "<td>" . __('Startup date') . "</td><td>";
             Html::showDateFormItem("use_date", $ic->fields["use_date"], true, $editcalendar);
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . __('Value') . "</td>";
             echo "<td><input type='text' name='value' {$option} value='" . Html::formatNumber($ic->fields["value"], true) . "' size='14'></td>";
             echo "</td>";
             echo "<td>" . __('Date of last physical inventory') . "</td><td>";
             Html::showDateFormItem("inventory_date", $ic->fields["inventory_date"], true, $editcalendar);
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . __('Warranty extension value') . "</td>";
             echo "<td><input type='text' {$option} name='warranty_value' value='" . Html::formatNumber($ic->fields["warranty_value"], true) . "' size='14'></td>";
             echo "<td rowspan='5'>" . __('Comments') . "</td>";
             echo "<td rowspan='5' class='middle'>";
             echo "<textarea cols='45' rows='9' name='comment' >" . $ic->fields["comment"];
             echo "</textarea></td></tr>\n";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . __('Account net value') . "</td><td>";
             echo Html::formatNumber(self::Amort($ic->fields["sink_type"], $ic->fields["value"], $ic->fields["sink_time"], $ic->fields["sink_coeff"], $ic->fields["warranty_date"], $ic->fields["use_date"], $date_tax, "n"));
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . __('Amortization type') . "</td><td >";
             if ($withtemplate == 2) {
                 echo self::getAmortTypeName($ic->fields["sink_type"]);
             } else {
                 self::dropdownAmortType("sink_type", $ic->fields["sink_type"]);
             }
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . __('Amortization duration') . "</td><td>";
             if ($withtemplate == 2) {
                 printf(_n('%d year', '%d years', $ic->fields["sink_time"]), $ic->fields["sink_time"]);
             } else {
                 Dropdown::showNumber("sink_time", array('value' => $ic->fields["sink_time"], 'max' => 15, 'unit' => 'year'));
             }
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . __('Amortization coefficient') . "</td>";
             echo "<td>";
             Html::autocompletionTextField($ic, "sink_coeff", array('size' => 14, 'option' => $option));
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             if (!in_array($item->getType(), array('Cartridge', 'CartridgeItem', 'Consumable', 'ConsumableItem', 'Software', 'SoftwareLicense'))) {
                 echo "<td>" . __('TCO (value + tracking cost)') . "</td><td>";
                 echo self::showTco($item->getField('ticket_tco'), $ic->fields["value"]);
             } else {
                 echo "<td colspan='2'>";
             }
             echo "</td>";
             if (!in_array($item->getType(), array('Cartridge', 'CartridgeItem', 'Consumable', 'ConsumableItem', 'Software', 'SoftwareLicense'))) {
                 echo "<td>" . __('Monthly TCO') . "</td><td>";
                 echo self::showTco($item->getField('ticket_tco'), $ic->fields["value"], $ic->fields["warranty_date"]);
             } else {
                 echo "<td colspan='2'>";
             }
             echo "</td></tr>";
             echo "<tr><th colspan='4'>" . __('Warranty information') . "</th></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . __('Start date of warranty') . "</td><td>";
             Html::showDateFormItem("warranty_date", $ic->fields["warranty_date"], true, $editcalendar);
             echo "</td>";
             echo "<td>" . __('Warranty duration') . "</td><td>";
             if ($withtemplate == 2) {
                 // -1 = life
                 if ($ic->fields["warranty_duration"] == -1) {
                     _e('Lifelong');
                 } else {
                     printf(_n('%d month', '%d months', $ic->fields["warranty_duration"]), $ic->fields["warranty_duration"]);
                 }
             } else {
                 Dropdown::showInteger("warranty_duration", $ic->fields["warranty_duration"], 0, 120, 1, array(-1 => __('Lifelong')), array('unit' => 'month'));
             }
             $tmpdat = self::getWarrantyExpir($ic->fields["warranty_date"], $ic->fields["warranty_duration"], 0, true);
             if ($tmpdat) {
                 echo "<span class='small_space'>" . sprintf(__('Valid to %s'), $tmpdat) . "</span>";
             }
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . __('Warranty information') . "</td>";
             echo "<td >";
             Html::autocompletionTextField($ic, "warranty_info", array('option' => $option));
             echo "</td>";
             if ($CFG_GLPI['use_mailing']) {
                 echo "<td>" . __('Alarms on financial and administrative information') . "</td>";
                 echo "<td>";
                 self::dropdownAlert(array('name' => "alert", 'value' => $ic->fields["alert"]));
                 Alert::displayLastAlert('Infocom', $ic->fields['id']);
                 echo "</td>";
             } else {
                 echo "</td><td colspan='2'>";
             }
             echo "</td></tr>";
             if ($canedit) {
                 echo "<tr>";
                 echo "<td class='tab_bg_2 center' colspan='2'>";
                 echo "<input type='hidden' name='id' value='" . $ic->fields['id'] . "'>";
                 echo "<input type='submit' name='update' value=\"" . _sx('button', 'Save') . "\"\n                      class='submit'>";
                 echo "</td>";
                 echo "<td class='tab_bg_2 center' colspan='2'>";
                 echo "<input type='submit' name='delete' value=\"" . _sx('button', 'Delete permanently') . "\"\n                      class='submit'>";
                 echo "</td></tr>";
                 echo "</table></div>";
                 Html::closeForm();
             } else {
                 echo "</table></div>";
             }
         }
     }
 }
コード例 #6
0
ファイル: netpoint.class.php プロジェクト: jose-martins/glpi
 /**
  * Print the HTML array of the Netpoint associated to a Location
  *
  * @param $item Location
  *
  * @return Nothing (display)
  **/
 static function showForLocation($item)
 {
     global $DB, $CFG_GLPI;
     $ID = $item->getField('id');
     $netpoint = new self();
     $item->check($ID, READ);
     $canedit = $item->canEdit($ID);
     if (isset($_GET["start"])) {
         $start = intval($_GET["start"]);
     } else {
         $start = 0;
     }
     $number = countElementsInTable('glpi_netpoints', "`locations_id`='{$ID}'");
     if ($canedit) {
         echo "<div class='first-bloc'>";
         // Minimal form for quick input.
         echo "<form action='" . $netpoint->getFormURL() . "' method='post'>";
         echo "<br><table class='tab_cadre_fixe'>";
         echo "<tr class='tab_bg_2 center'>";
         echo "<td class='b'>" . _n('Network outlet', 'Network outlets', 1) . "</td>";
         echo "<td>" . __('Name') . "</td><td>";
         Html::autocompletionTextField($item, "name", array('value' => ''));
         echo "<input type='hidden' name='entities_id' value='" . $_SESSION['glpiactive_entity'] . "'>";
         echo "<input type='hidden' name='locations_id' value='{$ID}'></td>";
         echo "<td><input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
         echo "</td></tr>\n";
         echo "</table>\n";
         Html::closeForm();
         // Minimal form for massive input.
         echo "<form action='" . $netpoint->getFormURL() . "' method='post'>";
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr class='tab_bg_2 center'>";
         echo "<td class='b'>" . _n('Network outlet', 'Network outlets', Session::getPluralNumber()) . "</td>";
         echo "<td>" . __('Name') . "</td><td>";
         echo "<input type='text' maxlength='100' size='10' name='_before'>&nbsp;";
         Dropdown::showNumber('_from', array('value' => 0, 'min' => 0, 'max' => 400));
         echo "&nbsp;-->&nbsp;";
         Dropdown::showNumber('_to', array('value' => 0, 'min' => 0, 'max' => 400));
         echo "&nbsp;<input type='text' maxlength='100' size='10' name='_after'><br>";
         echo "<input type='hidden' name='entities_id' value='" . $_SESSION['glpiactive_entity'] . "'>";
         echo "<input type='hidden' name='locations_id' value='{$ID}'>";
         echo "<input type='hidden' name='_method' value='AddMulti'></td>";
         echo "<td><input type='submit' name='execute' value=\"" . _sx('button', 'Add') . "\"\n                    class='submit'>";
         echo "</td></tr>\n";
         echo "</table>\n";
         Html::closeForm();
         echo "</div>";
     }
     echo "<div class='spaced'>";
     if ($number < 1) {
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr><th>" . self::getTypeName(1) . "</th>";
         echo "<th>" . __('No item found') . "</th></tr>";
         echo "</table>\n";
     } else {
         Html::printAjaxPager(sprintf(__('Network outlets for %s'), $item->getTreeLink()), $start, $number);
         if ($canedit) {
             $rand = mt_rand();
             Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
             $massiveactionparams = array('num_displayed' => $_SESSION['glpilist_limit'], 'container' => 'mass' . __CLASS__ . $rand, 'specific_actions' => array('purge' => _x('button', 'Delete permanently')));
             Html::showMassiveActions($massiveactionparams);
         }
         echo "<table class='tab_cadre_fixe'><tr>";
         if ($canedit) {
             echo "<th width='10'>";
             Html::checkAllAsCheckbox('mass' . __CLASS__ . $rand);
             echo "</th>";
         }
         echo "<th>" . __('Name') . "</th>";
         // Name
         echo "<th>" . __('Comments') . "</th>";
         // Comment
         echo "</tr>\n";
         $crit = array('locations_id' => $ID, 'ORDER' => 'name', 'START' => $start, 'LIMIT' => $_SESSION['glpilist_limit']);
         Session::initNavigateListItems('Netpoint', sprintf(__('%1$s = %2$s'), $item->getTypeName(1), $item->getName()));
         foreach ($DB->request('glpi_netpoints', $crit) as $data) {
             Session::addToNavigateListItems('Netpoint', $data["id"]);
             echo "<tr class='tab_bg_1'>";
             if ($canedit) {
                 echo "<td>" . Html::getMassiveActionCheckBox(__CLASS__, $data["id"]) . "</td>";
             }
             echo "<td><a href='" . $netpoint->getFormURL();
             echo '?id=' . $data['id'] . "'>" . $data['name'] . "</a></td>";
             echo "<td>" . $data['comment'] . "</td>";
             echo "</tr>\n";
         }
         echo "</table>\n";
         if ($canedit) {
             $massiveactionparams['ontop'] = false;
             Html::showMassiveActions($massiveactionparams);
             Html::closeForm();
         }
         Html::printAjaxPager(sprintf(__('Network outlets for %s'), $item->getTreeLink()), $start, $number);
     }
     echo "</div>\n";
 }
 /**
  * Display a HTML report about systeme information / configuration
  **/
 function showSystemInformations()
 {
     global $DB, $CFG_GLPI;
     if (!Config::canUpdate()) {
         return false;
     }
     echo "<div class='center' id='tabsbody'>";
     echo "<form name='form' action=\"" . Toolbox::getItemTypeFormURL(__CLASS__) . "\" method='post'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='4'>" . __('General setup') . "</th></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . __('Log Level') . "</td><td>";
     $values[1] = __('1- Critical (login error only)');
     $values[2] = __('2- Severe (not used)');
     $values[3] = __('3- Important (successful logins)');
     $values[4] = __('4- Notices (add, delete, tracking)');
     $values[5] = __('5- Complete (all)');
     Dropdown::showFromArray('event_loglevel', $values, array('value' => $CFG_GLPI["event_loglevel"]));
     echo "</td><td>" . __('Maximal number of automatic actions (run by CLI)') . "</td><td>";
     Dropdown::showNumber('cron_limit', array('value' => $CFG_GLPI["cron_limit"], 'min' => 1, 'max' => 30));
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td> " . __('Logs in files (SQL, email, automatic action...)') . "</td><td>";
     Dropdown::showYesNo("use_log_in_files", $CFG_GLPI["use_log_in_files"]);
     echo "</td><td> " . _n('Mysql replica', 'Mysql replicas', 1) . "</td><td>";
     $active = DBConnection::isDBSlaveActive();
     Dropdown::showYesNo("_dbslave_status", $active);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='4' class='center b'>" . __('Password security policy');
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . __('Password security policy validation') . "</td>";
     echo "<td>";
     Dropdown::showYesNo("use_password_security", $CFG_GLPI["use_password_security"]);
     echo "</td>";
     echo "<td>" . __('Password minimum length') . "</td>";
     echo "<td>";
     Dropdown::showNumber('password_min_length', array('value' => $CFG_GLPI["password_min_length"], 'min' => 4, 'max' => 30));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . __('Password need digit') . "</td>";
     echo "<td>";
     Dropdown::showYesNo("password_need_number", $CFG_GLPI["password_need_number"]);
     echo "</td>";
     echo "<td>" . __('Password need lowercase character') . "</td>";
     echo "<td>";
     Dropdown::showYesNo("password_need_letter", $CFG_GLPI["password_need_letter"]);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . __('Password need uppercase character') . "</td>";
     echo "<td>";
     Dropdown::showYesNo("password_need_caps", $CFG_GLPI["password_need_caps"]);
     echo "</td>";
     echo "<td>" . __('Password need symbol') . "</td>";
     echo "<td>";
     Dropdown::showYesNo("password_need_symbol", $CFG_GLPI["password_need_symbol"]);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='4' class='center b'>" . __('Maintenance mode');
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . __('Maintenance mode') . "</td>";
     echo "<td>";
     Dropdown::showYesNo("maintenance_mode", $CFG_GLPI["maintenance_mode"]);
     echo "</td>";
     //TRANS: Proxy port
     echo "<td>" . __('Maintenance text') . "</td>";
     echo "<td>";
     echo "<textarea cols='70' rows='4' name='maintenance_text'>" . $CFG_GLPI["maintenance_text"];
     echo "</textarea>";
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='4' class='center b'>" . __('Proxy configuration for upgrade check');
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . __('Server') . "</td>";
     echo "<td><input type='text' name='proxy_name' value='" . $CFG_GLPI["proxy_name"] . "'></td>";
     //TRANS: Proxy port
     echo "<td>" . __('Port') . "</td>";
     echo "<td><input type='text' name='proxy_port' value='" . $CFG_GLPI["proxy_port"] . "'></td>";
     echo "</tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . __('Login') . "</td>";
     echo "<td><input type='text' name='proxy_user' value='" . $CFG_GLPI["proxy_user"] . "'></td>";
     echo "<td>" . __('Password') . "</td>";
     echo "<td><input type='password' name='proxy_passwd' value='' autocomplete='off'>";
     echo "<br><input type='checkbox' name='_blank_proxy_passwd'>" . __('Clear');
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td colspan='4' class='center'>";
     echo "<input type='submit' name='update' class='submit' value=\"" . _sx('button', 'Save') . "\">";
     echo "</td></tr>";
     echo "</table>";
     Html::closeForm();
     $width = 128;
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th>" . __('Information about system installation and configuration') . "</th></tr>";
     $oldlang = $_SESSION['glpilanguage'];
     // Keep this, for some function call which still use translation (ex showAllReplicateDelay)
     Session::loadLanguage('en_GB');
     // No need to translate, this part always display in english (for copy/paste to forum)
     // Try to compute a better version for .git
     if (is_dir(GLPI_ROOT . "/.git")) {
         $dir = getcwd();
         chdir(GLPI_ROOT);
         $returnCode = 1;
         $result = @exec('git describe --tags 2>&1', $output, $returnCode);
         chdir($dir);
         $ver = $returnCode ? $CFG_GLPI['version'] . '-git' : $result;
     } else {
         $ver = $CFG_GLPI['version'];
     }
     echo "<tr class='tab_bg_1'><td><pre>[code]\n&nbsp;\n";
     echo "GLPI {$ver} (" . $CFG_GLPI['root_doc'] . " => " . GLPI_ROOT . ")\n";
     echo "\n</pre></td></tr>";
     echo "<tr><th>Server</th></tr>\n";
     echo "<tr class='tab_bg_1'><td><pre>\n&nbsp;\n";
     echo wordwrap("Operating system: " . php_uname() . "\n", $width, "\n\t");
     $exts = get_loaded_extensions();
     sort($exts);
     echo wordwrap("PHP " . phpversion() . ' ' . php_sapi_name() . " (" . implode(', ', $exts) . ")\n", $width, "\n\t");
     $msg = "Setup: ";
     foreach (array('max_execution_time', 'memory_limit', 'post_max_size', 'safe_mode', 'session.save_handler', 'upload_max_filesize') as $key) {
         $msg .= $key . '="' . ini_get($key) . '" ';
     }
     echo wordwrap($msg . "\n", $width, "\n\t");
     $msg = 'Software: ';
     if (isset($_SERVER["SERVER_SOFTWARE"])) {
         $msg .= $_SERVER["SERVER_SOFTWARE"];
     }
     if (isset($_SERVER["SERVER_SIGNATURE"])) {
         $msg .= ' (' . Html::clean($_SERVER["SERVER_SIGNATURE"]) . ')';
     }
     echo wordwrap($msg . "\n", $width, "\n\t");
     if (isset($_SERVER["HTTP_USER_AGENT"])) {
         echo "\t" . $_SERVER["HTTP_USER_AGENT"] . "\n";
     }
     foreach ($DB->getInfo() as $key => $val) {
         echo "{$key}: {$val}\n\t";
     }
     echo "\n";
     self::checkWriteAccessToDirs(true);
     toolbox::checkSELinux(true);
     echo "\n</pre></td></tr>";
     self::showLibrariesInformation();
     foreach ($CFG_GLPI["systeminformations_types"] as $type) {
         $tmp = new $type();
         $tmp->showSystemInformations($width);
     }
     Session::loadLanguage($oldlang);
     echo "<tr class='tab_bg_1'><td>[/code]\n</td></tr>";
     echo "<tr class='tab_bg_2'><th>" . __('To copy/paste in your support request') . "</th></tr>\n";
     echo "</table></div>\n";
 }
コード例 #8
0
 function refreshPage($onlyreduced = false)
 {
     if (!$onlyreduced) {
         if (isset($_POST['_refresh'])) {
             $_SESSION['glpi_plugin_monitoring']['_refresh'] = $_POST['_refresh'];
         }
         echo '<meta http-equiv ="refresh" content="' . $_SESSION['glpi_plugin_monitoring']['_refresh'] . '">';
     }
     echo "<form name='form' method='post' action='" . $_SERVER["PHP_SELF"] . "' >";
     echo "<table class='tab_cadre_fixe' width='950'>";
     echo "<tr class='tab_bg_1'>";
     if (!$onlyreduced) {
         echo "<td>";
         echo __('Page refresh (in seconds)', 'monitoring') . " : ";
         echo "</td>";
         echo "<td width='120'>";
         Dropdown::showNumber("_refresh", array('value' => $_SESSION['glpi_plugin_monitoring']['_refresh'], 'min' => 30, 'max' => 1000, 'step' => 10));
         echo "</td>";
     }
     echo "<td>";
     echo __('Reduced interface', 'monitoring') . " : ";
     echo "</td>";
     echo "<td width='80'>";
     Dropdown::showYesNo("reduced_interface", $_SESSION['plugin_monitoring_reduced_interface']);
     echo "</td>";
     echo "<td align='center'>";
     echo "<input type='submit' name='sessionupdate' class='submit' value=\"" . __('Post') . "\">";
     echo "</td>";
     echo "</tr>";
     echo "</table>";
     Html::closeForm();
 }
コード例 #9
0
   /**
   * Display form for agent configuration
   *
   * @param $items_id integer ID
   * @param $options array
   *
   *@return bool true if form is ok
   *
   **/
   function showForm($items_id, $options=array(), $copy=array()) {

      $this->initForm($items_id, $options);
      if ($this->fields['id'] == 0) {
         $this->fields['width'] = 950;
         $this->fields['is_active'] = 1;
      }
      $this->showFormHeader($options);

      echo "<tr class='tab_bg_1'>";
      echo "<td>".__('Name')." :</td>";
      echo "<td>";
      echo "<input type='text' name='name' value='".$this->fields["name"]."' size='30'/>";
      echo "</td>";

      echo "<td>".__('Display carrousel / slider in dashboard', 'monitoring')."&nbsp;:</td>";
      echo "<td>";
      Dropdown::showYesNo("is_frontview", $this->fields['is_frontview']);
      echo "</td>";
      echo "</tr>";

      echo "<tr class='tab_bg_1'>";
      echo "<td>";
      echo __('Duration (in seconds)', 'monitoring');
      echo "</td>";
      echo "<td>";
      Dropdown::showNumber('duration', array(
          'value' => $this->fields['duration'],
          'min' => 1,
          'max' => 999
      ));
      echo "</td>";

      echo "<td>";
      echo __('Display in GLPI home page', 'monitoring');
      echo "</td>";
      echo "<td>";
      Dropdown::showYesNo("in_central", $this->fields['in_central']);
      echo "</td>";
      echo "</tr>";

      echo "<tr class='tab_bg_1'>";
      echo "<td>";
      echo "</td>";
      echo "<td>";
      echo "</td>";
      echo "<td>";
      echo __('Active');
      echo "</td>";
      echo "<td>";
      Dropdown::showYesNo("is_active", $this->fields['is_active']);
      echo "</td>";
      echo "</tr>";

      echo "<tr class='tab_bg_1'>";
      echo "<td>".__('Comments')."</td>";
      echo "<td colspan='3' class='middle'>";
      echo "<textarea cols='95' rows='3' name='comment' >".$this->fields["comment"];
      echo "</textarea>";
      echo "</td>";
      echo "</tr>";

      $this->showFormButtons($options);

      return true;
   }
コード例 #10
0
ファイル: consumableitem.class.php プロジェクト: stweil/glpi
 /**
  * Print the consumable type form
  *
  * @param $ID        integer ID of the item
  * @param $options   array
  *     - target filename : where to go when done.
  *     - withtemplate boolean : template or basic item
  *
  * @return Nothing (display)
  *
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     $this->initForm($ID, $options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td>" . __('Type') . "</td>";
     echo "<td>";
     ConsumableItemType::dropdown(array('value' => $this->fields["consumableitemtypes_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Reference') . "</td>\n";
     echo "<td>";
     Html::autocompletionTextField($this, "ref");
     echo "</td>";
     echo "<td>" . __('Manufacturer') . "</td>";
     echo "<td>";
     Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Technician in charge of the hardware') . "</td>";
     echo "<td>";
     User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'own_ticket', 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td rowspan='4' class='middle'>" . __('Comments') . "</td>";
     echo "<td class='middle' rowspan='4'>\n             <textarea cols='45' rows='9' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group in charge of the hardware') . "</td>";
     echo "<td>";
     Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Stock location') . "</td>";
     echo "<td>";
     Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Alert threshold') . "</td>";
     echo "<td>";
     Dropdown::showNumber('alarm_threshold', array('value' => $this->fields["alarm_threshold"], 'min' => 0, 'max' => 100, 'step' => 1, 'toadd' => array('-1' => __('Never'))));
     Alert::displayLastAlert('ConsumableItem', $ID);
     echo "</td></tr>";
     $this->showFormButtons($options);
     return true;
 }
コード例 #11
0
ファイル: vlan.class.php プロジェクト: btry/glpi
 function displaySpecificTypeField($ID, $field = array())
 {
     if ($field['name'] == 'tag') {
         Dropdown::showNumber('tag', array('value' => $this->fields['tag'], 'min' => 1, 'max' => pow(2, 12) - 2));
     }
 }
コード例 #12
0
ファイル: slt.class.php プロジェクト: stweil/glpi
 /**
  * Print the sla form
  *
  * @param $ID        integer  ID of the item
  * @param $options   array    of possible options:
  *     - target filename : where to go when done.
  *     - withtemplate boolean : template or basic item
  *
  *@return boolean item found
  **/
 function showForm($ID, $options = array())
 {
     $rowspan = 4;
     if ($ID > 0) {
         $rowspan = 6;
     }
     // Get SLA object
     $sla = new SLA();
     if (isset($options['parent'])) {
         $sla = $options['parent'];
     } else {
         $sla->getFromDB($this->fields['slas_id']);
     }
     if ($ID > 0) {
         $this->check($ID, READ);
     } else {
         // Create item
         $options[static::$items_id] = $sla->getField('id');
         //force itemtype of parent
         static::$itemtype = get_class($sla);
         $this->check(-1, CREATE, $options);
     }
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "name", array('value' => $this->fields["name"]));
     echo "<td rowspan='" . $rowspan . "'>" . __('Comments') . "</td>";
     echo "<td rowspan='" . $rowspan . "'>\n            <textarea cols='45' rows='8' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('SLA') . "</td>";
     echo "<td>";
     echo $sla->getLink();
     echo "<input type='hidden' name='slas_id' value='" . $this->fields['slas_id'] . "'>";
     echo "</td></tr>";
     if ($ID > 0) {
         echo "<tr class='tab_bg_1'>";
         echo "<td>" . __('Last update') . "</td>";
         echo "<td>" . ($this->fields["date_mod"] ? Html::convDateTime($this->fields["date_mod"]) : __('Never'));
         echo "</td></tr>";
     }
     echo "<tr class='tab_bg_1'><td>" . __('Type') . "</td>";
     echo "<td>";
     self::getSltTypeDropdown(array('value' => $this->fields["type"]));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Maximum time') . "</td>";
     echo "<td>";
     Dropdown::showNumber("number_time", array('value' => $this->fields["number_time"], 'min' => 0));
     $possible_values = array('minute' => _n('Minute', 'Minutes', Session::getPluralNumber()), 'hour' => _n('Hour', 'Hours', Session::getPluralNumber()), 'day' => _n('Day', 'Days', Session::getPluralNumber()));
     $rand = Dropdown::showFromArray('definition_time', $possible_values, array('value' => $this->fields["definition_time"], 'on_change' => 'appearhideendofworking()'));
     echo "\n<script type='text/javascript' >\n";
     echo "function appearhideendofworking() {\n";
     echo "if (\$('#dropdown_definition_time{$rand} option:selected').val() == 'day') {\n               \$('#title_endworkingday').show();\n               \$('#dropdown_endworkingday').show();\n            } else {\n               \$('#title_endworkingday').hide();\n               \$('#dropdown_endworkingday').hide();\n            }";
     echo "}\n";
     echo "appearhideendofworking();\n";
     echo "</script>\n";
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td><div id='title_endworkingday'>" . __('End of working day') . "</div></td>";
     echo "<td><div id='dropdown_endworkingday'>";
     Dropdown::showYesNo("end_of_working_day", $this->fields["end_of_working_day"]);
     echo "</div></td></tr>";
     $this->showFormButtons($options);
     return true;
 }
コード例 #13
0
 /**
  * @param $target
  * @param $ID
  * @param $withtemplate    (default '')
  * @param $templateid      (default '')
  **/
 function ocsFormImportOptions($target, $ID, $withtemplate = '', $templateid = '')
 {
     $this->getFromDB($ID);
     echo "<br><div class='center'>";
     echo "<form name='formconfig' action=\"{$target}\" method='post'>";
     echo "<table class='tab_cadre_fixe'>\n";
     echo "<tr class='tab_bg_2'><td class='center'>" . __('Web address of the OCSNG console', 'ocsinventoryng');
     echo "<input type='hidden' name='id' value='{$ID}'>" . " </td>\n";
     echo "<td><input type='text' size='30' name='ocs_url' value=\"" . $this->fields["ocs_url"] . "\">";
     echo "</td></tr>\n";
     echo "<tr><th colspan='2'>" . __('Import options') . "</th></tr>\n";
     echo "<tr class='tab_bg_2'><td class='center'>" . __('Limit the import to the following tags (separator $, nothing for all)', 'ocsinventoryng') . "</td>\n";
     echo "<td><input type='text' size='30' name='tag_limit' value='" . $this->fields["tag_limit"] . "'>";
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_2'><td class='center'>" . __('Exclude the following tags (separator $, nothing for all)', 'ocsinventoryng') . "</td>\n";
     echo "<td><input type='text' size='30' name='tag_exclude' value='" . $this->fields["tag_exclude"] . "'></td></tr>\n";
     echo "<tr class='tab_bg_2'><td class='center'>" . __('Default status', 'ocsinventoryng') . "</td>\n<td>";
     State::dropdown(array('name' => 'states_id_default', 'value' => $this->fields["states_id_default"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_2'><td class='center'>" . __('Behavior when disconnecting', 'ocsinventoryng') . "</td>\n<td>";
     Dropdown::showFromArray("deconnection_behavior", array('' => __('Preserve'), "trash" => _x('button', 'Put in dustbin'), "delete" => _x('button', 'Delete permanently')), array('value' => $this->fields["deconnection_behavior"]));
     echo "</td></tr>\n";
     $import_array = array("0" => __('No import', 'ocsinventoryng'), "1" => __('Global import', 'ocsinventoryng'), "2" => __('Unit import', 'ocsinventoryng'));
     $import_array2 = array("0" => __('No import', 'ocsinventoryng'), "1" => __('Global import', 'ocsinventoryng'), "2" => __('Unit import', 'ocsinventoryng'), "3" => __('Unit import on serial number', 'ocsinventoryng'), "4" => __('Unit import serial number only', 'ocsinventoryng'));
     $periph = $this->fields["import_periph"];
     $monitor = $this->fields["import_monitor"];
     $printer = $this->fields["import_printer"];
     $software = $this->fields["import_software"];
     echo "<tr class='tab_bg_2'><td class='center'>" . _n('Device', 'Devices', 2) . " </td>\n<td>";
     Dropdown::showFromArray("import_periph", $import_array, array('value' => $periph));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_2'><td class='center'>" . _n('Monitor', 'Monitors', 2) . "</td>\n<td>";
     Dropdown::showFromArray("import_monitor", $import_array2, array('value' => $monitor));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_2'><td class='center'>" . _n('Printer', 'Printers', 2) . "</td>\n<td>";
     Dropdown::showFromArray("import_printer", $import_array, array('value' => $printer));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_2'><td class='center'>" . _n('Software', 'Software', 2) . "</td>\n<td>";
     $import_array = array("0" => __('No import', 'ocsinventoryng'), "1" => __('Unit import', 'ocsinventoryng'));
     Dropdown::showFromArray("import_software", $import_array, array('value' => $software));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_2'><td class='center'>" . _n('Volume', 'Volumes', 2) . "</td>\n<td>";
     Dropdown::showYesNo("import_disk", $this->fields["import_disk"]);
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_2'><td class='center'>" . __('Use the OCSNG software dictionary', 'ocsinventoryng') . "</td>\n<td>";
     Dropdown::showYesNo("use_soft_dict", $this->fields["use_soft_dict"]);
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_2'><td class='center'>" . __('Registry', 'ocsinventoryng') . "</td>\n<td>";
     Dropdown::showYesNo("import_registry", $this->fields["import_registry"]);
     echo "</td></tr>\n";
     //check version
     if ($this->fields['ocs_version'] > self::OCS1_3_VERSION_LIMIT) {
         echo "<tr class='tab_bg_2'><td class='center'>" . _n('Virtual machine', 'Virtual machines', 2) . "</td>\n<td>";
         Dropdown::showYesNo("import_vms", $this->fields["import_vms"]);
         echo "</td></tr>\n";
     } else {
         echo "<tr class='tab_bg_2'><td class='center'>";
         echo "<input type='hidden' name='import_vms' value='0'>";
         echo "</td></tr>\n";
     }
     echo "<tr class='tab_bg_2'><td class='center'>" . __('Number of items to synchronize via the automatic OCSNG action', 'ocsinventoryng') . "</td>\n<td>";
     Dropdown::showNumber('cron_sync_number', array('value' => $this->fields['cron_sync_number'], 'min' => 1, 'toadd' => array(0 => __('None'))));
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'><td class='center'>" . __('Behavior to the deletion of a computer in OCSNG', 'ocsinventoryng') . "</td>";
     echo "<td>";
     $actions[0] = Dropdown::EMPTY_VALUE;
     $actions[1] = __('Put in dustbin');
     foreach (getAllDatasFromTable('glpi_states') as $state) {
         $actions['STATE_' . $state['id']] = sprintf(__('Change to state %s', 'ocsinventoryng'), $state['name']);
     }
     Dropdown::showFromArray('deleted_behavior', $actions, array('value' => $this->fields['deleted_behavior']));
     echo "</table>\n";
     echo "<br>" . __('No import: the plugin will not import these elements', 'ocsinventoryng');
     echo "<br>" . __('Global import: everything is imported but the material is globally managed (without duplicate)', 'ocsinventoryng');
     echo "<br>" . __("Unit import: everything is imported as it is", 'ocsinventoryng');
     echo "<p class='submit'><input type='submit' name='update_server' class='submit' value='" . _sx('button', 'Save') . "'></p>";
     Html::closeForm();
     echo "</div>";
 }
コード例 #14
0
 /**
  * Print the Project task form
  *
  * @param $ID        integer  Id of the project task
  * @param $options   array    of possible options:
  *     - target form target
  *     - projects_id ID of the software for add process
  *
  * @return true if displayed  false if item not found or not right to display
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     if ($ID > 0) {
         $this->check($ID, READ);
         $projects_id = $this->fields['projects_id'];
         $projecttasks_id = $this->fields['projecttasks_id'];
     } else {
         $projects_id = $options['projects_id'];
         $projecttasks_id = $options['projecttasks_id'];
         $this->check(-1, CREATE, $options);
     }
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'><td>" . _n('Project', 'Projects', Session::getPluralNumber()) . "</td>";
     echo "<td>";
     if ($this->isNewID($ID)) {
         echo "<input type='hidden' name='projects_id' value='{$projects_id}'>";
     }
     echo "<a href='project.form.php?id=" . $projects_id . "'>" . Dropdown::getDropdownName("glpi_projects", $projects_id) . "</a>";
     echo "</td>";
     echo "<td>" . __('As child of') . "</td>";
     echo "<td>";
     $this->dropdown(array('entity' => $this->fields['entities_id'], 'value' => $projecttasks_id, 'condition' => "`glpi_projecttasks`.`projects_id`='" . $this->fields['projects_id'] . "'", 'used' => array($this->fields['id'])));
     echo "</td></tr>";
     $showuserlink = 0;
     if (Session::haveRight('user', READ)) {
         $showuserlink = 1;
     }
     if ($ID) {
         echo "<tr class='tab_bg_1'>";
         echo "<td>" . __('Creation date') . "</td>";
         echo "<td>";
         echo sprintf(__('%1$s by %2$s'), Html::convDateTime($this->fields["date"]), getUserName($this->fields["users_id"], $showuserlink));
         echo "</td>";
         echo "<td>" . __('Last update') . "</td>";
         echo "<td>";
         echo Html::convDateTime($this->fields["date_mod"]);
         echo "</td></tr>";
     }
     echo "<tr class='tab_bg_1'><td>" . __('Name') . "</td>";
     echo "<td colspan='3'>";
     Html::autocompletionTextField($this, "name", array('size' => 80));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . _x('item', 'State') . "</td>";
     echo "<td>";
     ProjectState::dropdown(array('value' => $this->fields["projectstates_id"]));
     echo "</td>";
     echo "<td>" . __('Type') . "</td>";
     echo "<td>";
     ProjectTaskType::dropdown(array('value' => $this->fields["projecttasktypes_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Percent done') . "</td>";
     echo "<td>";
     Dropdown::showNumber("percent_done", array('value' => $this->fields['percent_done'], 'min' => 0, 'max' => 100, 'step' => 5, 'unit' => '%'));
     echo "</td>";
     echo "<td>";
     _e('Milestone');
     echo "</td>";
     echo "<td>";
     Dropdown::showYesNo("is_milestone", $this->fields["is_milestone"]);
     echo "</td>";
     echo "</tr>";
     echo "<tr><td colspan='4' class='subheader'>" . __('Planning') . "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Planned start date') . "</td>";
     echo "<td>";
     Html::showDateTimeField("plan_start_date", array('value' => $this->fields['plan_start_date']));
     echo "</td>";
     echo "<td>" . __('Real start date') . "</td>";
     echo "<td>";
     Html::showDateTimeField("real_start_date", array('value' => $this->fields['real_start_date']));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Planned end date') . "</td>";
     echo "<td>";
     Html::showDateTimeField("plan_end_date", array('value' => $this->fields['plan_end_date']));
     echo "</td>";
     echo "<td>" . __('Real end date') . "</td>";
     echo "<td>";
     Html::showDateTimeField("real_end_date", array('value' => $this->fields['real_end_date']));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Planned duration') . "</td>";
     echo "<td>";
     Dropdown::showTimeStamp("planned_duration", array('min' => 0, 'max' => 100 * HOUR_TIMESTAMP, 'step' => HOUR_TIMESTAMP, 'value' => $this->fields["planned_duration"], 'addfirstminutes' => true, 'inhours' => true));
     echo "</td>";
     echo "<td>" . __('Effective duration') . "</td>";
     echo "<td>";
     Dropdown::showTimeStamp("effective_duration", array('min' => 0, 'max' => 100 * HOUR_TIMESTAMP, 'step' => HOUR_TIMESTAMP, 'value' => $this->fields["effective_duration"], 'addfirstminutes' => true, 'inhours' => true));
     if ($ID) {
         $ticket_duration = ProjectTask_Ticket::getTicketsTotalActionTime($this->getID());
         echo "<br>";
         printf(__('%1$s: %2$s'), __('Tickets duration'), Html::timestampToString($ticket_duration, false));
         echo '<br>';
         printf(__('%1$s: %2$s'), __('Total duration'), Html::timestampToString($ticket_duration + $this->fields["effective_duration"], false));
     }
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Description') . "</td>";
     echo "<td colspan='3'>";
     echo "<textarea id='content' name='content' cols='90' rows='6'>" . $this->fields["content"] . "</textarea>";
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Comments') . "</td>";
     echo "<td colspan='3'>";
     echo "<textarea id='comment' name='comment' cols='90' rows='6'>" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>\n";
     $this->showFormButtons($options);
     return true;
 }
Session::checkCentralAccess();
// Make a select box
if ($_POST['items_id'] && $_POST['itemtype'] && class_exists($_POST['itemtype'])) {
    $devicetype = $_POST['itemtype'];
    $linktype = $devicetype::getItem_DeviceType();
    if (count($linktype::getSpecificities())) {
        $name_field = "CONCAT_WS(' - ', `" . implode('`, `', array_keys($linktype::getSpecificities())) . "`)";
    } else {
        $name_field = "`id`";
    }
    $query = "SELECT `id`, {$name_field} AS name\n             FROM `" . $linktype::getTable() . "`\n             WHERE `" . $devicetype::getForeignKeyField() . "` = '" . $_POST['items_id'] . "'\n                    AND `itemtype` = ''";
    $result = $DB->request($query);
    echo "<table width='100%'><tr><td>" . __('Choose an existing device') . "</td><td rowspan='2'>" . __('and/or') . "</td><td>" . __('Add new devices') . '</td></tr>';
    echo "<tr><td>";
    if ($result->numrows() == 0) {
        echo __('No unaffected device !');
    } else {
        $devices = array();
        foreach ($result as $row) {
            $name = $row['name'];
            if (empty($name)) {
                $name = $row['id'];
            }
            $devices[$row['id']] = $name;
        }
        dropdown::showFromArray($linktype::getForeignKeyField(), $devices, array('multiple' => true));
    }
    echo "</td><td>";
    Dropdown::showNumber('new_devices', array('min' => 0, 'max' => 10));
    echo "</td></tr></table>";
}
コード例 #16
0
                                  $params);

      echo "<span id='show_itemtype$rand'><input type='hidden' name='services_id[]' value='0'/></span>\n";
      break;

   case 'PluginMonitoringWeathermap':
      $toadd = array('-1' => "[".__('Legend', 'monitoring')."]");
      Dropdown::show(
              'PluginMonitoringWeathermap',
              array(
                  'name'  => 'items_id',
                  'toadd' => $toadd));
      echo "&nbsp;&nbsp;&nbsp;".__('% of the width of the frame', 'monitoring')."&nbsp: ";
      Dropdown::showNumber("extra_infos", array(
                      'value' => 100,
                      'min'   => 0,
                      'max'   => 100,
                      'step'  => 5)
      );
      break;

   case 'PluginMonitoringDisplayview':
      if (isset($_POST['sliders_id'])) {
         Dropdown::show('PluginMonitoringDisplayview',
                        array('name'      =>'items_id'));
      } else {
         Dropdown::show('PluginMonitoringDisplayview',
                        array('name'      =>'items_id',
                              'condition' => "`is_frontview`='0'",
                              'used'      => array($_POST['displayviews_id'])));
      }
      break;
コード例 #17
0
ファイル: networkport.class.php プロジェクト: stweil/glpi
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     if (!isset($options['several'])) {
         $options['several'] = false;
     }
     if (!self::canView()) {
         return false;
     }
     $this->initForm($ID, $options);
     $recursiveItems = $this->recursivelyGetItems();
     if (count($recursiveItems) > 0) {
         $lastItem = $recursiveItems[count($recursiveItems) - 1];
         $lastItem_entities_id = $lastItem->getField('entities_id');
     } else {
         $lastItem_entities_id = $_SESSION['glpiactive_entity'];
     }
     $options['entities_id'] = $lastItem_entities_id;
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'><td>";
     $this->displayRecursiveItems($recursiveItems, 'Type');
     echo "&nbsp;:</td>\n<td>";
     // Need these to update information
     echo "<input type='hidden' name='items_id' value='" . $this->fields["items_id"] . "'>\n";
     echo "<input type='hidden' name='itemtype' value='" . $this->fields["itemtype"] . "'>\n";
     echo "<input type='hidden' name='instantiation_type' value='" . $this->fields["instantiation_type"] . "'>\n";
     $this->displayRecursiveItems($recursiveItems, "Link");
     echo "</td>\n";
     $colspan = 2;
     if (!$options['several']) {
         $colspan++;
     }
     echo "<td rowspan='{$colspan}'>" . __('Comments') . "</td>";
     echo "<td rowspan='{$colspan}' class='middle'>";
     echo "<textarea cols='45' rows='{$colspan}' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>\n";
     if (!$options['several']) {
         echo "<tr class='tab_bg_1'><td>" . _n('Port number', 'Ports number', 1) . "</td>\n";
         echo "<td>";
         Html::autocompletionTextField($this, "logical_number", array('size' => 5));
         echo "</td></tr>\n";
     } else {
         echo "<tr class='tab_bg_1'><td>" . _n('Port number', 'Port numbers', Session::getPluralNumber()) . "</td>\n";
         echo "<td>";
         echo "<input type='hidden' name='several' value='yes'>";
         echo "<input type='hidden' name='logical_number' value=''>\n";
         echo __('from') . "&nbsp;";
         Dropdown::showNumber('from_logical_number', array('value' => 0));
         echo "&nbsp;" . __('to') . "&nbsp;";
         Dropdown::showNumber('to_logical_number', array('value' => 0));
         echo "</td></tr>\n";
     }
     echo "<tr class='tab_bg_1'><td>" . __('Name') . "</td>\n";
     echo "<td>";
     Html::autocompletionTextField($this, "name");
     echo "</td></tr>\n";
     $instantiation = $this->getInstantiation();
     if ($instantiation !== false) {
         echo "<tr class='tab_bg_1'><th colspan='4'>" . $instantiation->getTypeName(1) . "</th></tr>\n";
         $instantiation->showInstantiationForm($this, $options, $recursiveItems);
         unset($instantiation);
     }
     if (!$options['several']) {
         NetworkName::showFormForNetworkPort($this->getID());
     }
     $this->showFormButtons($options);
 }
コード例 #18
0
ファイル: contract.class.php プロジェクト: jose-martins/glpi
 /**
  * Print the contract form
  *
  * @param $ID        integer ID of the item
  * @param $options   array
  *     - target filename : where to go when done.
  *     - withtemplate boolean : template or basic item
  *
  *@return boolean item found
  **/
 function showForm($ID, $options = array())
 {
     $this->initForm($ID, $options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td><td>";
     Html::autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td>" . __('Contract type') . "</td><td >";
     ContractType::dropdown(array('value' => $this->fields["contracttypes_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . _x('phone', 'Number') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "num");
     echo "</td>";
     echo "<td colspan='2'></td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Start date') . "</td>";
     echo "<td>";
     Html::showDateField("begin_date", array('value' => $this->fields["begin_date"]));
     echo "</td>";
     echo "<td>" . __('Initial contract period') . "</td><td>";
     Dropdown::showNumber("duration", array('value' => $this->fields["duration"], 'min' => 1, 'max' => 120, 'step' => 1, 'toadd' => array(0 => Dropdown::EMPTY_VALUE), 'unit' => 'month'));
     if (!empty($this->fields["begin_date"])) {
         echo " -> " . Infocom::getWarrantyExpir($this->fields["begin_date"], $this->fields["duration"], 0, true);
     }
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Notice') . "</td><td>";
     Dropdown::showNumber("notice", array('value' => $this->fields["notice"], 'min' => 0, 'max' => 120, 'step' => 1, 'toadd' => array(), 'unit' => 'month'));
     if (!empty($this->fields["begin_date"]) && $this->fields["notice"] > 0) {
         echo " -> " . Infocom::getWarrantyExpir($this->fields["begin_date"], $this->fields["duration"], $this->fields["notice"], true);
     }
     echo "</td>";
     echo "<td>" . __('Account number') . "</td><td>";
     Html::autocompletionTextField($this, "accounting_number");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Contract renewal period') . "</td><td>";
     Dropdown::showNumber("periodicity", array('value' => $this->fields["periodicity"], 'min' => 12, 'max' => 60, 'step' => 12, 'toadd' => array(0 => Dropdown::EMPTY_VALUE, 1 => sprintf(_n('%d month', '%d months', 1), 1), 2 => sprintf(_n('%d month', '%d months', 2), 2), 3 => sprintf(_n('%d month', '%d months', 3), 3), 6 => sprintf(_n('%d month', '%d months', 6), 6)), 'unit' => 'month'));
     echo "</td>";
     echo "<td>" . __('Invoice period') . "</td>";
     echo "<td>";
     Dropdown::showNumber("billing", array('value' => $this->fields["billing"], 'min' => 12, 'max' => 60, 'step' => 12, 'toadd' => array(0 => Dropdown::EMPTY_VALUE, 1 => sprintf(_n('%d month', '%d months', 1), 1), 2 => sprintf(_n('%d month', '%d months', 2), 2), 3 => sprintf(_n('%d month', '%d months', 3), 3), 6 => sprintf(_n('%d month', '%d months', 6), 6)), 'unit' => 'month'));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Renewal') . "</td><td>";
     self::dropdownContractRenewal("renewal", $this->fields["renewal"]);
     echo "</td>";
     echo "<td>" . __('Max number of items') . "</td><td>";
     Dropdown::showNumber("max_links_allowed", array('value' => $this->fields["max_links_allowed"], 'min' => 1, 'max' => 200, 'step' => 1, 'toadd' => array(0 => __('Unlimited'))));
     echo "</td></tr>";
     if (Entity::getUsedConfig("use_contracts_alert", $this->fields["entities_id"])) {
         echo "<tr class='tab_bg_1'>";
         echo "<td>" . __('Email alarms') . "</td>";
         echo "<td>";
         self::dropdownAlert(array('name' => "alert", 'value' => $this->fields["alert"]));
         Alert::displayLastAlert(__CLASS__, $ID);
         echo "</td>";
         echo "<td colspan='2'>&nbsp;</td>";
         echo "</tr>";
     }
     echo "<tr class='tab_bg_1'><td class='top'>" . __('Comments') . "</td>";
     echo "<td class='center' colspan='3'>";
     echo "<textarea cols='50' rows='4' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'><td>" . __('Support hours') . "</td>";
     echo "<td colspan='3'>&nbsp;</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('on week') . "</td>";
     echo "<td colspan='3'>";
     echo "<table width='100%'><tr><td width='20%'>&nbsp;</td>";
     echo "<td width='20%'>";
     echo "<span class='small_space'>" . __('Start') . "</span>";
     echo "</td><td width='20%'>";
     Dropdown::showHours("week_begin_hour", array('value' => $this->fields["week_begin_hour"]));
     echo "</td><td width='20%'>";
     echo "<span class='small_space'>" . __('End') . "</span></td><td width='20%'>";
     Dropdown::showHours("week_end_hour", array('value' => $this->fields["week_end_hour"]));
     echo "</td></tr></table>";
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('on Saturday') . "</td>";
     echo "<td colspan='3'>";
     echo "<table width='100%'><tr><td width='20%'>";
     Dropdown::showYesNo("use_saturday", $this->fields["use_saturday"]);
     echo "</td><td width='20%'>";
     echo "<span class='small_space'>" . __('Start') . "</span>";
     echo "</td><td width='20%'>";
     Dropdown::showHours("saturday_begin_hour", array('value' => $this->fields["saturday_begin_hour"]));
     echo "</td><td width='20%'>";
     echo "<span class='small_space'>" . __('End') . "</span>";
     echo "</td><td width='20%'>";
     Dropdown::showHours("saturday_end_hour", array('value' => $this->fields["saturday_end_hour"]));
     echo "</td></tr></table>";
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Sundays and holidays') . "</td>";
     echo "<td colspan='3'>";
     echo "<table width='100%'><tr><td width='20%'>";
     Dropdown::showYesNo("use_monday", $this->fields["use_monday"]);
     echo "</td><td width='20%'>";
     echo "<span class='small_space'>" . __('Start') . "</span>";
     echo "</td><td width='20%'>";
     Dropdown::showHours("monday_begin_hour", array('value' => $this->fields["monday_begin_hour"]));
     echo "</td><td width='20%'>";
     echo "<span class='small_space'>" . __('End') . "</span>";
     echo "</td><td width='20%'>";
     Dropdown::showHours("monday_end_hour", array('value' => $this->fields["monday_end_hour"]));
     echo "</td></tr></table>";
     echo "</td></tr>";
     $this->showFormButtons($options);
     return true;
 }
コード例 #19
0
ファイル: entity.class.php プロジェクト: korial29/glpi
 /**
  * @since version 0.84 (before in entitydata.class)
  *
  * @param $entity Entity object
  **/
 static function showHelpdeskOptions(Entity $entity)
 {
     global $CFG_GLPI;
     $ID = $entity->getField('id');
     if (!$entity->can($ID, READ) || !Session::haveRightsOr(self::$rightname, array(self::READHELPDESK, self::UPDATEHELPDESK))) {
         return false;
     }
     $canedit = Session::haveRight(self::$rightname, self::UPDATEHELPDESK) && Session::haveAccessToEntity($ID);
     echo "<div class='spaced'>";
     if ($canedit) {
         echo "<form method='post' name=form action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
     }
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr class='tab_bg_1'><td colspan='2'>" . _n('Ticket template', 'Ticket templates', 1) . "</td>";
     echo "<td colspan='2'>";
     $toadd = array();
     if ($ID != 0) {
         $toadd = array(self::CONFIG_PARENT => __('Inheritance of the parent entity'));
     }
     $options = array('value' => $entity->fields["tickettemplates_id"], 'entity' => $ID, 'toadd' => $toadd);
     TicketTemplate::dropdown($options);
     if ($entity->fields["tickettemplates_id"] == self::CONFIG_PARENT && $ID != 0) {
         echo "<font class='green'>&nbsp;&nbsp;";
         $tt = new TicketTemplate();
         $tid = self::getUsedConfig('tickettemplates_id', $ID, '', 0);
         if (!$tid) {
             echo Dropdown::EMPTY_VALUE;
         } else {
             if ($tt->getFromDB($tid)) {
                 echo $tt->getLink();
             }
         }
         echo "</font>";
     }
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td colspan='2'>" . __('Calendar') . "</td>";
     echo "<td colspan='2'>";
     $options = array('value' => $entity->fields["calendars_id"], 'emptylabel' => __('24/7'));
     if ($ID != 0) {
         $options['toadd'] = array(self::CONFIG_PARENT => __('Inheritance of the parent entity'));
     }
     Calendar::dropdown($options);
     if ($entity->fields["calendars_id"] == self::CONFIG_PARENT && $ID != 0) {
         echo "<font class='green'>&nbsp;&nbsp;";
         $calendar = new Calendar();
         $cid = self::getUsedConfig('calendars_id', $ID, '', 0);
         if (!$cid) {
             _e('24/7');
         } else {
             if ($calendar->getFromDB($cid)) {
                 echo $calendar->getLink();
             }
         }
         echo "</font>";
     }
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td colspan='2'>" . __('Tickets default type') . "</td>";
     echo "<td colspan='2'>";
     $toadd = array();
     if ($ID != 0) {
         $toadd = array(self::CONFIG_PARENT => __('Inheritance of the parent entity'));
     }
     Ticket::dropdownType('tickettype', array('value' => $entity->fields["tickettype"], 'toadd' => $toadd));
     if ($entity->fields['tickettype'] == self::CONFIG_PARENT && $ID != 0) {
         echo "<font class='green'>&nbsp;&nbsp;";
         echo Ticket::getTicketTypeName(self::getUsedConfig('tickettype', $ID, '', Ticket::INCIDENT_TYPE));
         echo "</font>";
     }
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td  colspan='2'>" . __('Automatic assignment of tickets') . "</td>";
     echo "<td colspan='2'>";
     $autoassign = self::getAutoAssignMode();
     if ($ID == 0) {
         unset($autoassign[self::CONFIG_PARENT]);
     }
     Dropdown::showFromArray('auto_assign_mode', $autoassign, array('value' => $entity->fields["auto_assign_mode"]));
     if ($entity->fields['auto_assign_mode'] == self::CONFIG_PARENT && $ID != 0) {
         $auto_assign_mode = self::getUsedConfig('auto_assign_mode', $entity->fields['entities_id']);
         echo "<font class='green'>&nbsp;&nbsp;";
         echo $autoassign[$auto_assign_mode];
         echo "</font>";
     }
     echo "</td></tr>";
     echo "<tr><th colspan='4'>" . __('Automatic closing configuration') . "</th></tr>";
     echo "<tr class='tab_bg_1'>" . "<td colspan='2'>" . __('Automatic closing of solved tickets after') . "</td>";
     echo "<td colspan='2'>";
     $autoclose = array(self::CONFIG_PARENT => __('Inheritance of the parent entity'), self::CONFIG_NEVER => __('Never'), 0 => __('Immediatly'));
     if ($ID == 0) {
         unset($autoclose[self::CONFIG_PARENT]);
     }
     Dropdown::showNumber('autoclose_delay', array('value' => $entity->fields['autoclose_delay'], 'min' => 1, 'max' => 99, 'step' => 1, 'toadd' => $autoclose, 'unit' => 'day'));
     if ($entity->fields['autoclose_delay'] == self::CONFIG_PARENT && $ID != 0) {
         $autoclose_mode = self::getUsedConfig('autoclose_delay', $entity->fields['entities_id'], '', self::CONFIG_NEVER);
         echo "<br><font class='green'>&nbsp;&nbsp;";
         if ($autoclose_mode >= 0) {
             printf(_n('%d day', '%d days', $autoclose_mode), $autoclose_mode);
         } else {
             echo $autoclose[$autoclose_mode];
         }
         echo "</font>";
     }
     echo "</td></tr>";
     echo "<tr><th colspan='4'>" . __('Configuring the satisfaction survey') . "</th></tr>";
     echo "<tr class='tab_bg_1'>" . "<td colspan='2'>" . __('Configuring the satisfaction survey') . "</td>";
     echo "<td colspan='2'>";
     /// no inquest case = rate 0
     $typeinquest = array(self::CONFIG_PARENT => __('Inheritance of the parent entity'), 1 => __('Internal survey'), 2 => __('External survey'));
     // No inherit from parent for root entity
     if ($ID == 0) {
         unset($typeinquest[self::CONFIG_PARENT]);
         if ($entity->fields['inquest_config'] == self::CONFIG_PARENT) {
             $entity->fields['inquest_config'] = 1;
         }
     }
     $rand = Dropdown::showFromArray('inquest_config', $typeinquest, $options = array('value' => $entity->fields['inquest_config']));
     echo "</td></tr>\n";
     // Do not display for root entity in inherit case
     if ($entity->fields['inquest_config'] == self::CONFIG_PARENT && $ID != 0) {
         $inquestconfig = self::getUsedConfig('inquest_config', $entity->fields['entities_id']);
         $inquestrate = self::getUsedConfig('inquest_config', $entity->fields['entities_id'], 'inquest_rate');
         echo "<tr class='tab_bg_1'><td colspan='4' class='green center'>";
         if ($inquestrate == 0) {
             _e('Disabled');
         } else {
             echo $typeinquest[$inquestconfig] . '<br>';
             $inqconf = self::getUsedConfig('inquest_config', $entity->fields['entities_id'], 'inquest_delay');
             printf(_n('%d day', '%d days', $inqconf), $inqconf);
             echo "<br>";
             //TRANS: %d is the percentage. %% to display %
             printf(__('%d%%'), $inquestrate);
             if ($inquestconfig == 2) {
                 echo "<br>";
                 echo self::getUsedConfig('inquest_config', $entity->fields['entities_id'], 'inquest_URL');
             }
         }
         echo "</td></tr>\n";
     }
     echo "<tr class='tab_bg_1'><td colspan='4'>";
     $_POST = array('inquest_config' => $entity->fields['inquest_config'], 'entities_id' => $ID);
     $params = array('inquest_config' => '__VALUE__', 'entities_id' => $ID);
     echo "<div id='inquestconfig'>";
     include GLPI_ROOT . '/ajax/ticketsatisfaction.php';
     echo "</div>\n";
     echo "</td></tr>";
     if ($canedit) {
         echo "<tr class='tab_bg_2'>";
         echo "<td class='center' colspan='4'>";
         echo "<input type='hidden' name='id' value='" . $entity->fields["id"] . "'>";
         echo "<input type='submit' name='update' value=\"" . _sx('button', 'Save') . "\"\n                  class='submit'>";
         echo "</td></tr>";
         echo "</table>";
         Html::closeForm();
     } else {
         echo "</table>";
     }
     echo "</div>";
     Ajax::updateItemOnSelectEvent("dropdown_inquest_config{$rand}", "inquestconfig", $CFG_GLPI["root_doc"] . "/ajax/ticketsatisfaction.php", $params);
 }
コード例 #20
0
   function showForm($items_id, $options=array()) {
      global $DB,$CFG_GLPI;

      $this->initForm($items_id, $options);
      $options['formoptions'] = " enctype='multipart/form-data'";
      $this->showFormHeader($options);

      echo "<tr>";
      echo "<td>";
      echo __('Name')."&nbsp;:";
      echo "</td>";
      echo "<td>";
      $objectName = autoName($this->fields["name"], "name", 1,
                             $this->getType());
      Html::autocompletionTextField($this, 'name', array('value' => $objectName));
      echo "</td>";
      echo "<td>".__('Width', 'monitoring')."&nbsp;:</td>";
      echo "<td>";
      Dropdown::showNumber("width", array(
                'value' => $this->fields['width'],
                'min'   => 100,
                'max'   => 3000,
                'step'  => 20)
      );
      echo "</td>";
      echo "</tr>";

      echo "<tr>";
      echo "<td>";
      echo __('Background image', 'monitoring')."&nbsp;:";
      echo "</td>";
      echo "<td>";
      if ($this->fields['background'] == '') {
         echo "<input type='file' size='25' value='' name='background'/>";
      } else {
         echo $this->fields['background'];
         echo "&nbsp;";
         echo "<input type='image' name='deletepic' value='deletepic' class='submit' src='".$CFG_GLPI["root_doc"]."/pics/delete.png' >";

      }
      echo "</td>";
      echo "<td>".__('Height', 'monitoring')."&nbsp;:</td>";
      echo "<td>";
      Dropdown::showNumber("height", array(
                'value' => $this->fields['height'],
                'min'   => 100,
                'max'   => 3000,
                'step'  => 20)
      );
      echo "</td>";
      echo "</tr>";


      $this->showFormButtons($options);

      PluginMonitoringToolbox::loadLib();

      return true;
   }
コード例 #21
0
ファイル: rssfeed.class.php プロジェクト: stweil/glpi
 /**
  * Print the rssfeed form
  *
  * @param $ID        integer  Id of the item to print
  * @param $options   array    of possible options:
  *     - target filename : where to go when done.
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     // Test _rss cache directory. I permission trouble : unable to edit
     if (Toolbox::testWriteAccessToDirectory(GLPI_RSS_DIR) > 0) {
         echo "<div class='center'>";
         printf(__('Check permissions to the directory: %s'), GLPI_RSS_DIR);
         echo "<p class='red b'>" . __('Error') . "</p>";
         echo "</div>";
         return false;
     }
     $this->initForm($ID, $options);
     $canedit = $this->can($ID, UPDATE);
     $this->showFormHeader($options);
     $rowspan = 4;
     if (!$this->isNewID($ID)) {
         // Force getting feed :
         $feed = self::getRSSFeed($this->fields['url'], $this->fields['refresh_rate']);
         if (!$feed || $feed->error()) {
             $this->setError(true);
         } else {
             $this->setError(false);
         }
         echo "<tr class='tab_bg_2'>";
         echo "<td>" . __('Name') . "</td>";
         echo "<td>";
         Html::autocompletionTextField($this, "name", array('entity' => -1, 'user' => $this->fields["users_id"]));
         echo "</td><td colspan ='2'>&nbsp;</td></tr>\n";
     }
     echo "<tr class='tab_bg_1'><td>" . __('URL') . "</td>";
     echo "<td colspan='3'>";
     echo "<input type='text' name='url' size='100' value='" . $this->fields["url"] . "'>";
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . __('By') . "</td>";
     echo "<td>";
     echo getUserName($this->fields["users_id"]);
     echo "<input type='hidden' name='users_id' value='" . $this->fields['users_id'] . "'>\n";
     echo "</td>";
     echo "<td rowspan='{$rowspan}'>" . __('Comments') . "</td>";
     echo "<td rowspan='{$rowspan}' class='middle'>";
     echo "<textarea cols='45' rows='" . ($rowspan + 3) . "' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . __('Active') . "</td>";
     echo "<td>";
     Dropdown::showYesNo('is_active', $this->fields['is_active']);
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . __('Refresh rate') . "</td>";
     echo "<td>";
     Dropdown::showTimeStamp("refresh_rate", array('value' => $this->fields["refresh_rate"], 'min' => HOUR_TIMESTAMP, 'max' => DAY_TIMESTAMP, 'step' => HOUR_TIMESTAMP, 'display_emptychoice' => false, 'toadd' => array(5 * MINUTE_TIMESTAMP, 15 * MINUTE_TIMESTAMP, 30 * MINUTE_TIMESTAMP, 45 * MINUTE_TIMESTAMP)));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . __('Number of items displayed') . "</td>";
     echo "<td>";
     Dropdown::showNumber("max_items", array('value' => $this->fields["max_items"], 'min' => 5, 'max' => 100, 'step' => 5, 'toadd' => array(1), 'display_emptychoice' => false));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . __('Error retrieving RSS feed') . "</td>";
     echo "<td>";
     echo Dropdown::getYesNo($this->fields['have_error']);
     echo "</td>";
     if ($this->fields['have_error']) {
         echo "<td>" . __('RSS feeds found');
         echo "</td><td>";
         $this->showDiscoveredFeeds();
         echo "</td>\n";
     } else {
         echo "<td colspan='2'>&nbsp;</td>";
     }
     echo "</tr>";
     $this->showFormButtons($options);
     return true;
 }
コード例 #22
0
     $inquest_duration = -1;
     $max_closedate = '';
 }
 if ($_POST['inquest_config'] > 0) {
     echo "<table class='tab_cadre_fixe' width='50%'>";
     echo "<tr class='tab_bg_1'><td width='50%'>" . __('Create survey after') . "</td>";
     echo "<td>";
     Dropdown::showNumber('inquest_delay', array('value' => $inquest_delay, 'min' => 1, 'max' => 90, 'step' => 1, 'toadd' => array('0' => __('As soon as possible')), 'unit' => 'day'));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>" . "<td>" . __('Rate to trigger survey') . "</td>";
     echo "<td>";
     Dropdown::showNumber('inquest_rate', array('value' => $inquest_rate, 'min' => 10, 'max' => 100, 'step' => 10, 'toadd' => array(0 => __('Disabled')), 'unit' => '%'));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td width='50%'>" . __('Duration of survey') . "</td>";
     echo "<td>";
     Dropdown::showNumber('inquest_duration', array('value' => $inquest_duration, 'min' => 1, 'max' => 180, 'step' => 1, 'toadd' => array('0' => __('Unspecified')), 'unit' => 'day'));
     echo "</td></tr>";
     if ($max_closedate != '') {
         echo "<tr class='tab_bg_1'><td>" . __('For tickets closed after') . "</td><td>";
         Html::showDateTimeField("max_closedate", array('value' => $max_closedate, 'timestep' => 1));
         echo "</td></tr>";
     }
     if ($_POST['inquest_config'] == 2) {
         echo "<tr class='tab_bg_1'>";
         echo "<td>" . __('Valid tags') . "</td><td>" . "[TICKET_ID] [TICKET_NAME] [TICKET_CREATEDATE] [TICKET_SOLVEDATE] " . "[REQUESTTYPE_ID] [REQUESTTYPE_NAME] [TICKET_PRIORITY] [TICKET_PRIORITYNAME]  " . "[TICKETCATEGORY_ID] [TICKETCATEGORY_NAME] [TICKETTYPE_ID] " . "[TICKETTYPE_NAME] [SOLUTIONTYPE_ID] [SOLUTIONTYPE_NAME] " . "[SLA_ID] [SLA_NAME] [SLALEVEL_ID] [SLALEVEL_NAME]</td></tr>";
         echo "<tr class='tab_bg_1'><td>" . __('URL') . "</td>";
         echo "<td>";
         Html::autocompletionTextField($entity, "inquest_URL");
         echo "</td></tr>";
     }
     echo "</table>";
コード例 #23
0
 function showFormAdvancedConfig()
 {
     $ID = $this->getField('id');
     $hidden = '';
     echo "<div class='center'>";
     echo "<form method='post' action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr class='tab_bg_2'><th colspan='4'>";
     echo "<input type='hidden' name='id' value='{$ID}'>" . __('Advanced information') . "</th></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Use TLS') . "</td><td>";
     if (function_exists("ldap_start_tls")) {
         Dropdown::showYesNo('use_tls', $this->fields["use_tls"]);
     } else {
         echo "<input type='hidden' name='use_tls' value='0'>" . __('ldap_start_tls does not exist');
     }
     echo "</td>";
     echo "<td>" . __('LDAP directory time zone') . "</td><td>";
     Dropdown::showGMT("time_offset", $this->fields["time_offset"]);
     echo "</td></tr>";
     if (self::isLdapPageSizeAvailable(false, false)) {
         echo "<tr class='tab_bg_1'>";
         echo "<td>" . __('Use paged results') . "</td><td>";
         Dropdown::showYesNo('can_support_pagesize', $this->fields["can_support_pagesize"]);
         echo "</td>";
         echo "<td>" . __('Page size') . "</td><td>";
         Dropdown::showNumber("pagesize", array('value' => $this->fields['pagesize'], 'min' => 100, 'max' => 100000, 'step' => 100));
         echo "</td></tr>";
         echo "<tr class='tab_bg_1'>";
         echo "<td>" . __('Maximum number of results') . "</td><td>";
         Dropdown::showNumber('ldap_maxlimit', array('value' => $this->fields['ldap_maxlimit'], 'min' => 100, 'max' => 999999, 'step' => 100, 'toadd' => array(0 => __('Unlimited'))));
         echo "</td><td colspan='2'></td></tr>";
     } else {
         $hidden .= "<input type='hidden' name='can_support_pagesize' value='0'>";
         $hidden .= "<input type='hidden' name='pagesize' value='0'>";
         $hidden .= "<input type='hidden' name='ldap_maxlimit' value='0'>";
     }
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('How LDAP aliases should be handled') . "</td><td colspan='4'>";
     $alias_options[LDAP_DEREF_NEVER] = __('Never dereferenced (default)');
     $alias_options[LDAP_DEREF_ALWAYS] = __('Always dereferenced');
     $alias_options[LDAP_DEREF_SEARCHING] = __('Dereferenced during the search (but not when locating)');
     $alias_options[LDAP_DEREF_FINDING] = __('Dereferenced when locating (not during the search)');
     Dropdown::showFromArray("deref_option", $alias_options, array('value' => $this->fields["deref_option"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'><td class='center' colspan='4'>";
     echo "<input type='submit' name='update' class='submit' value=\"" . __s('Save') . "\">";
     echo $hidden;
     echo "</td></tr>";
     echo "</table>";
     Html::closeForm();
     echo "</div>";
 }
コード例 #24
0
ファイル: info.class.php プロジェクト: JULIO8/respaldo_glpi
 /**
  * Display command additional informations
  *
  * @param info
  * @param option
  * @param injectionClass
  *
  * @return nothing
  **/
 static function showAdditionalInformation(PluginDatainjectionInfo $info, $option = array(), $injectionClass, $values = array())
 {
     $name = "info[" . $option['linkfield'] . "]";
     if (isset($_SESSION['datainjection']['infos'][$option['linkfield']])) {
         $value = $_SESSION['datainjection']['infos'][$option['linkfield']];
     } else {
         $value = '';
     }
     switch ($option['displaytype']) {
         case 'text':
         case 'decimal':
             if (empty($value)) {
                 $value = isset($option['default']) ? $option['default'] : '';
             }
             echo "<input type='text' name='{$name}' value='{$value}'";
             if (isset($option['size'])) {
                 echo " size='" . $option['size'] . "'";
             }
             echo ">";
             break;
         case 'dropdown':
             if ($value == '') {
                 $value = 0;
             }
             Dropdown::show(getItemTypeForTable($option['table']), array('name' => $name, 'value' => $value));
             break;
         case 'bool':
             if ($value == '') {
                 $value = 0;
             }
             Dropdown::showYesNo($name, $value);
             break;
         case 'user':
             if ($value == '') {
                 $value = 0;
             }
             User::dropdown(array('name' => $name, 'value' => $value));
             break;
         case 'date':
             Html::showDateField($name, array('value' => $value));
             break;
         case 'multiline_text':
             echo "<textarea cols='45' rows='5' name='{$name}'>{$value}</textarea>";
             break;
         case 'dropdown_integer':
             $minvalue = isset($option['minvalue']) ? $option['minvalue'] : 0;
             $maxvalue = isset($option['maxvalue']) ? $option['maxvalue'] : 0;
             $step = isset($option['step']) ? $option['step'] : 1;
             $default = isset($option['-1']) ? array(-1 => $option['-1']) : array();
             Dropdown::showNumber($name, array('value' => $value, 'min' => $minvalue, 'max' => $maxvalue, 'step' => $step, 'toadd' => $default));
             break;
         case 'template':
             self::dropdownTemplates($name, $option['table']);
             break;
         case 'password':
             echo "<input type='password' name='{$name}' value='' size='20' autocomplete='off'>";
             break;
         default:
             if (method_exists($injectionClass, 'showAdditionalInformation')) {
                 //If type is not a standard type, must be treated by specific injection class
                 $injectionClass->showAdditionalInformation($info, $option);
             }
     }
     if ($info->isMandatory()) {
         echo "&nbsp;*";
     }
 }
コード例 #25
0
ファイル: crontask.class.php プロジェクト: glpi-project/glpi
 /**
  * Print the contact form
  *
  * @param $ID        integer ID of the item
  * @param $options   array
  *     - target filename : where to go when done.
  *     - withtemplate boolean : template or basic item
  *
  * @return Nothing (display)
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     if (!Config::canView() || !$this->getFromDB($ID)) {
         return false;
     }
     $options['candel'] = false;
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td>";
     echo "<td class ='b'>";
     $name = $this->fields["name"];
     if ($isplug = isPluginItemType($this->fields["itemtype"])) {
         $name = sprintf(__('%1$s - %2$s'), $isplug["plugin"], $name);
     }
     echo $name . "</td>";
     echo "<td rowspan='6' class='middle right'>" . __('Comments') . "</td>";
     echo "<td class='center middle' rowspan='6'>";
     echo "<textarea cols='45' rows='8' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Description') . "</td><td>";
     echo $this->getDescription($ID);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Run frequency') . "</td><td>";
     $this->dropdownFrequency('frequency', $this->fields["frequency"]);
     echo "</td></tr>";
     $tmpstate = $this->fields["state"];
     echo "<tr class='tab_bg_1'><td>" . __('Status') . "</td><td>";
     if (is_file(GLPI_CRON_DIR . '/' . $this->fields["name"] . '.lock') || is_file(GLPI_CRON_DIR . '/all.lock')) {
         echo "<span class='b'>" . __('System lock') . "</span><br>";
         $tmpstate = self::STATE_DISABLE;
     }
     if ($isplug) {
         $plug = new Plugin();
         if (!$plug->isActivated($isplug["plugin"])) {
             echo "<span class='b'>" . __('Disabled plugin') . "</span><br>";
             $tmpstate = self::STATE_DISABLE;
         }
     }
     if ($this->fields["state"] == self::STATE_RUNNING) {
         echo "<span class='b'>" . $this->getStateName(self::STATE_RUNNING) . "</span>";
     } else {
         self::dropdownState('state', $this->fields["state"]);
     }
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Run mode') . "</td><td>";
     $modes = array();
     if ($this->fields['allowmode'] & self::MODE_INTERNAL) {
         $modes[self::MODE_INTERNAL] = self::getModeName(self::MODE_INTERNAL);
     }
     if ($this->fields['allowmode'] & self::MODE_EXTERNAL) {
         $modes[self::MODE_EXTERNAL] = self::getModeName(self::MODE_EXTERNAL);
     }
     Dropdown::showFromArray('mode', $modes, array('value' => $this->fields['mode']));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Run period') . "</td><td>";
     Dropdown::showNumber('hourmin', array('value' => $this->fields['hourmin'], 'min' => 0, 'max' => 24, 'width' => '35%'));
     echo "&nbsp;->&nbsp;";
     Dropdown::showNumber('hourmax', array('value' => $this->fields['hourmax'], 'min' => 0, 'max' => 24, 'width' => '35%'));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Number of days this action logs are stored') . "</td><td>";
     Dropdown::showNumber('logs_lifetime', array('value' => $this->fields['logs_lifetime'], 'min' => 10, 'max' => 360, 'step' => 10, 'toadd' => array(0 => __('Infinite'))));
     echo "</td><td>" . __('Last run') . "</td><td>";
     if (empty($this->fields['lastrun'])) {
         _e('Never');
     } else {
         echo Html::convDateTime($this->fields['lastrun']);
         echo "&nbsp;";
         Html::showSimpleForm(static::getFormURL(), 'resetdate', __('Blank'), array('id' => $ID), $CFG_GLPI['root_doc'] . "/pics/reset.png");
     }
     echo "</td></tr>";
     $label = $this->getParameterDescription();
     echo "<tr class='tab_bg_1'><td>";
     if (empty($label)) {
         echo "&nbsp;</td><td>&nbsp;";
     } else {
         echo $label . "&nbsp;</td><td>";
         Dropdown::showNumber('param', array('value' => $this->fields['param'], 'min' => 0, 'max' => 400));
     }
     echo "</td><td>" . __('Next run') . "</td><td>";
     if ($tmpstate == self::STATE_RUNNING) {
         $launch = false;
     } else {
         $launch = $this->fields['allowmode'] & self::MODE_INTERNAL;
     }
     if ($tmpstate != self::STATE_WAITING) {
         echo $this->getStateName($tmpstate);
     } else {
         if (empty($this->fields['lastrun'])) {
             _e('As soon as possible');
         } else {
             $next = strtotime($this->fields['lastrun']) + $this->fields['frequency'];
             $h = date('H', $next);
             $deb = $this->fields['hourmin'] < 10 ? "0" . $this->fields['hourmin'] : $this->fields['hourmin'];
             $fin = $this->fields['hourmax'] < 10 ? "0" . $this->fields['hourmax'] : $this->fields['hourmax'];
             if ($deb < $fin && $h < $deb) {
                 $disp = date('Y-m-d', $next) . " {$deb}:00:00";
                 $next = strtotime($disp);
             } else {
                 if ($deb < $fin && $h >= $this->fields['hourmax']) {
                     $disp = date('Y-m-d', $next + DAY_TIMESTAMP) . " {$deb}:00:00";
                     $next = strtotime($disp);
                 }
             }
             if ($deb > $fin && $h < $deb && $h >= $fin) {
                 $disp = date('Y-m-d', $next) . " {$deb}:00:00";
                 $next = strtotime($disp);
             } else {
                 $disp = date("Y-m-d H:i:s", $next);
             }
             if ($next < time()) {
                 echo __('As soon as possible') . '<br>(' . Html::convDateTime($disp) . ') ';
             } else {
                 echo Html::convDateTime($disp);
             }
         }
     }
     if ($launch) {
         echo "&nbsp;";
         Html::showSimpleForm(static::getFormURL(), array('execute' => $this->fields['name']), __('Execute'));
     }
     if ($tmpstate == self::STATE_RUNNING) {
         Html::showSimpleForm(static::getFormURL(), 'resetstate', __('Blank'), array('id' => $ID), $CFG_GLPI['root_doc'] . "/pics/reset.png");
     }
     echo "</td></tr>";
     $this->showFormButtons($options);
     return true;
 }
コード例 #26
0
 /**
  * Print the sla form
  *
  * @param $ID        integer  ID of the item
  * @param $options   array    of possible options:
  *     - target filename : where to go when done.
  *     - withtemplate boolean : template or basic item
  *
  *@return boolean item found
  **/
 function showForm($ID, $options = array())
 {
     $rowspan = 4;
     if ($ID > 0) {
         $rowspan = 5;
     }
     $this->initForm($ID, $options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "name", array('value' => $this->fields["name"]));
     echo "<td rowspan='" . $rowspan . "'>" . __('Comments') . "</td>";
     echo "<td rowspan='" . $rowspan . "'>\n            <textarea cols='45' rows='8' name='comment' class='form-control' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>";
     if ($ID > 0) {
         echo "<tr class='tab_bg_1'>";
         echo "<td>" . __('Last update') . "</td>";
         echo "<td>" . ($this->fields["date_mod"] ? Html::convDateTime($this->fields["date_mod"]) : __('Never'));
         echo "</td></tr>";
     }
     echo "<tr class='tab_bg_1'><td>" . __('Calendar') . "</td>";
     echo "<td>";
     Calendar::dropdown(array('value' => $this->fields["calendars_id"], 'emptylabel' => __('24/7'), 'toadd' => array('-1' => __('Calendar of the ticket'))));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Maximum time to solve') . "</td>";
     echo "<td>";
     Dropdown::showNumber("resolution_time", array('value' => $this->fields["resolution_time"], 'min' => 0));
     $possible_values = array('minute' => _n('Minute', 'Minutes', Session::getPluralNumber()), 'hour' => _n('Hour', 'Hours', Session::getPluralNumber()), 'day' => _n('Day', 'Days', Session::getPluralNumber()));
     $rand = Dropdown::showFromArray('definition_time', $possible_values, array('value' => $this->fields["definition_time"], 'on_change' => 'appearhideendofworking()'));
     echo "\n<script type='text/javascript' >\n";
     echo "function appearhideendofworking() {\n";
     echo "if (\$('#dropdown_definition_time{$rand} option:selected').val() == 'day') {\n         \$('#title_endworkingday').show();\n         \$('#dropdown_endworkingday').show();\n      } else {\n         \$('#title_endworkingday').hide();\n         \$('#dropdown_endworkingday').hide();\n      }";
     echo "}\n";
     echo "appearhideendofworking();\n";
     echo "</script>\n";
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td><div id='title_endworkingday'>" . __('End of working day') . "</div></td>";
     echo "<td><div id='dropdown_endworkingday'>";
     Dropdown::showYesNo("end_of_working_day", $this->fields["end_of_working_day"]);
     echo "</div></td></tr>";
     $this->showFormButtons($options);
     return true;
 }
コード例 #27
0
ファイル: task.class.php プロジェクト: InfotelGLPI/tasklists
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     $this->initForm($ID, $options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td>" . _n('Context', 'Contexts', 1, 'tasklists') . "</td><td>";
     Dropdown::show('PluginTasklistsTaskType', array('name' => "plugin_tasklists_tasktypes_id", 'value' => $this->fields["plugin_tasklists_tasktypes_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Priority') . "</td>";
     echo "<td>";
     CommonITILObject::dropdownPriority(array('value' => $this->fields['priority'], 'withmajor' => 1));
     echo "</td>";
     echo "<td>" . __('Planned duration') . "</td>";
     echo "<td>";
     $toadd = array();
     //for ($i=9 ; $i<=100 ; $i++) {
     //   $toadd[] = $i*HOUR_TIMESTAMP;
     //}
     Dropdown::showTimeStamp("actiontime", array('min' => 0, 'max' => 50 * DAY_TIMESTAMP, 'step' => DAY_TIMESTAMP, 'value' => $this->fields["actiontime"], 'toadd' => $toadd));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Visibility') . "</td>";
     echo "<td>";
     self::dropdownVisibility(array('value' => $this->fields['visibility']));
     echo "</td>";
     echo "<td>" . __('Due date');
     echo "&nbsp;";
     Html::showToolTip(nl2br(__('Empty for infinite', 'tasklists')));
     echo "</td>";
     echo "<td>";
     Html::showDateFormItem("due_date", $this->fields["due_date"], true, true);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('User') . "</td><td>";
     User::dropdown(array('name' => "users_id", 'value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
     echo "</td>";
     echo "<td>" . __('Percent done') . "</td>";
     echo "<td>";
     Dropdown::showNumber("percent_done", array('value' => $this->fields['percent_done'], 'min' => 0, 'max' => 100, 'step' => 20, 'unit' => '%'));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group') . "</td>";
     echo "<td>";
     Dropdown::show('Group', array('name' => "groups_id", 'value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_assign`'));
     echo "</td>";
     echo "<td>" . __('Status') . "</td><td>";
     Planning::dropdownState("state", $this->fields["state"]);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>";
     echo __('Description') . "</td>";
     echo "<td colspan = '3' class='center'>";
     echo "<textarea cols='100' rows='15' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td>";
     echo "</tr>";
     $this->showFormButtons($options);
     return true;
 }
コード例 #28
0
ファイル: display.class.php プロジェクト: geldarr/hack-space
 function refreshPage()
 {
     if (isset($_POST['_refresh'])) {
         $_SESSION['glpi_plugin_monitoring']['_refresh'] = $_POST['_refresh'];
     }
     echo '<meta http-equiv ="refresh" content="' . $_SESSION['glpi_plugin_monitoring']['_refresh'] . '">';
     echo "<form name='form' method='post' action='" . $_SERVER["PHP_SELF"] . "' >";
     echo "<table width='100%'>";
     echo "<tr>";
     echo "<td align='right'>";
     echo __('Page refresh (in seconds)', 'monitoring') . " : ";
     echo "&nbsp;";
     Dropdown::showNumber("_refresh", array('value' => $_SESSION['glpi_plugin_monitoring']['_refresh'], 'min' => 30, 'max' => 1000, 'step' => 10));
     echo "&nbsp;";
     echo "<input type='submit' name='sessionupdate' class='submit' value=\"" . __('Post') . "\">";
     echo "</td>";
     echo "</tr>";
     echo "</table>";
     Html::closeForm();
 }
コード例 #29
0
 /**
  * Print the Software / license form
  *
  * @param $ID        integer  Id of the version or the template to print
  * @param $options   array    of possible options:
  *     - target form target
  *     - softwares_id ID of the software for add process
  *
  * @return true if displayed  false if item not found or not right to display
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     $softwares_id = -1;
     if (isset($options['softwares_id'])) {
         $softwares_id = $options['softwares_id'];
     }
     if ($ID < 0) {
         // Create item
         $this->fields['softwares_id'] = $softwares_id;
         $this->fields['number'] = 1;
         $soft = new Software();
         if ($soft->getFromDB($softwares_id) && in_array($_SESSION['glpiactive_entity'], getAncestorsOf('glpi_entities', $soft->getEntityID()))) {
             $options['entities_id'] = $soft->getEntityID();
         }
     }
     $this->initForm($ID, $options);
     $this->showFormHeader($options);
     // Restore saved value or override with page parameter
     if (!isset($options['template_preview'])) {
         if (isset($_REQUEST)) {
             $saved = Html::cleanPostForTextArea($_REQUEST);
         }
     }
     foreach ($this->fields as $name => $value) {
         if (isset($saved[$name]) && empty($this->fields[$name])) {
             $this->fields[$name] = $saved[$name];
         }
     }
     echo "<input type='hidden' name='withtemplate' value='" . $options['withtemplate'] . "'>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . Software::getTypeName(1) . "</td>";
     echo "<td>";
     if ($ID > 0) {
         $softwares_id = $this->fields["softwares_id"];
         echo "<input type='hidden' name='softwares_id' value='{$softwares_id}'>";
         echo "<a href='software.form.php?id=" . $softwares_id . "'>" . Dropdown::getDropdownName("glpi_softwares", $softwares_id) . "</a>";
     } else {
         Dropdown::show('Software', array('condition' => "`is_template`='0' AND `is_deleted`='0'", 'entity' => $_SESSION['glpiactive_entity'], 'entity_sons' => $_SESSION['glpiactive_entity_recursive'], 'on_change' => 'this.form.submit()', 'value' => $softwares_id));
     }
     echo "</td>";
     echo "<td colspan='2'>";
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . sprintf(__('%1$s%2$s'), __('Name'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>";
     echo "<td>";
     $objectName = autoName($this->fields["name"], "name", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
     Html::autocompletionTextField($this, 'name', array('value' => $objectName));
     echo "</td>";
     echo "<td>" . __('Status') . "</td>";
     echo "<td>";
     State::dropdown(array('value' => $this->fields["states_id"], 'entity' => $this->fields["entities_id"], 'condition' => "`is_visible_softwarelicense`"));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Location') . "</td><td>";
     Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . __('Type') . "</td>";
     echo "<td>";
     SoftwareLicenseType::dropdown(array('value' => $this->fields["softwarelicensetypes_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Technician in charge of the hardware') . "</td>";
     echo "<td>";
     User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'own_ticket', 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . __('Publisher') . "</td>";
     echo "<td>";
     Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group in charge of the hardware') . "</td>";
     echo "<td>";
     Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
     echo "</td>";
     echo "<td>" . __('Serial number') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "serial");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td >" . __('User') . "</td>";
     echo "<td >";
     User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
     echo "</td>";
     echo "<td>" . sprintf(__('%1$s%2$s'), __('Inventory number'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "");
     echo "</td>";
     echo "<td>";
     $objectName = autoName($this->fields["otherserial"], "otherserial", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
     Html::autocompletionTextField($this, 'otherserial', array('value' => $objectName));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group') . "</td><td>";
     Group::dropdown(array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_itemgroup`'));
     echo "</td>";
     echo "<td rowspan='4' class='middle'>" . __('Comments') . "</td>";
     echo "<td class='center middle' rowspan='4'>";
     echo "<textarea cols='45' rows='4' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Version in use') . "</td>";
     echo "<td>";
     SoftwareVersion::dropdownForOneSoftware(array('name' => "softwareversions_id_use", 'softwares_id' => $this->fields["softwares_id"], 'value' => $this->fields["softwareversions_id_use"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Purchase version') . "</td>";
     echo "<td>";
     SoftwareVersion::dropdownForOneSoftware(array('name' => "softwareversions_id_buy", 'softwares_id' => $this->fields["softwares_id"], 'value' => $this->fields["softwareversions_id_buy"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . _x('quantity', 'Number') . "</td>";
     echo "<td>";
     Dropdown::showNumber("number", array('value' => $this->fields["number"], 'min' => 1, 'max' => 10000, 'step' => 1, 'toadd' => array(-1 => __('Unlimited'))));
     if ($ID > 0) {
         echo "&nbsp;";
         if ($this->fields['is_valid']) {
             echo "<span class='green'>" . _x('adjective', 'Valid') . '<span>';
         } else {
             echo "<span class='red'>" . _x('adjective', 'Invalid') . '<span>';
         }
     }
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Expiration') . "</td>";
     echo "<td>";
     Html::showDateField('expire', array('value' => $this->fields["expire"]));
     if ($ID && is_null($this->fields["expire"])) {
         echo "<br>" . __('Never expire') . "&nbsp;";
         Html::showToolTip(__('On search engine, use "Expiration contains NULL" to search licenses with no expiration date'));
     }
     Alert::displayLastAlert('SoftwareLicense', $ID);
     echo "</td><td colspan='2'></td></tr>\n";
     $this->showFormButtons($options);
     return true;
 }
コード例 #30
0
 static function commonShowMassiveAction()
 {
     $pbBarcode = new PluginBarcodeBarcode();
     $pbConfig = new PluginBarcodeConfig();
     $config = $pbConfig->getConfigType();
     echo '<table>';
     echo '<tr>';
     echo '<td>';
     echo "<br/>" . __('Page size', 'barcode') . " : </td><td>";
     $pbBarcode->showSizeSelect($config['size']);
     echo '</td>';
     echo '</tr>';
     echo '<tr>';
     echo '<td>';
     echo "<br/>" . __('Orientation', 'barcode') . " : </td><td>";
     $pbBarcode->showOrientationSelect($config['orientation']);
     echo '</td>';
     echo '</tr>';
     echo '<tr>';
     echo '<td>';
     echo __('Not use first xx barcodes', 'barcode') . " : </td><td>";
     Dropdown::showNumber("eliminate", array('width' => '100'));
     echo '</td>';
     echo '</tr>';
     echo '<tr>';
     echo '<td>';
     echo __('Display border', 'barcode') . " : </td><td>";
     Dropdown::showYesNo("border", 1, -1, array('width' => '100'));
     echo '</td>';
     echo '</tr>';
     echo '</table>';
     echo '</center>';
     echo "<br/><input type='submit' value='" . __('Create', 'barcode') . "' class='submit'>";
 }