/** * Get agents can do a "module name" * * @param $module_name value Name of the module * * @return array of agents * **/ function getAgentsCanDo($module_name) { $pfAgent = new PluginFusioninventoryAgent(); if ($module_name == 'SNMPINVENTORY') { $module_name = 'SNMPQUERY'; } $agentModule = $this->getActivationExceptions($module_name); $where = ""; if ($agentModule['is_active'] == 0) { $a_agentList = importArrayFromDB($agentModule['exceptions']); if (count($a_agentList) > 0) { $where = " `id` IN ("; $i = 0; $sep = ''; foreach ($a_agentList as $agent_id) { if ($i > 0) { $sep = ', '; } $where .= $sep . $agent_id; $i++; } $where .= ") "; if (isset($_SESSION['glpiactiveentities_string'])) { $where .= getEntitiesRestrictRequest("AND", $pfAgent->getTable()); } } else { return array(); } } else { $a_agentList = importArrayFromDB($agentModule['exceptions']); if (count($a_agentList) > 0) { $where = " `id` NOT IN ("; $i = 0; $sep = ''; foreach ($a_agentList as $agent_id) { if ($i > 0) { $sep = ', '; } $where .= $sep . $agent_id; $i++; } $where .= ") "; if (isset($_SESSION['glpiactiveentities_string'])) { $where .= getEntitiesRestrictRequest("AND", $pfAgent->getTable()); } } } $a_agents = $pfAgent->find($where); return $a_agents; }