当前位置: 首页>>代码示例>>PHP>>正文


PHP Projects::count方法代码示例

本文整理汇总了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);
 }
开发者ID:vlad6085,项目名称:projectstorage,代码行数:31,代码来源:ProjectsController.php

示例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));
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:10,代码来源:Projects.class.php

示例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
 }
开发者ID:bklein01,项目名称:Project-Pier,代码行数:17,代码来源:Company.class.php

示例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">&nbsp;</span>', logged_user()->getPersonalProject()->getName());
    ?>
<br/><br/>
<?php 
} else {
    ?>
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:31,代码来源:widget_getting_started.php


注:本文中的Projects::count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。