示例#1
0
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
// ----------------------------------------------------------------------
// Original Author of file: Dennis Ploeger <*****@*****.**>
// Purpose of file: Ajax method of displaying a rack
// ----------------------------------------------------------------------
include '../../../inc/includes.php';
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
Session::checkLoginUser();
if (isset($_GET['id'])) {
    $rackId = $_GET['id'];
    $rack = new PluginRackviewRack();
    if ($rack->getFromDB($rackId)) {
        $mini = false;
        if (isset($_GET['mini']) && $_GET['mini'] == 'true') {
            $mini = true;
        }
        if (isset($_GET['startu'])) {
            $rack->showRack($mini, $_GET['startu']);
        } else {
            $rack->showRack($mini);
        }
    }
}
示例#2
0
 /**
  * Main frontend data for object modification
  *
  * @param CommonDBTM $item Item to Display
  * @param int $ID
  * @param int $withtemplate
  */
 static function rackview_data($item, $ID, $withtemplate = 0)
 {
     global $CFG_GLPI, $DB, $LANG;
     if (!$withtemplate) {
         print '<table class="tab_cadre_fixe">';
         print '<tr class="tab_bg_2">';
         print '<th colspan="2">' . $LANG['plugin_rackview']['title'] . '</th>';
         print '</tr>';
         print '<tr class="tab_bg_2" valign="top">';
         // Show rack, if all informations have been correctly set
         $result = $DB->request("glpi_plugin_rackview_mount", array("object_type" => $item->getType(), "object_id" => $item->getID()));
         if ($result->numrows() > 0) {
             // Display rack(s)
             print '<td width="50%">';
             while ($mount = $result->next()) {
                 print '<table>';
                 print '<tr valign="top">';
                 print '<td>';
                 // Show rack
                 $rack = new PluginRackviewRack();
                 $rack->getFromDB($mount['rack_id']);
                 print '<div id="rackview_rack_' . $mount['id'] . '" class="CSSTableGenerator">';
                 $rack->showRack(true, 'rackview_startu_' . $mount['id']);
                 print '</div>';
                 print '</td>';
                 print '<td>';
                 // Show mount toolbox
                 PluginRackviewRack::rackview_mount_toolbox($item, 'remount_' . $mount['id'], 'remount', $mount, true);
                 print '</td>';
                 print '</tr>';
                 print '</table>';
             }
         } else {
             print '<td width="50%">';
             print '<div>' . $LANG['plugin_rackview']['label_notmounted'] . '</div>';
         }
         // Show racks to mount
         $result = $DB->request("glpi_plugin_rackview_racks");
         if ($result->numrows() == 0) {
             // no racks have been defined
             print '<div>' . $LANG['plugin_rackview']['label_noracks'] . '</div>';
         } else {
             // Build "mount" toolbox
             print '<table>';
             print '<tr>';
             print '<td>';
             print '<div id="rackview_rack_new" class="CSSTableGenerator">' . $LANG['plugin_rackview']['label_selectarack'] . '</div>';
             print '</td>';
             print '<td>';
             PluginRackviewRack::rackview_mount_toolbox($item);
             print '</td>';
             print '</tr>';
             print '</table>';
         }
         print '</td>';
         // Display rack informations
         $result = $DB->request("glpi_plugin_rackview_object", array("object_type" => $item->getType(), "object_id" => $item->getID()));
         $rack_object = array("size" => "", "object_type" => $item->getType(), "object_id" => $item->getID());
         if ($result->numrows() > 0) {
             $rack_object = $result->next();
         }
         print '<td width="50%">';
         // Form
         print '<form name="form" method="post" action="' . $CFG_GLPI["root_doc"] . '/plugins/rackview/front/plugin_rackview_setobject.php">';
         print '<input type="hidden" name="object_type" ' . 'value="' . $rack_object['object_type'] . '" />';
         print '<input type="hidden" name="object_id" ' . 'value="' . $rack_object['object_id'] . '" />';
         print '<table class="tab_cadre_fixe" style="width: 100%">';
         print '<tr class="tab_bg_1">';
         print '<th colspan="2">' . $LANG['plugin_rackview']['label_data'] . '</th>';
         foreach (array("size") as $field) {
             print '<tr class="tab_bg_1">';
             print '<td title="' . $LANG['plugin_rackview']['help_' . $field] . '">' . $LANG['plugin_rackview']['field_' . $field] . '</td>';
             print '<td>';
             print '<input type="text" name="rackview_size" size="2" ' . 'value="' . $rack_object[$field] . '" />';
             print '</td>';
             print '</tr>';
         }
         print '<tr>';
         print '<td colspan="2" align="center">' . '<input type="submit" class="submit" value="' . $LANG['plugin_rackview']['label_update'] . '" /></td>';
         print '</tr>';
         print '</table>';
         Html::closeForm();
         print '</td>';
         print '</tr>';
         print '</table>';
     }
 }
示例#3
0
        if (isset($_POST['update'])) {
            $rack->check($_POST['id'], 'w');
            $rack->update($_POST);
            Html::redirect($_SERVER['HTTP_REFERER']);
        } else {
            $rack->check($_GET["id"], 'r');
            if (!isset($_SESSION['glpi_tab'])) {
                $_SESSION['glpi_tab'] = 1;
            }
            if (isset($_GET['tab'])) {
                $_SESSION['glpi_tab'] = $_GET['tab'];
            }
            Html::header($LANG['plugin_rackview']['title'], 'plugins', 'rackview');
            print '<table>';
            print '<tr valign="top">';
            print '<td>';
            if (isset($_GET['id']) && $_GET['id'] != -1) {
                print '<div class="CSSTableGenerator">';
                $rack->showRack(false);
                print '</div>';
            }
            print '</td>';
            print '<td>';
            $rack->showForm($_GET["id"]);
            print '</td>';
            print '</tr>';
            print '</table>';
            Html::footer();
        }
    }
}