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

Show div with auto completion
static public autocompletionTextField ( CommonDBTM $item, $field, $options = [] ) : nothing
$item CommonDBTM item object used for create dropdown
$field field to search for autocompletion
$options array of possible options: - name : string / name of the select (default is field parameter) - value : integer / preselected value (default value of the item object) - size : integer / size of the text field - entity : integer / restrict to a defined entity (default entity of the object if define) set to -1 not to take into account - user : integer / restrict to a defined user (default -1 : no restriction) - option : string / options to add to text field - display : boolean / if false get string
Результат nothing (print out an HTML div)
Пример #1
0
 /**
  * @see Rule::showNewRuleForm()
  **/
 function showNewRuleForm($ID)
 {
     echo "<form method='post' action='" . Toolbox::getItemTypeFormURL('Entity') . "'>";
     echo "<table  class='tab_cadre_fixe'>";
     echo "<tr><th colspan='7'>" . __('Authorizations assignment rules') . "</th></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td><td>";
     Html::autocompletionTextField($this, "name", array('value' => '', 'size' => 33));
     echo '</td><td>' . __('Description') . "</td><td>";
     Html::autocompletionTextField($this, "description", array('value' => '', 'size' => 33));
     echo "</td><td>" . __('Logical operator') . "</td><td>";
     $this->dropdownRulesMatch();
     echo "</td><td rowspan='2' class='tab_bg_2 center middle'>";
     echo "<input type=hidden name='sub_type' value='" . get_class($this) . "'>";
     echo "<input type=hidden name='entities_id' value='-1'>";
     echo "<input type=hidden name='affectentity' value='{$ID}'>";
     echo "<input type=hidden name='_method' value='AddRule'>";
     echo "<input type='submit' name='execute' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td class='center'>" . _n('Profile', 'Profiles', 1) . "</td><td>";
     Profile::dropdown();
     echo "</td><td><span class='small_space'>" . __('Recursive') . "</span></td><td colspan='3'>";
     Dropdown::showYesNo("is_recursive", 0);
     echo "</td></tr>\n";
     echo "</table>";
     Html::closeForm();
 }
 function showForm($ID, $options = array())
 {
     $this->initForm($ID, $options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>";
     echo __('Name');
     echo "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, 'name');
     echo "</td>";
     echo "<td>" . __('Type') . "</td>";
     echo "<td>";
     Dropdown::showFromArray('type', PluginFusioninventoryCollect::getTypes(), array('value' => $this->fields['type']));
     echo "</td>";
     echo "</tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>";
     echo __('Comments');
     echo "</td>";
     echo "<td class='middle'>";
     echo "<textarea cols='45' rows='3' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td>";
     echo "<td>" . __('Active') . "</td>";
     echo "<td>";
     Dropdown::showYesNo('is_active', $this->fields['is_active']);
     echo "</td>";
     echo "</tr>\n";
     $this->showFormButtons($options);
     return TRUE;
 }
 /**
  * Basic display elements
  */
 public function showTextField($title, $varname)
 {
     echo "<label>" . $title . "&nbsp;:</label>";
     echo "<div class='input_wrap'>";
     Html::autocompletionTextField($this, $varname, $this->fields['name']);
     echo "</div>";
 }
Пример #4
0
 public function showForm($ID, $options = array())
 {
     if (!$this->isNewID($ID)) {
         $this->check($ID, READ);
     } else {
         $this->check(-1, UPDATE);
     }
     $options['colspan'] = 2;
     $options['target'] = Toolbox::getItemTypeFormURL(__CLASS__);
     $this->showFormHeader($options);
     echo '<table class="tab_cadre_fixe">';
     echo "<tr class='line0'><td>" . __('Name') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "name");
     echo "</td>";
     echo "</tr>";
     echo "<tr class='line1'><td>" . __('Content') . "</td>";
     echo "<td>";
     echo "<textarea name='comment' id ='comment' >" . $this->fields['comment'] . "</textarea>";
     Html::initEditorSystem('comment');
     echo "</td>";
     echo "</tr>";
     $this->showFormButtons($options);
     return true;
 }
Пример #5
0
 function showForm($ID, $options = array())
 {
     $relation = new PluginRelationRelation();
     $this->initForm($ID, $options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     //Nombre de la clase
     echo "<td>" . __('Nombre de la clase', 'Nombre de la clase') . ": </td><td>";
     $relation->dropdownClase("classname", $this->fields["classname"]);
     echo "</td>";
     //Clase con las que se relaciona
     echo "<td>" . __('Clase con la que se relaciona', 'Clase con la que se relaciona') . ": </td>";
     echo "<td>";
     $relation->dropdownClase("classlist", $this->fields["classlist"]);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     //Descripción
     echo "<td>" . __('Descripción', 'Descripción') . ": </td><td>";
     Html::autocompletionTextField($this, "comment", array('size' => "15"));
     echo "</td>";
     echo "</tr>";
     $this->showFormButtons($options);
     return true;
 }
Пример #6
0
 /**
  * @see NetworkPortInstantiation::showInstantiationForm()
  */
 function showInstantiationForm(NetworkPort $netport, $options = array(), $recursiveItems)
 {
     if (!$options['several']) {
         echo "<tr class='tab_bg_1'>";
         $this->showNetpointField($netport, $options, $recursiveItems);
         $this->showNetworkCardField($netport, $options, $recursiveItems);
         echo "</tr>\n";
     }
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('World Wide Name') . "</td><td>\n";
     Html::autocompletionTextField($this, 'wwn', array('value' => $this->fields['wwn']));
     echo "</td>";
     echo "<td>" . __('Fiber channel port speed') . "</td><td>\n";
     $standard_speeds = self::getPortSpeed();
     if (!isset($standard_speeds[$this->fields['speed']]) && !empty($this->fields['speed'])) {
         $speed = self::transformPortSpeed($this->fields['speed'], true);
     } else {
         $speed = true;
     }
     Dropdown::showFromArray('speed', $standard_speeds, array('value' => $this->fields['speed'], 'other' => $speed));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>\n";
     $this->showMacField($netport, $options);
     echo "<td>" . __('Connected to') . '</td><td>';
     self::showConnection($netport, true);
     echo "</td></tr>\n";
 }
Пример #7
0
 function showForm($id, $options = array())
 {
     if (!$this->can($id, READ)) {
         return false;
     }
     $this->showFormHeader($options);
     echo "<tr>";
     echo "<td><label>" . __('Name') . " :</label></td>";
     echo "<td style='width:30%'>";
     echo Html::autocompletionTextField($this, "name");
     echo "</td>";
     $rand = mt_rand();
     echo "<td><label for='dropdown_is_active{$rand}'>" . __('Active') . " :</label></td>";
     echo "<td style='width:30%'>";
     Dropdown::showYesNo('is_active', $this->fields['is_active'], -1, array('rand' => $rand));
     echo "</td></tr>";
     $rand = mt_rand();
     echo "<tr>";
     echo "<td><label for='dropdown_itilcategories_id{$rand}'>" . __('Category') . " :</label></td>";
     echo "<td>";
     Dropdown::show('ITILCategory', array('value' => $this->fields['itilcategories_id'], 'rand' => $rand));
     echo "</td><td colspan='2'></td></tr>";
     $rand = mt_rand();
     echo "<tr>";
     echo "<td><label for='dropdown_is_incident{$rand}'>" . __('Visible for an incident') . " :</label></td>";
     echo "<td>";
     Dropdown::showYesNo('is_incident', $this->fields['is_incident'], -1, array('rand' => $rand));
     echo "</td>";
     $rand = mt_rand();
     echo "<td><label for='dropdown_is_request{$rand}'>" . __('Visible for a request') . " :</label></td>";
     echo "<td>";
     Dropdown::showYesNo('is_request', $this->fields['is_request'], -1, array('rand' => $rand));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td><label for='comment'>" . __('Comments') . " : </label></td>";
     echo "<td align='left'>";
     echo "<textarea name='comment' id='comment' style='width:100%; height:70px;'>";
     echo $this->fields["comment"] . "</textarea>";
     echo "</td></tr>";
     echo "<tr><td colspan='4'><hr></td></tr>";
     echo "<tr><td><label for='groups_id_level1[]'>" . ucfirst(__('Level 1', 'itilcategorygroups')) . " :</label></td>";
     echo "<td>";
     self::multipleDropdownGroup(1, $this->fields['itilcategories_id'], $this->fields['view_all_lvl1']);
     echo "</td>";
     echo "<td><label for='groups_id_level2[]'>" . ucfirst(__('Level 2', 'itilcategorygroups')) . " :</label></td>";
     echo "<td>";
     self::multipleDropdownGroup(2, $this->fields['itilcategories_id'], $this->fields['view_all_lvl2']);
     echo "</td></tr>";
     echo "<tr><td><label for='groups_id_level3[]'>" . ucfirst(__('Level 3', 'itilcategorygroups')) . " :</label></td>";
     echo "<td>";
     self::multipleDropdownGroup(3, $this->fields['itilcategories_id'], $this->fields['view_all_lvl3']);
     echo "</td>";
     echo "<td><label for='groups_id_level4[]'>" . ucfirst(__('Level 4', 'itilcategorygroups')) . " :</label></td>";
     echo "<td>";
     self::multipleDropdownGroup(4, $this->fields['itilcategories_id'], $this->fields['view_all_lvl4']);
     echo "</td></tr>";
     $this->showFormButtons($options);
     Html::closeForm();
 }
Пример #8
0
 /**
  * Show order reference field
  * 
  * @param type $consumables_id
  */
 function showOrderReference($consumables_id)
 {
     $this->getFromDBByQuery(" WHERE `consumables_id` = '{$consumables_id}'");
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Order reference', 'consumables') . "</td>\n";
     echo "<td>";
     Html::autocompletionTextField($this, "order_ref");
     echo "</td>";
     echo "<td colspan='2'>";
     echo "</td>";
     echo "</tr>";
 }
Пример #9
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 = 1;
     $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' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>";
     $this->showFormButtons($options);
     return true;
 }
Пример #10
0
 static function showCloneForm(CommonGLPI $item)
 {
     echo "<form name='form' method='post' action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "' >";
     echo "<div class='spaced' id='tabsbody'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th>" . __('Clone', 'behaviors') . "</th></tr>";
     if ($item->isEntityAssign()) {
         echo "<tr class='tab_bg_1'><td class='center'>";
         printf(__('%1$s: %2$s'), __('Destination entity'), "<span class='b'>" . Dropdown::getDropdownName('glpi_entities', $_SESSION['glpiactive_entity']) . "</span>");
         echo "</td></tr>";
     }
     $name = sprintf(__('%1$s %2$s'), __('Clone of', 'behaviors'), $item->getName());
     echo "<tr class='tab_bg_1'><td class='center'>" . sprintf(__('%1$s: %2$s'), __('Name'), $name);
     Html::autocompletionTextField($item, 'name', array('value' => $name, 'size' => 60));
     echo "<input type='hidden' name='itemtype' value='" . $item->getType() . "'>";
     echo "<input type='hidden' name='id'       value='" . $item->getID() . "'>";
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td class='center'>";
     echo "<input type='submit' name='_clone' value='" . __('Clone', 'behaviors') . "' class='submit'>";
     echo "</th></tr>";
     echo "</table></div>";
     Html::closeForm();
 }
Пример #11
0
 public function showForm($ID, $options = array())
 {
     $this->initForm($ID, $options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     //Nombre de la relación
     echo "<td>" . __('Nombre de la relación', 'Nombre de la relación') . ": </td><td>";
     Html::autocompletionTextField($this, "name", array('size' => "15"));
     echo "</td>";
     //Nombre de la relación en sentido inverso
     echo "<td>" . __('Nombre de la relación (sentido inverso)', 'Nombre de la relación (sentido inverso)') . ": </td>";
     echo "<td>";
     Html::autocompletionTextField($this, "invname", array('size' => "15"));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     //Descripción
     echo "<td>" . __('Descripción', 'Descripción') . ": </td><td>";
     Html::autocompletionTextField($this, "comment", array('size' => "15"));
     echo "</td>";
     echo "</tr>";
     $this->showFormButtons($options);
     return true;
 }
Пример #12
0
 /**
  * Print the mailgate form
  *
  * @param $ID        integer  Id of the item to print
  * @param $options   array
  *     - target filename : where to go when done.
  *
  * @return boolean item found
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     $this->initForm($ID, $options);
     $options['colspan'] = 1;
     $this->showFormHeader($options);
     if (!function_exists('mb_list_encodings') || !function_exists('mb_convert_encoding')) {
         echo "<tr class='tab_bg_1'>" . "<td colspan='2'>" . __('mbstring extension not found. Warning with charsets used.') . "</td></tr>";
     }
     echo "<tr class='tab_bg_1'><td>" . sprintf(__('%1$s (%2$s)'), __('Name'), __('Email address')) . "</td><td>";
     Html::autocompletionTextField($this, "name");
     echo "</td></tr>";
     if ($this->fields['errors']) {
         echo "<tr class='tab_bg_1_2'><td>" . __('Connection errors') . "</td>";
         echo "<td>" . $this->fields['errors'] . "</td>";
         echo "</tr>";
     }
     echo "<tr class='tab_bg_1'><td>" . __('Active') . "</td><td>";
     Dropdown::showYesNo("is_active", $this->fields["is_active"]);
     echo "</td></tr>";
     $type = Toolbox::showMailServerConfig($this->fields["host"]);
     echo "<tr class='tab_bg_1'><td>" . __('Login') . "</td><td>";
     Html::autocompletionTextField($this, "login");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Password') . "</td>";
     echo "<td><input type='password' name='passwd' value='' size='20' autocomplete='off'>";
     if ($ID > 0) {
         echo "<input type='checkbox' name='_blank_passwd'>&nbsp;" . __('Clear');
     }
     echo "</td></tr>";
     if (version_compare(PHP_VERSION, '5.3.2', '>=')) {
         echo "<tr class='tab_bg_1'><td>" . __('Use Kerberos authentication') . "</td>";
         echo "<td>";
         Dropdown::showYesNo("use_kerberos", $this->fields["use_kerberos"]);
         echo "</td></tr>\n";
     }
     if ($type != "pop") {
         echo "<tr class='tab_bg_1'><td>" . __('Accepted mail archive folder (optional)') . "</td>";
         echo "<td><input size='30' type='text' name='accepted' value=\"" . $this->fields['accepted'] . "\">";
         echo "</td></tr>\n";
         echo "<tr class='tab_bg_1'><td>" . __('Refused mail archive folder (optional)') . "</td>";
         echo "<td><input size='30' type='text' name='refused' value=\"" . $this->fields['refused'] . "\">";
         echo "</td></tr>\n";
     }
     echo "<tr class='tab_bg_1'>";
     echo "<td width='200px'> " . __('Maximum size of each file imported by the mails receiver') . "</td><td>";
     self::showMaxFilesize('filesize_max', $this->fields["filesize_max"]);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Use mail date, instead of collect one') . "</td>";
     echo "<td>";
     Dropdown::showYesNo("use_mail_date", $this->fields["use_mail_date"]);
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'><td>" . __('Comments') . "</td>";
     echo "<td><textarea cols='45' rows='5' name='comment' >" . $this->fields["comment"] . "</textarea>";
     if ($ID > 0) {
         echo "<br>";
         //TRANS: %s is the datetime of update
         printf(__('Last update on %s'), Html::convDateTime($this->fields["date_mod"]));
     }
     echo "</td></tr>";
     $this->showFormButtons($options);
     return true;
 }
Пример #13
0
 /**
  * Print the computer form
  *
  * @param $ID        integer ID of the item
  * @param $options   array
  *     - target for the Form
  *     - withtemplate template or basic computer
  *
  *@return Nothing (display)
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI, $DB;
     $this->initForm($ID, $options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     //TRANS: %1$s is a string, %2$s a second one without spaces between them : to change for RTL
     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_computer`"));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Location') . "</td>";
     echo "<td>";
     Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . __('Type') . "</td>";
     echo "<td>";
     ComputerType::dropdown(array('value' => $this->fields["computertypes_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>" . __('Manufacturer') . "</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>" . __('Model') . "</td>";
     echo "<td>";
     ComputerModel::dropdown(array('value' => $this->fields["computermodels_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     //TRANS: Number of the alternate username
     echo "<td>" . __('Alternate username number') . "</td>";
     echo "<td >";
     Html::autocompletionTextField($this, 'contact_num');
     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>" . __('Alternate username') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, 'contact');
     echo "</td>";
     echo "<td>" . sprintf(__('%1$s%2$s'), __('Inventory number'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</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>" . __('User') . "</td>";
     echo "<td>";
     User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
     echo "</td>";
     echo "<td>" . __('Network') . "</td>";
     echo "<td>";
     Network::dropdown(array('value' => $this->fields["networks_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group') . "</td>";
     echo "<td>";
     Group::dropdown(array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_itemgroup`'));
     echo "</td>";
     // Display auto inventory informations
     $rowspan = 10;
     $inventory_show = false;
     if (!empty($ID) && Plugin::haveImport() && $this->fields["is_dynamic"]) {
         $inventory_show = true;
         $rowspan -= 4;
     }
     echo "<td rowspan='{$rowspan}'>" . __('Comments') . "</td>";
     echo "<td rowspan='{$rowspan}' class='middle'>";
     echo "<textarea cols='45' rows='" . ($rowspan + 3) . "' name='comment' >" . $this->fields["comment"];
     echo "</textarea></td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Domain') . "</td>";
     echo "<td >";
     Domain::dropdown(array('value' => $this->fields["domains_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Operating system') . "</td>";
     echo "<td>";
     OperatingSystem::dropdown(array('value' => $this->fields["operatingsystems_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Service pack') . "</td>";
     echo "<td >";
     OperatingSystemServicePack::dropdown(array('value' => $this->fields["operatingsystemservicepacks_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Version of the operating system') . "</td>";
     echo "<td >";
     OperatingSystemVersion::dropdown(array('value' => $this->fields["operatingsystemversions_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Product ID of the operating system') . "</td>";
     echo "<td >";
     Html::autocompletionTextField($this, 'os_licenseid');
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Serial of the operating system') . "</td>";
     echo "<td >";
     Html::autocompletionTextField($this, 'os_license_number');
     echo "</td>";
     if ($inventory_show) {
         echo "<td rowspan='4' colspan='2'>";
         Plugin::doHook("autoinventory_information", $this);
         echo "</td>";
     }
     echo "</tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('UUID') . "</td>";
     echo "<td >";
     Html::autocompletionTextField($this, 'uuid');
     echo "</td>";
     echo "</tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>";
     if ((!isset($options['withtemplate']) || $options['withtemplate'] == 0) && !empty($this->fields['template_name'])) {
         echo "<span class='small_space'>";
         printf(__('Created from the template %s'), $this->fields['template_name']);
         echo "</span>";
     } else {
         echo "&nbsp;";
     }
     echo "</td><td>";
     if (isset($options['withtemplate']) && $options['withtemplate']) {
         //TRANS: %s is the datetime of insertion
         printf(__('Created on %s'), Html::convDateTime($_SESSION["glpi_currenttime"]));
     } else {
         //TRANS: %s is the datetime of update
         printf(__('Last update on %s'), Html::convDateTime($this->fields["date_mod"]));
     }
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Update Source') . "</td>";
     echo "<td >";
     AutoUpdateSystem::dropdown(array('value' => $this->fields["autoupdatesystems_id"]));
     echo "</td></tr>";
     $this->showFormButtons($options);
     return true;
 }
 /**
  * Print the version form
  *
  * @param $ID        integer ID of the item
  * @param $options   array
  *     - target for the Form
  *     - computers_id ID of the computer 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 (!Session::haveRight("computer", "w")) {
         return false;
     }
     $comp = new Computer();
     if ($ID > 0) {
         $this->check($ID, 'r');
         $comp->getFromDB($this->fields['computers_id']);
     } else {
         // Create item
         $this->check(-1, 'w', $options);
         $comp->getFromDB($options['computers_id']);
     }
     $this->showTabs($options);
     $this->showFormHeader($options);
     if ($this->isNewID($ID)) {
         echo "<input type='hidden' name='computers_id' value='" . $options['computers_id'] . "'>";
     }
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Computer') . "</td>";
     echo "<td>" . $comp->getLink() . "</td>";
     if (Plugin::haveImport()) {
         echo "<td>" . __('Automatic inventory') . "</td>";
         echo "<td>";
         if ($ID && $this->fields['is_dynamic']) {
             Plugin::doHook("autoinventory_information", $this);
         } else {
             _e('No');
         }
         echo "</td>";
     } else {
         echo "<td colspan='2'></td>";
     }
     echo "</tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "name");
     echo "</td><td>" . __('Virtualization system') . "</td>";
     echo "<td>";
     VirtualMachineType::dropdown(array('value' => $this->fields['virtualmachinetypes_id']));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Virtualization model') . "</td>";
     echo "<td>";
     VirtualMachineSystem::dropdown(array('value' => $this->fields['virtualmachinesystems_id']));
     echo "</td><td>" . __('State of the virtual machine') . "</td>";
     echo "<td>";
     VirtualMachineState::dropdown(array('value' => $this->fields['virtualmachinestates_id']));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('UUID') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "uuid");
     echo "</td>";
     echo "<td>" . _x('quantity', 'Processors number') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "vcpu");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . sprintf(__('%1$s (%2$s)'), __('Memory'), __('Mio')) . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "ram");
     echo "</td>";
     echo "<td>" . __('Machine') . "</td>";
     echo "<td>";
     if ($link_computer = self::findVirtualMachine($this->fields)) {
         $computer = new Computer();
         if ($computer->getFromDB($link_computer)) {
             echo $computer->getLink(array('comments' => true));
         } else {
             echo NOT_AVAILABLE;
         }
     }
     echo "</td>";
     echo "</tr>";
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }
Пример #15
0
 /**
  * Print the contract cost form
  *
  * @param $ID        integer  ID of the item
  * @param $options   array    options used
  **/
 function showForm($ID, $options = array())
 {
     if ($ID > 0) {
         $this->check($ID, READ);
     } else {
         // Create item
         $options['contracts_id'] = $options['parent']->getField('id');
         $this->check(-1, CREATE, $options);
         $this->initBasedOnPrevious();
     }
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td>";
     echo "<td>";
     echo "<input type='hidden' name='contracts_id' value='" . $this->fields['contracts_id'] . "'>";
     Html::autocompletionTextField($this, 'name');
     echo "</td>";
     echo "<td>" . __('Cost') . "</td>";
     echo "<td>";
     echo "<input type='text' name='cost' value='" . Html::formatNumber($this->fields["cost"], true) . "'\n             size='14'>";
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Begin date') . "</td>";
     echo "<td>";
     Html::showDateField("begin_date", array('value' => $this->fields['begin_date']));
     echo "</td>";
     $rowspan = 3;
     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_1'><td>" . __('End date') . "</td>";
     echo "<td>";
     Html::showDateField("end_date", array('value' => $this->fields['end_date']));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Budget') . "</td>";
     echo "<td>";
     Budget::dropdown(array('value' => $this->fields["budgets_id"]));
     echo "</td></tr>";
     $this->showFormButtons($options);
     return true;
 }
Пример #16
0
 /**
  * Print the enterprise form
  *
  * @param $ID Integer : Id of the computer or the template to print
  * @param $options array
  *     - target form target
  *     - withtemplate boolean : template or basic item
  *
  *@return Nothing (display)
  **/
 function showForm($ID, $options = array())
 {
     $this->initForm($ID, $options);
     $this->showTabs($options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td>" . __('Third party type') . "</td>";
     echo "<td>";
     SupplierType::dropdown(array('value' => $this->fields["suppliertypes_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Phone') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "phonenumber");
     echo "</td>";
     echo "<td rowspan='8' class='middle right'>" . __('Comments') . "</td>";
     echo "<td class='center middle' rowspan='8'>";
     echo "<textarea cols='45' rows='13' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Fax') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "fax");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Website') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "website");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . _n('Email', 'Emails', 1) . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "email");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td class='middle'>" . __('Address') . "</td>";
     echo "<td class='middle'>";
     echo "<textarea cols='37' rows='3' name='address'>" . $this->fields["address"] . "</textarea>";
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Postal code') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "postcode", array('size' => 10));
     echo "&nbsp;&nbsp;" . __('City') . "&nbsp;";
     Html::autocompletionTextField($this, "town", array('size' => 23));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('State') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "state");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Country') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "country");
     echo "</td></tr>";
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }
Пример #17
0
 /**
  * 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>";
             }
         }
     }
 }
Пример #18
0
 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;
 }
Пример #19
0
 function showForm($ID, $options = array())
 {
     if (!$this->canView()) {
         return false;
     }
     $plugin_resources_resources_id = -1;
     if (isset($options['plugin_resources_resources_id'])) {
         $plugin_resources_resources_id = $options['plugin_resources_resources_id'];
     }
     $item = new PluginResourcesResource();
     if ($item->getFromDB($plugin_resources_resources_id)) {
         $entities_id = $item->fields["entities_id"];
     }
     if ($ID > 0) {
         $this->check($ID, 'r');
         $plugin_resources_resources_id = $this->fields["plugin_resources_resources_id"];
     } else {
         // Create item
         $input = array('plugin_resources_resources_id' => $plugin_resources_resources_id, 'entities_id' => $entities_id);
         $this->check(-1, 'w', $input);
     }
     $this->showTabs($options);
     $this->showFormHeader($options);
     echo "<input type='hidden' name='plugin_resources_resources_id' value='{$plugin_resources_resources_id}'>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . PluginResourcesResource::getTypeName(2) . "&nbsp;</td><td>";
     $user = PluginResourcesResource::getResourceName($plugin_resources_resources_id, 2);
     $out = "<a href='" . $user['link'] . "'>";
     $out .= $user["name"];
     if ($_SESSION["glpiis_ids_visible"]) {
         $out .= " (" . $plugin_resources_resources_id . ")";
     }
     $out .= "</a>";
     echo $out;
     echo "</td>";
     echo "<td colspan='2'>";
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Name') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "name", array('size' => "50"));
     echo "</td>";
     echo "<td>" . PluginResourcesTaskType::getTypeName(1) . "</td><td>";
     Dropdown::show('PluginResourcesTaskType', array('value' => $this->fields["plugin_resources_tasktypes_id"]));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Technician') . "</td><td>";
     User::dropdown(array('name' => "users_id", 'value' => $this->fields["users_id"], 'right' => 'interface'));
     echo "</td>";
     echo "<td>" . __('Planning') . "</td>";
     echo "<td>";
     $plan = new PluginResourcesTaskPlanning();
     $plan->showFormForTask($plugin_resources_resources_id, $this);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group') . "</td><td>";
     Dropdown::show('Group', array('value' => $this->fields["groups_id"]));
     echo "</td>";
     echo "<td>" . __('Carried out task', 'resources') . "</td><td>";
     Dropdown::showYesNo("is_finished", $this->fields["is_finished"]);
     echo "</td>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Effective duration', 'resources') . "</td><td>";
     $toadd = array();
     for ($i = 9; $i <= 100; $i++) {
         $toadd[] = $i * HOUR_TIMESTAMP;
     }
     Dropdown::showTimeStamp("actiontime", array('min' => 0, 'max' => 8 * HOUR_TIMESTAMP, 'value' => $this->fields["actiontime"], 'addfirstminutes' => true, 'inhours' => true, 'toadd' => $toadd));
     echo "</td><td colspan='2'></td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='4'>" . __('Comments') . "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'><td colspan='4'>";
     echo "<textarea cols='130' rows='4' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "<input type='hidden' name='withtemplate' value=\"" . $options['withtemplate'] . "\" >";
     echo "</td></tr>";
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }
Пример #20
0
 /**
  * Print the Software 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())
 {
     $this->initForm($ID, $options);
     $this->showTabs($options);
     $this->showFormHeader($options);
     $canedit = $this->can($ID, 'w');
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td>" . __('Publisher') . "</td><td>";
     Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
     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>" . __('Category') . "</td><td>";
     SoftwareCategory::dropdown(array('value' => $this->fields["softwarecategories_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Technician in charge of the hardware') . "</td><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>" . __('Associable to a ticket') . "</td><td>";
     Dropdown::showYesNo('is_helpdesk_visible', $this->fields['is_helpdesk_visible']);
     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 rowspan='5' class='middle'>" . __('Comments') . "</td>";
     echo "<td class='center middle' rowspan='5'>";
     echo "<textarea cols='45' rows='8' name='comment' >" . $this->fields["comment"] . "</textarea>";
     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></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></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>";
     if ((!isset($options['withtemplate']) || $options['withtemplate'] == 0) && !empty($this->fields['template_name'])) {
         echo "<span class='small_space'>";
         printf(__('Created from the template %s'), $this->fields['template_name']);
         echo "</span>";
     } else {
         echo "&nbsp;";
     }
     echo "</td><td>";
     if (isset($options['withtemplate']) && $options['withtemplate']) {
         //TRANS: %s is the datetime of insertion
         printf(__('Created on %s'), Html::convDateTime($_SESSION["glpi_currenttime"]));
     } else {
         //TRANS: %s is the datetime of insertion
         printf(__('Last update on %s'), Html::convDateTime($this->fields["date_mod"]));
     }
     echo "</td></tr>\n";
     // UPDATE
     echo "<tr class='tab_bg_1'>";
     //TRANS: a noun, (ex : this software is an upgrade of..)
     echo "<td>" . __('Upgrade') . "</td><td>";
     Dropdown::showYesNo("is_update", $this->fields['is_update']);
     echo "&nbsp;" . __('from') . "&nbsp;";
     Software::dropdown(array('value' => $this->fields["softwares_id"]));
     echo "</td></tr>\n";
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }
Пример #21
0
 /**
  * @param $networkPortID
  **/
 static function showFormForNetworkPort($networkPortID)
 {
     global $DB, $CFG_GLPI;
     $name = new self();
     $number_names = 0;
     if ($networkPortID > 0) {
         $query = "SELECT `id`\n                   FROM `" . $name->getTable() . "`\n                   WHERE `itemtype` = 'NetworkPort'\n                   AND `items_id` = '{$networkPortID}'\n                   AND `is_deleted` = '0'";
         $result = $DB->query($query);
         if ($DB->numrows($result) > 1) {
             echo "<tr class='tab_bg_1'><th colspan='4'>" . __("Several network names available! Go to the tab 'Network Name' to manage them.") . "</th></tr>\n";
             return;
         }
         switch ($DB->numrows($result)) {
             case 1:
                 $nameID = $DB->fetch_assoc($result);
                 $name->getFromDB($nameID['id']);
                 break;
             case 0:
                 $name->getEmpty();
                 break;
         }
     } else {
         $name->getEmpty();
     }
     echo "<tr class='tab_bg_1'><th colspan='4'>";
     // If the networkname is defined, we must be able to edit it. So we make a link
     if ($name->getID() > 0) {
         echo "<a href='" . $name->getLinkURL() . "'>" . self::getTypeName(1) . "</a>";
         echo "<input type='hidden' name='NetworkName_id' value='" . $name->getID() . "'>&nbsp;\n";
         Html::showSimpleForm($name->getFormURL(), 'unaffect', _sx('button', 'Dissociate'), array('id' => $name->getID()), $CFG_GLPI["root_doc"] . '/pics/sub_dropdown.png');
     } else {
         echo self::getTypeName(1);
     }
     echo "</th>\n";
     echo "</tr><tr class='tab_bg_1'>";
     echo "<td>" . self::getTypeName(1) . "</td><td>\n";
     Html::autocompletionTextField($name, "name", array('name' => 'NetworkName_name'));
     echo "</td>\n";
     echo "<td>" . FQDN::getTypeName(1) . "</td><td>";
     Dropdown::show(getItemTypeForTable(getTableNameForForeignKeyField("fqdns_id")), array('value' => $name->fields["fqdns_id"], 'name' => 'NetworkName_fqdns_id', 'entity' => $name->getEntityID(), 'displaywith' => array('view')));
     echo "</td>\n";
     echo "</tr><tr class='tab_bg_1'>\n";
     echo "<td>" . IPAddress::getTypeName(Session::getPluralNumber());
     IPAddress::showAddChildButtonForItemForm($name, 'NetworkName__ipaddresses');
     echo "</td>";
     echo "<td>";
     IPAddress::showChildsForItemForm($name, 'NetworkName__ipaddresses');
     echo "</td>";
     // MoYo : really need to display it here ?
     // make confure because not updatable
     //       echo "<td>".IPNetwork::getTypeName(Session::getPluralNumber())."&nbsp;";
     //       Html::showToolTip(__('IP network is not included in the database. However, you can see current available networks.'));
     //       echo "</td><td>";
     //       IPNetwork::showIPNetworkProperties($name->getEntityID());
     //       echo "</td>\n";
     echo "<td colspan='2'>&nbsp;</td>";
     echo "</tr>\n";
 }
 function showForm($ID, $options = array())
 {
     $PluginRacksConfig = new PluginRacksConfig();
     $this->initForm($ID, $options);
     $this->showFormHeader($options);
     //ligne 1
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td><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>" . __('Size') . "</td><td>";
     Dropdown::showInteger("rack_size", $this->fields["rack_size"], 1, 100, 1);
     echo " " . __('U', 'racks') . "</td>";
     echo "</tr>";
     //ligne 2
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Manufacturer') . "</td><td>";
     Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
     echo "</td>";
     echo "<td >" . __('Location') . "</td>";
     echo "<td>";
     Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "</tr>";
     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' => 'interface', 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . __('Place', 'racks');
     echo "</td><td>";
     $PluginRacksRoomLocation = new PluginRacksRoomLocation();
     $PluginRacksRoomLocation->dropdownRoomLocations("plugin_racks_roomlocations_id", $this->fields["plugin_racks_roomlocations_id"], $this->fields["entities_id"]);
     echo "</td>";
     echo "</tr>";
     //ligne 4
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group in charge of the hardware') . "</td><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>" . __('Width', 'racks') . "</td><td>";
     echo "<input type='text' name='width' \n                              value=\"" . Html::formatNumber($this->fields["width"], true) . "\" size='10'> ";
     $PluginRacksConfig->getUnit("size");
     echo "</td>";
     echo "</tr>";
     //ligne 5
     echo "<tr class='tab_bg_1'>";
     echo "</td>";
     echo "<td>" . __('Serial number') . "</td>";
     echo "<td >";
     Html::autocompletionTextField($this, 'serial');
     echo "</td>";
     echo "<td>" . __('Height', 'racks') . "</td><td>";
     echo "<input type='text' name='height' \n                              value=\"" . Html::formatNumber($this->fields["height"], true) . "\" size='10'> ";
     $PluginRacksConfig->getUnit("size");
     echo "</td>";
     echo "</tr>";
     //ligne 6
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Inventory number') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, 'otherserial');
     echo "</td>";
     echo "<td>" . __('Weight', 'racks') . "</td><td>";
     echo "<input type='text' name='weight' \n                              value=\"" . Html::formatNumber($this->fields["weight"], true) . "\" size='10'> ";
     $PluginRacksConfig->getUnit("weight");
     echo "</td>";
     echo "</tr>";
     //ligne 7
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Model') . "</td>";
     echo "<td>";
     Dropdown::show('PluginRacksRackModel', array('name' => "plugin_racks_rackmodels_id", 'value' => $this->fields["plugin_racks_rackmodels_id"]));
     echo "</td>";
     echo "<td>" . __('Depth', 'racks') . "</td><td>";
     echo "<input type='text' name='depth' \n                              value=\"" . Html::formatNumber($this->fields["depth"], true) . "\" size='10'> ";
     $PluginRacksConfig->getUnit("size");
     echo "</td>";
     echo "</tr>";
     //ligne 8
     echo "<tr class='tab_bg_1'>";
     echo "<td >" . __('Type') . "</td><td>";
     Dropdown::show('PluginRacksRackType', array('value' => $this->fields["plugin_racks_racktypes_id"]));
     echo "</td>";
     echo "<td >" . __('Status') . "</td><td>";
     Dropdown::show('PluginRacksRackState', array('value' => $this->fields["plugin_racks_rackstates_id"]));
     echo "</td>";
     echo "</tr>";
     //ligne 9
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='2'>";
     if ((!isset($options['withtemplate']) || $options['withtemplate'] == 0) && !empty($this->fields['template_name'])) {
         echo "<span class='small_space'>";
         printf(__('Created from the template %s'), $this->fields['template_name']);
         echo "</span>";
     } else {
         echo "&nbsp;";
     }
     echo "</td><td colspan='2'>";
     if (isset($options['withtemplate']) && $options['withtemplate']) {
         //TRANS: %s is the datetime of insertion
         printf(__('Created on %s'), Html::convDateTime($_SESSION["glpi_currenttime"]));
     } else {
         //TRANS: %s is the datetime of update
         printf(__('Last update on %s'), Html::convDateTime($this->fields["date_mod"]));
     }
     echo "</td></tr>\n";
     $this->showFormButtons($options);
     if (!$this->isNewID($this->getID())) {
         $this->showTotal();
     }
     return true;
 }
Пример #23
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;
 }
Пример #24
0
 /**
  * Print the network alias form
  *
  * @param $ID        integer ID of the item
  * @param $options   array
  *     - target for the Form
  *     - withtemplate template or basic computer
  *
  * @return Nothing (display)
  **/
 function showForm($ID, $options = array())
 {
     // Show only simple form to add / edit
     $showsimple = false;
     if (isset($options['parent'])) {
         $showsimple = true;
         $options['networknames_id'] = $options['parent']->getID();
     }
     $this->initForm($ID, $options);
     $recursiveItems = $this->recursivelyGetItems();
     if (count($recursiveItems) == 0) {
         return false;
     }
     $lastItem = $recursiveItems[count($recursiveItems) - 1];
     if (!$showsimple) {
         $this->showTabs();
     }
     $options['entities_id'] = $lastItem->getField('entities_id');
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'><td>";
     $this->displayRecursiveItems($recursiveItems, 'Type');
     echo "&nbsp;:</td>\n<td>";
     if (!($ID > 0)) {
         echo "<input type='hidden' name='networknames_id' value='" . $this->fields["networknames_id"] . "'>\n";
     }
     $this->displayRecursiveItems($recursiveItems, isset($options['popup']) ? "Name" : "Link");
     echo "</td><td>" . __('Name') . "</td><td>\n";
     Html::autocompletionTextField($this, "name");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . FQDN::getTypeName() . "</td><td>";
     Dropdown::show(getItemTypeForTable(getTableNameForForeignKeyField("fqdns_id")), array('value' => $this->fields["fqdns_id"], 'name' => 'fqdns_id', 'entity' => $this->getEntityID(), 'displaywith' => array('view')));
     echo "</td>";
     echo "<td>" . __('Comments') . "</td>";
     echo "<td><textarea cols='45' rows='4' name='comment' >" . $this->fields["comment"];
     echo "</textarea></td>\n";
     echo "</tr>\n";
     $this->showFormButtons($options);
     if (!$showsimple) {
         $this->addDivForTabs();
     }
     return true;
 }
 /**
  * Print the phone 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())
 {
     global $CFG_GLPI;
     $target = $this->getFormURL();
     $withtemplate = $this->initForm($ID, $options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     //TRANS: %1$s is a string, %2$s a second one without spaces between them : to change for RTL
     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_phone`='1'"));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Location') . "</td>";
     echo "<td>";
     Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . __('Type') . "</td>";
     echo "<td>";
     PhoneType::dropdown(array('value' => $this->fields["phonetypes_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>" . __('Manufacturer') . "</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>" . __('Model') . "</td>";
     echo "<td>";
     PhoneModel::dropdown(array('value' => $this->fields["phonemodels_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Alternate username number') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "contact_num");
     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>" . __('Alternate username') . "</td><td>";
     Html::autocompletionTextField($this, "contact");
     echo "</td>";
     echo "<td>" . sprintf(__('%1$s%2$s'), __('Inventory number'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</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>" . __('User') . "</td>";
     echo "<td>";
     User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
     echo "</td>";
     echo "<td>" . __('Management type') . "</td>";
     echo "<td>";
     Dropdown::showGlobalSwitch($this->fields["id"], array('withtemplate' => $withtemplate, 'value' => $this->fields["is_global"], 'management_restrict' => $CFG_GLPI["phones_management_restrict"], 'target' => $target));
     echo "</td></tr>\n";
     // Display auto inventory informations
     $rowspan = 7;
     $inventory_show = false;
     if (!empty($ID) && $this->fields["is_dynamic"]) {
         $inventory_show = true;
         $rowspan -= 2;
     }
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group') . "</td>";
     echo "<td>";
     Group::dropdown(array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_itemgroup`'));
     echo "</td>";
     echo "<td rowspan='{$rowspan}'>" . __('Comments') . "</td>";
     echo "<td rowspan='{$rowspan}'>\n            <textarea cols='45' rows='" . ($rowspan + 3) . "' name='comment' class='form-control' >" . $this->fields["comment"];
     echo "</textarea></td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Brand') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "brand");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Power supply') . "</td>";
     echo "<td>";
     PhonePowerSupply::dropdown(array('value' => $this->fields["phonepowersupplies_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . _n('Firmware', 'Firmwares', 1) . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "firmware");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . _x('quantity', 'Number of lines') . "</td><td>";
     Html::autocompletionTextField($this, "number_line");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Flags') . "</td>";
     echo "<td>";
     // micro?
     echo "\n<table><tr><td>" . __('Headset') . "</td>";
     echo "<td>&nbsp;";
     Dropdown::showYesNo("have_headset", $this->fields["have_headset"]);
     echo "</td></tr>";
     // hp?
     echo "<tr><td>" . __('Speaker') . "</td>";
     echo "<td>&nbsp;";
     Dropdown::showYesNo("have_hp", $this->fields["have_hp"]);
     echo "</td></tr></table>\n";
     echo "</td>";
     if ($inventory_show) {
         echo "<td rowspan='2'>" . __('Automatic inventory') . "</td>";
         echo "<td rowspan='2'>";
         Plugin::doHook("autoinventory_information", $this);
         echo "</td>";
     }
     echo "</tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>";
     if ((!isset($options['withtemplate']) || $options['withtemplate'] == 0) && !empty($this->fields['template_name'])) {
         echo "<span class='small_space'>";
         printf(__('Created from the template %s'), $this->fields['template_name']);
         echo "</span>";
     } else {
         echo "&nbsp;";
     }
     echo "</td><td>";
     if (isset($options['withtemplate']) && $options['withtemplate']) {
         //TRANS: %s is the datetime of insertion
         printf(__('Created on %s'), Html::convDateTime($_SESSION["glpi_currenttime"]));
     } else {
         //TRANS: %s is the datetime of insertion
         printf(__('Last update on %s'), Html::convDateTime($this->fields["date_mod"]));
     }
     echo "</td></tr>\n";
     $this->showFormButtons($options);
     return true;
 }
Пример #26
0
 /**
  * Print the link form
  *
  * @param $ID      integer ID of the item
  * @param $options array
  *     - target filename : where to go when done.
  *
  * @return Nothing (display)
  **/
 function showForm($ID, $options = array())
 {
     $this->initForm($ID, $options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'><td height='23'>" . __('Valid tags') . "</td>";
     echo "<td colspan='3'>[LOGIN], [ID], [NAME], [LOCATION], [LOCATIONID], [IP], [MAC], [NETWORK],\n                            [DOMAIN], [SERIAL], [OTHERSERIAL], [USER], [GROUP], [REALNAME],\n                            [FIRSTNAME]</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Name') . "</td>";
     echo "<td colspan='3'>";
     Html::autocompletionTextField($this, "name");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Link or filename') . "</td>";
     echo "<td colspan='3'>";
     Html::autocompletionTextField($this, "link", array('size' => 84));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Open in a new window') . "</td><td>";
     Dropdown::showYesNo('open_window', $this->fields['open_window']);
     echo "</td><td colspan='2'>&nbsp;</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . __('File content') . "</td>";
     echo "<td colspan='3'>";
     echo "<textarea name='data' rows='10' cols='96'>" . $this->fields["data"] . "</textarea>";
     echo "</td></tr>";
     $this->showFormButtons($options);
     return true;
 }
Пример #27
0
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     if (!isset($options['several'])) {
         $options['several'] = false;
     }
     if (!Session::haveRight("networking", "r")) {
         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'];
     }
     $this->showTabs();
     $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', 2) . "</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::showInteger('from_logical_number', 0, 0, 100);
         echo "&nbsp;" . __('to') . "&nbsp;";
         Dropdown::showInteger('to_logical_number', 0, 0, 100);
         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);
     $this->addDivForTabs();
 }
Пример #28
0
 /**
  * @since version 0.85
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     if (!$this->isNewID($ID)) {
         $this->check($ID, READ);
     } else {
         // Create item
         $this->check(-1, CREATE);
     }
     $this->showFormHeader($options);
     $item = $this->getOnePeer(0);
     $device = $this->getOnePeer(1);
     echo "<tr class='tab_bg_1'><td>" . __('Item') . "</td>";
     echo "<td>";
     if ($item === false) {
         echo __('No associated item');
     } else {
         echo $item->getLink();
     }
     echo "</td>";
     echo "<td>" . __('Device') . "</td>";
     echo "<td>" . $device->getLink() . "</td>";
     echo "</tr>";
     $even = 0;
     $nb = count(static::getSpecificities());
     foreach (static::getSpecificities() as $field => $attributs) {
         if ($even % 2 == 0) {
             echo "<tr class='tab_bg_1'>";
         }
         echo "<td>" . $attributs['long name'] . "</td>";
         echo "<td>";
         Html::autocompletionTextField($this, $field, array('size' => $attributs['size']));
         echo "</td>";
         $even++;
         if ($even == $nb && $nb % 2 != 0 && $nb > 1) {
             echo "<td></td><td></td></tr>";
         }
     }
     $options['canedit'] = Session::haveRight('device', UPDATE);
     $this->showFormButtons($options);
     return true;
 }
Пример #29
0
 /**
  * Print the user preference form
  *
  * @param $target          form target
  * @param $ID     integer  Id of the user
  *
  * @return boolean : user found
  **/
 function showMyForm($target, $ID)
 {
     global $CFG_GLPI, $PLUGIN_HOOKS;
     // Affiche un formulaire User
     if ($ID != Session::getLoginUserID() && !$this->currentUserHaveMoreRightThan($ID)) {
         return false;
     }
     if ($this->getFromDB($ID)) {
         $authtype = $this->getAuthMethodsByID();
         $extauth = !($this->fields["authtype"] == Auth::DB_GLPI || $this->fields["authtype"] == Auth::NOT_YET_AUTHENTIFIED && !empty($this->fields["password"]));
         // No autocopletion :
         $save_autocompletion = $CFG_GLPI["use_ajax_autocompletion"];
         $CFG_GLPI["use_ajax_autocompletion"] = false;
         echo "<div class='center'>";
         echo "<form method='post' name='user_manager' action='" . $target . "'>";
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr><th colspan='4'>" . sprintf(__('%1$s: %2$s'), __('Login'), $this->fields["name"]);
         echo "<input type='hidden' name='name' value='" . $this->fields["name"] . "'>";
         echo "<input type='hidden' name='id' value='" . $this->fields["id"] . "'>";
         echo "</th></tr>";
         echo "<tr class='tab_bg_1'><td>" . __('Surname') . "</td><td>";
         if ($extauth && isset($authtype['realname_field']) && !empty($authtype['realname_field'])) {
             echo $this->fields["realname"];
         } else {
             Html::autocompletionTextField($this, "realname");
         }
         echo "</td>";
         //do some rights verification
         if (!$extauth && Session::haveRight("password_update", "1")) {
             echo "<td>" . __('Password') . "</td>";
             echo "<td><input id='password' type='password' name='password' value='' size='30' autocomplete='off' onkeyup=\"return passwordCheck();\">";
             echo "</td></tr>";
         } else {
             echo "<td colspan='2'></tr>";
         }
         echo "<tr class='tab_bg_1'><td>" . __('First name') . "</td><td>";
         if ($extauth && isset($authtype['firstname_field']) && !empty($authtype['firstname_field'])) {
             echo $this->fields["firstname"];
         } else {
             Html::autocompletionTextField($this, "firstname");
         }
         echo "</td>";
         if (!$extauth && Session::haveRight("password_update", "1")) {
             echo "<td>" . __('Password confirmation') . "</td>";
             echo "<td><input type='password' name='password2' value='' size='30' autocomplete='off'>";
             echo "</td></tr>";
         } else {
             echo "<td colspan='2'></tr>";
         }
         echo "<tr class='tab_bg_1'><td class='top'>" . _n('Email', 'Emails', 2);
         UserEmail::showAddEmailButton($this);
         echo "</td><td>";
         UserEmail::showForUser($this);
         echo "</td>";
         if (!$extauth && Session::haveRight("password_update", "1")) {
             echo "<td>" . __('Password security policy') . "</td>";
             echo "<td>";
             Config::displayPasswordSecurityChecks();
             echo "</td>";
         } else {
             echo "<td colspan='2'>";
         }
         echo "</tr>";
         echo "<tr class='tab_bg_1'><td>" . __('Mobile phone') . "&nbsp;:</td><td>";
         if ($extauth && isset($authtype['mobile_field']) && !empty($authtype['mobile_field'])) {
             echo $this->fields["mobile"];
         } else {
             Html::autocompletionTextField($this, "mobile");
         }
         echo "</td>";
         if (!GLPI_DEMO_MODE) {
             echo "<td>" . __('Language') . "</td><td>";
             // Use session variable because field in table may be null if same of the global config
             Dropdown::showLanguages("language", array('value' => $_SESSION["glpilanguage"]));
         } else {
             echo "<td colspan='2'>&nbsp;";
         }
         echo "</td></tr>";
         echo "<tr class='tab_bg_1'><td>" . __('Phone') . "</td><td>";
         if ($extauth && isset($authtype['phone_field']) && !empty($authtype['phone_field'])) {
             echo $this->fields["phone"];
         } else {
             Html::autocompletionTextField($this, "phone");
         }
         echo "</td>";
         if (count($_SESSION['glpiprofiles']) > 1) {
             echo "<td>" . __('Default profile') . "</td><td>";
             $options = array(0 => Dropdown::EMPTY_VALUE);
             $options += Dropdown::getDropdownArrayNames('glpi_profiles', Profile_User::getUserProfiles($this->fields['id']));
             Dropdown::showFromArray("profiles_id", $options, array('value' => $this->fields["profiles_id"]));
         } else {
             echo "<td colspan='2'>&nbsp;";
         }
         echo "</td></tr>";
         echo "<tr class='tab_bg_1'><td>" . __('Phone 2') . "</td><td>";
         if ($extauth && isset($authtype['phone2_field']) && !empty($authtype['phone2_field'])) {
             echo $this->fields["phone2"];
         } else {
             Html::autocompletionTextField($this, "phone2");
         }
         echo "</td>";
         $entities = Profile_User::getUserEntities($this->fields['id'], 1);
         if (!GLPI_DEMO_MODE && count($_SESSION['glpiactiveentities']) > 1) {
             echo "<td>" . __('Default entity') . "</td><td>";
             Entity::dropdown(array('value' => $this->fields['entities_id'], 'entity' => $entities));
         } else {
             echo "<td colspan='2'>&nbsp;";
         }
         echo "</td></tr>";
         echo "<tr class='tab_bg_1'><td>" . __('Location') . "</td><td>";
         $entities = Profile_User::getUserEntities($ID, true);
         Location::dropdown(array('value' => $this->fields['locations_id'], 'entity' => $entities));
         if (Session::haveRight("config", "w")) {
             echo "<td>" . __('Use GLPI in mode') . "</td><td>";
             $modes[Session::NORMAL_MODE] = __('Normal');
             //$modes[Session::TRANSLATION_MODE] = __('Translation');
             $modes[Session::DEBUG_MODE] = __('Debug');
             Dropdown::showFromArray('use_mode', $modes, array('value' => $this->fields["use_mode"]));
         } else {
             echo "<td colspan='2'>&nbsp;";
         }
         echo "</td></tr>";
         echo "<tr><td class='tab_bg_2 center' colspan='4'>";
         echo "<input type='submit' name='update' value=\"" . _sx('button', 'Save') . "\" class='submit'>";
         echo "</td></tr>";
         echo "</table>";
         Html::closeForm();
         echo "</div>";
         $CFG_GLPI["use_ajax_autocompletion"] = $save_autocompletion;
         return true;
     }
     return false;
 }
Пример #30
0
 /**
  * Print the link form
  *
  * @param $ID      integer ID of the item
  * @param $options array
  *     - target filename : where to go when done.
  *
  * @return Nothing (display)
  **/
 function showForm($ID, $options = array())
 {
     $this->initForm($ID, $options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'><td height='23'>" . __('Valid tags') . "</td>";
     echo "<td colspan='3'>";
     $count = count(self::$tags);
     $i = 0;
     foreach (self::$tags as $tag) {
         echo $tag;
         echo "&nbsp;";
         $i++;
         if ($i % 8 == 0 && $count > 1) {
             echo "<br>";
         }
     }
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Name') . "</td>";
     echo "<td colspan='3'>";
     Html::autocompletionTextField($this, "name");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Link or filename') . "</td>";
     echo "<td colspan='3'>";
     Html::autocompletionTextField($this, "link", array('size' => 84));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Open in a new window') . "</td><td>";
     Dropdown::showYesNo('open_window', $this->fields['open_window']);
     echo "</td><td colspan='2'>&nbsp;</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . __('File content') . "</td>";
     echo "<td colspan='3'>";
     echo "<textarea name='data' rows='10' cols='96'>" . $this->fields["data"] . "</textarea>";
     echo "</td></tr>";
     $this->showFormButtons($options);
     return true;
 }