本文整理汇总了PHP中Search::getArrayUrlLink方法的典型用法代码示例。如果您正苦于以下问题:PHP Search::getArrayUrlLink方法的具体用法?PHP Search::getArrayUrlLink怎么用?PHP Search::getArrayUrlLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Search
的用法示例。
在下文中一共展示了Search::getArrayUrlLink方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showMinimalList
//.........这里部分代码省略.........
$WHERE = ' WHERE ' . $WHERE . ' ';
}
$first = false;
}
$query .= $WHERE;
//// 7 - Manage GROUP BY
$GROUPBY = "";
// Meta Search / Search All / Count tickets
if (in_array('all', $p['field'])) {
$GROUPBY = " GROUP BY `" . $itemtable . "`.`id`";
}
if (empty($GROUPBY)) {
foreach ($toview as $key2 => $val2) {
if (!empty($GROUPBY)) {
break;
}
if (isset($searchopt[$itemtype][$val2]["forcegroupby"])) {
$GROUPBY = " GROUP BY `" . $itemtable . "`.`id`";
}
}
}
$query .= $GROUPBY;
//// 4 - ORDER
$ORDER = " ORDER BY `id` ";
foreach ($toview as $key => $val) {
if ($p['sort'] == $val) {
$ORDER = Search::addOrderBy($itemtype, $p['sort'], $p['order'], $key);
}
}
$query .= $ORDER;
// Get it from database
if ($result = $DB->query($query)) {
$numrows = $DB->numrows($result);
$globallinkto = Search::getArrayUrlLink("field", $p['field']) . Search::getArrayUrlLink("link", $p['link']) . Search::getArrayUrlLink("contains", $p['contains']) . Search::getArrayUrlLink("field2", $p['field2']) . Search::getArrayUrlLink("contains2", $p['contains2']) . Search::getArrayUrlLink("itemtype2", $p['itemtype2']) . Search::getArrayUrlLink("link2", $p['link2']);
$parameters = "sort=" . $p['sort'] . "&order=" . $p['order'] . $globallinkto;
if ($output_type == Search::GLOBAL_SEARCH) {
if (class_exists($itemtype)) {
echo "<div class='center'><h2>" . $this->getTypeName();
// More items
if ($numrows > $p['start'] + Search::GLOBAL_DISPLAY_COUNT) {
echo " <a href='{$target}?{$parameters}'>" . __('All') . "</a>";
}
echo "</h2></div>\n";
} else {
return false;
}
}
if ($p['start'] < $numrows) {
// Pager
if ($output_type == Search::HTML_OUTPUT) {
Html::printPager($p['start'], $numrows, $target, $parameters, $itemtype);
}
//massive action
$sel = "";
if (isset($_GET["select"]) && $_GET["select"] == "all") {
$sel = "checked";
}
// Add toview elements
$nbcols = $toview_count;
if ($output_type == Search::HTML_OUTPUT) {
// HTML display - massive modif
$nbcols++;
}
// Define begin and end var for loop
// Search case
$begin_display = $p['start'];
示例2: showMinimalList
//.........这里部分代码省略.........
}
}
}
$query .= " WHERE `" . $itemtable . "`.`plugin_resources_resources_id` = '" . $p['id'] . "'";
$query .= " AND `" . $itemtable . "`.`is_deleted` = '" . $p['is_deleted'] . "' ";
//// 7 - Manage GROUP BY
$GROUPBY = "";
// Meta Search / Search All / Count tickets
if (in_array('all', $p['field'])) {
$GROUPBY = " GROUP BY `" . $itemtable . "`.`id`";
}
if (empty($GROUPBY)) {
foreach ($toview as $key2 => $val2) {
if (!empty($GROUPBY)) {
break;
}
if (isset($searchopt[$itemtype][$val2]["forcegroupby"])) {
$GROUPBY = " GROUP BY `" . $itemtable . "`.`id`";
}
}
}
$query .= $GROUPBY;
//// 4 - ORDER
$ORDER = " ORDER BY `id` ";
foreach ($toview as $key => $val) {
if ($p['sort'] == $val) {
$ORDER = Search::addOrderBy($itemtype, $p['sort'], $p['order'], $key);
}
}
$query .= $ORDER;
// Get it from database
if ($result = $DB->query($query)) {
$numrows = $DB->numrows($result);
$globallinkto = Search::getArrayUrlLink("field", $p['field']) . Search::getArrayUrlLink("link", $p['link']) . Search::getArrayUrlLink("contains", $p['contains']) . Search::getArrayUrlLink("field2", $p['field2']) . Search::getArrayUrlLink("contains2", $p['contains2']) . Search::getArrayUrlLink("itemtype2", $p['itemtype2']) . Search::getArrayUrlLink("link2", $p['link2']);
$parameters = "sort=" . $p['sort'] . "&order=" . $p['order'] . $globallinkto;
if ($output_type == Search::GLOBAL_SEARCH) {
if (class_exists($itemtype)) {
echo "<div class='center'><h2>" . $item->getTypeName();
// More items
if ($numrows > $p['start'] + Search::GLOBAL_DISPLAY_COUNT) {
echo " <a href='{$target}?{$parameters}'>" . __('All') . "</a>";
}
echo "</h2></div>\n";
} else {
return false;
}
}
if ($p['start'] < $numrows) {
if ($output_type == Search::HTML_OUTPUT && !$p['withtemplate']) {
echo "<div align='center'>";
echo "<a href='" . $CFG_GLPI["root_doc"] . "/plugins/resources/front/task.php?contains%5B0%5D=" . $p['id'] . "&field%5B0%5D=13&sort=1&is_deleted=0&start=0'>" . _x('button', 'Search') . "</a><br>";
echo "</div>";
}
// Pager
if ($output_type == Search::HTML_OUTPUT) {
// HTML display - massive modif
$search_config = "";
if ($item->canCreate() && $canedit) {
$tmp = " class='pointer' onClick=\"var w = window.open('" . $CFG_GLPI["root_doc"] . "/front/popup.php?popup=search_config&itemtype=" . $itemtype . "' ,'glpipopup', " . "'height=400, width=1000, top=100, left=100, scrollbars=yes' ); w.focus();\"";
$search_config = "<img alt='" . __('Select default items to show') . "' title='" . __('Select default items to show') . "' src='" . $CFG_GLPI["root_doc"] . "/pics/options_search.png' ";
$search_config .= $tmp . ">";
}
//echo Search::showHeaderItem($output_type,$search_config,$header_num,"",0,$p['order']);
}
// Pager
if ($output_type == Search::HTML_OUTPUT) {
示例3: showMinimalList
//.........这里部分代码省略.........
$WHERE = ' WHERE ' . $ASSIGN . ' ' . $WHERE . ' ';
}
$first = false;
}
$query .= $WHERE;
//// 7 - Manage GROUP BY
$GROUPBY = "";
// Meta Search / Search All / Count tickets
if (in_array('all', $p['field'])) {
$GROUPBY = " GROUP BY `" . $itemtable . "`.`id`";
}
if (empty($GROUPBY)) {
foreach ($toview as $key2 => $val2) {
if (!empty($GROUPBY)) {
break;
}
if (isset($searchopt["PluginResourcesDirectory"][$val2]["forcegroupby"])) {
$GROUPBY = " GROUP BY `" . $itemtable . "`.`id`";
}
}
}
$query .= $GROUPBY;
//// 4 - ORDER
$ORDER = " ORDER BY `id` ";
foreach ($toview as $key => $val) {
if ($p['sort'] == $val) {
$ORDER = Search::addOrderBy($itemtype, $p['sort'], $p['order'], $key);
}
}
$query .= $ORDER;
// Get it from database
if ($result = $DB->query($query)) {
$numrows = $DB->numrows($result);
$globallinkto = Search::getArrayUrlLink("field", $p['field']) . Search::getArrayUrlLink("link", $p['link']) . Search::getArrayUrlLink("contains", $p['contains']) . Search::getArrayUrlLink("searchtype", $p['searchtype']) . Search::getArrayUrlLink("field2", $p['field2']) . Search::getArrayUrlLink("contains2", $p['contains2']) . Search::getArrayUrlLink("searchtype2", $p['searchtype2']) . Search::getArrayUrlLink("itemtype2", $p['itemtype2']) . Search::getArrayUrlLink("link2", $p['link2']);
$parameters = "sort=" . $p['sort'] . "&order=" . $p['order'] . $globallinkto;
if ($output_type == Search::GLOBAL_SEARCH) {
if (class_exists($itemtype)) {
echo "<div class='center'><h2>" . $this->getTypeName();
// More items
if ($numrows > $p['start'] + Search::GLOBAL_DISPLAY_COUNT) {
echo " <a href='{$target}?{$parameters}'>" . __('All') . "</a>";
}
echo "</h2></div>\n";
} else {
return false;
}
}
if ($p['start'] < $numrows) {
// Pager
if ($output_type == Search::HTML_OUTPUT) {
// HTML display - massive modif
$search_config = "";
if ($item->canCreate() && $canedit) {
$tmp = " class='pointer' onClick=\"var w = window.open('" . $CFG_GLPI["root_doc"] . "/front/popup.php?popup=search_config&itemtype=" . $itemtype . "' ,'glpipopup', " . "'height=400, width=1000, top=100, left=100, scrollbars=yes' ); w.focus();\"";
$search_config = "<img alt='" . __('Select default items to show') . "' title='" . __('Select default items to show') . "' src='" . $CFG_GLPI["root_doc"] . "/pics/options_search.png' ";
$search_config .= $tmp . ">";
}
//echo Search::showHeaderItem($output_type,$search_config,$header_num,"",0,$p['order']);
}
// Pager
if ($output_type == Search::HTML_OUTPUT) {
Html::printPager($p['start'], $numrows, $target, $parameters, $itemtype, 0, $search_config);
echo "<br>";
}
// Define begin and end var for loop
// Search case
示例4: showBoard
function showBoard($width = '', $limit = '')
{
global $DB, $CFG_GLPI;
$order = "ASC";
if (isset($_GET['order'])) {
$order = $_GET['order'];
}
$where = '';
if ($limit == 'hosts') {
$where = "`plugin_monitoring_services_id`='0' ";
} else {
if ($limit == 'services') {
$where = "`plugin_monitoring_services_id`>0 ";
}
}
if (isset($_GET['field'])) {
foreach ($_GET['field'] as $key => $value) {
$wheretmp = '';
if (isset($_GET['link'][$key])) {
$wheretmp .= " " . $_GET['link'][$key] . " ";
}
$wheretmp .= Search::addWhere("", 0, "PluginMonitoringService", $_GET['field'][$key], $_GET['searchtype'][$key], $_GET['contains'][$key]);
if (!strstr($wheretmp, "``.``")) {
if ($where != '' and !isset($_GET['link'][$key])) {
$where .= " AND ";
}
$where .= $wheretmp;
}
}
}
if ($where != '') {
$where = "(" . $where;
$where .= ") AND ";
}
$where .= ' `glpi_plugin_monitoring_services`.`entities_id` IN (' . $_SESSION['glpiactiveentities_string'] . ')';
if ($where != '') {
$where = " WHERE " . $where;
$where = str_replace("`" . getTableForItemType("PluginMonitoringDisplay") . "`.", "", $where);
}
$leftjoin = '';
$leftjoin .= " LEFT JOIN `glpi_plugin_monitoring_components`\n ON `plugin_monitoring_components_id` = \n `glpi_plugin_monitoring_components`.`id` ";
$leftjoin .= " LEFT JOIN `glpi_entities`\n ON `" . getTableForItemType("PluginMonitoringService") . "`.`entities_id` = \n `glpi_entities`.`id`";
if (isset($_GET['field'])) {
foreach ($_GET['field'] as $value) {
if ($value == '20' or $value == '21' or $value == '22') {
$leftjoin .= " LEFT JOIN `glpi_plugin_monitoring_componentscatalogs_hosts`\n ON `plugin_monitoring_componentscatalogs_hosts_id` = \n `glpi_plugin_monitoring_componentscatalogs_hosts`.`id` ";
} else {
if ($value == '7') {
} else {
if ($value == '8') {
if (!strstr($leftjoin, 'LEFT JOIN `glpi_plugin_monitoring_componentscatalogs_hosts`')) {
$leftjoin .= " LEFT JOIN `glpi_plugin_monitoring_componentscatalogs_hosts`\n ON `plugin_monitoring_componentscatalogs_hosts_id` = \n `glpi_plugin_monitoring_componentscatalogs_hosts`.`id` ";
}
if (!strstr($leftjoin, 'LEFT JOIN `glpi_plugin_monitoring_componentscatalogs`')) {
$leftjoin .= " LEFT JOIN `glpi_plugin_monitoring_componentscatalogs`\n ON `glpi_plugin_monitoring_componentscatalogs_hosts`.`plugin_monitoring_componentscalalog_id` = \n `glpi_plugin_monitoring_componentscatalogs`.`id` ";
}
}
}
}
}
}
// * ORDER
$ORDERQUERY = " ORDER BY `name` ";
$toview = array(3, 6, 7, 10, 4, 9);
$toviewComplete = array('ITEM_0' => 'state', 'ITEM_1' => 'completename', 'ITEM_2' => 'component_name', 'ITEM_3' => 'state', 'ITEM_4' => 'last_check', 'ITEM_5' => 'event');
foreach ($toview as $key => $val) {
if ($_GET['sort'] == $val) {
$ORDERQUERY = Search::addOrderBy("PluginMonitoringService", $_GET['sort'], $_GET['order'], $key);
foreach ($toviewComplete as $keyi => $vali) {
$ORDERQUERY = str_replace($keyi, $vali, $ORDERQUERY);
}
}
}
$query = "SELECT `" . getTableForItemType("PluginMonitoringService") . "`.*,\n `glpi_plugin_monitoring_components`.`name` as component_name, \n `glpi_entities`.`completename`\n FROM `" . getTableForItemType("PluginMonitoringService") . "`\n " . $leftjoin . "\n " . $where . "\n " . $ORDERQUERY;
$result = $DB->query($query);
$start = 0;
if (isset($_GET["start"])) {
$start = $_GET["start"];
}
$numrows = $DB->numrows($result);
$parameters = '';
$globallinkto = Search::getArrayUrlLink("field", $_GET['field']) . Search::getArrayUrlLink("link", $_GET['link']) . Search::getArrayUrlLink("contains", $_GET['contains']) . Search::getArrayUrlLink("searchtype", $_GET['searchtype']) . Search::getArrayUrlLink("field2", $_GET['field2']) . Search::getArrayUrlLink("contains2", $_GET['contains2']) . Search::getArrayUrlLink("itemtype2", $_GET['itemtype2']) . Search::getArrayUrlLink("searchtype2", $_GET['searchtype2']) . Search::getArrayUrlLink("link2", $_GET['link2']);
$parameters = "sort=" . $_GET['sort'] . "&order=" . $_GET['order'] . $globallinkto;
Html::printPager($_GET['start'], $numrows, $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/service.php", $parameters);
$limit = $numrows;
if ($_SESSION["glpilist_limit"] < $numrows) {
$limit = $_SESSION["glpilist_limit"];
}
$query .= " LIMIT " . intval($start) . "," . intval($_SESSION['glpilist_limit']);
$result = $DB->query($query);
echo '<div id="custom_date" style="display:none"></div>';
echo '<div id="custom_time" style="display:none"></div>';
if ($width == '') {
echo "<table class='tab_cadrehov' style='width:100%;'>";
} else {
echo "<table class='tab_cadrehov' style='width:100%;'>";
}
$num = 0;
echo "<tr class='tab_bg_1'>";
$this->showHeaderItem(__('Status'), 3, $num, $start, $globallinkto);
//.........这里部分代码省略.........
示例5: showBoard
function showBoard($width = '', $limit = '')
{
global $DB, $CFG_GLPI, $LANG;
$where = '';
if ($limit == 'hosts') {
$where = "`plugin_monitoring_services_id`='0' ";
} else {
if ($limit == 'services') {
$where = "`plugin_monitoring_services_id`>0 ";
}
}
if (isset($_SESSION['plugin_monitoring']['service']['field'])) {
foreach ($_SESSION['plugin_monitoring']['service']['field'] as $key => $value) {
$wheretmp = '';
if (isset($_SESSION['plugin_monitoring']['service']['link'][$key])) {
$wheretmp .= " " . $_SESSION['plugin_monitoring']['service']['link'][$key] . " ";
}
$wheretmp .= Search::addWhere("", 0, "PluginMonitoringService", $_SESSION['plugin_monitoring']['service']['field'][$key], $_SESSION['plugin_monitoring']['service']['searchtype'][$key], $_SESSION['plugin_monitoring']['service']['contains'][$key]);
if (!strstr($wheretmp, "``.``")) {
if ($where != '' and !isset($_SESSION['plugin_monitoring']['service']['link'][$key])) {
$where .= " AND ";
}
$where .= $wheretmp;
}
}
}
if ($where != '') {
$where = "(" . $where;
$where .= ") AND ";
}
$where .= ' `glpi_plugin_monitoring_services`.`entities_id` IN (' . $_SESSION['glpiactiveentities_string'] . ')';
if ($where != '') {
$where = " WHERE " . $where;
$where = str_replace("`" . getTableForItemType("PluginMonitoringDisplay") . "`.", "", $where);
}
$leftjoin = '';
if (isset($_SESSION['plugin_monitoring']['service']['field'])) {
foreach ($_SESSION['plugin_monitoring']['service']['field'] as $value) {
if ($value == '20' or $value == '21' or $value == '22') {
$leftjoin .= " LEFT JOIN `glpi_plugin_monitoring_componentscatalogs_hosts`\n ON `plugin_monitoring_componentscatalogs_hosts_id` = \n `glpi_plugin_monitoring_componentscatalogs_hosts`.`id` ";
} else {
if ($value == '7') {
$leftjoin .= " LEFT JOIN `glpi_plugin_monitoring_components`\n ON `plugin_monitoring_components_id` = \n `glpi_plugin_monitoring_components`.`id` ";
} else {
if ($value == '8') {
if (!strstr($leftjoin, 'LEFT JOIN `glpi_plugin_monitoring_componentscatalogs_hosts`')) {
$leftjoin .= " LEFT JOIN `glpi_plugin_monitoring_componentscatalogs_hosts`\n ON `plugin_monitoring_componentscatalogs_hosts_id` = \n `glpi_plugin_monitoring_componentscatalogs_hosts`.`id` ";
}
if (!strstr($leftjoin, 'LEFT JOIN `glpi_plugin_monitoring_componentscatalogs`')) {
$leftjoin .= " LEFT JOIN `glpi_plugin_monitoring_componentscatalogs`\n ON `glpi_plugin_monitoring_componentscatalogs_hosts`.`plugin_monitoring_componentscalalog_id` = \n `glpi_plugin_monitoring_componentscatalogs`.`id` ";
}
}
}
}
}
}
$query = "SELECT `" . getTableForItemType("PluginMonitoringService") . "`.* FROM `" . getTableForItemType("PluginMonitoringService") . "`\n " . $leftjoin . "\n " . $where . "\n ORDER BY `name`";
$result = $DB->query($query);
$start = 0;
if (isset($_GET["start"])) {
$start = $_GET["start"];
}
$numrows = $DB->numrows($result);
$parameters = '';
$globallinkto = Search::getArrayUrlLink("field", $_GET['field']) . Search::getArrayUrlLink("link", $_GET['link']) . Search::getArrayUrlLink("contains", $_GET['contains']) . Search::getArrayUrlLink("searchtype", $_GET['searchtype']) . Search::getArrayUrlLink("field2", $_GET['field2']) . Search::getArrayUrlLink("contains2", $_GET['contains2']) . Search::getArrayUrlLink("itemtype2", $_GET['itemtype2']) . Search::getArrayUrlLink("searchtype2", $_GET['searchtype2']) . Search::getArrayUrlLink("link2", $_GET['link2']);
$parameters = "sort=" . $_GET['sort'] . "&order=" . $_GET['order'] . $globallinkto;
printPager($_GET['start'], $numrows, $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/display.php", $parameters);
$limit = $numrows;
if ($_SESSION["glpilist_limit"] < $numrows) {
$limit = $_SESSION["glpilist_limit"];
}
$query .= " LIMIT " . intval($start) . "," . intval($_SESSION['glpilist_limit']);
$result = $DB->query($query);
if ($width == '') {
echo "<table class='tab_cadrehov' style='width:100%;'>";
} else {
echo "<table class='tab_cadrehov' style='width:100%;'>";
}
echo "<tr class='tab_bg_1'>";
echo "<th>";
echo $LANG['joblist'][0];
echo "</th>";
echo "<th>";
echo $LANG['entity'][0];
echo "</th>";
echo "<th>";
echo $LANG['stats'][7];
echo "</th>";
echo "<th>";
echo $LANG['state'][6] . " - " . $LANG['common'][16];
echo "</th>";
echo "<th>";
echo $LANG['plugin_monitoring']['component'][0];
echo "</th>";
echo "<th>";
echo $LANG['state'][0];
echo "</th>";
echo "<th>";
echo $LANG['plugin_monitoring']['service'][18];
echo "</th>";
//.........这里部分代码省略.........
示例6: seePreImport
/**
* Prints display pre import
*
* @param $type the type of device
* @param $configID the ID of the supplier config
* @param $start for pager display
* @param $complete to see all device (already imported and not)
* @return nothing (print out a table)
*
*/
static function seePreImport($params)
{
global $DB, $CFG_GLPI;
// Default values of parameters
$p['link'] = array();
//
$p['field'] = array();
//
$p['contains'] = array();
//
$p['searchtype'] = array();
//*/
$p['sort'] = '1';
//
$p['order'] = 'ASC';
//
$p['start'] = 0;
//
$p['export_all'] = 0;
$p['link2'] = '';
//
$p['contains2'] = '';
//
$p['field2'] = '';
//
$p['itemtype2'] = '';
$p['searchtype2'] = '';
$p['itemtype'] = '';
$p['manufacturers_id'] = '';
$p['imported'] = '';
foreach ($params as $key => $val) {
$p[$key] = $val;
}
$globallinkto = Search::getArrayUrlLink("field", $p['field']) . Search::getArrayUrlLink("link", $p['link']) . Search::getArrayUrlLink("contains", $p['contains']) . Search::getArrayUrlLink("searchtype", $p['searchtype']) . Search::getArrayUrlLink("field2", $p['field2']) . Search::getArrayUrlLink("contains2", $p['contains2']) . Search::getArrayUrlLink("searchtype2", $p['searchtype2']) . Search::getArrayUrlLink("itemtype2", $p['itemtype2']) . Search::getArrayUrlLink("link2", $p['link2']);
$modeltable = "";
$target = $CFG_GLPI["root_doc"] . "/plugins/manufacturersimports/front/import.php";
if ($p['itemtype'] && $p['manufacturers_id']) {
$config = new PluginManufacturersimportsConfig();
$config->GetFromDB($p['manufacturers_id']);
$suppliername = $config->fields["name"];
$supplierclass = "PluginManufacturersimports" . $suppliername;
$supplier = new $supplierclass();
$infocom = new Infocom();
$canedit = plugin_manufacturersimports_haveRight("manufacturersimports", "w") && $infocom->canUpdate();
if (!$p['start']) {
$p['start'] = 0;
}
$modeltable = getTableForItemType($p['itemtype'] . "Model");
$modelfield = getForeignKeyFieldForTable(getTableForItemType($p['itemtype'] . "Model"));
$item = new $p['itemtype']();
$itemtable = getTableForItemType($p['itemtype']);
$query = "SELECT `" . $itemtable . "`.`id`,\n `" . $itemtable . "`.`name`, \n `" . $itemtable . "`.`serial`,\n `" . $itemtable . "`.`entities_id`,\n `glpi_plugin_manufacturersimports_logs`.`import_status`,\n `glpi_plugin_manufacturersimports_logs`.`items_id`,\n `glpi_plugin_manufacturersimports_logs`.`itemtype`, \n `glpi_plugin_manufacturersimports_logs`.`documents_id`,\n `glpi_plugin_manufacturersimports_logs`.`date_import`, \n '" . $p['itemtype'] . "' AS type,\n `{$modeltable}`.`name` AS model_name\n FROM `" . $itemtable . "` ";
//model device left join
$query .= "LEFT JOIN `{$modeltable}` ON (`{$modeltable}`.`id` = `" . $itemtable . "`.`" . $modelfield . "`) ";
$query .= " LEFT JOIN `glpi_entities` ON (`glpi_entities`.`id` = `" . $itemtable . "`.`entities_id`)";
$query .= " LEFT JOIN `glpi_plugin_manufacturersimports_configs` \n ON (`glpi_plugin_manufacturersimports_configs`.`manufacturers_id` = `" . $itemtable . "`.`manufacturers_id`)";
$query .= " LEFT JOIN `glpi_plugin_manufacturersimports_logs` \n ON (`glpi_plugin_manufacturersimports_logs`.`items_id` = `" . $itemtable . "`.`id` \n AND `glpi_plugin_manufacturersimports_logs`.`itemtype` = '" . $p['itemtype'] . "')";
$query .= " LEFT JOIN `glpi_plugin_manufacturersimports_models` \n ON (`glpi_plugin_manufacturersimports_models`.`items_id` = `" . $itemtable . "`.`id` \n AND `glpi_plugin_manufacturersimports_models`.`itemtype` = '" . $p['itemtype'] . "')";
//serial must be not empty
$query .= " WHERE `" . $itemtable . "`.`is_deleted` = '0'\n AND `" . $itemtable . "`.`is_template` = '0'\n AND `glpi_plugin_manufacturersimports_configs`.`id` = '" . $p['manufacturers_id'] . "'\n AND `" . $itemtable . "`.`serial` != '' ";
//already imported
if ($p['imported'] == self::IMPORTED) {
$query .= " AND `import_status` != " . self::IMPORTED . "";
//not imported
} else {
if ($p['imported'] == self::NOT_IMPORTED) {
$query .= " AND (`date_import` IS NULL OR `import_status` = " . self::IMPORTED . " ";
$query .= ") ";
}
}
$entities = "";
if ($config->isRecursive()) {
$entities = getSonsOf('glpi_entities', $config->getEntityID());
} else {
$entities = $config->getEntityID();
}
$query .= "" . getEntitiesRestrictRequest(" AND", $itemtable, '', '', $item->maybeRecursive());
//// 4 - ORDER
$ORDER = " ORDER BY `entities_id`,`" . $itemtable . "`.`name` ";
$toview = array("name" => 1);
foreach ($toview as $key => $val) {
if ($p['sort'] == $val) {
$ORDER = self::addOrderBy($p['itemtype'], $p['sort'], $p['order'], $key);
}
}
$query .= $ORDER;
$result = $DB->query($query);
$numrows = $DB->numrows($result);
if ($p['start'] < $numrows) {
// Set display type for export if define
//.........这里部分代码省略.........