/** * protected функция получает последние новости в соответствии с настройкой в панели администратора * * @return array or false */ public function getLastNewses() { if (CONF_ENABLE_CACHING) { if (false === ($result = caching::getCahing('caching/newses.last.cache'))) { $result = $this->getNewses("token IN ('active') AND datetime<=NOW()", array('datetime' => 'DESC'), array('strLimit' => '0, ' . CONF_NEWSES_LAST_SHOW_PERPAGE, 'calcRows' => false), array('id', 'title', 'small_text', 'datetime')); empty($result) ? $result = array() : null; caching::setCaching('caching/newses.last.cache', $result); } } else { $result = $this->getNewses("token IN ('active') AND datetime<=NOW()", array('datetime' => 'DESC'), array('strLimit' => '0, ' . CONF_NEWSES_LAST_SHOW_PERPAGE, 'calcRows' => false), array('id', 'title', 'small_text', 'datetime')); } return $result; }
/** * static функция получения статистики из БД * * @return array */ static function getStatistics(&$arrXmlTemplate, &$objVacancy, &$objResume, &$objUser) { $sides = array_merge($arrXmlTemplate['left_side'], $arrXmlTemplate['right_side']); if (false !== array_search('block.statistics.tpl', $sides)) { if (!CONF_ENABLE_CACHING || false === ($arrStat = caching::getCahing('caching/statistic.cache'))) { $arrStat = array('users' => $objUser->cntActiveUsers(), 'vacancys' => $objVacancy->cntAnnounces("token IN ('active')"), 'resumes_v' => $objResume->cntAnnounces("token IN ('active') AND visibility IN ('visible','visiblehc')"), 'resumes_m' => $objResume->cntAnnounces("token IN ('active') AND visibility IN ('visible','visiblehc','members','membershc')")); CONF_ENABLE_CACHING ? caching::setCaching('caching/statistic.cache', $arrStat) : null; } } else { $arrStat = false; } return $arrStat; }
public function getApiLastAnnounces($arrParams = false) { $returnData = false; $cacheFileName = 'caching/resume.api.last.cache'; $strWhere = "!vip AND !hot AND visibility IN ('visible','visiblehc')"; if (!empty($arrParams['limit']) && strings::ifInt($arrParams['limit'])) { $limit = $arrParams['limit']; } else { $limit = CONF_VACANCY_LAST_SHOW_PERPAGE; } if (false === ($result = caching::getCahing($cacheFileName)) || $limit > count($result)) { $result = $this->getAnnouncesByToken('active', $strWhere, array('strLimit' => '0, ' . $limit, 'calcRows' => false), array('act_datetime' => 'DESC')); empty($result) ? $result = array() : null; foreach ($result as $id => &$announce) { if ('visiblehc' === $announce['visibility']) { unset($announce['first_name'], $announce['last_name'], $announce['middle_name'], $announce['phone'], $announce['note_phone'], $announce['addition_phone_1'], $announce['note_addition_phone_1'], $announce['addition_phone_2'], $announce['note_addition_phone_2'], $announce['image'], $announce['video']); } if (empty($announce['public_email'])) { unset($announce['email']); } /** * инициализация списка разделов */ global $sections; $arrDataSections = $sections->retCategorys(); /** * инициализация списка профессий */ global $professions; $arrDataProfessions = $professions->retCategorysByIds(array($announce['id_profession'], $announce['id_profession_1'], $announce['id_profession_2'])); /** * инициализация списка регионов */ global $regions; $arrDataRegions = $regions->retCategorys(); /** * инициализация списка городов */ global $citys; $arrDataCitys = $citys->retCategorysByIds($announce['id_city']); $announce['section'] = @$arrDataSections[$announce['id_section']]['name']; $announce['profession'] = @$arrDataProfessions[$announce['id_profession']]['name']; $announce['profession_1'] = @$arrDataProfessions[$announce['id_profession_1']]['name']; $announce['profession_2'] = @$arrDataProfessions[$announce['id_profession_2']]['name']; $announce['region'] = @$arrDataRegions[$announce['id_region']]['name']; $announce['city'] = @$arrDataCitys[$announce['id_city']]['name']; unset($announce['xml_data'], $announce['id_section'], $announce['id_profession'], $announce['id_profession_1'], $announce['id_profession_2'], $announce['id_region'], $announce['id_city'], $announce['unikey'], $announce['id_user'], $announce['public_email'], $announce['birthday'], $announce['act_period'], $announce['subscription'], $announce['vip'], $announce['vip_unset_datetime'], $announce['hot'], $announce['hot_unset_datetime'], $announce['rate'], $announce['cnt_views_total'], $announce['cnt_views_temp'], $announce['cnt_views_temp_datetime'], $announce['cnt_views_last_ip'], $announce['token'], $announce['token_datetime'], $announce['visibility'], $announce['comments']); } caching::setCaching($cacheFileName, $result); } $result = array_slice($result, 0, $limit); $returnData = array('resume' => &$result); return $returnData; }
/** * private функция считывает данные структуры таблицы БД * * @return bool */ private function tbReadFieldList() { $strQuery = "SHOW COLUMNS FROM " . $this->tbPrefix . $this->tbPostfix; if (CONF_ENABLE_CACHING) { if ($this->tbTableStructure = caching::getCahing('caching/' . $this->tbPrefix . $this->tbPostfix . '.tsc')) { return true; } else { db::$dbTypeSelect = 'multi'; return !($this->tbTableStructure = db::dbMultiQuery($strQuery)) ? false : caching::setCaching('caching/' . $this->tbPrefix . $this->tbPostfix . '.tsc', $this->tbTableStructure); } } else { db::$dbTypeSelect = 'multi'; return !($this->tbTableStructure = db::dbMultiQuery($strQuery)) ? false : true; } }
/** * protected Функция выборки логотипов для вывода на главной * * @return mixed (array | false) */ protected function getLogoToMain() { $arrFields = array(array('conf_users', 'id'), array('conf_users', 'company_name'), array('conf_users', 'company_city'), array('conf_users', 'logo')); $strWhere = "conf_users.main_logo AND conf_users.logo!='' AND conf_users.token IN ('active') AND conf_users.user_type IN ('company')"; $arrOrderBy = array('conf_users.sort_logo' => 'ASC'); if (CONF_ENABLE_CACHING) { if (false === ($result = caching::getCahing('caching/company.logo.cache'))) { $result = $this->getCombinedUsersData($arrFields, $strWhere, $arrOrderBy, false); empty($result) ? $result = array() : null; caching::setCaching('caching/company.logo.cache', $result); } } else { $result = $this->getCombinedUsersData($arrFields, $strWhere, $arrOrderBy, false); } return $result; }