/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = teams::find()->with('country0'); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id_team' => $this->id_team, 'country' => $this->country]); $query->andFilterWhere(['like', 'team_name', $this->team_name])->andFilterWhere(['like', 'team_logo', $this->team_logo]); return $dataProvider; }
<?php if (!defined('IN_STDF')) { header('HTTP/1.0 404 Not Found'); exit; } require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/country.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/city.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/teams.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/notes.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/commune.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/rating.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/user_langs.php'; $recoms = new teams(); $additinfo = $user->GetAdditInfo($user->login, $error); $languages = users::GetUserLangs($user->uid); if ($rating && $rating instanceof rating && $rating->data['user_id'] == $user->uid) { $rating_total = rating::round($rating->data['total']); } else { $rating_total = rating::round($additinfo['rating']); } $info_for_reg = unserialize($user->info_for_reg); $reg_string = 'только для <A class="blue" href="/registration/">зарегистрированных</A>'; if ($_SESSION['uid']) { $note = notes::GetNotes($_SESSION['uid'], null, $error); if (count($note) > 0) { foreach ($note as $key => $value) { $notes[$value['to_id']] = $value; } }
<tr> <td>{{ $user->name }}</td> <td><?php if ($user->summoner_id != 0) { $summoner = Summoners::findorfail($user->summoner_id); echo $summoner->name; } else { echo "none"; } ?> </td> <td><?php if ($user->team_id != 0) { $team = teams::findorfail($user->team_id); echo $team->name; } else { echo "none"; } ?> </td> <td>{{ $user->email }}</td> <td class="adminoptions"> <a class="btn btn-default adminbutton" href="" type="button">Info (edit)</a> <a class="btn btn-default adminbutton" href="" type="button">Ban</a> <a class="btn btn-default adminbutton" href="" type="button">Remove</a> <a class="btn btn-default adminbutton" href="" type="button">Kick from team</a> <a class="btn btn-default adminbutton" href="" type="button">Reset password</a>
} if (!$error_flag && $resume->size == 0 && strlen($resume->tmp_name) != 0) { $error_flag = 1; $alert[4] = "Файл не удовлетворяет условиям загрузки"; } if (!$error_flag) { user_langs::updateUserLangs($_SESSION["uid"], $user_langs); $error .= $frl->UpdateInform($uid, $resume, $del_resume, $file_error); // Доступ пользователя к функциям сайта require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/registration.php"; $reg = new registration(); $reg->checkUserAccess($uid, true); $selected = $_POST['id']; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/teams.php"; //var_dump($selected); $error .= teams::teamsDelFavoritesExcept($uid, $selected); if ($file_error) { $error_flag = 1; $alert[4] = "Файл не удовлетворяет условиям загрузки"; } } if (!$error && !$error_flag) { $info = "Изменения внесены"; } break; case "main_change": $name = change_q(substr(trim($_POST['name']), 0, 21), true); $pname = change_q(substr(trim(stripslashes($_POST['pname'])), 0, 100), true); $surname = change_q(substr(trim($_POST['surname']), 0, 21), true); $email = change_q(substr(trim($_POST['email']), 0, 64), true); $oldpwd = trim($_POST['oldpwd']);
/** * Возвращает список избранных фрилансеров. * * @param integer $prof_id id профессии (не используется, видимо оставлено для совместимости) * @param integer $uid id пользователя * @param boolean $filter_apply использовать фильтр? (временно не используется) * @param array $filter массив с данными для фильтра (временно не используется) * @return array массив избранных фрилансеров (id фрилансера) */ function GetFavorites($prof_id, $uid, $filter_apply = false, $filter = null) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/teams.php'; $teams = new teams(); $ret = $teams->teamsFavorites($uid, $error); /* if ($prof_id > 0) { require_once($_SERVER['DOCUMENT_ROOT'] . "/classes/professions.php"); $mirrored = professions::GetMirroredProfs($prof_id); $profs = "'" . implode("', '", $mirrored) . "'"; $sql = "SELECT ff.target_id FROM teams AS ff INNER JOIN portf_choise as pc ON (ff.target_id = pc.user_id) WHERE pc.prof_id IN ($profs) AND ff.user_id='$uid'"; } else { $sql = "SELECT ff.target_id FROM teams AS ff WHERE ff.user_id='$uid'"; } */ $out = array(); if ($ret) { foreach ($ret as $ikey => $value) { $out[] = $value['uid']; } } return $out; }
/** * Получение списка предложений по конкретному проекту. * * @param integer $count возвращает количество предложений * @param integer $prj_id id проекта * @param string $show_all признак отображения всех (true) или только открытых (false) предложений проекта * @param string $sort сортировка списка предложений * @param string $type выбор предложений одного типа ('o' - все, 'c' - выбранных в кандидаты, 'r' - отказанных, 'nor' - все кроме отказавшихся, 'i' - исполнитель) * * @return array список предложений */ public function GetPrjOffers(&$count, $prj_id, $limit, $offset = 0, $user_id = 0, $show_all = false, $sort = 'date', $type = 'a') { global $DB; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/teams.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/notes.php'; $user_id = intval($user_id); $limit = $limit == 'ALL' ? $limit : intval($limit); $offset = intval($offset); $limit_str = " LIMIT {$limit} OFFSET {$offset}"; $bPermissions = hasPermissions('projects'); // исключаем заблокированные предложения $sel_blocked = ', pb.reason as blocked_reason, pb.blocked_time, COALESCE(pb.src_id::boolean, false) as is_blocked'; $join_blocked = 'LEFT JOIN projects_offers_blocked pb ON po.id = pb.src_id '; if ($bPermissions) { $sel_blocked .= ', admins.login as admin_login, admins.uname as admin_uname, admins.usurname as admin_usurname'; $join_blocked .= 'LEFT JOIN users as admins ON pb.admin = admins.uid '; $where_blocked = ''; $and_blocked = ''; } else { $where_blocked = " (po.user_id = {$user_id} OR pb.src_id IS NULL) "; $and_blocked = ' AND ' . $where_blocked; } //@todo: Рекомендуется вынести completed_cnt в users_counters таблицу и с ней соединяться //тем более, что в ней уже есть кол-во по новой БС reserves_completed_cnt //нужно добавить поле по старой БС и пересчитать туда if ($type == 'i') { $sql = "SELECT\n po.*,\n fl.uid, fl.login, fl.uname, fl.usurname, fl.photo, fl.photosm, fl.spec, fl.is_pro, fl.is_team, fl.is_pro_test, fl.is_profi, uc.ops_frl_plus as ops_plus, uc.ops_frl_null as ops_null, uc.ops_frl_minus as ops_minus, fl.role, fl.warn, fl.is_banned, fl.ban_where, rating_get(fl.rating, fl.is_pro, fl.is_verify, fl.is_profi) as rating, fl.is_verify, fl.reg_date, fl.modified_time, fl.photo_modified_time,\n p.name AS spec_name,\n cr.country_name,\n ct.city_name, \n COALESCE(sbr_meta.completed_cnt, 0) + COALESCE(uc.reserves_completed_cnt, 0) AS completed_cnt, -- старые БС + новые БС\n uc.ops_emp_plus + uc.ops_frl_plus as ops_all_plus, uc.ops_emp_null + uc.ops_frl_null as ops_all_null, uc.ops_emp_minus + uc.ops_frl_minus as ops_all_minus,\n uc.ops_emp_plus, uc.ops_emp_null, uc.ops_emp_minus,\n uc.sbr_opi_plus, uc.sbr_opi_null, uc.sbr_opi_minus,\n uc.paid_advices_cnt + uc.sbr_opi_plus + uc.ops_emp_plus + uc.tu_orders_plus + uc.projects_fb_plus as opinions_plus,\n uc.sbr_opi_minus + uc.ops_emp_minus + uc.tu_orders_minus + uc.projects_fb_minus as opinions_minus\n {$sel_blocked} \n FROM (SELECT por.*, exec_id, pr.user_id as p_user_id FROM projects AS pr\n LEFT JOIN projects_offers as por ON por.project_id=pr.id AND (pr.exec_id =por.user_id)\n WHERE pr.id = '{$prj_id}' AND (por.user_id > 0)" . ($show_all ? '' : " AND (por.only_4_cust='f')") . ') AS po INNER JOIN freelancer as fl ON (po.exec_id=fl.uid' . ($bPermissions ? '' : ' AND fl.is_banned::integer = 0') . ")\n {$join_blocked} \n LEFT JOIN professions p ON p.id=fl.spec\n LEFT JOIN users_counters uc ON uc.user_id = fl.uid\n LEFT JOIN sbr_meta ON sbr_meta.user_id = fl.uid -- старые БС\n LEFT JOIN country cr ON cr.id=fl.country\n LEFT JOIN city ct ON ct.id=fl.city\n " . ($user_id == 0 ? "WHERE {$where_blocked}" : 'WHERE (fl.uid<>' . $user_id . ") {$and_blocked}"); $ret = $DB->rows($sql); $error = $DB->error; if ($error) { $error = parse_db_error($error); } else { if ($ret) { foreach ($ret as &$value) { // Выбираем вложения. if ($value['id']) { $sql = 'SELECT a.id, a.prev_pict as prev, a.pict ' . 'FROM projects_offers_attach AS a ' . 'WHERE a.offer_id= ?i '; $value['attach'] = $DB->rows($sql, $value['id']); } } } } } else { switch ($sort) { default: case 'date': $order = ' ORDER BY (fl.is_verify AND fl.is_pro) DESC, fl.is_pro DESC, fl.is_verify DESC, post_date DESC'; break; case 'rating': $order = ' ORDER BY rating DESC, fl.is_pro DESC, post_date DESC'; break; case 'opinions': $order = ' ORDER BY ssum DESC, fl.is_pro DESC, post_date DESC'; break; case 'time': $order = ' ORDER BY (((time_from = 0) OR (time_from IS NULL)) AND ((time_to = 0) OR (time_to IS NULL))) ASC, time_from_days ASC, time_to_days ASC, is_pro DESC, post_date DESC'; break; case 'cost': $order = ' ORDER BY (((cost_from = 0) OR (cost_from IS NULL)) AND ((cost_to = 0) OR (cost_to IS NULL))) ASC, usd_cost_from DESC, usd_cost_to DESC, is_pro DESC, post_date DESC'; break; } switch ($type) { default: case 'a': $filter = ''; break; case 'o': $filter = ' AND NOT po.selected AND NOT po.refused AND NOT po.frl_refused AND COALESCE(pr.exec_id,0)<>fl.uid'; break; case 'c': $filter = ' AND po.selected'; break; case 'r': $filter = ' AND po.refused'; break; case 'nor': $filter = ' AND NOT po.frl_refused'; break; case 'fr': $filter = ' AND po.frl_refused'; break; } require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/project_exrates.php'; $project_exRates = project_exrates::GetAll(); $sql = "SELECT\n CASE po.cost_type\n WHEN 0 THEN po.cost_from\n WHEN 1 THEN po.cost_from*{$project_exRates[32]}\n WHEN 2 THEN po.cost_from*{$project_exRates[42]}\n WHEN 3 THEN po.cost_from*{$project_exRates[12]}\n END as usd_cost_from,\n CASE po.cost_type\n WHEN 0 THEN po.cost_to\n WHEN 1 THEN po.cost_to*{$project_exRates[32]}\n WHEN 2 THEN po.cost_to*{$project_exRates[42]}\n WHEN 3 THEN po.cost_to*{$project_exRates[12]}\n END as usd_cost_to,\n\n CASE po.time_type\n WHEN 0 THEN po.time_from\n WHEN 1 THEN po.time_from * 30\n WHEN 2 THEN po.time_from * 356\n ELSE po.time_from\n END as time_from_days,\n CASE po.time_type\n WHEN 0 THEN po.time_to\n WHEN 1 THEN po.time_to * 30\n WHEN 2 THEN po.time_to * 356\n ELSE po.time_to\n END as time_to_days,\n po.*, pr.user_id AS p_user_id,\n fl.uid, fl.login, fl.uname, fl.usurname, fl.photo, fl.photosm, fl.spec, fl.is_profi, fl.is_pro, fl.is_team, fl.is_pro_test, \n uc.ops_frl_plus as ops_plus, \n uc.ops_frl_null as ops_null, \n uc.ops_frl_minus as ops_minus, \n fl.role, fl.warn, fl.is_banned, fl.ban_where, \n rating_get(fl.rating, fl.is_pro, fl.is_verify, fl.is_profi) as rating, \n zin(uc.ops_emp_plus) + zin(uc.sbr_opi_plus) - zin(uc.ops_emp_minus) - zin(uc.sbr_opi_minus) as ssum, \n fl.is_verify, fl.reg_date, fl.modified_time, fl.photo_modified_time,\n p.name AS spec_name,\n cr.country_name,\n COALESCE(sbr_meta.completed_cnt, 0) + COALESCE(uc.reserves_completed_cnt, 0) AS completed_cnt, -- старые БС + новые БС\n ct.city_name,\n uc.ops_emp_plus + uc.ops_frl_plus as ops_all_plus, uc.ops_emp_null + uc.ops_frl_null as ops_all_null, uc.ops_emp_minus + uc.ops_frl_minus as ops_all_minus,\n uc.ops_emp_plus, uc.ops_emp_null, uc.ops_emp_minus,\n uc.sbr_opi_plus, uc.sbr_opi_null, uc.sbr_opi_minus,\n uc.paid_advices_cnt + uc.sbr_opi_plus + uc.ops_emp_plus + uc.tu_orders_plus + uc.projects_fb_plus as opinions_plus,\n uc.sbr_opi_minus + uc.ops_emp_minus + uc.tu_orders_minus + uc.projects_fb_minus as opinions_minus\n {$sel_blocked} \n FROM projects_offers AS po\n LEFT JOIN projects pr ON pr.id=po.project_id\n INNER JOIN freelancer as fl ON po.user_id=fl.uid\n {$join_blocked} \n LEFT JOIN users_counters uc ON uc.user_id = fl.uid\n LEFT JOIN professions p ON p.id=fl.spec\n LEFT JOIN country cr ON cr.id=fl.country\n LEFT JOIN city ct ON ct.id=fl.city\n LEFT JOIN sbr_meta ON sbr_meta.user_id = fl.uid -- старые БС\n WHERE (po.project_id = ?i ) AND (po.user_id > 0) {$and_blocked}" . ($bPermissions ? '' : ' AND fl.is_banned::integer = 0') . ($show_all ? '' : " AND (po.only_4_cust='f')") . ($user_id == 0 ? '' : ' AND (fl.uid<>' . $user_id . ')') . $filter . $order . $limit_str; $ret = $DB->rows($sql, $prj_id); $error = $DB->error; if ($error) { $error = parse_db_error($error); } else { //$ret = pg_fetch_all($res); $sql = "SELECT COUNT(*) as num\n FROM projects_offers AS po\n LEFT JOIN projects as pr ON po.project_id=pr.id\n INNER JOIN freelancer as fl ON po.user_id=fl.uid\n {$join_blocked} \n LEFT JOIN professions p ON p.id=fl.spec\n LEFT JOIN country cr ON cr.id=fl.country\n LEFT JOIN city ct ON ct.id=fl.city\n WHERE (po.project_id = ?i ) AND (po.user_id > 0) {$and_blocked}" . ($bPermissions ? '' : ' AND fl.is_banned::integer = 0') . ($show_all ? '' : " AND (po.only_4_cust='f')") . ($user_id == 0 ? '' : ' AND (fl.uid<>' . $user_id . ')') . $filter; $count = $DB->val($sql, $prj_id); if ($count && $ret) { foreach ($ret as &$value) { // Выбираем вложения. if ($value['id']) { $sql = 'SELECT a.id, a.prev_pict as prev, a.pict ' . 'FROM projects_offers_attach AS a ' . 'WHERE a.offer_id= ?i'; $value['attach'] = $DB->rows($sql, $value['id']); } } } } } // временное решение для plproxy. очень не красиво, но пока не перенесется большая часть таблиц, // придется видимо оставить так if (!empty($ret)) { $teams = new teams(); $notes = new notes(); $t = $teams->teamsFavorites($ret[0]['p_user_id'], $error); $n = $notes->GetNotes($ret[0]['p_user_id'], 0, $error); for ($i = 0; $i < count($ret); ++$i) { // избранные $ret[$i]['in_team'] = 0; for ($j = 0; $j < count($t); ++$j) { if ($t[$j]['uid'] == $ret[$i]['uid']) { $ret[$i]['in_team'] = $ret[$i]['uid']; break; } } // заметки $ret[$i]['n_text'] = ''; for ($j = 0; $j < count($n); ++$j) { if ($n[$j]['to_id'] == $ret[$i]['uid']) { $ret[$i]['n_text'] = $n[$j]['n_text']; break; } } } } return $ret; }
require_once ABS_PATH . "/classes/users.php"; require_once ABS_PATH . '/classes/admin_log.php'; $user_obj = new users(); $sUid = get_uid(); $user_obj->GetUserByUID($sUid); $sObjName = $user_obj->uname . ' ' . $user_obj->usurname . '[' . $user_obj->login . ']'; $sObjLink = '/users/' . $user_obj->login; $sReason = "Аккаунт удален самостоятельно"; if ($user_obj->setUserBan(get_uid(), 0, $sReason, 4, '', 1, true)) { // если удалось заблокировать аккаунт // пишем лог admin_log::addLog(admin_log::OBJ_CODE_USER, admin_log::ACT_ID_DEL_ACC, $sUid, $sUid, $sObjName, $sObjLink, 1, '', 18, $sReason); header("Location: /users/{$user}"); } break; case "delmrec": $selected = $_POST['id']; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/teams.php"; $error .= teams::teamsDelFavoritesExcept(get_uid(), $selected); } require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/payed.php"; $is_pro = payed::CheckPro($_SESSION['login']); $no_banner = !!$is_pro; $header = $rpath . "header.php"; $footer = $rpath . "footer.html"; if ($css_file) { $css_file = array($css_file); } $css_file = array('settings.css', '/css/nav.css', '/css/block/b-voting/b-voting.css'); $body_class = $is_pro ? 'p-pro' : 'p-nopro'; include $rpath . $template;
global $session; $sbr_info = sbr_meta::getUserInfo($user->uid); //@todo: упростил но это вообще здесь не нужно впринципе см getHeaderData $from = is_emp($user->role) ? 'emp' : 'frl'; $op_data = opinions::getHeaderData($from, $user, $user->uid); if (!$rating || !$rating instanceof rating || $rating->data['user_id'] != $user->uid) { $rating = new rating($user->uid, $user->is_pro, $user->is_verify, $user->is_profi, 1); } $r_data = $rating->data; //$samerank = rating::CountByRank($r_data['rank']); $banblog = $user->GetBan($user->uid, 1); if ($user->birthday && $user->birthday > "1910-01-01") { $user_ago = ElapsedYears(strtotime($user->birthday)); } $info_for_reg = @unserialize($user->info_for_reg); $team = new teams(); // срок окончания ПРО - только для админов if (hasPermissions('users') && $user->is_pro === 't') { $proLast = payed::ProLast($user->login); $proDate = date('d-m-Y в h:i', strtotime($proLast['cnt'])); } $access_favorite = $_SESSION['login'] && $user->login != $_SESSION['login']; $access_contacts = ($user->isCurrent() || is_view_contacts($user->uid) || hasPermissions('users')) && is_contacts_not_empty($user); $show_contacts_col = $access_favorite || $access_contacts; $is_allow_messages = true; if ($uid > 0 && !is_emp() && is_emp($user->role)) { require_once ABS_PATH . "/classes/messages.php"; $is_allow_messages = messages::isAllowed($user->uid, $uid); } ?>
function ChFolderInner($folder_id, $login) { session_start(); $objResponse = new xajaxResponse(); $folder_id = intval($folder_id); $user = new users(); $user->GetUser($login); if (!$user->is_banned) { $login = addslashes($login); $uid = get_uid(false); if ($folder_id && $login && $folder_id > 0) { $fld = new mess_ustf(); $fld->from_id = $uid; $fld->folder = $folder_id; $passive = $fld->Change($login); } if ($folder_id < 0) { if ($folder_id == -1) { $fld = new teams(); $fld->user_id = $uid; $passive = !$fld->teamsInverseFavorites($login); } if ($folder_id == -2) { $fld = new ignor(); $fld->user_id = $uid; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/memBuff.php"; $passive = !$fld->Change($login); $memBuff = new memBuff(); $memBuff->delete("msgsCnt" . $uid); $objResponse->script("GetNewMsgCount();"); } if ($folder_id == -3) { $passive = messages::DeleteFromUsers($login); $objResponse->addScrip("document.location='/contacts/';"); } } if ($passive) { $objResponse->assign("folder" . $folder_id, "className", "active"); $objResponse->assign("vfolder" . $folder_id, "className", "active"); } else { $objResponse->assign("folder" . $folder_id, "className", ""); $objResponse->assign("vfolder" . $folder_id, "className", "passive"); } } return $objResponse; }
<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/teams.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/projects.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/stat_collector.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/country.php"; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php'; $team = new teams(); $stop_words = new stop_words(hasPermissions('projects')); stat_collector::setStamp(); foreach ($f_offers as $i => $offer) { unset($user_ago); if ($offer['birthday'] !== NULL && $offer['birthday'] > "1910-01-01") { $user_ago = ElapsedYears(strtotime($offer['birthday'])); } $info_for_reg = @unserialize($offer['info_for_reg']); $offer['sf'] = abs($offer['se']) + abs($offer['sg']) + abs($offer['sl']); $offer['ef'] = abs($offer['e_plus']) + abs($offer['e_null']) + abs($offer['e_minus']); if (get_uid(false)) { $offer['is_fav'] = $team->teamsIsInFavorites($_SESSION['uid'], $offer['uid']); } $sTitle = htmlspecialchars($offer['title']); $sTitle = $offer['moderator_status'] === '0' && $offer['is_pro'] != 't' ? $stop_words->replace($sTitle) : $sTitle; $sTitle = reformat($sTitle, 35, 0, 1); $sDescr = htmlspecialchars($offer['descr']); $sDescr = $offer['moderator_status'] === '0' && $offer['is_pro'] != 't' ? $stop_words->replace($sDescr) : $sDescr; $sDescr = reformat($sDescr, 50); ?> <a name="o_<?php echo $offer['id']; ?>
function DelInTeamNew($login) { $objResponse = new xajaxResponse(); if ($_SESSION['login']) { $team = new teams(); if ($team->teamsDelFavoritesByLogin($_SESSION['uid'], $login)) { return false; } $objResponse->script("\n \$('team_{$login}').removeClass('uprj-bar-act');\n \$('team_{$login}').addClass('uprj-bar');\n\n r = \$('team_{$login}').getElement('.uprj-st2');\n r.set('html', '<a href=\"javascript:void(0)\" onclick=\"addToFav(\\'{$login}\\')\" class=\"lnk-dot-grey\">Добавить в избранные</a>');\n r.removeClass('uprj-st2');\n r.addClass('uprj-st1');\n "); } return $objResponse; }
/** * Возвращает часть ответа с информацией о пользователе * * @param array $aData информация о пользователе из базы * @param bool $bShowEmail включить пользователя Email в ответ * @param bool $bExtended получить расширенную информацию (аналог профиля на сайте) * @return array */ private function _getUserData($aData = array(), $bShowEmail = false, $bExtended = false) { $this->_oSession->view_online_status($aData['login'], false); $u = new users(); if (!is_emp($aData['role'])) { require_once ABS_PATH . '/classes/professions.php'; $prof_id = $aData['spec'] ? $aData['spec'] : 0; $prof_group_id = $aData['spec'] ? professions::GetProfField($aData['spec'], 'prof_group') : 0; } else { $prof_id = 0; $prof_group_id = 0; } $aReturn = array('id' => $aData['uid'], 'status' => $aData['self_deleted'] == 't' ? 2 : 1, 'username' => $aData['login'] ? iconv('cp1251', 'utf-8', $aData['login']) : '', 'firstname' => $aData['uname'] ? iconv('cp1251', 'utf-8', $aData['uname']) : '', 'lastname' => $aData['usurname'] ? iconv('cp1251', 'utf-8', $aData['usurname']) : '', 'role' => is_emp($aData['role']) ? 2 : 1, 'pro' => $aData['is_pro'] == 't' ? 1 : 0, 'verified' => $aData['is_verify'] == 't' ? 1 : 0, 'online' => $this->_oSession->is_active ? 1 : 0, 'spec' => $aData['spec'] ? $aData['spec'] : 0, 'avatar' => array('url' => $aData['photo'] ? WDCPREFIX . '/users/' . $aData['login'] . '/foto/' : '', 'file' => $aData['photo'] ? substr($aData['photo'], 2) . '?' . strtotime($aData['photo_modified_time']) : ''), 'gender' => $aData['sex'] == 't' ? 1 : ($aData['sex'] == 'f' ? 2 : 0), 'country_id' => intval($aData['country']), 'city_id' => intval($aData['city']), 'age' => ElapsedYears(strtotime($u->GetField($aData['uid'], $e, 'birthday'))), 'birthday' => $u->GetField($aData['uid'], $e, 'birthday'), 'prof_id' => $prof_id, 'prof_group_id' => $prof_group_id, 'create_time' => strtotime($aData['reg_date']), 'update_time' => $aData['modified_time'] ? strtotime($aData['modified_time']) : 0); if ($bShowEmail) { $aReturn['email'] = $aData['email'] ? iconv('cp1251', 'utf-8', $aData['email']) : ''; } if ($bExtended) { require_once ABS_PATH . '/classes/rating.php'; require_once ABS_PATH . '/classes/teams.php'; $rating = new rating($aData['uid'], $aData['is_pro'], $aData['is_verify'], @$aData['is_profi'], 1); $team = new teams(); $aReturn['rating'] = rating::round($rating->data['total']); $aReturn['favorite'] = $team->teamsIsInFavorites($_SESSION['uid'], $aData['uid']); $aReturn['contacts'] = is_view_contacts(get_uid(false)) ? $this->_getUserContactsData($aData) : array(); $aReturn['reviews'] = $this->_getUserOpinionsData($aData); } return $aReturn; }
public function setSelectFilter($filter) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/professions.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/project_exrates.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/teams.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/freelancer.php'; $project_exRates = project_exrates::GetAll(); $set_select[] = '*'; // Разделы/Подразделы if ($filter['prof']) { if (count($filter['prof'][0]) > 0) { $p1 = professions::getProfIdForGroups(array_keys($filter['prof'][0]), true); } if (count($filter['prof'][1]) > 0) { $p2 = professions::GetProfessionOrigin(implode(',', array_keys($filter['prof'][1]))); } $specs = explode(',', ($p2 ? $p2 : '') . ($p1 && $p2 ? ', ' : '') . ($p1 ? $p1 : '')); $this->_engine->setFilter('specs', $specs); $this->_sortby = 'is_pro DESC, spec_origin IN (' . implode(',', $specs) . ') rating DESC, @id'; } //Стоимость if ($filter['cost']) { foreach ($filter['cost'] as $val) { if ($val['cost_from'] || $val['cost_to']) { switch ($val['type_date']) { default: case 4: if ($prof_id) { $cf = 'pcost_hour'; $ct = 'pcost_type_hour'; } else { $cf = 'cost_hour'; $ct = 'cost_type_hour'; } break; case 3: $cf = 'cost_from'; $ct = 'cost_type'; break; case 1: $cf = 'cost_month'; $ct = 'cost_type_month'; break; case 2: $cf = 'cost_1000'; $ct = 'cost_type'; break; } $cr = (int) $val['cost_type']; $cex = array(freelancer::USD => project_exrates::USD, freelancer::EUR => project_exrates::EUR, freelancer::RUR => project_exrates::RUR, freelancer::FM => project_exrates::FM); if (($cost_from = (double) $val['cost_from']) < 0) { $cost_from = 0; } if (($cost_to = (double) $val['cost_to']) < 0) { $cost_to = 0; } if ($cost_to < $cost_from && $cost_to != 0) { $cost_to = $cost_from; } if ($cost_to || $cost_from) { $cost_sql = ''; for ($i = 0; $i < 4; ++$i) { $exfr = round($cost_from * $project_exRates[$cex[$cr] . $cex[$i]], 4); $exto = round($cost_to * $project_exRates[$cex[$cr] . $cex[$i]], 4); $cost[] = "({$ct} = {$i} AND {$cf} >= {$exfr}" . ($cost_to ? " AND {$cf} <= {$exto}" : '') . ')'; } $select[] = implode(' OR ', $cost); } } } if ($select) { $set_select[] = 'IF( ( ' . implode(' OR ', $select) . ' ), 1, 0) as cost_filter'; unset($select); $this->_engine->setFilter('cost_filter', array(1)); } } // Опыт работы if ($filter['exp'][0] > 0 || $filter['exp'][1] > 0) { if ($filter['exp'][1] == 0 && $filter['exp'][0] > 0) { $select[] = "( exp >= {$filter['exp'][0]} )"; } elseif ($filter['exp'][1] > 0 && $filter['exp'][0] == 0) { $select[] = "( exp <= {$filter['exp'][1]} )"; } else { $select[] = "( exp >= {$filter['exp'][0]} AND exp <= {$filter['exp'][1]} )"; } $set_select[] = 'IF( ( ' . implode(' OR ', $select) . ' ), 1, 0) as exp_filter'; unset($select); $this->_engine->setFilter('exp_filter', array(1)); } //Возраст if ($filter['age'][1] > 0 || $filter['age'][0] > 0) { $age_from = $filter['age'][0]; $age_to = $filter['age'][1]; if ($age_to == 0 && $age_from > 0) { $select[] = "( age >= {$age_from} )"; } elseif ($age_to > 0 && $age_from == 0) { $select[] = "( age <= {$age_to} )"; } else { $select[] = "( age >= {$age_from} AND age <= {$age_to} )"; } $set_select[] = 'IF( ( ' . implode(' OR ', $select) . ' ), 1, 0) as age_filter'; unset($select); $this->_engine->setFilter('age_filter', array(1)); } // Местоположение if ($filter['country']) { $this->_engine->setFilter('country', array($filter['country'])); } if ($filter['city']) { $this->_engine->setFilter('city', array($filter['city'])); } // Ищет работу в офисе if ($filter['in_office']) { $this->_engine->setFilter('in_office', array(1)); } // У меня в избранных if ($filter['in_fav']) { $teams = new teams(); if ($tt = $teams->teamsFavorites($uid, $error)) { foreach ($tt as $t) { $select[] = " ( uid = {$t['uid']} ) "; } $set_select[] = 'IF(( ' . implode(' OR ', $select) . ' ), 1, 0) as is_fav'; unset($select); $this->_engine->setFilter('is_fav', array(1)); } } //С PRO аккаунтом if ($filter['is_pro']) { $this->_engine->setFilter('is_pro', array(1)); } //С положительными рекомендациями if ($filter['sbr_is_positive']) { $select[] = '( sbr_opi_plus > 0 )'; $set_select[] = 'IF(( ' . implode(' OR ', $select) . ' ), 1, 0) as sbr_positive_filter'; unset($select); $this->_engine->setFilter('sbr_positive_filter', array(1)); } //Без отрицательных рекомендаций if ($filter['sbr_not_negative']) { $select[] = '( sbr_opi_minus = 0 )'; $set_select[] = 'IF(( ' . implode(' OR ', $select) . ' ), 1, 0) as sbr_not_negative_filter'; unset($select); $this->_engine->setFilter('sbr_not_negative_filter', array(1)); } //С положительными мнениями /*if($filter['opi_is_positive']) { $select[] = '( ops_emp_plus > 0 )'; $set_select[] = "IF(( ".implode(" OR ", $select)." ), 1, 0) as opi_positive_filter"; unset($select); $this->_engine->setFilter("opi_positive_filter", array(1)); } //Без отрицательных мнений if($filter['opi_not_negative']) { $select[] = '( ops_emp_minus = 0 )'; $set_select[] = "IF(( ".implode(" OR ", $select)." ), 1, 0) as opi_not_negative_filter"; unset($select); $this->_engine->setFilter("opi_not_negative_filter", array(1)); }*/ // Только с примерами работ if ($filter['is_preview']) { $select[] = '( o_wrk_factor_a > 0 )'; $set_select[] = 'IF(( ' . implode(' OR ', $select) . ' ), 1, 0) as preview_filter'; unset($select); $this->_engine->setFilter('preview_filter', array(1)); } // Только свободные if ($filter['only_free']) { $select[] = '( status_type = 0)'; $set_select[] = 'IF(( ' . implode(' OR ', $select) . ' ), 1, 0) as onlyfree_filter'; unset($select); $this->_engine->setFilter('onlyfree_filter', array(1)); } //С успешным СБР if ($filter['success_sbr'][0] == 1) { $select[] = '( sbr_sum > 0 )'; for ($i = 1; $i < 4; ++$i) { if ($filter['success_sbr'][$i] == 1) { $rank[] = "( rank = {$i} )"; } } if ($rank) { $select[] = '( ' . implode(' OR ', $rank) . ' )'; } $set_select[] = 'IF(( ' . implode(' AND ', $select) . ' ), 1, 0) as sbr_rank_filter'; unset($select); $this->_engine->setFilter('sbr_rank_filter', array(1)); } if ($set_select) { $this->_engine->setSelect(implode(', ', $set_select)); } }
$teaminfo = teams::findOrFail($alert->team_id); ?> <li class="notification"> <a href="#" class="innernot"> <span class="glyphicon glyphicon-exclamation-sign"></span> You have been kicked out of the team ({{ $teaminfo->name }}) by the team captain. </a> <div class="btn-group" role="group" aria-label="invite"> <a type="button" class="btn btn-default" href="{{ url('team/delete-alert/' . $alert->id) }}">Ok</a> </div> </li> <li class="divider"></li> @elseif (($alert->alert_id == 5) && ($alert->team_id == Auth::User()->team_id)) <?php $teaminfo = teams::findOrFail($alert->team_id); ?> <li class="notification"> <a href="#" class="innernot"> <span class="glyphicon glyphicon-exclamation-sign"></span> The team you are in has changed it's name to "{{ $teaminfo->name }}". </a> <div class="btn-group" role="group" aria-label="invite"> <a type="button" class="btn btn-default" href="{{ url('team/delete-alert/' . $alert->id) }}">Ok</a> </div> </li> <li class="divider"></li> @endif @endforeach </ul>