Esempio n. 1
0
 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;
 }