本文整理汇总了PHP中professions::GetAllMirroredProfsId方法的典型用法代码示例。如果您正苦于以下问题:PHP professions::GetAllMirroredProfsId方法的具体用法?PHP professions::GetAllMirroredProfsId怎么用?PHP professions::GetAllMirroredProfsId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类professions
的用法示例。
在下文中一共展示了professions::GetAllMirroredProfsId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
default:
$frm_action = '/';
$prmd = '?';
}
if (!$filter) {
$filter = array('user_id' => $uid, 'cost_from' => '', 'cost_to' => '', 'currency' => 0, 'wo_cost' => 't', 'only_sbr' => 'f', 'country' => 0, 'city' => 0, 'keywords' => '', 'categories' => array());
}
if ($filter_params && is_array($filter_params)) {
$filter_inputs = '';
$filter_query = '';
foreach ($filter_params as $pn => $pv) {
$filter_inputs .= '<input type="hidden" name="' . $pn . '" value="' . $pv . '" />';
$filter_query .= "&{$pn}={$pv}";
}
}
$all_mirrored_specs = professions::GetAllMirroredProfsId();
$mirrored_specs = array();
for ($is = 0; $is < sizeof($all_mirrored_specs); $is++) {
$mirrored_specs[$all_mirrored_specs[$is]['main_prof']] = $all_mirrored_specs[$is]['mirror_prof'];
$mirrored_specs[$all_mirrored_specs[$is]['mirror_prof']] = $all_mirrored_specs[$is]['main_prof'];
}
$_SESSION['ph_categories'] = $filter['categories'];
//создаем массив специализаций (для фильтра на главной он уже есть в $prfs, для фильтра в проектах фрилансера его нет, поэтому делаем проверку на существование
if (!sizeof($profs)) {
$all_specs = professions::GetAllProfessions("", 0, 1);
} else {
$all_specs = $profs;
}
// if(isset($_COOKIE['new_pf'.$filter_page]))
// $filter_show = $_COOKIE['new_pf'.$filter_page];
// else {
示例2: header
<?php
if (!$_in_setup) {
header("HTTP/1.0 403 Forbidden");
exit;
}
require_once $_SERVER['DOCUMENT_ROOT'] . "/xajax/users.common.php";
$xajax->printJavascript('/xajax/');
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/professions.php";
$prfs = new professions();
$profs = $prfs->GetAllProfessionsPortfWithoutMirrored(get_uid());
$mirrors = $prfs->GetAllMirroredProfsId();
?>
<script type="text/javascript">
var mirrors = [];
<?php
for ($i = 0, $m = count($mirrors); $i < $m; $i++) {
?>
mirrors[<?php
echo $i;
?>
] = {main: <?php
echo $mirrors[$i]['main_prof'];
?>
, mirror: <?php
echo $mirrors[$i]['mirror_prof'];
?>
};
<?php
}
示例3: addGroup
/**
* Добавляем категории профессий в фильтр
*
* @param arrya $category Категории
* @return string Сообщение об ошибке
*/
function addGroup($category)
{
include_once realpath(dirname(__FILE__)) . '/professions.php';
$added = array();
if (get_uid(false)) {
if ($this->fid > 0) {
global $DB;
$sql = "DELETE FROM freelancers_filters_group WHERE filter_id = ?";
$DB->query($sql, $this->fid);
$all_mirrored_specs = professions::GetAllMirroredProfsId();
$mirrored_specs = array();
for ($is = 0; $is < sizeof($all_mirrored_specs); $is++) {
$mirrored_specs[$all_mirrored_specs[$is]['main_prof']] = (int) $all_mirrored_specs[$is]['mirror_prof'];
$mirrored_specs[$all_mirrored_specs[$is]['mirror_prof']] = (int) $all_mirrored_specs[$is]['main_prof'];
}
$sql = "";
function isMirrored($group_id, $level, $mirrored_specs, $added)
{
if (!empty($mirrored_specs[$group_id]) && isset($added[$mirrored_specs[$group_id]])) {
return true;
}
}
if (count($category) > 0) {
foreach ($category as $level => $ids) {
foreach ($ids as $group_id => $val) {
if (!(int) $group_id) {
continue;
}
if (isMirrored($group_id, $level, $mirrored_specs, $added) || !empty($added[(int) $group_id])) {
continue;
}
$sql .= "INSERT INTO freelancers_filters_group (filter_id, group_id, level) VALUES ('{$this->fid}', '" . intval($group_id) . "', '" . intval($level) . "');";
if (!(int) $level) {
$subs = professions::GetProfs($group_id);
foreach ($subs as $itm) {
$added[$itm['id']] = true;
}
} else {
$added[(int) $group_id] = true;
}
}
}
if (!$sql) {
return false;
}
$DB->squery($sql);
return $DB->error;
}
}
} else {
$_SESSION['f_freelancers_filter']['f_freelancers_category'] = $category;
$_SESSION['f_freelancers_filter']['freelancers_filters_group'] = array();
$all_mirrored_specs = professions::GetAllMirroredProfsId();
$mirrored_specs = array();
for ($is = 0; $is < sizeof($all_mirrored_specs); $is++) {
$mirrored_specs[$all_mirrored_specs[$is]['main_prof']] = (int) $all_mirrored_specs[$is]['mirror_prof'];
$mirrored_specs[$all_mirrored_specs[$is]['mirror_prof']] = (int) $all_mirrored_specs[$is]['main_prof'];
}
$sql = "";
function isMirrored($group_id, $level, $mirrored_specs, $added)
{
if (!empty($mirrored_specs[$group_id]) && isset($added[$mirrored_specs[$group_id]])) {
return true;
}
}
$data = array();
if (count($category) > 0) {
foreach ($category as $level => $ids) {
foreach ($ids as $group_id => $val) {
$tdata = array();
if (!(int) $group_id) {
continue;
}
if (isMirrored($group_id, $level, $mirrored_specs, $added) || !empty($added[(int) $group_id])) {
continue;
}
$tdata['group_id'] = intval($group_id);
$tdata['level'] = intval($level);
$data[] = $tdata;
$sql = '1';
if (!(int) $level) {
$subs = professions::GetProfs($group_id);
foreach ($subs as $itm) {
$added[$itm['id']] = true;
}
} else {
$added[(int) $group_id] = true;
}
}
}
if (!$sql) {
return false;
}
$_SESSION['f_freelancers_filter']['freelancers_filters_group'] = $data;
//.........这里部分代码省略.........
示例4: NewProjForMissingMoreThan24h
/**
* Рассылка о новых проектах лицам, отсутствовавшим на сайте более суток и менее года. Вызывается раз в день из hourly.php.
*
* @param array &$uids - массив идентификаторов пользователей, подписанных на новые проекты но которым отправлено это уведомление
* необходимо передать в smail::NewProj
*
* @return int количество получивших рассылку
*/
public function NewProjForMissingMoreThan24h(&$uids)
{
$projects = projects::GetNewProjectsWithBudjet($error);
//сортировка по стоимости
foreach ($projects as $key => $prj) {
$prj['sort_cost'] = $prj['cost'];
if ($prj['currency'] == 0) {
$prj['sort_cost'] *= 30;
//в данном случае точный курс не важен, важно отсортировать
}
if ($prj['currency'] == 1) {
$prj['sort_cost'] *= 40;
//в данном случае точный курс не важен, важно отсортировать
}
$projects[$key] = $prj;
}
$all_mirrored_specs = professions::GetAllMirroredProfsId();
$professions = professions::GetProfessionsAndGroup();
$professionsTree = array();
foreach ($professions as $k => $i) {
if ($professionsTree[$i['gid']] === null) {
$professionsTree[$i['gid']] = array('gid' => $i['gname']);
if ($i['id'] !== null) {
$professionsTree[$i['gid']][$i['id']] = $i['name'];
} else {
$professionsTree[$i['gid']] = $i['gname'];
}
} elseif (is_array($professionsTree[$i['gid']])) {
$professionsTree[$i['gid']][$i['id']] = $i['name'];
}
}
$page = 0;
$count = 0;
// total
$countBs = 0;
// БС
$countCar = 0;
// карусель
$countPro = 0;
// ПРО
$countPayed = 0;
// платные места
$countVerify = 0;
// верификация
$this->subject = 'Новые проекты и конкурсы на FL.ru';
$pHost = $GLOBALS['host'];
ob_start();
include $_SERVER['DOCUMENT_ROOT'] . '/masssending/tpl.missing_more_than_24h.php';
$this->message = ob_get_clean();
$this->recipient = '';
$massId = $this->masssend();
$dbStat = new DB('master');
while ($users = freelancer::GetMissingMoreThan24h($error, ++$page, 100)) {
$this->recipient = array();
foreach ($users as $user) {
if (!$user['unsubscribe_key']) {
$user['unsubscribe_key'] = users::GetUnsubscribeKey($user['login']);
}
$unsubscribe_link = "{$pHost}/unsubscribe?ukey=" . $user['unsubscribe_key'];
$advert_template = $this->getAdvertTemplate($user, $n);
//номер рекламного блока 0 - БС, 1 - карусель, 2 - ПРО, 3 - платные места, 4 - верификация
switch ($n) {
case 0:
$countBs++;
break;
case 1:
$countCar++;
break;
case 2:
$countPro++;
break;
case 3:
$countPayed++;
break;
case 4:
$countVerify++;
break;
}
$pList = $this->getProjectsForUser($projects, $user, $all_mirrored_specs, $professionsTree);
$length = count($pList);
if ($length == 0) {
continue;
}
for ($i = 0; $i < count($pList); ++$i) {
for ($j = $i; $j < count($pList); ++$j) {
$a = $pList[$i];
$b = $pList[$j];
if ($b['sort_cost'] > $a['sort_cost']) {
$buf = $pList[$i];
$pList[$i] = $pList[$j];
$pList[$j] = $buf;
}
//.........这里部分代码省略.........
示例5: x____settings_get
/**
* Получение списка настроек
*
* @param array $aParams массив входящих данных
* @return array $aResult ответ
*/
protected function x____settings_get($aParams = array())
{
$this->_validDevice($aParams);
global $DB;
$aKeys = array_keys($this->_mCfg['tables']);
// ключи справочных таблиц
$aLastTime = array();
// последнее время обновления
$bRetMirror = false;
// возвращать ли зеркальные профессии
foreach ($aKeys as $sKey) {
$aLastTime[$sKey] = intvalPgSql($aParams['last_update_' . $this->_mCfg['tables'][$sKey]['out']]);
}
$aResult = array('settings' => array("version_ios" => "1.0", "version_android" => "1.0"));
foreach ($aKeys as $sKey) {
$sql = "SELECT version FROM external_cache WHERE obj_name = '{$sKey}' AND obj_type = " . self::OBJTYPE_TABLE;
$bRet = true;
// выводить данные
if ($server_version = $DB->val($sql)) {
$server_version = $this->pg2ex($server_version, EXTERNAL_DT_TIME);
if ($aLastTime[$sKey] && $server_version <= $aLastTime[$sKey]) {
$bRet = false;
// данные не изменялись - не выводить данные
}
}
if ($bRet) {
if ($sKey == 'professions') {
$bRetMirror = true;
}
$aData = $DB->rows('SELECT * FROM ' . $this->_mCfg['tables'][$sKey]['view']);
$sFunc = '_settings_get_' . $sKey;
$aResult['settings'][$this->_mCfg['tables'][$sKey]['out']] = $this->{$sFunc}($aData, $server_version);
} else {
$aResult['settings'][$sKey] = array();
}
}
$aResult['settings']['filter'] = $this->_settings_get_filter();
// настройки фильтра
// зеркальные профессии
if ($bRetMirror) {
require_once ABS_PATH . '/classes/professions.php';
$aResult['settings']['mirrored_professions'] = professions::GetAllMirroredProfsId();
} else {
$aResult['settings']['mirrored_professions'] = array();
}
// Push
$uid = get_uid(false);
$sql = "SELECT * FROM external_m_push_settings WHERE device_id = ? AND device_type = ? AND user_id = ?i";
$settings = $DB->row($sql, $this->_sUdid, $this->_sPlatform, $uid);
$aResult['settings']['push'] = array();
$aResult['settings']['push']['message_new'] = $settings['message_new'] == 't' ? 1 : 0;
$aResult['settings']['push']['projects_new'] = $settings['projects_new'] == 't' ? 1 : 0;
$aResult['settings']['push']['project_response_new'] = $settings['project_response_new'] == 't' ? 1 : 0;
$aResult['settings']['push']['project_select_candidate'] = $settings['project_select_candidate'] == 't' ? 1 : 0;
$aResult['settings']['push']['project_select_performer'] = $settings['project_select_performer'] == 't' ? 1 : 0;
$aResult['settings']['push']['project_select_reject'] = $settings['project_select_reject'] == 't' ? 1 : 0;
return $aResult;
}