当前位置: 首页>>代码示例>>PHP>>正文


PHP Search::manageParams方法代码示例

本文整理汇总了PHP中Search::manageParams方法的典型用法代码示例。如果您正苦于以下问题:PHP Search::manageParams方法的具体用法?PHP Search::manageParams怎么用?PHP Search::manageParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Search的用法示例。


在下文中一共展示了Search::manageParams方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doSearch

 private function doSearch($itemtype, $params, array $forcedisplay = array())
 {
     global $DEBUG_SQL;
     // check param itemtype exists (to avoid search errors)
     $this->assertTrue(is_subclass_of($itemtype, "CommonDBTM"));
     // login to glpi if needed
     if (!isset($_SESSION['glpiname'])) {
         $this->Login();
     }
     // force session in debug mode (to store & retrieve sql errors)
     $glpi_use_mode = $_SESSION['glpi_use_mode'];
     $_SESSION['glpi_use_mode'] = Session::DEBUG_MODE;
     // don't compute last request from session
     $params['reset'] = 'reset';
     // do search
     $params = Search::manageParams($itemtype, $params);
     $data = Search::getDatas($itemtype, $params, $forcedisplay);
     // append existing errors to returned data
     $data['last_errors'] = array();
     if (isset($DEBUG_SQL['errors'])) {
         $data['last_errors'] = implode(', ', $DEBUG_SQL['errors']);
         unset($DEBUG_SQL['errors']);
     }
     // restore glpi mode to previous
     $_SESSION['glpi_use_mode'] = $glpi_use_mode;
     // do not store this search from session
     Search::resetSaveSearch();
     return $data;
 }
开发者ID:btry,项目名称:glpi,代码行数:29,代码来源:SearchTest.php

示例2: switch

                switch ($params["type"]) {
                    case "comp_champ":
                        $val = Stat::getItems($_GET["itemtype"], $params["date1"], $params["date2"], $params["dropdown"]);
                        Stat::showTable($_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::showTable($_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::showTable($_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;
                }
            }
            $params = Search::manageParams($_GET["item_type"], $_GET);
            Search::showList($_GET["item_type"], $params);
    }
}
开发者ID:btry,项目名称:glpi,代码行数:31,代码来源:report.dynamic.php

示例3:

-------------------------------------------------------------------------

LICENSE

This file is part of GLPI.

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, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
*/
include '../inc/includes.php';
Session::checkLoginUser();
Html::popHeader(__('Setup'), $_SERVER['PHP_SELF']);
$params = Search::manageParams('DocumentType', $_GET);
$params['target'] = $_SERVER['PHP_SELF'];
Search::showList('DocumentType', $params);
Html::popFooter();
开发者ID:glpi-project,项目名称:glpi,代码行数:30,代码来源:documenttype.list.php

示例4: Copyright

  @comment
  @copyright Copyright (c) 2011-2014 Plugin Monitoring for GLPI team
  @license   AGPL License 3.0 or (at your option) any later version
             http://www.gnu.org/licenses/agpl-3.0-standalone.html
  @link      https://forge.indepnet.net/projects/monitoring/
  @since     2011

  ------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
Session::checkCentralAccess();
Html::header(__('Monitoring - dashboard (resources)', 'monitoring'), $_SERVER["PHP_SELF"], "plugins", "PluginMonitoringDashboard", "dashboard");
if (!isset($_GET['itemtype'])) {
    $_GET['itemtype'] = "PluginMonitoringService";
}
$params = Search::manageParams("PluginMonitoringService", $_GET);
/*
// Display ressources perfdata ?
if (isset($_SESSION['plugin_monitoring']['ressources_perfdata'])) {
   Html::redirect($CFG_GLPI['root_doc']."/plugins/monitoring/front/perfdatas.php");
   unset($_SESSION['plugin_monitoring']['ressources_perfdata']);
}
*/
// Reduced or normal interface ?
if (!isset($_SESSION['plugin_monitoring_reduced_interface'])) {
    $_SESSION['plugin_monitoring_reduced_interface'] = false;
}
if (isset($_POST['reduced_interface'])) {
    $_SESSION['plugin_monitoring_reduced_interface'] = $_POST['reduced_interface'];
}
$pmDisplay = new PluginMonitoringDisplay();
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:31,代码来源:service.php

示例5: showResults

 static function showResults(PluginFusioninventoryDeployGroup $group)
 {
     $computers_params['metacriteria'] = array();
     $computers_params['criteria'][] = array('searchtype' => 'equals', 'value' => $_GET['id'], 'field' => 6000);
     $search_params = Search::manageParams('PluginFusioninventoryComputer', $computers_params);
     //Add extra parameters for massive action display : only the Delete action should be displayed
     $search_params['massiveactionparams']['extraparams']['id'] = $_GET['id'];
     $search_params['massiveactionparams']['extraparams']['custom_action'] = 'delete_from_group';
     $search_params['massiveactionparams']['extraparams']['massive_action_fields'] = array('action', 'id');
     Search::showList('PluginFusioninventoryComputer', $search_params);
 }
开发者ID:korial29,项目名称:fusioninventory-for-glpi,代码行数:11,代码来源:deploygroup_staticdata.class.php

示例6: trim

along with GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
*/
include '../inc/includes.php';
Session::checkCentralAccess();
Html::header(__('Search'), $_SERVER['PHP_SELF']);
if (!$CFG_GLPI['allow_search_global']) {
    Html::displayRightError();
}
if (isset($_GET["globalsearch"])) {
    $searchtext = trim($_GET["globalsearch"]);
    foreach ($CFG_GLPI["globalsearch_types"] as $itemtype) {
        if (($item = getItemForItemtype($itemtype)) && $item->canView()) {
            $_GET["reset"] = 'reset';
            $params = Search::manageParams($itemtype, $_GET, false, true);
            $params["display_type"] = Search::GLOBAL_SEARCH;
            $count = count($params["criteria"]);
            $params["criteria"][$count]["field"] = 'view';
            $params["criteria"][$count]["searchtype"] = 'contains';
            $params["criteria"][$count]["value"] = $searchtext;
            //          $_SESSION["glpisearchcount"][$itemtype]  = $count+1;
            //          $_SESSION["glpisearchcount2"][$itemtype] = 0;
            Search::showList($itemtype, $params);
            echo "<hr>";
        }
    }
}
Html::footer();
开发者ID:jose-martins,项目名称:glpi,代码行数:31,代码来源:search.php

示例7: listByHost

   /**
    * Display services associated with host
    *
    * @param $itemtype value type of item
    * @param $items_id integer id of the object
    *
    **/
   function listByHost($itemtype, $items_id) {
      global $CFG_GLPI,$DB;

      $params = Search::manageParams("PluginMonitoringService", array(), false);
      $num = 20; // Computer
      if ($itemtype == 'Printer') {
         $num = 21;
      } else if ($itemtype == 'NetworkEquipment') {
         $num = 22;
      }
      $params['criteria'][0] = array(
         'field'      => $num,
         'searchtype' => 'is',
         'value'      => $items_id
      );
      $col_to_display = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);

      $data = Search::prepareDatasForSearch('PluginMonitoringService', $params, $col_to_display);
      $data['tocompute'] = $data['toview'];
      Search::constructSQL($data);
      Search::constructDatas($data);

      $pmComponentscatalog = new PluginMonitoringComponentscatalog();

      $services_id = array();
      foreach ($data['data']['rows'] as $row) {
         $services_id[] = $row['id'];
      }
      $oldvalue = current(getAllDatasFromTable(
              'glpi_plugin_monitoring_serviceevents',
              "`plugin_monitoring_services_id` IN ('".implode("', '", $services_id)."')",
              false,
              'date ASC LIMIT 1'));
      $date = new DateTime($oldvalue['date']);
      $start = time();
      if ($date->getTimestamp() < $start) {
         $start = $date->getTimestamp();
      }

      $nbdays = round((date('U') - $start) / 86400);
      echo "<script type=\"text/javascript\">
      $(function() {
          $( \"#custom_date\" ).datepicker({ minDate: -".$nbdays.", maxDate: \"+0D\", dateFormat:'mm/dd/yy' });
          $( \"#custom_time\" ).timepicker();

      });
      </script>";

      echo '<center><input type="text" id="custom_date" value="'.date('m/d/Y').'"> '
              . ' <input type="text" id="custom_time" value="'.date('H:i').'"></center>';

      echo '<div id="custom_date" style="display:none"></div>';
      echo '<div id="custom_time" style="display:none"></div>';

      echo "<table class='tab_cadre_fixe'>";

      echo "<tr class='tab_bg_1'>";
      echo "<th colspan='5'>";
      echo __('Resources', 'monitoring');
      $item = new $itemtype();
      $item->getFromDB($items_id);
      echo " - ".$item->getTypeName();
      echo " - ".$item->getName();
      echo "</th>";
      echo "</tr>";

      echo "<table class='tab_cadre_fixe'>";

      foreach ($data['data']['rows'] as $row) {
         $pmComponentscatalog->getFromDB($row[8][0]['id']);

         echo "<tr class='tab_bg_1'>";
         echo "<th colspan='14'>".$pmComponentscatalog->getTypeName()."&nbsp;:&nbsp;".$pmComponentscatalog->getLink()."</th>";
         echo "</tr>";

         echo "<tr class='tab_bg_1'>";
         // echo "<th>";
         // echo __('Show counters', 'monitoring');
         // echo "</th>";
         echo "<th>";
         echo __('Show graphics', 'monitoring');
         echo "</th>";
         echo "<th>";
         echo __('Component', 'monitoring');
         echo "</th>";
         echo "<th>";
         echo __('Resource state', 'monitoring');
         echo "</th>";
         echo "<th>";
         echo __('Last check', 'monitoring');
         echo "</th>";
         echo "<th>";
         echo __('Result details', 'monitoring');
//.........这里部分代码省略.........
开发者ID:euqip,项目名称:glpi-smartcities,代码行数:101,代码来源:service.class.php

示例8: prepareRun


//.........这里部分代码省略.........
                         break;
                     case 'DYNAMIC':
                         if ($this->definitionFiltered("PluginFusioninventoryDeployGroupDynamic", $definitions_filter)) {
                             break;
                         }
                         //$definitions_filter is NULL = update by crontask !
                         if ($definitions_filter != NULL) {
                             $where = " AND `can_update_group`='1'";
                         } else {
                             $where = "";
                         }
                         $query = "SELECT fields_array\n                     FROM glpi_plugin_fusioninventory_deploygroups_dynamicdatas\n                     WHERE groups_id = '{$items_id}' {$where}\n                     LIMIT 1";
                         $res = $DB->query($query);
                         $row = $DB->fetch_assoc($res);
                         //No dynamic groups have been found : break
                         if ($DB->numrows($res) == 0) {
                             break;
                         }
                         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::manageParams('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;
         }
     }
     //Remove duplicatas from array
     //We are using isset for faster processing than array_unique because we might have many
     //entries in this list.
     $tmp_computers = array();
     foreach ($computers as $computer) {
         if (!isset($tmp_computers[$computer])) {
             $tmp_computers[$computer] = 1;
         }
     }
     $computers = array_keys($tmp_computers);
     $c_input = array();
     $c_input['plugin_fusioninventory_taskjobs_id'] = $job->fields['id'];
     $c_input['state'] = 0;
     $c_input['plugin_fusioninventory_agents_id'] = 0;
     $c_input['execution_id'] = $task->fields['execution_id'];
     $package = new PluginFusioninventoryDeployPackage();
     foreach ($computers as $computer_id) {
开发者ID:korial29,项目名称:fusioninventory-for-glpi,代码行数:67,代码来源:deploycommon.class.php

示例9: 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']);
             }
             $params = Search::manageParams($pmDisplayview_rule->fields['itemtype'], $_GET);
             //            Search::manageGetValues($pmDisplayview_rule->fields['itemtype']);
             $queryd = "SELECT * FROM `glpi_plugin_monitoring_displayviews_items`\n               WHERE `plugin_monitoring_displayviews_id`='" . $pmDisplayview_rule->fields["plugin_monitoring_displayviews_id"] . "'\n                  AND `itemtype`='" . $pmDisplayview_rule->fields['type'] . "'\n                  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']]);
                     }
                 }
             }
             // Reload current entity
             Session::changeActiveEntities($default_entity, $entities_isrecursive);
         } else {
             $pmDisplayview->delete(array('id' => $pmDisplayview_rule->fields['plugin_monitoring_displayviews_id']));
         }
     }
     foreach ($devices_present as $id) {
         $pmDisplayview_item->delete(array('id' => $id));
     }
     return true;
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:83,代码来源:displayview_rule.class.php

示例10: displayTabContentForItem

 static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
 {
     switch ($item->getType()) {
         case 'Central':
             $pmDisplay = new PluginMonitoringDisplay();
             // $pmDisplay->showHostsCounters("Hosts", 1, 1);
             $params = Search::manageParams("PluginMonitoringHost", array());
             $pmDisplay->showHostsBoard($params);
             return true;
     }
     if ($item->getID() > 0) {
         if ($tabnum == 0) {
             PluginMonitoringToolbox::loadLib();
             $pmService = new PluginMonitoringService();
             $pmService->manageServices(get_class($item), $item->fields['id']);
             $pmHostconfig = new PluginMonitoringHostconfig();
             $pmHostconfig->showForm($item->getID(), get_class($item));
         } else {
             if ($tabnum == 1) {
                 $pmService = new PluginMonitoringService();
                 $pmService->showGraphsByHost(get_class($item), $item->fields['id']);
             }
         }
     }
     return true;
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:26,代码来源:host.class.php

示例11: or

   @license   AGPL License 3.0 or (at your option) any later version
              http://www.gnu.org/licenses/agpl-3.0-standalone.html
   @link      https://forge.indepnet.net/projects/monitoring/
   @since     2011

   ------------------------------------------------------------------------
 */

include ("../../../inc/includes.php");

Session::checkCentralAccess();

Html::header(__('Monitoring - dashboard (hosts)', 'monitoring'), $_SERVER["PHP_SELF"], "plugins",
             "PluginMonitoringDashboard", "dashboard");

$params = Search::manageParams("PluginMonitoringHost", $_GET);

// Display ressources perfdata ?
if (isset($_SESSION['plugin_monitoring']['ressources_perfdata'])) {
   unset($_SESSION['plugin_monitoring']['ressources_perfdata']);
}
// Reduced or normal interface ?
if (! isset($_SESSION['plugin_monitoring_reduced_interface'])) {
   $_SESSION['plugin_monitoring_reduced_interface'] = false;
}
if (isset($_POST['reduced_interface'])) {
   $_SESSION['plugin_monitoring_reduced_interface'] = $_POST['reduced_interface'];
}

$pmDisplay = new PluginMonitoringDisplay();
$pmMessage = new PluginMonitoringMessage();
开发者ID:euqip,项目名称:glpi-smartcities,代码行数:31,代码来源:host.php

示例12: getSearchParamsAsAnArray

 /**
  *
  */
 static function getSearchParamsAsAnArray(PluginFusioninventoryDeployGroup $group, $check_post_values = FALSE, $getAll = FALSE)
 {
     global $DB;
     $computers_params = array();
     unset($_SESSION['glpisearch']['PluginFusioninventoryComputer']);
     //Check criteria from DB
     if (!$check_post_values) {
         if ($group->fields['type'] == PluginFusioninventoryDeployGroup::DYNAMIC_GROUP) {
             $query = "SELECT `fields_array`\n                     FROM `glpi_plugin_fusioninventory_deploygroups_dynamicdatas`\n                     WHERE `plugin_fusioninventory_deploygroups_id`='" . $group->getID() . "'";
             $result = $DB->query($query);
             if ($DB->numrows($result) > 0) {
                 $fields_array = $DB->result($result, 0, 'fields_array');
                 $computers_params = unserialize($fields_array);
             }
         }
     } else {
         $computers_params = $_GET;
     }
     if ($getAll) {
         $computers_params['export_all'] = true;
     }
     return Search::manageParams('PluginFusioninventoryComputer', $computers_params);
 }
开发者ID:korial29,项目名称:fusioninventory-for-glpi,代码行数:26,代码来源:deploygroup.class.php

示例13: isThisItemCheckRule

 static function isThisItemCheckRule($parm)
 {
     global $DB;
     $itemtype = get_class($parm);
     $items_id = $parm->fields['id'];
     $session_glpisearch = array();
     if (isset($_SESSION['glpisearch'])) {
         $session_glpisearch = $_SESSION['glpisearch'];
     }
     $session_glpisearchcount = array();
     if (isset($_SESSION['glpisearchcount'])) {
         $session_glpisearchcount = $_SESSION['glpisearchcount'];
     }
     $session_glpisearchcount2 = array();
     if (isset($_SESSION['glpisearchcount2'])) {
         $session_glpisearchcount2 = $_SESSION['glpisearchcount2'];
     }
     $a_find = array();
     $pmComponentscatalog_rule = new PluginMonitoringComponentscatalog_rule();
     $pmComponentscatalog = new PluginMonitoringComponentscatalog();
     $query = "SELECT * FROM `" . $pmComponentscatalog_rule->getTable() . "`\n         WHERE `itemtype`='" . $itemtype . "'";
     $result = $DB->query($query);
     $get_tmp = array();
     if (isset($_GET)) {
         $get_tmp = $_GET;
     }
     while ($data = $DB->fetch_array($result)) {
         if (!isset($_SESSION['glpiactiveentities_string'])) {
             $_SESSION['glpiactiveentities_string'] = $parm->fields['entities_id'];
         }
         // Load right entity
         $pmComponentscatalog->getFromDB($data['plugin_monitoring_componentscalalog_id']);
         $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;
         }
         if (!isset($_SESSION['glpiactiveprofile']['entities'])) {
             $_SESSION['glpiactiveprofile']['entities'] = array($pmComponentscatalog->fields['entities_id'] => array('id' => $pmComponentscatalog->fields['entities_id'], 'name' => '', 'is_recursive' => $pmComponentscatalog->fields['is_recursive']));
         }
         Session::changeActiveEntities($pmComponentscatalog->fields['entities_id'], $pmComponentscatalog->fields['is_recursive']);
         $itemtype = $data['itemtype'];
         $condition = importArrayFromDB($data['condition']);
         $params = Search::manageParams($itemtype, $condition, FALSE);
         $datar = Search::prepareDatasForSearch($itemtype, $params);
         Search::constructSQL($datar);
         $DBread = DBConnection::getReadConnection();
         $DBread->query("SET SESSION group_concat_max_len = 16384;");
         $resultr = $DBread->query($datar['sql']['search']);
         /// Check group concat limit : if warning : increase limit
         if ($result2 = $DBread->query('SHOW WARNINGS')) {
             if ($DBread->numrows($result2) > 0) {
                 $res = $DBread->fetch_assoc($result2);
                 if ($res['Code'] == 1260) {
                     $DBread->query("SET SESSION group_concat_max_len = 4194304;");
                     $resultr = $DBread->query($datar['sql']['search']);
                 }
             }
         }
         $find = 0;
         while ($datar = $DB->fetch_array($resultr)) {
             if ($datar['id'] == $items_id) {
                 $find = 1;
                 break;
             }
         }
         if ($find == 1) {
             $a_find[$data['plugin_monitoring_componentscalalog_id']] = 1;
         } else {
             if (!isset($a_find[$data['plugin_monitoring_componentscalalog_id']])) {
                 $a_find[$data['plugin_monitoring_componentscalalog_id']] = 0;
             }
         }
         // Reload current entity
         Session::changeActiveEntities($default_entity, $entities_isrecursive);
     }
     if (count($get_tmp) > 0) {
         $_GET = $get_tmp;
     }
     $pmComponentscatalog_Host = new PluginMonitoringComponentscatalog_Host();
     foreach ($a_find as $componentscalalog_id => $is_present) {
         if ($is_present == '0') {
             // * Remove from dynamic if present
             $query = "SELECT * FROM `glpi_plugin_monitoring_componentscatalogs_hosts`\n               WHERE `plugin_monitoring_componentscalalog_id`='" . $componentscalalog_id . "'\n                  AND `itemtype`='" . $itemtype . "'\n                  AND `items_id`='" . $items_id . "'\n                  AND`is_static`='0'";
             $result = $DB->query($query);
             while ($data = $DB->fetch_array($result)) {
                 $pmComponentscatalog_Host->delete(array('id' => $data['id']));
             }
         } else {
             //  add if not present
             $query = "SELECT * FROM `glpi_plugin_monitoring_componentscatalogs_hosts`\n               WHERE `plugin_monitoring_componentscalalog_id`='" . $componentscalalog_id . "'\n                  AND `itemtype`='" . $itemtype . "'\n                  AND `items_id`='" . $items_id . "'\n                     LIMIT 1";
             $result = $DB->query($query);
             if ($DB->numrows($result) == '0') {
                 $input = array();
                 $input['plugin_monitoring_componentscalalog_id'] = $componentscalalog_id;
                 $input['is_static'] = '0';
                 $input['items_id'] = $items_id;
//.........这里部分代码省略.........
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:101,代码来源:componentscatalog_rule.class.php

示例14: importArrayFromDB

            $_POST = $_GET;
            $pmComponentscatalog_rule->delete($_POST);
            Html::redirect($CFG_GLPI['root_doc'] . "/plugins/monitoring/front/componentscatalog.form.php?id=" . $_POST['plugin_monitoring_componentscalalog_id']);
        } else {
            if (isset($_GET['criteria']) or isset($_GET['reset'])) {
                //   if (isset($_SESSION['plugin_monitoring_rules'])) {
                //      unset($_SESSION['plugin_monitoring_rules']);
                //   }
                //   $_SESSION['plugin_monitoring_rules'] = $_POST;
                //   $_SESSION['plugin_monitoring_rules_REQUEST_URI'] = $_SERVER['REQUEST_URI'];
                //Html::back();
            } else {
                if (isset($_GET['id']) and !isset($_GET['itemtype'])) {
                    $pmComponentscatalog_rule->getFromDB($_GET['id']);
                    $val = importArrayFromDB($pmComponentscatalog_rule->fields['condition']);
                    $params = Search::manageParams($pmComponentscatalog_rule->fields['itemtype'], $val);
                    $url = str_replace("?id=" . $_GET['id'], "", $_SERVER['REQUEST_URI']);
                    $url .= "?" . Toolbox::append_params($params);
                    $url .= "&plugin_monitoring_componentscalalog_id=" . $pmComponentscatalog_rule->fields['plugin_monitoring_componentscalalog_id'];
                    $url .= "&name=" . $pmComponentscatalog_rule->fields['name'];
                    $url .= "&id=" . $_GET['id'];
                    Html::redirect($url);
                }
            }
        }
    }
}
if (isset($_POST['name'])) {
    $a_construct = array();
    foreach ($_POST as $key => $value) {
        $a_construct[] = $key . "=" . $value;
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:31,代码来源:componentscatalog_rule.form.php


注:本文中的Search::manageParams方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。