本文整理汇总了PHP中Search::manageGetValues方法的典型用法代码示例。如果您正苦于以下问题:PHP Search::manageGetValues方法的具体用法?PHP Search::manageGetValues怎么用?PHP Search::manageGetValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Search
的用法示例。
在下文中一共展示了Search::manageGetValues方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayTabContentForItem
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
{
if ($item->getType() == 'Computer') {
if (self::canView()) {
// Show list filtered on computer, sorted on day descending ...
$_GET = array('field' => array(22), 'searchtype' => array('equals'), 'contains' => array($item->getID()), 'itemtype' => 'PluginMonitoringServiceevent', 'start' => 0, 'sort' => 3, 'order' => 'DESC');
Search::manageGetValues(self::getTypeName());
Search::showList(self::getTypeName(), $_GET);
return true;
}
}
return true;
}
示例2: displayTabContentForItem
public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
{
global $CFG_GLPI;
echo '<div class="tab_cadre_pager" style="padding: 2px; margin: 5px 0">
<h3 class="tab_bg_2" style="padding: 5px">
<a href="' . Toolbox::getItemTypeFormURL(__CLASS__) . '" class="submit">
<img src="' . $CFG_GLPI['root_doc'] . '/pics/menu_add.png" alt="+" align="absmiddle" />
' . __('Add a form category', 'formcreator') . '
</a>
</h3>
</div>';
$params['sort'] = !empty($_POST['sort']) ? (int) $_POST['sort'] : 0;
$params['order'] = !empty($_POST['order']) && in_array($_POST['order'], array('ASC', 'DESC')) ? $_POST['order'] : 'ASC';
$params['start'] = !empty($_POST['start']) ? (int) $_POST['start'] : 0;
Search::manageGetValues(__CLASS__);
Search::showList(__CLASS__, $params);
}
示例3: displayTabContentForItem
public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
{
$header = new self();
$found = $header->find('entities_id = ' . $_SESSION['glpiactive_entity']);
if (count($found) > 0) {
echo '<div class="tab_cadre_pager" style="padding: 2px; margin: 5px 0">
<h3 class="tab_bg_2" style="padding: 5px">
<img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/pics/menu_add_off.png" alt="+" align="absmiddle" />
' . __('Add an header', 'formcreator') . '<br /><br />
<em><i><img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/pics/warning.png" alt="/!\\" align="absmiddle" height="16" />
' . __('An header already exists for this entity! You can have only one header per entity.', 'formcreator') . '</i></em>
</h3>
</div>';
} else {
$table = getTableForItemType('PluginFormcreatorHeader');
$where = getEntitiesRestrictRequest("", $table, "", "", true, false);
$found = $header->find($where);
if (count($found) > 0) {
echo '<div class="tab_cadre_pager" style="padding: 2px; margin: 5px 0">
<h3 class="tab_bg_2" style="padding: 5px">
<a href="' . Toolbox::getItemTypeFormURL(__CLASS__) . '" class="submit">
<img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/pics/menu_add.png" alt="+" align="absmiddle" />
' . __('Add an header', 'formcreator') . '
</a><br /><br />
<em><i><img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/pics/warning.png" alt="/!\\" align="absmiddle" height="16" />
' . __('An header exists for a parent entity! Another header will overwrite the previous one.', 'formcreator') . '</i></em>
</h3>
</div>';
} else {
echo '<div class="tab_cadre_pager" style="padding: 2px; margin: 5px 0">
<h3 class="tab_bg_2" style="padding: 5px">
<a href="' . Toolbox::getItemTypeFormURL(__CLASS__) . '" class="submit">
<img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/pics/menu_add.png" alt="+" align="absmiddle" />
' . __('Add an header', 'formcreator') . '
</a>
</h3>
</div>';
}
}
$params['sort'] = !empty($_POST['sort']) ? (int) $_POST['sort'] : 0;
$params['order'] = !empty($_POST['order']) && in_array($_POST['order'], array('ASC', 'DESC')) ? $_POST['order'] : 'ASC';
$params['start'] = !empty($_POST['start']) ? (int) $_POST['start'] : 0;
Search::manageGetValues(__CLASS__);
//Search::showGenericSearch(__CLASS__, $_GET);
Search::showList(__CLASS__, $params);
}
示例4: switch
switch ($params["type"]) {
case "comp_champ":
$val = Stat::getItems($_GET["itemtype"], $params["date1"], $params["date2"], $params["dropdown"]);
Stat::show($_GET["itemtype"], $params["type"], $params["date1"], $params["date2"], $params["start"], $val, $params["dropdown"]);
break;
case "device":
$val = Stat::getItems($_GET["itemtype"], $params["date1"], $params["date2"], $params["dropdown"]);
Stat::show($_GET["itemtype"], $params["type"], $params["date1"], $params["date2"], $params["start"], $val, $params["dropdown"]);
break;
default:
$val2 = isset($params['value2']) ? $params['value2'] : 0;
$val = Stat::getItems($_GET["itemtype"], $params["date1"], $params["date2"], $params["type"], $val2);
Stat::show($_GET["itemtype"], $params["type"], $params["date1"], $params["date2"], $params["start"], $val, $val2);
}
} else {
if (isset($_GET["type"]) && $_GET["type"] == "hardwares") {
Stat::showItems("", $_GET["date1"], $_GET["date2"], $_GET['start']);
}
}
break;
default:
// Plugin case
if ($plug = isPluginItemType($_GET["item_type"])) {
if (Plugin::doOneHook($plug['plugin'], 'dynamicReport', $_GET)) {
exit;
}
}
Search::manageGetValues($_GET["item_type"]);
Search::showList($_GET["item_type"], $_GET);
}
}
示例5: quickListLogs
/**
* Display quick list logs
*
* @param $tasks_id integer id of task
*
* @return nothing
*/
static function quickListLogs($tasks_id)
{
global $DB;
$query = "SELECT * FROM `glpi_plugin_fusioninventory_taskjobstates`\n LEFT JOIN `glpi_plugin_fusioninventory_taskjobs`\n ON `plugin_fusioninventory_taskjobs_id` = `glpi_plugin_fusioninventory_taskjobs`.`id`\n WHERE `plugin_fusioninventory_tasks_id`='" . $tasks_id . "'\n ORDER BY uniqid DESC\n LIMIT 1";
$result = $DB->query($query);
$uniqid = 0;
$action = '';
while ($data = $DB->fetch_array($result)) {
$uniqid = $data['uniqid'];
$action = $data['action'];
}
if ($uniqid == '0') {
if ($action == '') {
echo "<center><strong>No agent found for this task</strong></center>";
}
} else {
$params = array();
$params['field'][0] = '6';
$params['searchtype'][0] = 'contains';
$params['contains'][0] = $uniqid;
$params['itemtype'] = 'PluginFusioninventoryTaskjoblog';
$params['start'] = '0';
Search::manageGetValues('PluginFusioninventoryTaskjoblog');
Search::showList('PluginFusioninventoryTaskjoblog', $params);
}
}
示例6: PluginResourcesDirectory
You should have received a copy of the GNU General Public License
along with Resources. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
//show list of users linked with a resource
if ($_SESSION['glpiactiveprofile']['interface'] == 'central') {
Html::header(PluginResourcesResource::getTypeName(2), '', "plugins", "resources");
} else {
Html::helpHeader(PluginResourcesResource::getTypeName(2));
}
$directory = new PluginResourcesDirectory();
if ($directory->canView() || Session::haveRight("config", "w")) {
if (empty($_GET["sort"])) {
$_GET["sort"] = "34";
}
if (empty($_GET["order"])) {
$_GET["order"] = "ASC";
}
Search::manageGetValues("PluginResourcesDirectory");
$directory->showGenericSearch($_GET);
$directory->showMinimalList($_GET);
} else {
Html::displayRightError();
}
if ($_SESSION['glpiactiveprofile']['interface'] == 'central') {
Html::footer();
} else {
Html::helpFooter();
}
示例7: displayTabContentForItem
/**
* Display content of tab
*
* @param CommonGLPI $item
* @param integer $tabnum
* @param interger $withtemplate
*
* @return boolean true
*/
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
{
// Toolbox::logInFile("pm-downtime", "Downtime, displayTabContentForItem ($withtemplate), item concerned : ".$item->getTypeName()."/".$item->getID()."\n");
if ($item->getType() == 'Ticket') {
if (self::canView()) {
// Show list filtered on item, sorted on day descending ...
Search::manageGetValues(self::getTypeName());
Search::showList(self::getTypeName(), array('field' => array(12), 'searchtype' => array('equals'), 'contains' => array($item->getID()), 'sort' => 4, 'order' => 'DESC'));
return true;
}
}
if ($item->getType() == 'Computer') {
if (self::canView()) {
// Show list filtered on item, sorted on day descending ...
Search::manageGetValues(self::getTypeName());
Search::showList(self::getTypeName(), array('field' => array(2), 'searchtype' => array('equals'), 'contains' => array($item->getID()), 'sort' => 4, 'order' => 'DESC'));
return true;
}
}
return true;
}
示例8: PluginIdeaboxIdeabox
} else {
Html::helpHeader(PluginIdeaboxIdeabox::getTypeName(2));
}
$idea = new PluginIdeaboxIdeabox();
if ($idea->canView() || Session::haveRight("config", "w")) {
if ($_SESSION['glpiactiveprofile']['interface'] != 'central') {
if ($idea->canCreate()) {
echo "<div align='center'><table class='tab_cadre_fixe' cellpadding='5'>";
echo "<tr><th>" . __('Menu', 'ideabox') . "</th></tr>";
echo "<tr class='tab_bg_1'><td class='center'>";
echo "<a href=\"./ideabox.form.php\">";
_e('Submit an idea', 'ideabox');
echo "</a>";
echo "</td></tr>";
echo " </table></div>";
}
Search::manageGetValues("PluginIdeaboxIdeabox");
$_GET["field"] = array(0 => "2");
$_GET["contains"] = array(0 => $_SESSION["glpiname"]);
Search::showList("PluginIdeaboxIdeabox", $_GET);
} else {
Search::show("PluginIdeaboxIdeabox");
}
} else {
Html::displayRightError();
}
if ($_SESSION['glpiactiveprofile']['interface'] == 'central') {
Html::footer();
} else {
Html::helpFooter();
}
示例9: PluginResourcesEmployment
This file is part of Resources.
Resources 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.
Resources 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 Resources. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
Html::header(PluginResourcesResource::getTypeName(2), '', "plugins", "resources", "employment");
$employment = new PluginResourcesEmployment();
if ($employment->canView() || Session::haveRight("config", "w")) {
Search::manageGetValues("PluginResourcesEmployment");
if (isset($_GET["plugin_resources_resources_id"]) && !empty($_GET["plugin_resources_resources_id"])) {
$_GET["field"] = array(0 => "13");
$_GET["contains"] = array(0 => $_GET["plugin_resources_resources_id"]);
}
Search::showGenericSearch("PluginResourcesEmployment", $_GET);
Search::showList("PluginResourcesEmployment", $_GET);
} else {
Html::displayRightError();
}
Html::footer();
示例10: PluginResourcesResourceHoliday
Resources 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 Resources. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
if ($_SESSION['glpiactiveprofile']['interface'] == 'central') {
//from central
Html::header(PluginResourcesResource::getTypeName(2), '', "plugins", "resources");
} else {
//from helpdesk
Html::helpHeader(PluginResourcesResource::getTypeName(2));
}
$holiday = new PluginResourcesResourceHoliday();
if ($holiday->canView() || Session::haveRight("config", "w")) {
Search::manageGetValues("PluginResourcesResourceHoliday");
$holiday->showGenericSearch($_GET);
$holiday->showMinimalList($_GET);
} else {
Html::displayRightError();
}
if ($_SESSION['glpiactiveprofile']['interface'] == 'central') {
Html::footer();
} else {
Html::helpFooter();
}
示例11: PluginResourcesTask
Resources 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.
Resources 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 Resources. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
Html::header(PluginResourcesResource::getTypeName(2), '', "plugins", "resources");
$task = new PluginResourcesTask();
if ($task->canView() || Session::haveRight("config", "w")) {
Search::manageGetValues("PluginResourcesTask");
//if $_GET["plugin_resources_resources_id"] exist this show list of tasks from a resource
//else show all resources
if (isset($_GET["plugin_resources_resources_id"]) && !empty($_GET["plugin_resources_resources_id"])) {
$_GET["field"] = array(0 => "13");
$_GET["contains"] = array(0 => $_GET["plugin_resources_resources_id"]);
}
Search::showGenericSearch("PluginResourcesTask", $_GET);
Search::showList("PluginResourcesTask", $_GET);
} else {
Html::displayRightError();
}
Html::footer();
示例12: PluginResourcesChecklistconfig
-------------------------------------------------------------------------
LICENSE
This file is part of Resources.
Resources 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.
Resources 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 Resources. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
Html::header(PluginResourcesResource::getTypeName(2), '', "plugins", "resources", "checklist");
$checklistconfig = new PluginResourcesChecklistconfig();
if ($checklistconfig->canView() || Session::haveRight("config", "w")) {
Search::manageGetValues("PluginResourcesChecklistconfig");
Search::showGenericSearch("PluginResourcesChecklistconfig", $_GET);
Search::showList("PluginResourcesChecklistconfig", $_GET);
} else {
Html::displayRightError();
}
Html::footer();
示例13: prepareRun
function prepareRun($taskjobs_id)
{
global $DB;
$task = new PluginFusioninventoryTask();
$job = new PluginFusioninventoryTaskjob();
$joblog = new PluginFusioninventoryTaskjoblog();
$jobstate = new PluginFusioninventoryTaskjobstate();
$agent = new PluginFusioninventoryAgent();
$uniqid = uniqid();
$job->getFromDB($taskjobs_id);
$task->getFromDB($job->fields['plugin_fusioninventory_tasks_id']);
$communication = $task->fields['communication'];
$actions = importArrayFromDB($job->fields['action']);
$definitions = importArrayFromDB($job->fields['definition']);
$taskvalid = 0;
$computers = array();
foreach ($actions as $action) {
$itemtype = key($action);
$items_id = current($action);
switch ($itemtype) {
case 'Computer':
$computers[] = $items_id;
break;
case 'Group':
$computer_object = new Computer();
//find computers by user associated with this group
$group_users = new Group_User();
$group = new Group();
$group->getFromDB($items_id);
$members = array();
$computers_a_1 = array();
$computers_a_2 = array();
//array_keys($group_users->find("groups_id = '$items_id'"));
$members = $group_users->getGroupUsers($items_id);
foreach ($members as $member) {
$computers = $computer_object->find("users_id = '{$member['id']}'");
foreach ($computers as $computer) {
$computers_a_1[] = $computer['id'];
}
}
//find computers directly associated with this group
$computers = $computer_object->find("groups_id = '{$items_id}'");
foreach ($computers as $computer) {
$computers_a_2[] = $computer['id'];
}
//merge two previous array and deduplicate entries
$computers = array_unique(array_merge($computers_a_1, $computers_a_2));
break;
case 'PluginFusioninventoryDeployGroup':
$group = new PluginFusioninventoryDeployGroup();
$group->getFromDB($items_id);
switch ($group->getField('type')) {
case 'STATIC':
$query = "SELECT items_id\n FROM glpi_plugin_fusioninventory_deploygroups_staticdatas\n WHERE groups_id = '{$items_id}'\n AND itemtype = 'Computer'";
$res = $DB->query($query);
while ($row = $DB->fetch_assoc($res)) {
$computers[] = $row['items_id'];
}
break;
case 'DYNAMIC':
$query = "SELECT fields_array\n FROM glpi_plugin_fusioninventory_deploygroups_dynamicdatas\n WHERE groups_id = '{$items_id}'\n LIMIT 1";
$res = $DB->query($query);
$row = $DB->fetch_assoc($res);
if (isset($_GET)) {
$get_tmp = $_GET;
}
if (isset($_SESSION["glpisearchcount"]['Computer'])) {
unset($_SESSION["glpisearchcount"]['Computer']);
}
if (isset($_SESSION["glpisearchcount2"]['Computer'])) {
unset($_SESSION["glpisearchcount2"]['Computer']);
}
$_GET = importArrayFromDB($row['fields_array']);
$_GET["glpisearchcount"] = count($_GET['field']);
if (isset($_GET['field2'])) {
$_GET["glpisearchcount2"] = count($_GET['field2']);
}
$pfSearch = new PluginFusioninventorySearch();
Search::manageGetValues('Computer');
$glpilist_limit = $_SESSION['glpilist_limit'];
$_SESSION['glpilist_limit'] = 999999999;
$result = $pfSearch->constructSQL('Computer', $_GET);
$_SESSION['glpilist_limit'] = $glpilist_limit;
while ($data = $DB->fetch_array($result)) {
$computers[] = $data['id'];
}
if (count($get_tmp) > 0) {
$_GET = $get_tmp;
}
break;
}
break;
}
}
$c_input = array();
$c_input['plugin_fusioninventory_taskjobs_id'] = $taskjobs_id;
$c_input['state'] = 0;
$c_input['plugin_fusioninventory_agents_id'] = 0;
$c_input['execution_id'] = $task->fields['execution_id'];
$pfCollect = new PluginFusioninventoryCollect();
//.........这里部分代码省略.........
示例14: getItemsDynamicly
static function getItemsDynamicly($parm) {
global $DB;
$pmDisplayview_rule = new PluginMonitoringDisplayview_rule();
$pmDisplayview_item = new PluginMonitoringDisplayview_item();
$pmDisplayview = new PluginMonitoringDisplayview();
$pmSearch = new PluginMonitoringSearch();
$pmService = new PluginMonitoringService();
$devices_present = array();
if ($pmDisplayview_rule->getFromDB($parm->fields['id'])) {
if ($pmDisplayview->getFromDB($pmDisplayview_rule->fields['plugin_monitoring_displayviews_id'])) {
// Load right entity
$default_entity = 0;
if (isset($_SESSION['glpiactive_entity'])) {
$default_entity = $_SESSION['glpiactive_entity'];
}
$entities_isrecursive = 0;
if (isset($_SESSION['glpiactiveentities'])
AND count($_SESSION['glpiactiveentities']) > 1) {
$entities_isrecursive = 1;
}
Session::changeActiveEntities($pmDisplayview->fields['entities_id'],
$pmDisplayview->fields['is_recursive']);
$get_tmp = '';
$itemtype = $pmDisplayview_rule->fields['itemtype'];
if (isset($_GET)) {
$get_tmp = $_GET;
}
if (isset($_SESSION["glpisearchcount"][$pmDisplayview_rule->fields['itemtype']])) {
unset($_SESSION["glpisearchcount"][$pmDisplayview_rule->fields['itemtype']]);
}
if (isset($_SESSION["glpisearchcount2"][$pmDisplayview_rule->fields['itemtype']])) {
unset($_SESSION["glpisearchcount2"][$pmDisplayview_rule->fields['itemtype']]);
}
$_GET = importArrayFromDB($pmDisplayview_rule->fields['condition']);
$_GET["glpisearchcount"] = count($_GET['field']);
if (isset($_GET['field2'])) {
$_GET["glpisearchcount2"] = count($_GET['field2']);
}
Search::manageGetValues($pmDisplayview_rule->fields['itemtype']);
$queryd = "SELECT * FROM `glpi_plugin_monitoring_displayviews_items`
WHERE `plugin_monitoring_displayviews_id`='".$pmDisplayview_rule->fields["plugin_monitoring_displayviews_id"]."'
AND `itemtype`='".$pmDisplayview_rule->fields['type']."'
AND `extra_infos`='".$pmDisplayview_rule->fields['itemtype']."'";
$result = $DB->query($queryd);
while ($data=$DB->fetch_array($result)) {
$devices_present[$data['items_id']] = $data['id'];
}
$glpilist_limit = $_SESSION['glpilist_limit'];
$_SESSION['glpilist_limit'] = 500000;
$result = $pmSearch->constructSQL($itemtype,
$_GET);
$_SESSION['glpilist_limit'] = $glpilist_limit;
while ($data=$DB->fetch_array($result)) {
if (!isset($devices_present[$data['id']])) {
// Verify this device has one or more resources
$query_h = "SELECT * FROM `glpi_plugin_monitoring_componentscatalogs_hosts`"
. " LEFT JOIN `glpi_plugin_monitoring_services`"
. " ON `plugin_monitoring_componentscatalogs_hosts_id`="
. " `glpi_plugin_monitoring_componentscatalogs_hosts`.`id`"
. " WHERE `items_id`='".$data['id']."'"
. " AND `itemtype`='".$pmDisplayview_rule->fields['itemtype']."'"
. " AND `glpi_plugin_monitoring_services`.`id` IS NOT NULL";
$result_h = $DB->query($query_h);
if ($DB->numrows($result_h) > 0) {
$input = array();
$input['plugin_monitoring_displayviews_id'] = $pmDisplayview_rule->fields["plugin_monitoring_displayviews_id"];
$input['x'] = '1';
$input['y'] = '1';
$input['items_id'] = $data['id'];
$input['itemtype'] = $pmDisplayview_rule->fields['type'];
$input['extra_infos'] = $pmDisplayview_rule->fields['itemtype'];
$pmDisplayview_item->add($input);
}
} else {
// Verify this device has one or more resources
$query_h = "SELECT * FROM `glpi_plugin_monitoring_componentscatalogs_hosts`"
. " LEFT JOIN `glpi_plugin_monitoring_services`"
. " ON `plugin_monitoring_componentscatalogs_hosts_id`="
. " `glpi_plugin_monitoring_componentscatalogs_hosts`.`id`"
. " WHERE `items_id`='".$data['id']."'"
. " AND `itemtype`='".$pmDisplayview_rule->fields['itemtype']."'"
. " AND `glpi_plugin_monitoring_services`.`id` IS NOT NULL";
$result_h = $DB->query($query_h);
if ($DB->numrows($result_h) > 0) {
unset($devices_present[$data['id']]);
}
}
//.........这里部分代码省略.........
示例15: prepareRun
function prepareRun($taskjobs_id)
{
global $DB;
$pfTask = new PluginFusioninventoryTask();
$pfTaskjob = new PluginFusioninventoryTaskjob();
$pfTaskjobstate = new PluginFusioninventoryTaskjobstate();
$pfTaskjoblog = new PluginFusioninventoryTaskjoblog();
$pfAgent = new PluginFusioninventoryAgent();
$uniqid = uniqid();
$pfTaskjob->getFromDB($taskjobs_id);
$pfTask->getFromDB($pfTaskjob->fields['plugin_fusioninventory_tasks_id']);
$communication = $pfTask->fields['communication'];
$a_definitions = importArrayFromDB($pfTaskjob->fields['definition']);
$a_computers_to_wake = array();
foreach ($a_definitions as $definition) {
$itemtype = key($definition);
$items_id = current($definition);
switch ($itemtype) {
case 'Computer':
$a_computers_to_wake[] = $items_id;
break;
case 'PluginFusioninventoryDeployGroup':
$group = new PluginFusioninventoryDeployGroup();
$group->getFromDB($items_id);
switch ($group->getField('type')) {
case 'STATIC':
$query = "SELECT items_id\n FROM glpi_plugin_fusioninventory_deploygroups_staticdatas\n WHERE groups_id = '{$items_id}'\n AND itemtype = 'Computer'";
$res = $DB->query($query);
while ($row = $DB->fetch_assoc($res)) {
$a_computers_to_wake[] = $row['items_id'];
}
break;
case 'DYNAMIC':
$query = "SELECT fields_array\n FROM glpi_plugin_fusioninventory_deploygroups_dynamicdatas\n WHERE groups_id = '{$items_id}'\n LIMIT 1";
$res = $DB->query($query);
$row = $DB->fetch_assoc($res);
if (isset($_GET)) {
$get_tmp = $_GET;
}
if (isset($_SESSION["glpisearchcount"]['Computer'])) {
unset($_SESSION["glpisearchcount"]['Computer']);
}
if (isset($_SESSION["glpisearchcount2"]['Computer'])) {
unset($_SESSION["glpisearchcount2"]['Computer']);
}
$_GET = importArrayFromDB($row['fields_array']);
$_GET["glpisearchcount"] = count($_GET['field']);
if (isset($_GET['field2'])) {
$_GET["glpisearchcount2"] = count($_GET['field2']);
}
$pfSearch = new PluginFusioninventorySearch();
Search::manageGetValues('Computer');
$glpilist_limit = $_SESSION['glpilist_limit'];
$_SESSION['glpilist_limit'] = 999999999;
$result = $pfSearch->constructSQL('Computer', $_GET);
$_SESSION['glpilist_limit'] = $glpilist_limit;
while ($data = $DB->fetch_array($result)) {
$a_computers_to_wake[] = $data['id'];
}
if (count($get_tmp) > 0) {
$_GET = $get_tmp;
}
break;
}
}
}
$a_actions = importArrayFromDB($pfTaskjob->fields['action']);
$a_agentList = array();
if (!strstr($pfTaskjob->fields['action'], '".1"') and !strstr($pfTaskjob->fields['action'], '".2"')) {
foreach ($a_actions as $a_action) {
if (!in_array('.1', $a_action) && !in_array('.2', $a_action)) {
$agent_id = current($a_action);
if ($pfAgent->getFromDB($agent_id)) {
if ($communication == 'pull') {
$a_agentList[] = $agent_id;
} else {
if ($pfTaskjob->isAgentAlive('1', $agent_id)) {
$a_agentList[] = $agent_id;
}
}
}
}
}
} else {
if (strstr($pfTaskjob->fields['action'], '".1"')) {
$a_agentList = $this->getAgentsSubnet(count($a_computers_to_wake), $communication);
} else {
if (in_array('.2', $a_actions)) {
$subnet = '';
foreach ($a_computers_to_wake as $items_id) {
$sql = "SELECT * FROM `glpi_networkports`\n WHERE `items_id`='" . $items_id . "'\n AND `itemtype`='Computer'\n AND `mac`!='' ";
$result = $DB->query($sql);
if ($result) {
while ($data = $DB->fetch_array($result)) {
$subnet = $data['subnet'];
}
}
}
if ($subnet != '') {
$a_agentList = $this->getAgentsSubnet(count($a_computers_to_wake), $communication, $subnet);
//.........这里部分代码省略.........