當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。