static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
 {
     $itemspecification = new PluginRacksItemSpecification();
     if ($item->getType() == __CLASS__) {
         switch ($tabnum) {
             case 1:
                 $itemspecification->showList('', -1, 'ComputerModel');
                 break;
             case 2:
                 $itemspecification->showList('', -1, 'NetworkEquipmentModel');
                 break;
             case 3:
                 $itemspecification->showList('', -1, 'PeripheralModel');
                 break;
             case 4:
                 $itemspecification->showList('', -1, 'PluginRacksOtherModel');
                 break;
         }
     }
     return true;
 }
 static function getMenuContent()
 {
     global $CFG_GLPI;
     $menu = array();
     //Menu entry in tools
     $menu['title'] = self::getMenuName(2);
     $menu['page'] = PluginRacksRack::getSearchURL(false);
     $menu['links']['search'] = PluginRacksRack::getSearchURL(false);
     $menu['options']['racks']['links']['search'] = PluginRacksRack::getSearchURL(false);
     $menu['options']['racks']['links']['config'] = PluginRacksConfig::getFormURL(false);
     $menu['options']['config']['title'] = __('Setup');
     $menu['options']['config']['page'] = PluginRacksConfig::getSearchURL(false);
     $menu['options']['specifications']['title'] = __('Specifications', 'racks');
     $menu['options']['specifications']['page'] = PluginRacksItemSpecification::getSearchURL(false);
     $menu['options']['specifications']['links']['search'] = PluginRacksItemSpecification::getSearchURL(false);
     if (PluginRacksRack::canCreate()) {
         $menu['options']['racks']['links']['add'] = PluginRacksRack::getFormURL(false);
     }
     if (PluginRacksRackModel::canView()) {
         $menu['options']['racks']['links']['template'] = '/plugins/racks/front/setup.templates.php?add=0';
         $menu['options']['racks']['links']["<img  src='" . $CFG_GLPI["root_doc"] . "/pics/menu_showall.png' title=\"" . __('Equipments models specifications', 'racks') . "\" alt=\"" . __('Equipments models specifications', 'racks') . "\">"] = PluginRacksItemSpecification::getSearchURL(false);
     }
     return $menu;
 }
Exemplo n.º 3
0
Racks is distributed in the hope that it will be useful,
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 Racks. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
if (!isset($_POST["id"])) {
    exit;
}
$PluginRacksItemSpecification = new PluginRacksItemSpecification();
$PluginRacksItemSpecification->checkGlobal("r");
if (empty($_POST["id"])) {
    switch ($_POST['plugin_racks_tab']) {
        default:
            break;
    }
} else {
    $target = $CFG_GLPI['root_doc'] . "/plugins/racks/front/itemspecification.form.php";
    switch ($_POST['plugin_racks_tab']) {
        case "all":
            $_SESSION['glpi_plugin_racks_tab'] = "all";
            $PluginRacksItemSpecification->showForm($target, 'Computer');
            $PluginRacksItemSpecification->showForm($target, 'NetworkEquipment');
            $PluginRacksItemSpecification->showForm($target, 'Peripheral');
            $PluginRacksItemSpecification->showForm($target, 'PluginRacksOther');
 function addItem($plugin_racks_racks_id, $rack_size, $face, $ID, $itemtype, $spec, $position)
 {
     $space_left = $this->checkPosition($plugin_racks_racks_id, $rack_size, $face, $ID, $itemtype, $spec, $position);
     if ($space_left >= 0) {
         $values["plugin_racks_racks_id"] = $plugin_racks_racks_id;
         $values["faces_id"] = $face;
         $values["items_id"] = $ID;
         $values["plugin_racks_itemspecifications_id"] = $spec;
         $values["itemtype"] = $itemtype;
         $values["position"] = $position;
         $PluginRacksItemSpecification = new PluginRacksItemSpecification();
         $PluginRacksItemSpecification->GetfromDB($spec);
         $values["amps"] = $PluginRacksItemSpecification->fields["amps"];
         $values["flow_rate"] = $PluginRacksItemSpecification->fields["flow_rate"];
         $values["dissipation"] = $PluginRacksItemSpecification->fields["dissipation"];
         $values["weight"] = $PluginRacksItemSpecification->fields["weight"];
         $this->add($values);
     }
     return $space_left;
 }
Exemplo n.º 5
0
    echo "<option selected value='" . $_POST['value'] . "'>" . $output . "</option>";
}
if ($DB->numrows($result)) {
    $prev = -1;
    while ($data = $DB->fetch_array($result)) {
        $output = $data["name"];
        $id = $data['id'];
        $addcomment = "";
        if ($multi && $data["entities_id"] != $prev) {
            if ($prev >= 0) {
                echo "</optgroup>";
            }
            $prev = $data["entities_id"];
            echo "<optgroup label=\"" . Dropdown::getDropdownName("glpi_entities", $prev) . "\">";
        }
        $PluginRacksItemSpecification = new PluginRacksItemSpecification();
        if ($PluginRacksItemSpecification->GetfromDB($data['spec'])) {
            $output .= " - " . $PluginRacksItemSpecification->fields["size"] . "U";
        }
        if (isset($data["comment"])) {
            $addcomment = " - " . $data["comment"];
        }
        if (empty($output)) {
            $output = "({$id})";
        }
        echo "<option value=\"" . $_POST["modeltable"] . ";{$id};" . $data['spec'] . "\" title=\"{$output}{$addcomment}\">" . substr($output, 0, $_POST["limit"]) . "</option>";
    }
}
echo "</select>";
if (isset($_POST["comment"]) && $_POST["comment"]) {
    $paramscomments = array('value' => '__VALUE__', 'table' => $_POST["table"]);
Exemplo n.º 6
0
function plugin_racks_postinit()
{
    global $PLUGIN_HOOKS;
    $PLUGIN_HOOKS['item_purge']['racks'] = array();
    foreach (PluginRacksRack::getTypes(true) as $type) {
        $PLUGIN_HOOKS['item_purge']['racks'][$type] = array('PluginRacksRack_Item', 'cleanForItem');
        CommonGLPI::registerStandardTab($type, 'PluginRacksRack_Item');
    }
    foreach (PluginRacksItemSpecification::getModelClasses() as $model) {
        CommonGLPI::registerStandardTab($model, 'PluginRacksItemSpecification');
    }
}
Exemplo n.º 7
0
Racks is distributed in the hope that it will be useful,
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 Racks. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
if (!isset($_POST["id"])) {
    exit;
}
$PluginRacksItemSpecification = new PluginRacksItemSpecification();
$PluginRacksItemSpecification->checkGlobal("r");
if (empty($_POST["id"])) {
    switch ($_POST['plugin_racks_tab']) {
        default:
            break;
    }
} else {
    $target = $CFG_GLPI['root_doc'] . "/plugins/racks/front/itemspecification.form.php";
    switch ($_POST['plugin_racks_tab']) {
        case "all":
            $_SESSION['glpi_plugin_racks_tab'] = "all";
            $PluginRacksItemSpecification->showList($target, $_POST["id"], 'ComputerModel');
            $PluginRacksItemSpecification->showList($target, $_POST["id"], 'NetworkEquipmentModel');
            $PluginRacksItemSpecification->showList($target, $_POST["id"], 'PeripheralModel');
            $PluginRacksItemSpecification->showList($target, $_POST["id"], 'PluginRacksOtherModel');
(at your option) any later version.

Racks is distributed in the hope that it will be useful,
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 Racks. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
$PluginRacksItemSpecification = new PluginRacksItemSpecification();
if (isset($_POST["add"])) {
    if ($PluginRacksItemSpecification->canCreate()) {
        $newID = $PluginRacksItemSpecification->add($_POST);
    }
    Html::back();
} elseif (isset($_POST["update"])) {
    if ($PluginRacksItemSpecification->canCreate()) {
        $PluginRacksItemSpecification->UpdateItemSpecification($_POST);
    }
    Html::back();
} else {
    if (isset($_POST["delete"])) {
        if ($PluginRacksItemSpecification->canCreate()) {
            $PluginRacksItemSpecification->deleteItemSpecification($_POST["id"]);
        }
Exemplo n.º 9
0
Racks is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

Racks is distributed in the hope that it will be useful,
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 Racks. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
$PluginRacksItemSpecification = new PluginRacksItemSpecification();
$PluginRacksItemSpecification->checkGlobal("r");
if (!isset($_SESSION['glpi_plugin_racks_tab'])) {
    $_SESSION['glpi_plugin_racks_tab'] = 'ComputerModel';
}
if (isset($_GET['onglet'])) {
    $_SESSION['glpi_plugin_racks_tab'] = $_GET['onglet'];
}
Html::header(PluginRacksRack::getTypeName(2), '', "plugins", "racks");
$tabs['ComputerModel'] = array('title' => __('Servers', 'racks'), 'url' => $CFG_GLPI['root_doc'] . "/plugins/racks/ajax/itemspecification.tabs.php", 'params' => "target=" . $_SERVER['PHP_SELF'] . "&id=-1&plugin_racks_tab=" . 'ComputerModel');
$tabs['NetworkEquipmentModel'] = array('title' => _n('Network equipment', 'Network equipments', 2, 'racks'), 'url' => $CFG_GLPI['root_doc'] . "/plugins/racks/ajax/itemspecification.tabs.php", 'params' => "target=" . $_SERVER['PHP_SELF'] . "&id=-1&plugin_racks_tab=" . 'NetworkEquipmentModel');
$tabs['PeripheralModel'] = array('title' => _n('Peripheral', 'Peripherals', 2, 'racks'), 'url' => $CFG_GLPI['root_doc'] . "/plugins/racks/ajax/itemspecification.tabs.php", 'params' => "target=" . $_SERVER['PHP_SELF'] . "&id=-1&plugin_racks_tab=" . 'PeripheralModel');
$tabs['PluginRacksOtherModel'] = array('title' => _n('Other equipment', 'Others equipments', 2, 'racks'), 'url' => $CFG_GLPI['root_doc'] . "/plugins/racks/ajax/itemspecification.tabs.php", 'params' => "target=" . $_SERVER['PHP_SELF'] . "&id=-1&plugin_racks_tab=" . 'PluginRacksOtherModel');
$tabs['all'] = array('title' => __('All'), 'url' => $CFG_GLPI['root_doc'] . "/plugins/racks/ajax/itemspecification.tabs.php", 'params' => "target=" . $_SERVER['PHP_SELF'] . "&id=-1&plugin_racks_tab=all");
echo "<div id='tabspanel' class='center-h'></div>";
Ajax::createTabs('tabspanel', 'tabcontent', $tabs, 'PluginRacksItemSpecification');
Exemplo n.º 10
0
 function addItem($plugin_racks_racks_id, $rack_size, $face, $ID, $itemtype, $spec, $position)
 {
     $space_left = $this->checkPosition($plugin_racks_racks_id, $rack_size, $face, $ID, $itemtype, $spec, $position);
     if ($space_left >= 0) {
         $values["plugin_racks_racks_id"] = $plugin_racks_racks_id;
         $values["faces_id"] = $face;
         $values["items_id"] = $ID;
         $values["plugin_racks_itemspecifications_id"] = $spec;
         $values["itemtype"] = $itemtype;
         $values["position"] = $position;
         $PluginRacksItemSpecification = new PluginRacksItemSpecification();
         $PluginRacksItemSpecification->GetfromDB($spec);
         $values["amps"] = $PluginRacksItemSpecification->fields["amps"];
         $values["flow_rate"] = $PluginRacksItemSpecification->fields["flow_rate"];
         $values["dissipation"] = $PluginRacksItemSpecification->fields["dissipation"];
         $values["weight"] = $PluginRacksItemSpecification->fields["weight"];
         $this->add($values);
         //If rack's location must be copied in the associated item
         $config = PluginRacksConfig::getConfig();
         if ($config->canAddLocationOnNewItem()) {
             $rack = new PluginRacksRack();
             $rack->getFromDB($plugin_racks_racks_id);
             if ($rack->fields['locations_id'] > 0) {
                 if (preg_match("/(.*)Model/", $itemtype, $results)) {
                     $item = new $results[1]();
                     $item->update(array('id' => $ID, 'locations_id' => $rack->fields['locations_id']));
                 }
             }
         }
     }
     return $space_left;
 }
Exemplo n.º 11
0
(at your option) any later version.

Racks is distributed in the hope that it will be useful,
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 Racks. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
$PluginRacksItemSpecification = new PluginRacksItemSpecification();
if (isset($_POST["add"])) {
    if ($PluginRacksItemSpecification->canCreate()) {
        $newID = $PluginRacksItemSpecification->add($_POST);
    }
    Html::back();
} else {
    if (isset($_POST["update"])) {
        if ($PluginRacksItemSpecification->canCreate()) {
            $PluginRacksItemSpecification->UpdateItemSpecification($_POST);
        }
        Html::back();
    } else {
        if (isset($_POST["delete"])) {
            if ($PluginRacksItemSpecification->canCreate()) {
                $PluginRacksItemSpecification->deleteItemSpecification($_POST["id"]);