本文整理汇总了PHP中professions::GetProfs方法的典型用法代码示例。如果您正苦于以下问题:PHP professions::GetProfs方法的具体用法?PHP professions::GetProfs怎么用?PHP professions::GetProfs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类professions
的用法示例。
在下文中一共展示了professions::GetProfs方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __paramInit
$a = $_POST['age'][0];
$age[0] = $age[1];
$age[1] = $a;
}
$from_cost = __paramInit('int', 'from_cost', 'from_cost');
$to_cost = __paramInit('int', 'to_cost', 'to_cost');
if ($from_cost > $to_cost && $to_cost != 0) {
$a = $from_cost;
$from_cost = $to_cost;
$to_cost = $a;
}
$filter_prof = array();
if ($prof_id > 0) {
$filter_prof = array(1 => array($prof_id => 1));
} elseif ($prof_group_id > 0) {
$profs = professions::GetProfs($prof_group_id);
$filter_prof = array();
foreach ($profs as $prof) {
$filter_prof[1][$prof['id']] = 1;
}
}
$filter = array("is_pro" => $is_pro, 'prof' => $filter_prof);
$string_professions = '';
if ($action == "search_advanced") {
$filter = array("active" => "t", "prof" => $filter_prof, "cost_type" => intval(@$_POST['cost_type_db_id']), "from_cost" => $from_cost, "to_cost" => $to_cost, "curr_type" => intval(@$_POST['curr_type_db_id']), "exp" => is_array($_POST['exp']) ? array_map("intval", $_POST['exp']) : @$_POST['exp'], "exp_from" => $exp[0], "exp_to" => $exp[1], "age" => is_array($_POST['age']) ? array_map("intval", $_POST['age']) : @$_POST['age'], "age_from" => $age[0], "age_to" => $age[1], "country" => (int) @$_POST['location_columns'][0], "city" => (int) @$_POST['location_columns'][1], "in_office" => (bool) @$_POST['in_office'], "in_fav" => (bool) @$_POST['in_fav'], "only_free" => (bool) @$_POST['only_free'], "is_pro" => $is_pro, "is_verify" => (bool) @$_POST['is_verify'], "is_preview" => (bool) @$_POST['is_preview'], "sbr_is_positive" => (bool) @$_POST['sbr_is_positive'], "sbr_not_negative" => (bool) @$_POST['sbr_not_negative'], "opi_is_positive" => (bool) @$_POST['sbr_is_positive'], "opi_not_negative" => (bool) @$_POST['sbr_not_negative']);
if ($filter['cost_type']) {
$filter['cost'][] = array('cost_type' => $filter['curr_type'], 'cost_from' => $filter['from_cost'], 'cost_to' => $filter['to_cost'], 'type_date' => $filter['cost_type']);
}
$countryObj = new country();
$countryCityName = $countryObj->getCountryAndCityNames($filter['country'], $filter['city']);
$countryCityName = @$countryCityName['name'];
示例2: processRequest
//.........这里部分代码省略.........
}
$membuf->add($memkey, $result, $expire);
}
return json_encode($result);
case 'getprofessionsandgroups':
$membuf = new memBuff();
$memkey = 'b-combo-getprofandgroups';
$result = $membuf->get($memkey);
if (!$result) {
$rows = professions::GetProfessionsAndGroup();
$result = array();
foreach ($rows as $k => $i) {
if ($result[$i['gid']] === null) {
$result[$i['gid']] = array($i['gid'] => iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['gname']));
if ($i['id'] !== null) {
$result[$i['gid']][$i['id']] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['name']);
} else {
$result[$i['gid']] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['gname']);
}
} elseif (is_array($result[$i['gid']])) {
$result[$i['gid']][$i['id']] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['name']);
}
}
$membuf->add($memkey, $result, $expire);
}
return json_encode($result);
case 'getprofessions':
$n = __paramInit('integer', '', 'id');
if ($n !== false) {
$membuf = new memBuff();
$memkey = "b-combo-getprofbygroup{$n}";
$result = $membuf->get($memkey);
if (!$result) {
$rows = professions::GetProfs($n);
$result = array(0 => iconv('WINDOWS-1251', 'UTF-8//IGNORE', 'Все специальности'));
foreach ($rows as $k => $i) {
$result[$i['id']] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['name']);
}
$membuf->add($memkey, $result, $expire);
}
$data = array(array('parentId' => "{$n}"), $result);
return json_encode($data);
}
case 'get_pro_types':
$membuf = new memBuff();
$memkey = 'b-combo-get_pro_type';
$result = $membuf->get($memkey);
if (!$result) {
$rows = op_codes::getCodes(array(47, 48, 49, 50, 51));
$result = array();
foreach ($rows as $k => $i) {
$result[$i['id']] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['op_name']);
}
$result[76] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', 'На несколько недель');
$membuf->add($memkey, $result, $expire);
}
return json_encode($result);
case 'getcountries':
case 'getrelevantcountries':
$membuf = new memBuff();
$memkey = 'b-combo-getcountriesr';
$result = $membuf->get($memkey);
if (!$result) {
$rows = country::GetCountriesByCountUser();
$result = array();
foreach ($rows as $k => $i) {
示例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;
//.........这里部分代码省略.........