本文整理汇总了PHP中Projects::count方法的典型用法代码示例。如果您正苦于以下问题:PHP Projects::count方法的具体用法?PHP Projects::count怎么用?PHP Projects::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Projects
的用法示例。
在下文中一共展示了Projects::count方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
/**
* Index action
*/
public function indexAction()
{
$page = $this->request->getQuery('page', 'int', 1);
$limit = $this->request->getQuery('limit', 'int', 5);
$orderBy = $this->request->getQuery('order', 'string', 'id');
$searchName = $this->request->getQuery('q', 'string', null);
$projects = new Projects();
$totalCount = $projects->count();
$qOrderAsc = $this->request->getQuery('asc', 'int', 1);
$orderAsc = $qOrderAsc == 1 ? ' ASC' : ' DESC';
$builder = $this->modelsManager->createBuilder()->columns('*')->from('Projects')->orderBy($orderBy . ' ' . $orderAsc);
if ($searchName !== null) {
$builder->andWhere("name like '%{$searchName}%'")->orWhere("uri like '%{$searchName}%'");
}
$paginator = new PaginatorQueryBuilder(array("builder" => $builder, "limit" => $limit, "page" => $page));
$paginate = $paginator->getPaginate();
if ($page > $paginate->last && $paginate->last > 0) {
$q = $this->request->getQuery();
if ($totalCount > 0 && $limit > $totalCount) {
$q['page'] = $paginate->last;
return $this->response->redirect($this->url->get('', $q));
} elseif ($totalCount > 0) {
return $this->dispatcher->forward(['controller' => 'error', 'action' => 'error404']);
}
}
$this->view->setVar("totalProjects", $totalCount);
$this->view->setVar("projectList", $paginate);
}
示例2: countByGroup
/**
* Return number of projects in a specific group
*
* @param ProjectGroup $group
* @return integer
*/
function countByGroup($group)
{
return Projects::count(array('group_id = ? AND type = ?', $group->getId(), PROJECT_TYPE_NORMAL));
}
示例3: countProjects
/**
* Return total number of projects
*
* @access public
* @param void
* @return integer
*/
function countProjects()
{
if ($this->isOwner()) {
return Projects::count();
// all
} else {
return ProjectCompanies::count('`company_id` = ' . DB::escape($this->getId()));
}
// if
}
示例4: get_url
<b><?php
echo '<a class="internalLink dashboard-link" href="' . get_url('account', 'index') . '">' . lang('new account step update account', $step) . '</a>';
?>
</b><br/>
<?php
echo lang('new account step update account info');
?>
<br/><br/>
<?php
}
// if
$step++;
?>
<?php
if (count(Projects::count('`created_by_id` = ' . logged_user()->getId())) > 0) {
?>
<p><b><?php
echo '<a class="internalLin dashboard-link" href="' . get_url('project', 'add') . '">' . lang('new account step start workspace', $step) . '</a>';
?>
</b><img src="<?php
echo image_url('16x16/complete.png');
?>
"/></p>
<?php
echo lang('new account step start workspace info', '<span class="ico-workspace-add" style="padding: 5px 16px 0 0"> </span>', logged_user()->getPersonalProject()->getName());
?>
<br/><br/>
<?php
} else {
?>