本文整理汇总了PHP中professions::GetProfessionsTitles方法的典型用法代码示例。如果您正苦于以下问题:PHP professions::GetProfessionsTitles方法的具体用法?PHP professions::GetProfessionsTitles怎么用?PHP professions::GetProfessionsTitles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类professions
的用法示例。
在下文中一共展示了professions::GetProfessionsTitles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$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'];
}
if (!empty($filter["prof"]) && is_array($filter["prof"][1])) {
$raw_professions = professions::GetProfessionsTitles(array_keys($filter["prof"][1]));
$a_professions = array();
foreach ($raw_professions as $profession_item) {
$a_professions[$profession_item["name"]] = '(@name_prof "' . $profession_item["name"] . '" | @additional_specs "' . $profession_item["name"] . '")';
}
$string_professions = '(' . join(" | ", $a_professions) . ')';
}
$string_query = $search_string;
// @todo Кажется, это никогда не используется?
$string_query .= !empty($string_professions) ? ' ' . $string_professions : '';
$type = 'users_ext';
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/search/search_ext.php";
$search = new searchExt($uid);
$search->setUserLimit(FRL_PP);
$search->addElement($type, true, FRL_PP);
$search->searchByType($type, $string_query, $page, $filter);
示例2: CalculateFromSearch
/**
* Подсчет получателей если пришли в рассылку из поиска исполнителей
* Метод может использоваться в двух случаях:
* 1. Для подсчета количества пользователей и стомости рассылки исходя из заданного фильтра.
* 2. Расчитать (без дополнительно расчета каталога и городов) количество пользователей и стоимость + сохранить список пользователей в mass_sending_users
* @param integer $uid uid пользователя совершаемого рассылку
* @param array $param массив с данными фильтра фрилансеров
* @param commit integer если не 0, то сохранит всех найденых пользователей для рассылки $commit иначе просто расчет
* @return array результат расчета в виде
* array('count', 'cost', 'pro'=>array('count', 'cost'), locations=>array(array('city', 'country', 'count', 'cost')), professions=>array(array('group', 'profession', 'count', 'cost')))
*
*/
public function CalculateFromSearch($uid, array $param, $commit = 0)
{
global $DB;
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/search/search.php";
if ($param['exp'][0] > $param['exp'][1] && $param['exp'][1] != 0) {
$a = $param['exp'][0];
$param['exp'][0] = $param['exp'][1];
$param['exp'][1] = $a;
}
if ($param['age'][0] > $param['age'][1] && $param['age'][1] != 0) {
$a = $param['age'][0];
$param['age'][0] = $param['age'][1];
$param['age'][1] = $a;
}
if (is_array($param['from_cost'])) {
foreach ($param['from_cost'] as $key => $val) {
if ($val > $param['to_cost'][$key] && $param['to_cost'][$key] != 0) {
$a = $param['from_cost'][$key];
$param['from_cost'][$key] = $param['to_cost'][$key];
$param['to_cost'][$key] = $a;
}
}
}
if ($param['action'] == "search_advanced" || $param['advanced_search']) {
$filter = array("active" => "t", "categories" => $param['pf_categofy'], "prof" => $param['pf_categofy'], "kwords" => $param['kword'], "cost_type" => is_array($param['cost_type']) ? array_map("intval", $param['cost_type']) : $param['cost_type'], "from_cost" => is_array($param['from_cost']) ? array_map("intval", $param['from_cost']) : $param['from_cost'], "to_cost" => is_array($param['to_cost']) ? array_map("intval", $param['to_cost']) : $param['to_cost'], "curr_type" => is_array($param['curr_type']) ? array_map("intval", $param['curr_type']) : $param['curr_type'], "exp" => is_array($param['exp']) ? array_map("intval", $param['exp']) : $param['exp'], "exp_from" => (int) $param['exp'][0], "exp_to" => (int) $param['exp'][1], "login" => htmlspecialchars($param['login']), "age" => is_array($param['age']) ? array_map("intval", $param['age']) : $param['age'], "age_from" => (int) $param['age'][0], "age_to" => (int) $param['age'][1], "country" => (int) $param['pf_country'], "city" => (int) $param['pf_city'], "in_office" => $param['in_office'], "in_fav" => $param['in_fav'], "only_free" => $param['only_free'], "is_pro" => $param['is_pro'], "sbr_is_positive" => $param['sbr_is_positive'], "is_preview" => $param['is_preview'], "sbr_not_negative" => $param['sbr_not_negative'], "opi_is_positive" => $param['opi_is_positive'], "opi_not_negative" => $param['opi_not_negative'], "success_sbr" => $param['success_sbr']);
}
if (!$filter) {
$filter = array();
}
if ($filter['cost_type']) {
foreach ($filter['cost_type'] as $key => $value) {
$cFilter[] = array("cost_type" => $filter['curr_type'][$key], "cost_from" => $filter['from_cost'][$key], "cost_to" => $filter['to_cost'][$key], "type_date" => $value);
}
$filter['cost'] = $cFilter;
}
$searchString = __paramValue('htmltext', $param['search_string']);
if ($filter["prof"][1] && is_array($filter["prof"][1])) {
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/professions.php";
$raw_professions = professions::GetProfessionsTitles(array_keys($filter["prof"][1]));
$a_professions = array();
foreach ($raw_professions as $profession_item) {
$a_professions[$profession_item["name"]] = '(@name_prof "' . $profession_item["name"] . '" | @additional_specs "' . $profession_item["name"] . '")';
}
$searchString .= join(" ", $a_professions);
}
$cost = $this->GetTariff($this->tariff_id);
$search = new search($uid);
// сохраняем всех будущих получателей в базу
if ($commit) {
$searchCount = __paramValue('int', $param['search_count']);
$searchCount = $searchCount ? $searchCount : 1;
$search->addElement('users', true, $searchCount);
$search->search($searchString, 1, $filter);
$elements = $search->getElements();
$massSendingUsers = array();
foreach ($elements['users']->results as $key => $user) {
$massSendingUsers[] = array('mid' => $commit, 'uid' => $user['id']);
}
$DB->insert('mass_sending_users', $massSendingUsers);
}
$search->addElement('users', true, 1);
if ($filter['is_pro']) {
// если нужны только ПРО
$search->search($searchString, 1, $filter);
$elements = $search->getElements();
$searchCountPro = (int) $elements['users']->total;
$searchCostPro = $searchCountPro * $cost['pro'];
$calc = array('count' => $searchCountPro, 'cost' => $searchCostPro, 'pro' => array('count' => $searchCountPro, 'cost' => $searchCostPro));
} else {
// все пользователи
$search->search($searchString, 1, $filter);
$elementsTotal = $search->getElements();
$searchCountTotal = (int) $elementsTotal['users']->total;
// только ПРО
$filter['is_pro'] = true;
$search->search($searchString, 1, $filter);
$elementsPro = $search->getElements();
// количество ПРО пользователей
$searchCountPro = (int) $elementsPro['users']->total;
// количество неПРО
$searchCount = $searchCountTotal - $searchCountPro;
// стоимость рассылки
$searchCostPro = $searchCountPro * $cost['pro'];
$searchCost = $searchCount * $cost['no_pro'];
$searchCostTotal = $searchCostPro + $searchCost;
$calc = array('count' => $searchCountTotal, 'cost' => $searchCostTotal, 'pro' => array('count' => $searchCountPro, 'cost' => $searchCostPro));
}
return $calc;
//.........这里部分代码省略.........