Esempio n. 1
0
 function showFormUserPreferences()
 {
     global $DB;
     $entity = $_SESSION['glpiactive_entity'];
     $userID = Session::getLoginUserID();
     $templates = PluginUninstallUninstall::getAllTemplatesByEntity($_SESSION["glpiactive_entity"], true);
     $data = plugin_version_uninstall();
     echo "<form action='" . $this->getFormURL() . "' method='post'>";
     echo "<div class='center'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='2'>" . $data['name'] . "</th></tr>";
     if (!empty($templates)) {
         echo "<tr class='tab_bg_1 center'>";
         echo "<th>" . PluginUninstallModel::getTypeName() . "</th>";
         echo "<th>" . __("Item's location after uninstall", "uninstall") . "</th>";
         echo "</tr>";
         foreach ($templates as $ID => $name) {
             $pref_ID = self::checkIfPreferenceExistsByEntity($userID, $ID, $entity);
             if (!$pref_ID) {
                 $pref_ID = self::addDefaultPreference($userID, $ID, $entity);
             }
             $this->getFromDB($pref_ID);
             echo "<tr class='tab_bg_1'><td>" . $name . "</td>";
             echo "<td>";
             $value = isset($this->fields["locations_id"]) ? $this->fields["locations_id"] : 0;
             Location::dropdown(array('name' => "id[{$pref_ID}][locations_id]", 'value' => $value == '' ? 0 : $value, 'comments' => 1, 'entity' => $entity, 'toadd' => array(-1 => __('Keep previous location', 'uninstall'), 0 => __('Empty location', 'uninstall'))));
             echo "<input type='hidden' name='id[" . $pref_ID . "][id]' value='" . $pref_ID . "'>";
             echo "</td></tr>";
         }
         echo "<tr class='tab_bg_1'><td colspan='2' class='center'>";
         echo "<input type='submit' name='update_user_preferences_uninstall' value='" . _sx('button', 'Post') . "' class='submit'>";
         echo "</td></tr>";
     }
     echo "</table>";
     echo "</div>";
     Html::closeForm();
 }