本文整理汇总了PHP中projects::getProjectViews方法的典型用法代码示例。如果您正苦于以下问题:PHP projects::getProjectViews方法的具体用法?PHP projects::getProjectViews怎么用?PHP projects::getProjectViews使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类projects
的用法示例。
在下文中一共展示了projects::getProjectViews方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ShowProjects
/**
* Функция генерации ленты проектов.
*
* @param int $num_prjs проектов на странице
* @param array $projects массив проектов (результат работы projects::GetProjects())
* @param int $kind закладка
* @param int $page номер страницы
* @param inetger $is_ajax если функция вызвана через ajax @see JS seo_print();
*
* @return HTML
*/
public function ShowProjects($num_prjs, $projects, $kind, $page, $filter, $is_ajax)
{
$this->projects = $projects;
$this->num_prjs = $num_prjs;
$this->kind = $this_kind = $kind;
$this->page = $this_page = $page == '' ? 1 : $page;
$this->pages = ceil($this->num_prjs / new_projects::PAGE_SIZE);
$this->filter = $this_filter = (int) ($filter && $filter['active'] == 't');
$this->uid = $this_uid = get_uid(false);
$this->pro_last = $this_pro_last = $_SESSION['pro_last'];
$this->is_pro = $this_is_pro = payed::CheckPro($_SESSION['login']);
$this->edit_mode = $this_edit_mode = hasPermissions('projects');
if ($this->uid) {
$this->user_role = $this_user_role = $_SESSION['role'];
}
$outHTML = '';
$outHTML .= $this->ShowHeader();
$list = array();
if ($projects) {
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php';
$stop_words = new stop_words(hasPermissions('projects'));
foreach ($projects as $i => $project) {
$this->project = $project;
$list[$i] = $project;
if ($this->edit_mode || $this->project['kind'] == 2 || $this->project['user_id'] == $this->uid || $this->project['offer_id'] || $this->pro_last) {
$this->show_data = 1;
$list[$i]['show_data'] = 1;
} else {
$this->show_data = 0;
$list[$i]['show_data'] = 0;
}
$descr = $list[$i]['descr'];
$descr = $list[$i]['moderator_status'] === '0' && $list[$i]['kind'] != 4 && $list[$i]['is_pro'] != 't' ? $stop_words->replace($descr) : $descr;
$descr = preg_replace('/^ /', "", $descr);
$descr = preg_replace("/(\n) /", "\$1", $descr);
$descr = LenghtFormatEx($descr, 180);
$descr = htmlspecialchars($descr, ENT_QUOTES, 'CP1251', false);
$descr = reformat($descr, 50, 1, 0, 1);
$descr = preg_replace("//", ' ', $descr);
$list[$i]['name'] = htmlspecialchars($list[$i]['name'], ENT_QUOTES, 'CP1251', false);
$list[$i]['descr'] = $descr;
$list[$i]['t_is_payed'] = $this->project['payed'] && $this->project['kind'] != 2 && $this->project['kind'] != 7 && $this->project['kind'] != 4;
$list[$i]['t_is_contest'] = $this->project['kind'] == 2 || $this->project['kind'] == 7;
$list[$i]['t_pro_only'] = $this->project['pro_only'] == 't';
$list[$i]['t_verify_only'] = $this->project['verify_only'] == 't';
$list[$i]['t_prefer_sbr'] = $this->project['prefer_sbr'] == 't';
$list[$i]['priceby'] = $this->project['priceby'];
$list[$i]['t_is_adm'] = hasPermissions('projects');
$list[$i]['t_is_ontop'] = strtotime($this->project['top_to']) >= time();
$list[$i]['unread'] = (int) $this->project['unread_p_msgs'] + (int) $this->project['unread_c_msgs'] + (int) $this->project['unread_c_prjs'];
$list[$i]['t_is_proonly'] = $this->project['pro_only'] == 't' && !$_SESSION['pro_last'] && !$this->edit_mode && $this->uid != $this->project['user_id'];
$list[$i]['friendly_url'] = getFriendlyURL('project', array('id' => $this->project['id'], 'name' => $this->project['name']));
$attaches = projects::GetAllAttach($this->project['id']);
$attaches = !$attaches ? array() : $attaches;
foreach ($attaches as $k => $a) {
$a['virus'] = is_null($a['virus']) ? $a['virus'] : bindec($a['virus']);
$attaches[$k] = $a;
}
$list[$i]['attaches'] = $this->project['attaches'] = $attaches;
$list[$i]['view_cnt'] = projects::getProjectViews($this->project['id']);
}
} elseif ($page == 1) {
$outHTML .= '<div class="project-preview">Ничего не найдено</div>';
}
$kind = $this->kind;
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/professions.php';
switch ($kind) {
case 0:
case 1:
$rss_link = 'projects.xml';
break;
case 2:
$rss_link = 'competition.xml';
break;
case 4:
$rss_link = 'office.xml';
break;
case 6:
$rss_link = 'pro.xml';
break;
case 5:
$rss_link = 'all.xml';
break;
default:
$rss_link = 'all.xml';
break;
}
$isPrjOpened = isset($_COOKIE['isPrjOpened']) ? $_COOKIE['isPrjOpened'] : true;
ob_start();
//.........这里部分代码省略.........