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>"; }
function plugin_init_archires() { global $PLUGIN_HOOKS, $CFG_GLPI; $PLUGIN_HOOKS['csrf_compliant']['archires'] = true; Plugin::registerClass('PluginArchiresProfile', array('addtabon' => array('Profile'))); $PLUGIN_HOOKS['change_profile']['archires'] = array('PluginArchiresProfile', 'changeProfile'); $PLUGIN_HOOKS['pre_item_purge']['archires'] = array('Profile' => array('PluginArchiresProfile', 'purgeProfiles')); if (Session::getLoginUserID()) { if (plugin_archires_haveRight("archires", "r")) { $PLUGIN_HOOKS['menu_entry']['archires'] = 'front/archires.php'; //summary $PLUGIN_HOOKS['submenu_entry']['archires']['options']['summary']['title'] = __('Summary', 'archires'); $PLUGIN_HOOKS['submenu_entry']['archires']['options']['summary']['page'] = '/plugins/archires/front/archires.php'; //views $PLUGIN_HOOKS['submenu_entry']['archires']['options']['view']['title'] = _n('View', 'Views', 2); $PLUGIN_HOOKS['submenu_entry']['archires']['options']['view']['page'] = '/plugins/archires/front/view.php'; $PLUGIN_HOOKS['submenu_entry']['archires']['options']['view']['links']['search'] = '/plugins/archires/front/view.php'; //locations $PLUGIN_HOOKS['submenu_entry']['archires']['options']['location']['title'] = __('Location'); $PLUGIN_HOOKS['submenu_entry']['archires']['options']['location']['page'] = '/plugins/archires/front/locationquery.php'; $PLUGIN_HOOKS['submenu_entry']['archires']['options']['location']['links']['search'] = '/plugins/archires/front/locationquery.php'; //networkequipments $PLUGIN_HOOKS['submenu_entry']['archires']['options']['networkequipment']['title'] = _n('Network equipment', 'Network equipments', 1, 'archires'); $PLUGIN_HOOKS['submenu_entry']['archires']['options']['networkequipment']['page'] = '/plugins/archires/front/networkequipmentquery.php'; $PLUGIN_HOOKS['submenu_entry']['archires']['options']['networkequipment']['links']['search'] = '/plugins/archires/front/networkequipmentquery.php'; //appliances if (class_exists('PluginAppliancesAppliance')) { $PLUGIN_HOOKS['submenu_entry']['archires']['options']['appliance']['title'] = PluginAppliancesAppliance::getTypeName(1); $PLUGIN_HOOKS['submenu_entry']['archires']['options']['appliance']['page'] = '/plugins/archires/front/appliancequery.php'; $PLUGIN_HOOKS['submenu_entry']['archires']['options']['appliance']['links']['search'] = '/plugins/archires/front/appliancequery.php'; } } if (plugin_archires_haveRight("archires", "w")) { //summary $PLUGIN_HOOKS['submenu_entry']['archires']['options']['view']['links']['add'] = '/plugins/archires/front/view.form.php?new=1'; $PLUGIN_HOOKS['submenu_entry']['archires']['options']['view']['links']['config'] = '/plugins/archires/front/config.form.php'; //locations $PLUGIN_HOOKS['submenu_entry']['archires']['options']['location']['links']['add'] = '/plugins/archires/front/locationquery.form.php?new=1'; $PLUGIN_HOOKS['submenu_entry']['archires']['options']['location']['links']['config'] = '/plugins/archires/front/config.form.php'; //networkequipments $PLUGIN_HOOKS['submenu_entry']['archires']['options']['networkequipment']['links']['add'] = '/plugins/archires/front/networkequipmentquery.form.php?new=1'; $PLUGIN_HOOKS['submenu_entry']['archires']['options']['networkequipment']['links']['config'] = '/plugins/archires/front/config.form.php'; //appliances $PLUGIN_HOOKS['submenu_entry']['archires']['options']['appliance']['links']['add'] = '/plugins/archires/front/appliancequery.form.php?new=1'; $PLUGIN_HOOKS['submenu_entry']['archires']['options']['appliance']['links']['config'] = '/plugins/archires/front/config.form.php'; if (Session::haveRight("config", "w")) { $PLUGIN_HOOKS['submenu_entry']['archires']['config'] = 'front/config.form.php'; } $PLUGIN_HOOKS['use_massive_action']['archires'] = 1; } // Config page if (plugin_archires_haveRight("archires", "w") || Session::haveRight("config", "w")) { $PLUGIN_HOOKS['config_page']['archires'] = 'front/config.form.php'; } } }
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { if (!$withtemplate) { if ($item->getType() == 'PluginAppliancesAppliance' && count(PluginAppliancesAppliance::getTypes(false))) { if ($_SESSION['glpishow_count_on_tabs']) { return self::createTabEntry(_n('Associated item', 'Associated items', 2), self::countForAppliance($item)); } return __('Associated item', 'Associated items', 2); } else { if (in_array($item->getType(), PluginAppliancesAppliance::getTypes(true)) && plugin_appliances_haveRight('appliance', 'r')) { if ($_SESSION['glpishow_count_on_tabs']) { return self::createTabEntry(PluginAppliancesAppliance::getTypeName(2), self::countForItem($item)); } return PluginAppliancesAppliance::getTypeName(2); } } } return ''; }
function showForm($ID, $options = array()) { $this->initForm($ID, $options); $this->showTabs($options); $this->showFormHeader($options); echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Name') . "</td>"; echo "<td>"; Html::autocompletionTextField($this, "name"); echo "</td>"; echo "<td>" . __('Group') . "</td><td>"; Group::dropdown(array('name' => "groups_id", 'value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"])); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . PluginAppliancesAppliance::getTypeName(1) . "</td><td>"; Dropdown::show('PluginAppliancesAppliance', array('name' => "appliances_id", 'value' => $this->fields["plugin_appliances_appliances_id"], 'entity' => $this->fields["entities_id"])); echo "</td>"; echo "<td>" . __('VLAN') . "</td><td>"; Vlan::dropdown(array('name' => "vlans_id", 'value' => $this->fields["vlans_id"])); echo "</td></tr>"; echo "<tr class='tab_bg_1'><td>" . __('Network') . "</td><td>"; Network::dropdown(array('name' => "networks_id", 'value' => $this->fields["networks_id"])); echo "</td>"; echo "<td>" . PluginArchiresView::getTypeName(1) . "</td><td>"; //View Dropdown::show('PluginArchiresView', array('name' => "plugin_archires_views_id", 'value' => $this->fields["plugin_archires_views_id"])); echo "</td></tr>"; echo "<tr class='tab_bg_1'><td>" . __('State') . "</td><td colspan='3'>"; State::dropdown(array('name' => "states_id")); echo "</td></tr>"; $this->showFormButtons($options); $this->addDivForTabs(); return true; }
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() . " " . PluginAppliancesAppliance::getTypeName(), '', "plugins", "archires", "appliance"); $PluginArchiresApplianceQuery = new PluginArchiresApplianceQuery(); if ($PluginArchiresApplianceQuery->canView() || Session::haveRight("config", "w")) { Search::show("PluginArchiresApplianceQuery"); } else { Html::displayRightError(); } Html::footer();