本文整理汇总了PHP中search::decodeSearchString方法的典型用法代码示例。如果您正苦于以下问题:PHP search::decodeSearchString方法的具体用法?PHP search::decodeSearchString怎么用?PHP search::decodeSearchString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类search
的用法示例。
在下文中一共展示了search::decodeSearchString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: empty
// проверяем поисковую строку
empty($_GET['q']) || strlen($_GET['q']) < 4 ? $arrErrors[] = ERROR_SEARCH_SHORT_QUERY : null;
// проверяем наличие всех необходимых полей в поисковом запросе
$errToken = false;
foreach ($arrFields as $key => $value) {
!isset($_GET[$key]) ? $errToken = true : null;
}
if ($errToken) {
$arrErrors[] = ERROR_SEARCH_NONE_REQUIRED_FIELDS;
} elseif ('vacancy' !== $_GET['base'] && 'resume' !== $_GET['base'] || 'exact' !== $_GET['type'] && 'any' !== $_GET['type']) {
$arrErrors[] = ERROR_SEARCH_INCORRECT_DATA;
}
if (!$arrErrors) {
// создаем объект
$search = new search(strtolower($_GET['base']));
$arrFields = array('q' => $search->decodeSearchString($_GET['q']), 'base' => strtolower($_GET['base']), 'type' => strtolower($_GET['type']), 'id_section' => validate::checkNaturalNumber($_GET['id_section']), 'id_profession' => validate::checkNaturalNumber($_GET['id_profession']), 'id_region' => validate::checkNaturalNumber($_GET['id_region']), 'id_city' => validate::checkNaturalNumber($_GET['id_city']), 'pay_from' => validate::checkNaturalNumber($_GET['pay_from']), 'currency' => in_array($_GET['currency'], $arrSysDict['Currency']['values']) ? $_GET['currency'] : false, 'period' => array_key_exists($_GET['period'], $arrSysDict['SearchPeriod']['values']) ? $_GET['period'] : 0, 'records' => in_array($_GET['records'], $arrSysDict['AnnounceRecords']['values']) ? $_GET['records'] : 5);
// смещение, всегда 0 (затем берется из $_GET)
$offset = !empty($_GET['offset']) && validate::checkNaturalNumber($_GET['offset']) ? validate::checkNaturalNumber($_GET['offset']) : 0;
//смещение, всегда
// производим поиск
$arrData = $search->searchQuery($arrFields + array('offset' => $offset));
// формируем ссылку
$path = 'index.php?ut=' . $_SESSION['sd_user'][DB_PREFIX . 'conf']['user_type'] . '&do=search&q=' . $arrFields['q'] . '&base=' . $arrFields['base'] . '&type=' . $arrFields['type'] . '&id_section=' . $arrFields['id_section'] . '&id_profession=' . $arrFields['id_profession'] . '&id_region=' . $arrFields['id_region'] . '&id_city=' . $arrFields['id_city'] . '&pay_from=' . $arrFields['pay_from'] . '&currency=' . $arrFields['currency'] . '&period=' . $arrFields['period'] . '&records=' . $arrFields['records'] . '&';
// формируем странциы
$strPages = strings::generatePage($arrData['records'], $offset, $arrFields['records'], $path, true);
// передаем в шаблон необходимые данные
$smarty->assign('link', CONF_SCRIPT_URL . 'index.php?ut=' . $_SESSION['sd_user'][DB_PREFIX . 'conf']['user_type'] . '&do=' . $arrFields['base'] . '&action=view&id=');
$smarty->assignByRef('return_data', $arrData['result']);
$smarty->assignByRef('find', $arrData['records']);
$smarty->assignByRef('time', $arrData['time']);
$smarty->assign('template', $arrFields['base'] . '.view.short.tpl');
示例2: die
*/
!defined('SDG') ? die('Triple protection!') : null;
/**
* Массив полей, содержащихся в форме поиска
*/
$arrFields = array('id_section' => false, 'id_profession' => false, 'id_region' => false, 'id_city' => false, 'chart_work' => false, 'expire_work' => false, 'education' => false, 'age_from' => false, 'age_post' => false, 'pay_from' => false, 'pay_post' => false, 'currency' => false, 'gender' => false, 'user_type' => false, 'period' => false, 'records' => false);
// поиск
if (isset($_GET['id_section'])) {
// проверяем наличие всех необходимых полей в поисковом запросе
foreach ($arrFields as $key => $value) {
!isset($_GET[$key]) ? $arrErrors = ERROR_SEARCH_NONE_REQUIRED_FIELDS : null;
}
if (!$arrErrors) {
// создаем объект
$search = new search('resume');
$arrFields = array('id_section' => validate::checkNaturalNumber($_GET['id_section']), 'id_profession' => validate::checkNaturalNumber($_GET['id_profession']), 'id_region' => validate::checkNaturalNumber($_GET['id_region']), 'id_city' => validate::checkNaturalNumber($_GET['id_city']), 'chart_work' => in_array($search->decodeSearchString($_GET['chart_work']), $arrAddDict['ChartWork']['values']) ? $search->decodeSearchString($_GET['chart_work']) : false, 'expire_work' => in_array($search->decodeSearchString($_GET['expire_work']), $arrAddDict['ExpireWorkSearch']['values']) ? $search->decodeSearchString($_GET['expire_work']) : false, 'education' => in_array($search->decodeSearchString($_GET['education']), $arrAddDict['Education']['values']) ? $search->decodeSearchString($_GET['education']) : false, 'age_from' => validate::checkNaturalNumber($_GET['age_from']), 'age_post' => validate::checkNaturalNumber($_GET['age_post']), 'pay_from' => validate::checkNaturalNumber($_GET['pay_from']), 'pay_post' => validate::checkNaturalNumber($_GET['pay_post']), 'currency' => in_array($_GET['currency'], $arrSysDict['Currency']['values']) ? $_GET['currency'] : false, 'gender' => array_key_exists($_GET['gender'], $arrSysDict['Gender']['values']) ? $_GET['gender'] : false, 'user_type' => $_GET['user_type'], 'period' => array_key_exists($_GET['period'], $arrSysDict['SearchPeriod']['values']) ? $_GET['period'] : 0, 'records' => in_array($_GET['records'], $arrSysDict['AnnounceRecords']['values']) ? $_GET['records'] : 5);
// смещение, всегда 0 (затем берется из $_GET)
$offset = isset($_GET['offset']) ? (int) abs($_GET['offset']) : 0;
// производим поиск
$arrData = $search->searchResume($arrFields + array('offset' => $offset));
if ($arrData['result']) {
// формируем ссылку
$path = 'index.php?ut=' . $_SESSION['sd_user'][DB_PREFIX . 'conf']['user_type'] . '&do=search.resume&id_section=' . $arrFields['id_section'] . '&id_profession=' . $arrFields['id_profession'] . '&id_region=' . $arrFields['id_region'] . '&id_city=' . $arrFields['id_city'] . '&chart_work=' . $arrFields['chart_work'] . '&expire_work=' . $arrFields['expire_work'] . '&education=' . $arrFields['education'] . '&age_from=' . $arrFields['age_from'] . '&age_post=' . $arrFields['age_post'] . '&pay_from=' . $arrFields['pay_from'] . '&pay_post=' . $arrFields['pay_post'] . '&currency=' . $arrFields['currency'] . '&gender=' . $arrFields['gender'] . '&user_type=' . $arrFields['user_type'] . '&period=' . $arrFields['period'] . '&records=' . $arrFields['records'] . '&';
// формируем странциы
$strPages = strings::generatePage($arrData['records'], $offset, $arrFields['records'], $path, true);
// передаем в шаблон необходимые данные
$smarty->assign('link', CONF_SCRIPT_URL . 'index.php?ut=' . $_SESSION['sd_user'][DB_PREFIX . 'conf']['user_type'] . '&do=resume&action=view&id=');
$smarty->assignByRef('return_data', $arrData['result']);
$smarty->assignByRef('string_page', $strPages);
} else {
$arrErrors[] = MESSAGE_NOT_FOUND_RECORDS;