本文整理汇总了PHP中CSearch::NavStart方法的典型用法代码示例。如果您正苦于以下问题:PHP CSearch::NavStart方法的具体用法?PHP CSearch::NavStart怎么用?PHP CSearch::NavStart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSearch
的用法示例。
在下文中一共展示了CSearch::NavStart方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Date
if (intVal($_REQUEST["DATE_CHANGE"]) > 0) {
$arFilter1["DATE_CHANGE"] = Date(CDatabase::DateFormatToPHP(CLang::GetDateFormat("FULL", LANGUAGE_ID)), time() - intVal($_REQUEST["DATE_CHANGE"]) * 24 * 3600 + CTimeZone::GetOffset());
}
$arFilter2 = array();
if (!empty($arParams["FID_RANGE"]) || !empty($arParams["FID"])) {
$arFilter2["PARAM1"] = empty($arParams["FID_RANGE"]) ? array() : array_keys($arResult["FORUMS"]);
$arFilter2["PARAM1"] = empty($arParams["FID"]) ? $arFilter2["PARAM1"] : $arParams["FID"];
}
$obSearch = new CSearch();
//When restart option is set we will ignore error on query with only stop words
$obSearch->SetOptions(array("ERROR_ON_EMPTY_STEM" => $arParams["RESTART"] != "Y", "NO_WORD_LOGIC" => $arParams["NO_WORD_LOGIC"] == "Y"));
$obSearch->Search($arFilter1, $aSort, array($arFilter2));
if ($obSearch->errorno != 0) {
$arResult["ERROR_MESSAGE"] = $obSearch->error;
} else {
$obSearch->NavStart($arParams["TOPICS_PER_PAGE"], false);
$obSearch->nPageWindow = $arParams["PAGE_NAVIGATION_WINDOW"];
$arResult["NAV_RESULT"] = $obSearch;
$arResult["NAV_STRING"] = $obSearch->GetPageNavStringEx($navComponentObject, GetMessage("FL_TOPIC_LIST"), $arParams["PAGE_NAVIGATION_TEMPLATE"]);
$arResult["EMPTY"] = "Y";
$topics = array();
if ($res = $obSearch->GetNext()) {
$arResult["order"]["~relevance"] = $APPLICATION->GetCurPageParam("q=" . urlencode($q) . (!empty($arParams["FID"]) ? "&FORUM_ID=" . $arParams["FID"] : ""), array("FORUM_ID", "q", "order", "s", BX_AJAX_PARAM_ID));
$arResult["order"]["~topic"] = $APPLICATION->GetCurPageParam("q=" . urlencode($q) . (!empty($arParams["FID"]) ? "&FORUM_ID=" . $arParams["FID"] : "") . "&order=topic", array("FORUM_ID", "q", "order", "s", BX_AJAX_PARAM_ID));
$arResult["order"]["~date"] = $APPLICATION->GetCurPageParam("q=" . urlencode($q) . (!empty($arParams["FID"]) ? "&FORUM_ID=" . $arParams["FID"] : "") . "&order=date", array("FORUM_ID", "q", "order", "s", BX_AJAX_PARAM_ID));
$arResult["order"]["relevance"] = htmlspecialcharsbx($arResult["order"]["~relevance"]);
$arResult["order"]["topic"] = htmlspecialcharsbx($arResult["order"]["~topic"]);
$arResult["order"]["date"] = htmlspecialcharsbx($arResult["order"]["~date"]);
$arResult["EMPTY"] = "N";
do {
if (intVal($res["ITEM_ID"]) > 0) {
示例2: while
</tr>
<tr>
<td align="center" valign="top"><font class="text">не</font></td>
<td valign="top"><font class="text">not, ~</font></td>
<td><font class="text">Оператор <i>логическое "не"</i> ограничивает поиск страниц, не содержащих слово, указанное после оператора. </font></td>
</tr>
<tr>
<td align="center" valign="top"><font class="text">( )</font></td>
<td valign="top"><font class="text"> </font></td>
<td><font class="text"><i>Круглые скобки</i> задают порядок действия логических операторов. </font></td>
</tr>
</table>
</font>
<?php
} else {
$obSearch->NavStart(20, false);
$obSearch->NavPrint("Результаты поиска");
?>
<br><br>
<?php
$bEmptyFlag = True;
while ($arResult = $obSearch->Fetch()) {
$bEmptyFlag = False;
?>
<font class="text">
<a href="<?php
echo $arResult["URL"];
?>
"><?php
echo $arResult["TITLE_FORMATED"];
?>
示例3: array
}
$arResult["SEARCH_RESULT"] = array();
if ($bSearchInstalled && (strlen($arResult["~q"]) > 0 || strlen($arResult["~tags"]) > 0)) {
$arFilter = array("SITE_ID" => SITE_ID, "QUERY" => $arResult["~q"], array("=MODULE_ID" => "socialnetwork", "ITEM_ID" => "G%"), "CHECK_DATES" => "Y", "TAGS" => $arResult["~tags"]);
if (strlen($arResult["~subject"]) > 0) {
$arFilter["PARAM1"] = $arResult["~subject"];
}
if ($arResult["~how"] == "d") {
$aSort = array("DATE_CHANGE" => "DESC", "CUSTOM_RANK" => "DESC", "RANK" => "DESC");
} else {
$aSort = array("CUSTOM_RANK" => "DESC", "RANK" => "DESC", "DATE_CHANGE" => "DESC");
}
$obSearch = new CSearch();
$obSearch->Search($arFilter, $aSort);
if ($obSearch->errorno == 0) {
$obSearch->NavStart($arParams["ITEMS_COUNT"]);
$arResult["NAV_STRING"] = $obSearch->GetPageNavString(GetMessage("SONET_C24_GROUPS"), "");
while ($arSearch = $obSearch->GetNext()) {
$arGroup = CSocNetGroup::GetByID($arSearch["PARAM2"]);
$arSearch["URL"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $arGroup["ID"]));
if (intval($arGroup["IMAGE_ID"]) <= 0) {
$arGroup["IMAGE_ID"] = COption::GetOptionInt("socialnetwork", "default_group_picture", false, SITE_ID);
}
$arImage = CSocNetTools::InitImage($arGroup["IMAGE_ID"], 100, "/bitrix/images/socialnetwork/nopic_group_100.gif", 100, $arSearch["URL"], true);
$arSearch["IMAGE_FILE"] = $arImage["FILE"];
$arSearch["IMAGE_IMG"] = $arImage["IMG"];
$arSearch["SUBJECT_NAME"] = $arGroup["SUBJECT_NAME"];
$arSearch["NUMBER_OF_MEMBERS"] = $arGroup["NUMBER_OF_MEMBERS"];
$arSearch["FULL_DATE_CHANGE_FORMATED"] = date($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($arSearch["FULL_DATE_CHANGE"], CSite::GetDateFormat("FULL")));
$arSearch["ARCHIVE"] = $arGroup["CLOSED"];
$arResult["SEARCH_RESULT"][] = $arSearch;
示例4: array
{
$arFilter["PARAM1"] = "C".$arParams["COURSE_ID"];
}
*/
if ($arResult["~how"] == "d") {
$aSort = array("DATE_CHANGE" => "DESC", "CUSTOM_RANK" => "DESC", "RANK" => "DESC");
} else {
$aSort = array("CUSTOM_RANK" => "DESC", "RANK" => "DESC", "DATE_CHANGE" => "DESC");
}
$arResult["SEARCH_RESULT"] = array();
if (strlen($arResult["~q"]) > 0 || strlen($arResult["~tags"]) > 0) {
$obSearch = new CSearch();
$obSearch->Search($arFilter, $aSort);
$arResult["SEARCH_RESULT"] = array();
if ($obSearch->errorno == 0) {
$obSearch->NavStart($arParams["PAGE_RESULT_COUNT"]);
$arResult["NAV_STRING"] = $obSearch->GetPageNavString(GetMessage("LEARNING_RESULT_PAGES"), $arParams["NAV_TEMPLATE"]);
while ($arSearch = $obSearch->GetNext()) {
$arResult["SEARCH_RESULT"][] = $arSearch;
}
if (count($arResult["SEARCH_RESULT"]) > 0) {
if (strlen($arResult["~tags"]) > 0) {
$arResult["ORDER_LINK"] = $APPLICATION->GetCurPageParam("tags=" . urlencode($arResult["tags"]) . "&where=" . urlencode($arResult["where"]), array("tags", "where", "how"));
} else {
$arResult["ORDER_LINK"] = $APPLICATION->GetCurPageParam("q=" . urlencode($arResult["q"]) . "&where=" . urlencode($arResult["where"]), array("q", "where", "how"));
}
if ($arResult["~how"] != "d") {
$arResult["ORDER_LINK"] .= "&how=d";
}
} else {
$arResult["ERROR_MESSAGE"] = GetMessage("LEARNING_MAIN_SEARCH_NOTHING_FOUND");
示例5: getSearchedElement
/**
* $arParams,
* $request
*/
function getSearchedElement($arParams, $request)
{
if (!CModule::IncludeModule("search")) {
return false;
}
$arParams["SHOW_WHEN"] = $arParams["SHOW_WHEN"] == "Y";
if (!is_array($arParams["arrWHERE"])) {
$arParams["arrWHERE"] = array();
}
$arParams["PAGE_RESULT_COUNT"] = 50;
if ($arParams["DEFAULT_SORT"] !== "date") {
$arParams["DEFAULT_SORT"] = "rank";
}
if (strlen($arParams["FILTER_NAME"]) <= 0 || !preg_match("/^[A-Za-z_][A-Za-z01-9_]*\$/", $arParams["FILTER_NAME"])) {
$arFILTERCustom = array();
} else {
$arFILTERCustom = $GLOBALS[$arParams["FILTER_NAME"]];
if (!is_array($arFILTERCustom)) {
$arFILTERCustom = array();
}
}
$exFILTER = CSearchParameters::ConvertParamsToFilter($arParams, "arrFILTER");
//options
if (isset($_REQUEST["q"])) {
$q = trim($_REQUEST["q"]);
} else {
$q = false;
}
if ($q !== false) {
if ($arParams["USE_LANGUAGE_GUESS"] == "N" || isset($_REQUEST["spell"])) {
$arResult["REQUEST"]["~QUERY"] = $q;
$arResult["REQUEST"]["QUERY"] = htmlspecialcharsex($q);
} else {
$arLang = CSearchLanguage::GuessLanguage($q);
if (is_array($arLang) && $arLang["from"] != $arLang["to"]) {
$arResult["REQUEST"]["~ORIGINAL_QUERY"] = $q;
$arResult["REQUEST"]["ORIGINAL_QUERY"] = htmlspecialcharsex($q);
$arResult["REQUEST"]["~QUERY"] = CSearchLanguage::ConvertKeyboardLayout($arResult["REQUEST"]["~ORIGINAL_QUERY"], $arLang["from"], $arLang["to"]);
$arResult["REQUEST"]["QUERY"] = htmlspecialcharsex($arResult["REQUEST"]["~QUERY"]);
} else {
$arResult["REQUEST"]["~QUERY"] = $q;
$arResult["REQUEST"]["QUERY"] = htmlspecialcharsex($q);
}
}
}
$arResult["URL"] = $APPLICATION->GetCurPage() . "?q=" . urlencode($q) . (isset($_REQUEST["spell"]) ? "&spell=1" : "") . ($tags !== false ? "&tags=" . urlencode($tags) : "");
if (isset($arResult["REQUEST"]["~ORIGINAL_QUERY"])) {
$arResult["ORIGINAL_QUERY_URL"] = $APPLICATION->GetCurPage() . "?q=" . urlencode($arResult["REQUEST"]["~ORIGINAL_QUERY"]) . "&spell=1" . "&where=" . urlencode($arResult["REQUEST"]["WHERE"]) . ($arResult["REQUEST"]["HOW"] == "d" ? "&how=d" : "") . ($arResult["REQUEST"]["FROM"] ? '&from=' . urlencode($arResult["REQUEST"]["~FROM"]) : "") . ($arResult["REQUEST"]["TO"] ? '&to=' . urlencode($arResult["REQUEST"]["~TO"]) : "") . ($tags !== false ? "&tags=" . urlencode($tags) : "");
}
$templatePage = "";
$arReturn = false;
$arFilter = array("SITE_ID" => SITE_ID, "QUERY" => $arResult["REQUEST"]["~QUERY"], "TAGS" => $arResult["REQUEST"]["~TAGS"]);
$arFilter = array_merge($arFILTERCustom, $arFilter);
if ($from) {
$arFilter[">=DATE_CHANGE"] = $from;
}
if ($to) {
$arFilter["<=DATE_CHANGE"] = $to;
}
$obSearch = new CSearch();
//When restart option is set we will ignore error on query with only stop words
$obSearch->SetOptions(array("ERROR_ON_EMPTY_STEM" => $arParams["RESTART"] != "Y", "NO_WORD_LOGIC" => $arParams["NO_WORD_LOGIC"] == "Y"));
$obSearch->Search($arFilter, $aSort, $exFILTER);
$arResult["ERROR_CODE"] = $obSearch->errorno;
$arResult["ERROR_TEXT"] = $obSearch->error;
$arResult["SEARCH"] = array();
if ($obSearch->errorno == 0) {
$obSearch->NavStart($arParams["PAGE_RESULT_COUNT"], false);
$ar = $obSearch->GetNext();
//Search restart
if (!$ar && $arParams["RESTART"] == "Y" && $obSearch->Query->bStemming) {
$exFILTER["STEMMING"] = false;
$obSearch = new CSearch();
$obSearch->Search($arFilter, $aSort, $exFILTER);
$arResult["ERROR_CODE"] = $obSearch->errorno;
$arResult["ERROR_TEXT"] = $obSearch->error;
if ($obSearch->errorno == 0) {
$obSearch->NavStart($arParams["PAGE_RESULT_COUNT"], false);
$ar = $obSearch->GetNext();
}
}
$arReturn = array();
while ($ar) {
$arReturn[$ar["ID"]] = $ar["ITEM_ID"];
$ar["CHAIN_PATH"] = $APPLICATION->GetNavChain($ar["URL"], 0, $folderPath . "/chain_template.php", true, false);
$ar["URL"] = htmlspecialcharsbx($ar["URL"]);
$ar["TAGS"] = array();
if (!empty($ar["~TAGS_FORMATED"])) {
foreach ($ar["~TAGS_FORMATED"] as $name => $tag) {
if ($arParams["TAGS_INHERIT"] == "Y") {
$arTags = $arResult["REQUEST"]["~TAGS_ARRAY"];
$arTags[$tag] = $tag;
$tags = implode(",", $arTags);
} else {
$tags = $tag;
}
//.........这里部分代码省略.........