本文整理汇总了PHP中Search::addHaving方法的典型用法代码示例。如果您正苦于以下问题:PHP Search::addHaving方法的具体用法?PHP Search::addHaving怎么用?PHP Search::addHaving使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Search
的用法示例。
在下文中一共展示了Search::addHaving方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showMinimalList
//.........这里部分代码省略.........
}
$COMMONWHERE .= $LINK . "(`glpi_plugin_resources_resources`.`users_id_recipient` = '{$who}' OR `glpi_plugin_resources_resources`.`users_id` = '{$who}') ";
}
$WHERE = "";
$HAVING = "";
// Add search conditions
// If there is search items
if ($_SESSION["glpisearchcount"][$itemtype] > 0 && count($p['contains']) > 0) {
for ($key = 0; $key < $_SESSION["glpisearchcount"][$itemtype]; $key++) {
// if real search (strlen >0) and not all and view search
if (isset($p['contains'][$key]) && strlen($p['contains'][$key]) > 0) {
// common search
if ($p['field'][$key] != "all" && $p['field'][$key] != "view") {
$LINK = " ";
$NOT = 0;
$tmplink = "";
if (is_array($p['link']) && isset($p['link'][$key])) {
if (strstr($p['link'][$key], "NOT")) {
$tmplink = " " . str_replace(" NOT", "", $p['link'][$key]);
$NOT = 1;
} else {
$tmplink = " " . $p['link'][$key];
}
} else {
$tmplink = " AND ";
}
if (isset($searchopt[$itemtype][$p['field'][$key]]["usehaving"])) {
// Manage Link if not first item
if (!empty($HAVING)) {
$LINK = $tmplink;
}
// Find key
$item_num = array_search($p['field'][$key], $toview);
$HAVING .= Search::addHaving($LINK, $NOT, $itemtype, $p['field'][$key], $p['searchtype'][$key], $p['contains'][$key], 0, $item_num);
} else {
// Manage Link if not first item
if (!empty($WHERE)) {
$LINK = $tmplink;
}
$WHERE .= Search::addWhere($LINK, $NOT, $itemtype, $p['field'][$key], $p['searchtype'][$key], $p['contains'][$key]);
}
// view and all search
} else {
$LINK = " OR ";
$NOT = 0;
$globallink = " AND ";
if (is_array($p['link']) && isset($p['link'][$key])) {
switch ($p['link'][$key]) {
case "AND":
$LINK = " OR ";
$globallink = " AND ";
break;
case "AND NOT":
$LINK = " AND ";
$NOT = 1;
$globallink = " AND ";
break;
case "OR":
$LINK = " OR ";
$globallink = " OR ";
break;
case "OR NOT":
$LINK = " AND ";
$NOT = 1;
$globallink = " OR ";
break;
示例2: constructSQL
//.........这里部分代码省略.........
}
}
}
$WHERE = "";
$HAVING = "";
// Add search conditions
// If there is search items
if ($_SESSION["glpisearchcount"][$itemtype] > 0 && count($p['contains']) > 0) {
for ($key = 0; $key < $_SESSION["glpisearchcount"][$itemtype]; $key++) {
// if real search (strlen >0) and not all and view search
if (isset($p['contains'][$key]) && strlen($p['contains'][$key]) > 0) {
// common search
if ($p['field'][$key] != "all" && $p['field'][$key] != "view") {
$LINK = " ";
$NOT = 0;
$tmplink = "";
if (is_array($p['link']) && isset($p['link'][$key])) {
if (strstr($p['link'][$key], "NOT")) {
$tmplink = " " . str_replace(" NOT", "", $p['link'][$key]);
$NOT = 1;
} else {
$tmplink = " " . $p['link'][$key];
}
} else {
$tmplink = " AND ";
}
if (isset($searchopt[$itemtype][$p['field'][$key]]["usehaving"])) {
// Manage Link if not first item
if (!empty($HAVING)) {
$LINK = $tmplink;
}
// Find key
$item_num = array_search($p['field'][$key], $toview);
$HAVING .= Search::addHaving($LINK, $NOT, $itemtype, $p['field'][$key], $p['searchtype'][$key], $p['contains'][$key], 0, $item_num);
} else {
// Manage Link if not first item
if (!empty($WHERE)) {
$LINK = $tmplink;
}
$WHERE .= Search::addWhere($LINK, $NOT, $itemtype, $p['field'][$key], $p['searchtype'][$key], $p['contains'][$key]);
}
// view and all search
} else {
$LINK = " OR ";
$NOT = 0;
$globallink = " AND ";
if (is_array($p['link']) && isset($p['link'][$key])) {
switch ($p['link'][$key]) {
case "AND":
$LINK = " OR ";
$globallink = " AND ";
break;
case "AND NOT":
$LINK = " AND ";
$NOT = 1;
$globallink = " AND ";
break;
case "OR":
$LINK = " OR ";
$globallink = " OR ";
break;
case "OR NOT":
$LINK = " AND ";
$NOT = 1;
$globallink = " OR ";
break;
示例3: showMinimalList
//.........这里部分代码省略.........
$COMMONWHERE .= getEntitiesRestrictRequest($LINK, "glpi_plugin_resources_resources", '', '', $PluginResourcesResource->maybeRecursive());
}
}
$WHERE = "";
$HAVING = "";
// Add search conditions
// If there is search items
if ($_SESSION["glpisearchcount"]["PluginResourcesDirectory"] > 0 && count($p['contains']) > 0) {
for ($key = 0; $key < $_SESSION["glpisearchcount"]["PluginResourcesDirectory"]; $key++) {
// if real search (strlen >0) and not all and view search
if (isset($p['contains'][$key]) && strlen($p['contains'][$key]) > 0) {
// common search
if ($p['field'][$key] != "all" && $p['field'][$key] != "view") {
$LINK = " ";
$NOT = 0;
$tmplink = "";
if (is_array($p['link']) && isset($p['link'][$key])) {
if (strstr($p['link'][$key], "NOT")) {
$tmplink = " " . str_replace(" NOT", "", $p['link'][$key]);
$NOT = 1;
} else {
$tmplink = " " . $p['link'][$key];
}
} else {
$tmplink = " AND ";
}
if (isset($searchopt["PluginResourcesDirectory"][$p['field'][$key]]["usehaving"])) {
// Manage Link if not first item
if (!empty($HAVING)) {
$LINK = $tmplink;
}
// Find key
$item_num = array_search($p['field'][$key], $toview);
$HAVING .= Search::addHaving($LINK, $NOT, "PluginResourcesDirectory", $p['field'][$key], $p['searchtype'][$key], $p['contains'][$key], 0, $item_num);
} else {
// Manage Link if not first item
if (!empty($WHERE)) {
$LINK = $tmplink;
}
$WHERE .= self::addWhere($LINK, $NOT, "PluginResourcesDirectory", $p['field'][$key], $p['searchtype'][$key], $p['contains'][$key]);
}
// view and all search
} else {
$LINK = " OR ";
$NOT = 0;
$globallink = " AND ";
if (is_array($p['link']) && isset($p['link'][$key])) {
switch ($p['link'][$key]) {
case "AND":
$LINK = " OR ";
$globallink = " AND ";
break;
case "AND NOT":
$LINK = " AND ";
$NOT = 1;
$globallink = " AND ";
break;
case "OR":
$LINK = " OR ";
$globallink = " OR ";
break;
case "OR NOT":
$LINK = " AND ";
$NOT = 1;
$globallink = " OR ";
break;
示例4: showList
//.........这里部分代码省略.........
}
}
}
$WHERE = "";
$HAVING = "";
// Add search conditions
// If there is search items
if ($_SESSION["glpisearchcount"][$itemtype] > 0 && count($p['contains']) > 0) {
for ($key = 0; $key < $_SESSION["glpisearchcount"][$itemtype]; $key++) {
// if real search (strlen >0) and not all and view search
if (isset($p['contains'][$key]) && strlen($p['contains'][$key]) > 0) {
// common search
if ($p['field'][$key] != "all" && $p['field'][$key] != "view") {
$LINK = " ";
$NOT = 0;
$tmplink = "";
if (is_array($p['link']) && isset($p['link'][$key])) {
if (strstr($p['link'][$key], "NOT")) {
$tmplink = " " . str_replace(" NOT", "", $p['link'][$key]);
$NOT = 1;
} else {
$tmplink = " " . $p['link'][$key];
}
} else {
$tmplink = " AND ";
}
if (isset($searchopt[$itemtype][$p['field'][$key]]["usehaving"])) {
// Manage Link if not first item
if (!empty($HAVING)) {
$LINK = $tmplink;
}
// Find key
$item_num = array_search($p['field'][$key], $toview);
$HAVING .= Search::addHaving($LINK, $NOT, $itemtype, $p['field'][$key], $p['searchtype'][$key], $p['contains'][$key], 0, $item_num);
} else {
// Manage Link if not first item
if (!empty($WHERE)) {
$LINK = $tmplink;
}
$WHERE .= self::addWhere($LINK, $NOT, $itemtype, $p['field'][$key], $p['searchtype'][$key], $p['contains'][$key]);
}
// view and all search
} else {
$LINK = " OR ";
$NOT = 0;
$globallink = " AND ";
if (is_array($p['link']) && isset($p['link'][$key])) {
switch ($p['link'][$key]) {
case "AND":
$LINK = " OR ";
$globallink = " AND ";
break;
case "AND NOT":
$LINK = " AND ";
$NOT = 1;
$globallink = " AND ";
break;
case "OR":
$LINK = " OR ";
$globallink = " OR ";
break;
case "OR NOT":
$LINK = " AND ";
$NOT = 1;
$globallink = " OR ";
break;