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


PHP Projects::paginateByUser方法代码示例

本文整理汇总了PHP中Projects::paginateByUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Projects::paginateByUser方法的具体用法?PHP Projects::paginateByUser怎么用?PHP Projects::paginateByUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Projects的用法示例。


在下文中一共展示了Projects::paginateByUser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 /**
  * Projects listing
  *
  */
 function index()
 {
     $per_page = 10;
     $page = (int) $this->request->get('page');
     if ($page < 1) {
         $page = 1;
     }
     // if
     $group = null;
     $group_id = $this->request->getId('group_id');
     if ($group_id) {
         $group = ProjectGroups::findById($group_id);
     }
     // if
     if (instance_of($group, 'ProjectGroup')) {
         list($projects, $pagination) = Projects::paginateByUserAndGroup($this->logged_user, $group, array(PROJECT_STATUS_ACTIVE), $page, $per_page);
     } else {
         list($projects, $pagination) = Projects::paginateByUser($this->logged_user, array(PROJECT_STATUS_ACTIVE), $page, $per_page);
     }
     // if
     $this->smarty->assign(array('groups' => ProjectGroups::findAll($this->logged_user), 'selected_group_id' => $group_id, 'pagination' => $pagination, 'projects' => $projects, 'page_title' => lang('Projects'), 'paginator_url' => assemble_url('mobile_access_projects')));
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:26,代码来源:MobileAccessProjectsController.class.php

示例2: archive

 /**
  * Projects Arhive
  *
  * @param void
  * @return null
  */
 function archive()
 {
     if ($this->request->isApiCall()) {
         $this->serveData(Projects::findByUser($this->logged_user), 'projects');
     }
     // if
     $per_page = 10;
     $page = (int) $this->request->get('page');
     if ($page < 1) {
         $page = 1;
     }
     // if
     if (!$this->logged_user->isOwner()) {
         $group_by = 'group';
     } else {
         $group_by = $this->request->get('group_by');
         if ($group_by != 'client') {
             $group_by = 'group';
         }
         // if
     }
     // if
     $filter_by_status = $this->request->get('filter');
     if (is_null($filter_by_status)) {
         $filter_by_status = 'all';
     }
     // if
     switch ($filter_by_status) {
         case 'all':
             $statuses = array(PROJECT_STATUS_COMPLETED, PROJECT_STATUS_CANCELED, PROJECT_STATUS_PAUSED);
             break;
         case 'completed':
             $statuses = array(PROJECT_STATUS_COMPLETED);
             break;
         case 'paused':
             $statuses = array(PROJECT_STATUS_PAUSED);
             break;
         case 'canceled':
             $statuses = array(PROJECT_STATUS_CANCELED);
             break;
         default:
             $statuses = array(PROJECT_STATUS_COMPLETED, PROJECT_STATUS_CANCELED, PROJECT_STATUS_PAUSED);
             break;
     }
     // switch project status filter
     $this->smarty->assign(array('group_by' => $group_by, 'filter' => $filter_by_status));
     if ($group_by == 'group') {
         $group = null;
         $group_id = $this->request->getId('group_id');
         if ($group_id) {
             $group = ProjectGroups::findById($group_id);
         }
         // if
         if (instance_of($group, 'ProjectGroup')) {
             list($projects, $pagination) = Projects::paginateByUserAndGroup($this->logged_user, $group, $statuses, $page, $per_page, true);
         } else {
             list($projects, $pagination) = Projects::paginateByUser($this->logged_user, $statuses, $page, $per_page, true);
         }
         // if
         $this->smarty->assign(array('projects' => $projects, 'pagination' => $pagination, 'groups' => ProjectGroups::findAll($this->logged_user), 'selected_group' => $group));
     } else {
         $company = null;
         $company_id = $this->request->getId('company_id');
         if ($company_id) {
             $company = Companies::findById($company_id);
         }
         // if
         if (!instance_of($company, 'Company')) {
             $company = $this->owner_company;
         }
         // if
         list($projects, $pagination) = Projects::paginateByUserAndCompany($this->logged_user, $company, $statuses, $page, $per_page, true);
         $this->smarty->assign(array('projects' => $projects, 'pagination' => $pagination, 'companies' => Companies::findClients($this->logged_user), 'selected_company' => $company));
     }
     // if
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:82,代码来源:ProjectsController.class.php


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