コード例 #1
0
ファイル: transfer.class.php プロジェクト: geldarr/hack-space
 function showTransferList()
 {
     global $DB, $CFG_GLPI;
     if (isset($_SESSION['glpitransfer_list']) && count($_SESSION['glpitransfer_list'])) {
         echo "<div class='center b'>" . __('You can continue to add elements to be transferred or execute the transfer now');
         echo "<br>" . __('Think of making a backup before transferring items.') . "</div>";
         echo "<table class='tab_cadre_fixe' >";
         echo '<tr><th>' . __('Items to transfer') . '</th><th>' . __('Transfer mode') . "&nbsp;";
         $rand = Transfer::dropdown(array('name' => 'id', 'comments' => false, 'toupdate' => array('value_fieldname' => 'id', 'to_update' => "transfer_form", 'url' => $CFG_GLPI["root_doc"] . "/ajax/transfers.php")));
         echo '</th></tr>';
         echo "<tr><td class='tab_bg_1 top'>";
         foreach ($_SESSION['glpitransfer_list'] as $itemtype => $tab) {
             if (count($tab)) {
                 $table = getTableForItemType($itemtype);
                 $query = "SELECT `{$table}`.`id`,\n                                 `{$table}`.`name`,\n                                 `glpi_entities`.`completename` AS locname,\n                                 `glpi_entities`.`id` AS entID\n                          FROM `{$table}`\n                          LEFT JOIN `glpi_entities`\n                               ON (`{$table}`.`entities_id` = `glpi_entities`.`id`)\n                          WHERE `{$table}`.`id` IN " . $this->createSearchConditionUsingArray($tab) . "\n                         ORDER BY locname, `{$table}`.`name`";
                 $entID = -1;
                 if (!($item = getItemForItemtype($itemtype))) {
                     continue;
                 }
                 if ($result = $DB->query($query)) {
                     if ($DB->numrows($result)) {
                         echo '<h3>' . $item->getTypeName() . '</h3>';
                         while ($data = $DB->fetch_assoc($result)) {
                             if ($entID != $data['entID']) {
                                 if ($entID != -1) {
                                     echo '<br>';
                                 }
                                 $entID = $data['entID'];
                                 echo "<span class='b spaced'>" . $data['locname'] . "</span><br>";
                             }
                             echo ($data['name'] ? $data['name'] : "(" . $data['id'] . ")") . "<br>";
                         }
                     }
                 }
             }
         }
         echo "</td><td class='tab_bg_2 top'>";
         if (countElementsInTable('glpi_transfers') == 0) {
             _e('No item found');
         } else {
             $params = array('id' => '__VALUE__');
             Ajax::updateItemOnSelectEvent("dropdown_id{$rand}", "transfer_form", $CFG_GLPI["root_doc"] . "/ajax/transfers.php", $params);
         }
         echo "<div class='center' id='transfer_form'><br>";
         Html::showSimpleForm($CFG_GLPI["root_doc"] . "/front/transfer.action.php", 'clear', __('To empty the list of elements to be transferred'));
         echo "</div>";
         echo '</td></tr>';
         echo '</table>';
     } else {
         _e('No selected element or badly defined operation');
     }
 }
 /**
  * Print the config form for restrictions
  *
  * @return Nothing (display)
  **/
 function showFormInventory()
 {
     global $DB, $CFG_GLPI;
     if (!self::canView()) {
         return false;
     }
     $canedit = Config::canUpdate();
     if ($canedit) {
         echo "<form name='form' action=\"" . Toolbox::getItemTypeFormURL(__CLASS__) . "\" method='post'>";
     }
     echo "<div class='center' id='tabsbody'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='4'>" . __('Assets') . "</th></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td width='30%'>" . __('Enable the financial and administrative information by default') . "</td>";
     echo "<td  width='20%'>";
     Dropdown::ShowYesNo('auto_create_infocoms', $CFG_GLPI["auto_create_infocoms"]);
     echo "</td><td width='20%'> " . __('Restrict monitor management') . "</td>";
     echo "<td width='30%'>";
     $this->dropdownGlobalManagement("monitors_management_restrict", $CFG_GLPI["monitors_management_restrict"]);
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'><td>" . __('Software category deleted by the dictionary rules') . "</td><td>";
     SoftwareCategory::dropdown(array('value' => $CFG_GLPI["softwarecategories_id_ondelete"], 'name' => "softwarecategories_id_ondelete"));
     echo "</td><td> " . __('Restrict device management') . "</td><td>";
     $this->dropdownGlobalManagement("peripherals_management_restrict", $CFG_GLPI["peripherals_management_restrict"]);
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . __('Beginning of fiscal year') . "</td><td>";
     Html::showDateField("date_tax", array('value' => $CFG_GLPI["date_tax"], 'maybeempty' => false, 'canedit' => true, 'min' => '', 'max' => '', 'showyear' => false));
     echo "</td><td> " . __('Restrict phone management') . "</td><td>";
     $this->dropdownGlobalManagement("phones_management_restrict", $CFG_GLPI["phones_management_restrict"]);
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . __('Automatic fields (marked by *)') . "</td><td>";
     $tab = array(0 => __('Global'), 1 => __('By entity'));
     Dropdown::showFromArray('use_autoname_by_entity', $tab, array('value' => $CFG_GLPI["use_autoname_by_entity"]));
     echo "</td><td> " . __('Restrict printer management') . "</td><td>";
     $this->dropdownGlobalManagement("printers_management_restrict", $CFG_GLPI["printers_management_restrict"]);
     echo "</td></tr>";
     echo "</table>";
     if (Session::haveRightsOr("transfer", array(CREATE, UPDATE)) && Session::isMultiEntitiesMode()) {
         echo "<br><table class='tab_cadre_fixe'>";
         echo "<tr><th colspan='2'>" . __('Automatic transfer of computers') . "</th></tr>";
         echo "<tr class='tab_bg_2'>";
         echo "<td>" . __('Template for the automatic transfer of computers in another entity') . "</td><td>";
         Transfer::dropdown(array('value' => $CFG_GLPI["transfers_id_auto"], 'name' => "transfers_id_auto", 'emptylabel' => __('No automatic transfer')));
         echo "</td></tr>";
         echo "</table>";
     }
     echo "<br><table class='tab_cadre_fixe'>";
     echo "<tr>";
     echo "<th colspan='4'>" . __('Automatically update of the elements related to the computers');
     echo "</th><th colspan='2'>" . __('Unit management') . "</th></tr>";
     echo "<tr><th>&nbsp;</th>";
     echo "<th>" . __('Alternate username') . "</th>";
     echo "<th>" . __('User') . "</th>";
     echo "<th>" . __('Group') . "</th>";
     echo "<th>" . __('Location') . "</th>";
     echo "<th>" . __('Status') . "</th>";
     echo "</tr>";
     $fields = array("contact", "user", "group", "location");
     echo "<tr class='tab_bg_2'>";
     echo "<td> " . __('When connecting or updating') . "</td>";
     $values[0] = __('Do not copy');
     $values[1] = __('Copy');
     foreach ($fields as $field) {
         echo "<td>";
         $fieldname = "is_" . $field . "_autoupdate";
         Dropdown::showFromArray($fieldname, $values, array('value' => $CFG_GLPI[$fieldname]));
         echo "</td>";
     }
     echo "<td>";
     State::dropdownBehaviour("state_autoupdate_mode", __('Copy computer status'), $CFG_GLPI["state_autoupdate_mode"]);
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td> " . __('When disconnecting') . "</td>";
     $values[0] = __('Do not delete');
     $values[1] = __('Clear');
     foreach ($fields as $field) {
         echo "<td>";
         $fieldname = "is_" . $field . "_autoclean";
         Dropdown::showFromArray($fieldname, $values, array('value' => $CFG_GLPI[$fieldname]));
         echo "</td>";
     }
     echo "<td>";
     State::dropdownBehaviour("state_autoclean_mode", __('Clear status'), $CFG_GLPI["state_autoclean_mode"]);
     echo "</td></tr>";
     if ($canedit) {
         echo "<tr class='tab_bg_2'>";
         echo "<td colspan='6' class='center'>";
         echo "<input type='submit' name='update' class='submit' value=\"" . _sx('button', 'Save') . "\">";
         echo "</td></tr>";
     }
     echo "</table></div>";
     Html::closeForm();
 }
コード例 #3
0
ファイル: model.class.php プロジェクト: pluginsGLPI/uninstall
 function showForm($ID, $options = array())
 {
     global $DB, $CFG_GLPI;
     $this->initForm($ID, $options);
     $this->showFormHeader($options);
     $entities = isset($_SESSION['glpiparententities']) ? $_SESSION['glpiparententities'] : 0;
     $entity_sons = empty($entity_sons) ? 0 : 1;
     echo "<tr class='tab_bg_1'><td>" . __('Name') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, 'name');
     echo "</td>";
     echo "<td>" . __('Type of template', 'uninstall') . "</td>";
     echo "<td>";
     $value = isset($this->fields["types_id"]) ? $this->fields["types_id"] : 0;
     self::dropdownType('types_id', $value);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     if ($this->fields["types_id"] != self::TYPE_MODEL_REPLACEMENT) {
         echo "<td>" . __("Transfer's model to use", "uninstall") . "</td>";
         echo "<td>";
         if ($ID == -1) {
             $value = PluginUninstallUninstall::getUninstallTransferModelid();
         } else {
             $value = $this->fields["transfers_id"];
         }
         Transfer::dropdown(array('value' => $value, 'display_emptychoice' => false));
     } else {
         echo "<td></td>";
         echo "<td></td>";
         echo "<input type='hidden' name='transfers_id' value='0'";
     }
     echo "</td>";
     echo "<td rowspan='4'>" . __('Comments') . "</td>";
     echo "<td rowspan='4'>";
     echo "<textarea cols='60' rows='4' name='comment'>" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . __('New status of the computer', 'uninstall') . "</td>";
     echo "<td>";
     State::dropdown(array('value' => $this->fields['states_id'], 'emptylabel' => __('None')));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     if ($ID == -1) {
         $this->fields['groups_id'] = -1;
     }
     if ($this->fields["types_id"] != self::TYPE_MODEL_REPLACEMENT) {
         echo "<td>" . __('Action on group', 'uninstall') . "</td><td>";
         $uninst = new PluginUninstallUninstall();
         $action = $uninst->dropdownFieldAction("groups_id", $this->fields['entities_id'], $entity_sons, $this->fields["groups_id"]);
         echo "</td>";
     } else {
         echo "<td colspan='2'></td>";
     }
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     if ($this->fields["types_id"] != self::TYPE_MODEL_REPLACEMENT) {
         echo "<td>" . __('New group', 'uninstall') . "</td><td>";
         echo "<span id='show_groups' name='show_groups'>";
         if ($this->fields['groups_id'] != -1) {
             Group::dropdown(array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"], 'entity_sons' => $entities, 'emptylabel' => __('None')));
         } else {
             echo Dropdown::EMPTY_VALUE;
         }
         echo "</span></td>";
     } else {
         echo "<td colspan='2'></td>";
     }
     echo "</tr>";
     if (!Session::isMultiEntitiesMode() && Session::haveRight("transfer", READ)) {
         echo "<tr class='tab_bg_1'>";
         echo "<td colspan='2'>";
         echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/transfer.form.php'\">" . __('Add template', 'uninstall') . "</td>";
         echo "<td colspan='2'>";
         echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/transfer.php'\">" . __('Manage templates', 'uninstall') . "</a></td>";
         echo "</tr>";
     }
     $this->showFormButtons($options);
     return true;
 }