Пример #1
0
 static function showSummary()
 {
     echo "<div class='center'><table class='tab_cadre' cellpadding='5' width='50%'>";
     echo "<tr><th>" . __('Summary') . "</th></tr>";
     if (countElementsInTable('glpi_plugin_archires_views', "`entities_id`='" . $_SESSION["glpiactive_entity"] . "'") > 0) {
         echo "<tr class='tab_bg_1'><td>";
         echo "<a href='view.php'>" . PluginArchiresView::getTypeName(2) . "</a>";
         echo "</td></tr>";
         echo "<tr class='tab_bg_1'><td>";
         echo "<a href='locationquery.php'>" . sprintf(__('%1$s - %2$s'), self::getTypeName(1), PluginArchiresLocationQuery::getTypeName(1)) . "</a>";
         echo "</td></tr>";
         echo "<tr class='tab_bg_1'><td>";
         echo "<a href='networkequipmentquery.php'>" . sprintf(__('%1$s - %2$s'), self::getTypeName(1), PluginArchiresNetworkEquipmentQuery::getTypeName(1)) . "</a>";
         echo "</td></tr>";
         $plugin = new Plugin();
         if ($plugin->isActivated("appliances")) {
             echo "<tr class='tab_bg_1'><td>";
             echo "<a href='appliancequery.php'>" . sprintf(__('%1$s - %2$s'), self::getTypeName(1), PluginAppliancesAppliance::getTypeName(1)) . "</a>";
             echo "</td></tr>";
         }
     } else {
         echo "<tr class='tab_bg_1'><td>";
         echo "<a href='view.form.php?new=1'>" . __('Add view', 'archires') . "</a>";
         echo "</td></tr>";
     }
     echo "</table></div>";
 }
Пример #2
0
 https://forge.indepnet.net/projects/archires
 -------------------------------------------------------------------------

 LICENSE

 This file is part of archires.

 Archires 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.

 Archires 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 Archires. If not, see <http://www.gnu.org/licenses/>.
 --------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
Html::header(PluginArchiresArchires::getTypeName() . " " . PluginArchiresNetworkEquipmentQuery::getTypeName(), '', "plugins", "archires", "networkequipment");
$PluginArchiresNetworkEquipmentQuery = new PluginArchiresNetworkEquipmentQuery();
if ($PluginArchiresNetworkEquipmentQuery->canView() || Session::haveRight("config", "w")) {
    Search::show("PluginArchiresNetworkEquipmentQuery");
} else {
    Html::displayRightError();
}
Html::footer();
Пример #3
0
 function createGraph($format, $obj, $plugin_archires_views_id)
 {
     global $DB, $CFG_GLPI;
     $type = get_class($obj);
     $ID = $obj->fields["id"];
     $object_view = $obj->fields["plugin_archires_views_id"];
     if (!isset($plugin_archires_views_id)) {
         $plugin_archires_views_id = $object_view;
     }
     $PluginArchiresView = new PluginArchiresView();
     $plugin = new Plugin();
     if ($plugin->isActivated("appliances")) {
         $PluginArchiresApplianceQuery = new PluginArchiresApplianceQuery();
     }
     $PluginArchiresLocationQuery = new PluginArchiresLocationQuery();
     $PluginArchiresNetworkEquipmentQuery = new PluginArchiresNetworkEquipmentQuery();
     $PluginArchiresImageItem = new PluginArchiresImageItem();
     $PluginArchiresView->getFromDB($plugin_archires_views_id);
     $devices = array();
     $ports = array();
     if ($type == 'PluginArchiresLocationQuery') {
         $devices = $PluginArchiresLocationQuery->Query($ID, $PluginArchiresView, true);
         $ports = $PluginArchiresLocationQuery->Query($ID, $PluginArchiresView, false);
     } else {
         if ($type == 'PluginArchiresNetworkEquipmentQuery') {
             $devices = $PluginArchiresNetworkEquipmentQuery->Query($ID, $PluginArchiresView, true);
             $ports = $PluginArchiresNetworkEquipmentQuery->Query($ID, $PluginArchiresView, false);
         } else {
             if ($type == 'PluginArchiresApplianceQuery') {
                 $devices = $PluginArchiresApplianceQuery->Query($ID, $PluginArchiresView, true);
                 $ports = $PluginArchiresApplianceQuery->Query($ID, $PluginArchiresView, false);
             }
         }
     }
     $wires = array();
     $query = "SELECT `id`, `networkports_id_1`, `networkports_id_2`\n                FROM `glpi_networkports_networkports`";
     if ($result = $DB->query($query)) {
         while ($data = $DB->fetch_array($result)) {
             $wires[$data["id"]]["networkports_id_1"] = $data["networkports_id_1"];
             $wires[$data["id"]]["networkports_id_2"] = $data["networkports_id_2"];
         }
     }
     $graph = "graph G {\n";
     $graph .= "overlap=false;\n";
     $graph .= "bgcolor=white;\n";
     //items
     $graph .= "node [shape=polygon, sides=6, fontname=\"Verdana\", fontsize=\"5\"];\n";
     foreach ($devices as $itemtype => $typed_devices) {
         foreach ($typed_devices as $device_id => $device) {
             $image_name = $PluginArchiresImageItem->displayItemImage($device["type"], $itemtype, false);
             $link = Toolbox::getItemTypeFormURL($itemtype);
             $url = $link . "?id=" . $device_id;
             $graph .= $this->graphItems($device, $device_id, $itemtype, $format, $image_name, $url, $PluginArchiresView);
         }
     }
     foreach ($wires as $wire) {
         if (!empty($ports[$wire["networkports_id_1"]]) && !empty($ports[$wire["networkports_id_2"]]) && isset($ports[$wire["networkports_id_1"]]) && isset($ports[$wire["networkports_id_2"]])) {
             $graph .= $this->graphPorts($devices, $ports, $wire, $format, $PluginArchiresView);
         }
     }
     $graph .= "}\n";
     return $this->generateGraphviz($graph, $format, $PluginArchiresView);
 }
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Archires. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
if (isset($_GET["start"])) {
    $start = $_GET["start"];
} else {
    $start = 0;
}
$PluginArchiresNetworkEquipmentQuery = new PluginArchiresNetworkEquipmentQuery();
$PluginArchiresQueryType = new PluginArchiresQueryType();
if (isset($_POST["add"])) {
    $PluginArchiresNetworkEquipmentQuery->check(-1, 'w', $_POST);
    $PluginArchiresNetworkEquipmentQuery->add($_POST);
    Html::back();
} else {
    if (isset($_POST["delete"])) {
        $PluginArchiresNetworkEquipmentQuery->check($_POST['id'], 'w');
        $PluginArchiresNetworkEquipmentQuery->delete($_POST);
        Html::redirect(Toolbox::getItemTypeSearchURL('PluginArchiresNetworkEquipmentQuery'));
    } else {
        if (isset($_POST["restore"])) {
            $PluginArchiresNetworkEquipmentQuery->check($_POST['id'], 'w');
            $PluginArchiresNetworkEquipmentQuery->restore($_POST);
            Html::redirect(Toolbox::getItemTypeSearchURL('PluginArchiresNetworkEquipmentQuery'));