public function getOptions($primary_type = '') { $tab = parent::getSearchOptions(); //Specific to location $tab[3]['linkfield'] = 'locations_id'; //Add linkfield for theses fields : no massive action is allowed in the core, but they can be //imported using the commonlib $add_linkfield = array('comment' => 'comment', 'notepad' => 'notepad'); foreach ($tab as $id => $tmp) { if (in_array($tmp['field'], $add_linkfield)) { $tab[$id]['linkfield'] = $add_linkfield[$tmp['field']]; } if (!isset($tmp['linkfield'])) { $tab[$id]['injectable'] = PluginDatainjectionCommonInjectionLib::FIELD_VIRTUAL; } else { $tab[$id]['injectable'] = PluginDatainjectionCommonInjectionLib::FIELD_INJECTABLE; } if (isset($tmp['linkfield']) && !isset($tmp['displaytype'])) { $tab[$id]['displaytype'] = 'text'; } if (isset($tmp['linkfield']) && !isset($tmp['checktype'])) { $tab[$id]['checktype'] = 'text'; } } return $tab; }
public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { if ($item->getType() == 'PluginConnectionsConnection' && count(self::getClasses(false))) { $tabName = __('Associated item'); $elements = countElementsInTable('glpi_plugin_connections_connections_items', "itemtype = 'NetworkEquipment'\n AND plugin_connections_connections_id = '" . $item->getID() . "'"); } else { if (in_array($item->getType(), self::getClasses(true))) { $tabName = PluginConnectionsConnection::getTypeName(2); $elements = countElementsInTable('glpi_plugin_connections_connections_items', "itemtype = 'NetworkEquipment'\n AND items_id = '" . $item->getID() . "'"); } } if (!$withtemplate) { if ($_SESSION['glpishow_count_on_tabs']) { return self::createTabEntry($tabName, $elements); } return $tabName; } return ''; }
GLPI 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. GLPI 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 GLPI; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -------------------------------------------------------------------------- // ---------------------------------------------------------------------- // Original Author of file: CAILLAUD Xavier, GRISARD Jean Marc // Purpose of file: plugin connections v1.6.4 - GLPI 0.84 // ---------------------------------------------------------------------- */ include '../../../inc/includes.php'; $plugin = new Plugin(); Html::header(__('Connections'), $_SERVER["PHP_SELF"], "assets", "pluginconnectionsmenu", ""); $PluginConnectionsConnection = new PluginConnectionsConnection(); if ($PluginConnectionsConnection->canView() || Session::haveRight("config", UPDATE)) { Search::show("PluginConnectionsConnection"); } else { echo "<div align='center'><br><br><img src=\"" . $CFG_GLPI["root_doc"] . "/pics/warning.png\" alt=\"warning\"><br><br>"; echo "<b>" . __('Access Denied') . "</b></div>"; } Html::footer();
function plugin_connections_MassiveActionsProcess($data) { $PluginConnectionsConnection = new PluginConnectionsConnection(); $PluginConnectionsConnection_Item = new PluginConnectionsConnection_Item(); switch ($data['action']) { case "plugin_connections_add_item": foreach ($data["item"] as $key => $val) { if ($val == 1) { $input = array('plugin_connections_connections_id' => $data['plugin_connections_connections_id'], 'items_id' => $key, 'itemtype' => $data['itemtype']); if ($PluginConnectionsConnection_Item->can(-1, UPDATE, $input)) { $PluginConnectionsConnection_Item->add($input); } } } break; case "plugin_connections_install": foreach ($data["item"] as $key => $val) { if ($val == 1) { $input = array('plugin_connections_connections_id' => $key, 'items_id' => $data["item_item"], 'itemtype' => $data['itemtype']); if ($PluginConnectionsConnection_Item->can(-1, UPDATE, $input)) { $PluginConnectionsConnection_Item->add($input); } } } break; case "plugin_connections_desinstall": foreach ($data["item"] as $key => $val) { if ($val == 1) { $PluginConnectionsConnection_Item->deleteItemByConnectionsAndItem($key, $data['item_item'], $data['itemtype']); } } break; case "plugin_connections_transfert": if ($data['itemtype'] == 'PluginConnectionsConnection') { foreach ($data["item"] as $key => $val) { if ($val == 1) { $PluginConnectionsConnection->getFromDB($key); $type = PluginConnectionsConnectionType::transfer($PluginConnectionsConnection->fields["plugin_connections_connections_id"], $data['entities_id']); $values["id"] = $key; $values["plugin_connections_connections_id"] = $type; $values["entities_id"] = $data['entities_id']; $PluginConnectionsConnection->update($values); } } } break; } }
along with GLPI; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -------------------------------------------------------------------------- // ---------------------------------------------------------------------- // Original Author of file: CAILLAUD Xavier, GRISARD Jean Marc // Purpose of file: plugin connections v1.6.4 - GLPI 0.84 // ---------------------------------------------------------------------- */ include '../../../inc/includes.php'; if (!isset($_GET["id"])) { $_GET["id"] = ""; } if (!isset($_GET["withtemplate"])) { $_GET["withtemplate"] = ""; } $PluginConnectionsConnection = new PluginConnectionsConnection(); $PluginConnectionsConnection_Item = new PluginConnectionsConnection_Item(); if (isset($_POST["add"]) && !isset($_POST["additem"])) { $PluginConnectionsConnection->check(-1, UPDATE, $_POST); $newID = $PluginConnectionsConnection->add($_POST); Html::back(); } elseif (isset($_POST["delete"])) { $PluginConnectionsConnection->check($_POST['id'], UPDATE); $PluginConnectionsConnection->delete($_POST); Html::redirect(Toolbox::getItemTypeSearchURL('PluginConnectionsConnection')); } elseif (isset($_POST["restore"])) { $PluginConnectionsConnection->check($_POST['id'], UPDATE); $PluginConnectionsConnection->restore($_POST); Html::redirect(Toolbox::getItemTypeSearchURL('PluginConnectionsConnection')); } elseif (isset($_POST["purge"])) { $PluginConnectionsConnection->check($_POST['id'], UPDATE);