. * * ------------------------------------------------------------------------ * * This file is used to manage the visibility of package by group. * * ------------------------------------------------------------------------ * * @package FusionInventory * @author David Durieux * @author Alexandre Delaunay * @copyright Copyright (c) 2010-2016 FusionInventory team * @license AGPL License 3.0 or (at your option) any later version * http://www.gnu.org/licenses/agpl-3.0-standalone.html * @link http://www.fusioninventory.org/ * @link https://github.com/fusioninventory/fusioninventory-for-glpi * */ if (!defined('GLPI_ROOT')) { die("Sorry. You can't access directly to this file"); } /** * Manage the visibility of package by group. */ class PluginFusioninventoryDeployPackage_Group extends CommonDBRelation { /** * Itemtype for the first part of relation * * @var string */ static public $itemtype_1 = 'PluginFusioninventoryDeployPackage'; /** * id field name for the first part of relation * * @var string */ static public $items_id_1 = 'plugin_fusioninventory_deploypackages_id'; /** * Itemtype for the second part of relation * * @var string */ static public $itemtype_2 = 'Group'; /** * id field name for the second part of relation * * @var string */ static public $items_id_2 = 'groups_id'; /** * Set we don't check parent right of the second item * * @var integer */ static public $checkItem_2_Rights = self::DONT_CHECK_ITEM_RIGHTS; /** * Logs for the second item are disabled * * @var type */ static public $logs_for_item_2 = false; /** * Get groups for a deploypackage * * @global object $DB * @param integer $deploypackages_id ID of the deploypackage * @return array list of groups linked to a deploypackage **/ static function getGroups($deploypackages_id) { global $DB; $groups = []; $query = "SELECT `glpi_plugin_fusioninventory_deploypackages_groups`.* FROM `glpi_plugin_fusioninventory_deploypackages_groups` WHERE plugin_fusioninventory_deploypackages_id = '$deploypackages_id'"; foreach ($DB->request($query) as $data) { $groups[$data['groups_id']][] = $data; } return $groups; } }