本文整理汇总了PHP中search::setUserLimit方法的典型用法代码示例。如果您正苦于以下问题:PHP search::setUserLimit方法的具体用法?PHP search::setUserLimit怎么用?PHP search::setUserLimit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类search
的用法示例。
在下文中一共展示了search::setUserLimit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: searchProject
function searchProject($string, $categories, $page = 1, $type_loading = 1)
{
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/search/search.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/professions.php';
$objResponse = new xajaxResponse();
if (!$string) {
$string = '';
}
$limit_project = 10;
if ($type_loading == 0) {
$filter['active'] = 't';
$filter['my_specs'] = 'f';
if ($categories[0] != '-1') {
$filter['categories'][0] = array($categories[0] => '0');
if ($categories[1] != '-1') {
unset($filter['categories'][0]);
$filter['categories'][1] = array($categories[1] => '1');
}
}
$project = new new_projects();
$project->page_size = $limit_project;
$projects = $project->getProjects($total, -1, $page, false, $filter, true, false, null, true);
} else {
$_SESSION['search_tab_active'] = 'projects';
$search = new search(false);
$search->setUserLimit($limit_project);
$search->addElement('projects', true, $limit_project);
$filter['active'] = 't';
$filter['my_specs'] = 'f';
if ($categories[0] != '-1') {
$filter['categories'][0] = array($categories[0] => '0');
if ($categories[1] != '-1') {
unset($filter['categories'][0]);
$filter['categories'][1] = array($categories[1] => '1');
}
} else {
$filter['categories'] = null;
}
$filter['is_closed_contest'] = true;
$search->search($string, $page, $filter);
$element = $search->getElements();
$total = $element['projects']->total;
$projects = $element['projects']->results;
}
$max_page = ceil($total / $limit_project);
$next_page = $page + 1;
if ($projects) {
if ($page > 1) {
$dont_show_hint = true;
}
ob_start();
include $_SERVER['DOCUMENT_ROOT'] . '/wizard/registration/steps/tpl.step.search.project.php';
$html = ob_get_clean();
$objResponse->script("\$('project_search_hint').show()");
} else {
$html = 'Совпадений не найдено';
$objResponse->script("\$('project_search_hint').hide()");
}
if ($next_page > $max_page) {
$objResponse->script("\$('load_project').getElement('.b-button').addClass('b-button_disabled')");
} else {
$objResponse->script("\$('load_project').getElement('.b-button').removeClass('b-button_disabled')");
$objResponse->assign('page-search', 'value', $next_page);
}
if ($page > 1) {
$objResponse->assign('project_loader_content', 'innerHTML', $html);
$objResponse->script("var html = new Element('span', {html:\$('project_loader_content').get('html')});\n \$('project_content').adopt(html);");
$objResponse->assign('project_loader_content', 'innerHTML', '');
} else {
$objResponse->assign('project_content', 'innerHTML', $html);
}
return $objResponse;
}
示例2: isset
if (!$type) {
$_SESSION['search_string'] = '';
}
$_SESSION['search_string'] = isset($_POST['search_string']) || $action == 'search' ? base64_encode(html_entity_decode(stripslashes(trim($pss)), ENT_QUOTES)) : $_SESSION['search_string'];
if (isset($_POST['search_elms']) && is_array($_POST['search_elms'])) {
$search_elms = array();
foreach ($_POST['search_elms'] as $search_elm => $total) {
if (in_array($search_elm, array('projects', 'users', 'works', 'messages', 'commune', 'notes'))) {
$search_elms[$search_elm] = abs(intval($total));
}
}
$_SESSION['search_elms'] = $search_elms;
}
$search_string = trim(base64_decode($_SESSION['search_string']) . ' ' . $_SESSION['string_professions']);
$search = new search($uid);
$search->setUserLimit($set_usr_limit);
foreach ($_SESSION['search_elms'] as $key => $total) {
$search->addElement($key, true, $set_usr_limit);
}
if ($type == 'all') {
$action = 'search';
}
if (!$page) {
$page = 1;
$bPageDefault = true;
}
if ($_POST['action']) {
$action = $_POST['action'];
}
if (isset($_SESSION['search_advanced'][$type]) && $action == 'view') {
$action = 'view_advanced';