public function run() { $user = $this->order[$this->is_emp ? 'freelancer' : 'employer']; //получаем общее кол-во отзывов $oplinks = NULL; $opcount = opinions::GetCounts($user['uid'], array('total')); if (array_sum($opcount['total']) > 0) { $oplinks = array('p' => getSortOpinionLinkEx('frl', "total", 1, $user['login'], zin($opcount['total']['p']), null, 0), 'n' => getSortOpinionLinkEx('frl', "total", 2, $user['login'], zin($opcount['total']['n']), null, 0), 'm' => getSortOpinionLinkEx('frl', "total", 3, $user['login'], zin($opcount['total']['m']), null, 0)); } //город юзера $city_id = $this->order['is_meet'] == 't' && $this->order['city'] > 0 ? $this->order['city'] : $user['city']; $user['place_title'] = ''; if ($city_id > 0) { $user['place_title'] = city::getCountryName($city_id) . ', ' . city::getCityName($city_id); } //собираем шаблон $this->render('t-service-order-user-profile', array('user' => $user, 'oplinks' => $oplinks)); }
ini_set('display_errors', 0); //error_reporting(E_ALL ^ E_NOTICE); ini_set('max_execution_time', 0); ini_set('memory_limit', '512M'); if (!isset($_SERVER['DOCUMENT_ROOT']) || !strlen($_SERVER['DOCUMENT_ROOT'])) { $_SERVER['DOCUMENT_ROOT'] = rtrim(realpath(pathinfo(__FILE__, PATHINFO_DIRNAME) . '/../../'), '/'); } require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stdf.php'; //require_once($_SERVER['DOCUMENT_ROOT'] . "/classes/config.php"); //require_once($_SERVER['DOCUMENT_ROOT'] . "/classes/profiler.php"); require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/opinions.php'; //------------------------------------------------------------------------------ $results = array(); if (count($argv) > 1) { parse_str(implode('&', array_slice($argv, 1)), $_GET); } //------------------------------------------------------------------------------ $login = @$_GET['login']; isAllowProfi(); $user = new users(); $user->GetUser($login); if ($user->uid > 0) { $results['GetCounts'] = print_r(opinions::GetCounts($user->uid, array('total')), true); } //------------------------------------------------------------------------------ array_walk($results, function (&$value, $key) { $value = sprintf('%s = %s' . PHP_EOL, $key, $value); }); print_r(implode('', $results)); exit;
<?php // Задача https://beta.free-lance.ru/mantis/view.php?id=28240 ini_set('display_errors', 'on'); require_once "../classes/config.php"; require_once "../classes/opinions.php"; // Месяц для подсчета статистики $date_start = '2014-09-01 00:00:00'; $date_end = '2014-10-01 00:00:00'; $sql = "\n select \n uid, \n login,\n (select count(*) from projects as p2 where p2.user_id = users.uid and p2.kind=4 and p2.post_date >= '{$date_start}' and p2.post_date < '{$date_end}') as vacancies_count,\n (select count(*) from projects as p3 where p3.user_id = users.uid and p3.payed = 0 and p3.kind=4 and p3.post_date >= '{$date_start}' and p3.post_date < '{$date_end}') as vacancies_not_payed,\n reg_date,\n (select 0-sum(ammount) from account_operations where billing_id=(select id from account where uid = users.uid) and ammount < 0) as amount\n from users where uid in (\n select user_id from projects where payed = 0 and kind=4 and post_date >= '{$date_start}' and post_date < '{$date_end}'\n ) \n order by vacancies_not_payed desc\n"; $count = 0; $rows = $DB->rows($sql); foreach ($rows as $row) { ++$count; $o = opinions::GetCounts($row['uid'], array('total')); $o_sum = intval($o['total']['p']) + intval($o['total']['m']); echo '"' . join('";"', $row) . '"'; echo ";\"{$o['total']['p']}\";\"{$o['total']['m']}\";"; echo "\n"; }
/** * печатает навигационную панель страницы отзывов * @param users $user объект класса users с данными о пользователе */ static function view_op_nav_bar($user, $sort) { global $filter_string, $author_filter_string, $period, $author, $filterCounts; $opinions = opinions::GetCounts($user->uid, array('total')); $opinionsTotal = $opinions['total']; $opinionsAll = $opinionsTotal['p'] + $opinionsTotal['n'] + $opinionsTotal['m']; $opinionsLink = '/users/' . $user->login . '/opinions/'; $authorFilterLinkParams = "?sort={$sort}&period={$period}"; $periodFilterLinkParams = "?sort={$sort}&author={$author}"; $ratingFilterLinkParams = "?period={$period}&author={$author}"; include $_SERVER['DOCUMENT_ROOT'] . '/user/tpl.op_nav_bar.php'; }
/** * Шаблон блока фрилансера, находящегося на странице создания/редактирования СБР. * @param object $frl информация о фрилансере. * * @return string html-блок. */ static function view_frl($frl) { global $session; if (!$frl->uid) { return ''; } require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/opinions.php'; $frl_link = "/users/{$frl->login}"; $frl_name = $frl->uname . ' ' . $frl->usurname . ' [' . $frl->login . ']'; $sbr_info = self::getUserInfo($frl->uid); $ocnt = opinions::GetCounts($frl->uid, array('norisk', 'emp', 'all')); ob_start(); ?> <a href="<?php echo $frl_link; ?> " target="_blank"><?php echo view_avatar($frl->login, $frl->photo); ?> </a> <div class="user-info"> <div class="user-stat"><?php echo $frl->is_pro == 't' ? view_pro2($frl->is_pro_test == 't') : ''; ?> <?php echo $session->view_online_status($frl->login); ?> <a href="<?php echo $frl_link; ?> " class="freelancer-name" target="_blank"><?php echo $frl_name; ?> </a></div> «Безопасных Сделок»: <?php echo (int) $sbr_info['success_cnt']; ?> <br /> <a href="/users/<?php echo $frl->login; ?> /opinions/?from=norisk#op_head" class="lnk-nr-reviews" target="_blank">Рекомендации работодателей</a>: <a href="<?php echo $frl_link; ?> /opinions/?from=norisk&sort=1#op_head" class="ops-plus" target="_blank">+<?php echo (int) $ocnt['norisk']['p']; ?> </a> / <a href="<?php echo $frl_link; ?> /opinions/?from=norisk&sort=2#op_head" class="ops-neitral" target="_blank"><?php echo (int) $ocnt['norisk']['n']; ?> </a> / <a href="<?php echo $frl_link; ?> /opinions/?from=norisk&sort=3#op_head" class="ops-minus" target="_blank">-<?php echo (int) $ocnt['norisk']['m']; ?> </a> <br/> <a href="<?php echo $frl_link; ?> /opinions/?from=users#op_head" class="lnk-nr-reviews" target="_blank">Мнения пользователей</a>: <a href="<?php echo $frl_link; ?> /opinions/?from=users&sort=1#op_head" class="ops-plus" target="_blank">+<?php echo (int) $ocnt['all']['p']; ?> </a> / <a href="<?php echo $frl_link; ?> /opinions/?from=users&sort=2#op_head" class="ops-neitral" target="_blank"><?php echo (int) $ocnt['all']['n']; ?> </a> / <a href="<?php echo $frl_link; ?> /opinions/?from=users&sort=3#op_head" class="ops-minus" target="_blank">-<?php echo (int) $ocnt['all']['m']; ?> </a> <input type="hidden" name="frl_login_added" value="<?php echo $frl->login; ?> "/> </div> <?php return ob_get_clean(); }