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


PHP ProjectTasks::paginate方法代码示例

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


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

示例1: paginateProjectTasks

 static function paginateProjectTasks($project = null, $order = null, $orderdir = 'ASC', $page = null, $tasks_per_page = null, $group_by_order = false, $parent_id = null, $milestone_id = 0, $tag = null, $assigned_to_company = null, $assigned_to_user = null, $assigned_by_user = null, $pending = false, $archived = false)
 {
     if ($order == self::ORDER_BY_STARTDATE) {
         $order_by = '`start_date` ' . $orderdir;
     } else {
         if ($order == self::ORDER_BY_DUEDATE) {
             $order_by = '`due_date` ' . $orderdir;
         } else {
             // default
             $order_by = '`order` ' . $orderdir;
         }
     }
     // if
     if ((int) $page < 1) {
         $page = 1;
     }
     // if
     if ((int) $tasks_per_page < 1) {
         $tasks_per_page = 10;
     }
     // if
     if ($project instanceof Project) {
         $pids = $project->getAllSubWorkspacesQuery(!$archived);
         $projectstr = " AND " . self::getWorkspaceString($pids);
     } else {
         $projectstr = "";
     }
     if ($parent_id === null) {
         $parentstr = "";
     } else {
         $parentstr = " AND `parent_id` = " . DB::escape($parent_id) . " ";
     }
     if ($milestone_id > 0) {
         $milestonestr = " AND `milestone_id` = " . DB::escape($milestone_id) . " ";
     } else {
         $milestonestr = "";
     }
     if ($tag == '' || $tag == null) {
         $tagstr = "";
     } else {
         $tagstr = " AND (select count(*) from " . TABLE_PREFIX . "tags where " . TABLE_PREFIX . "project_tasks.id = " . TABLE_PREFIX . "tags.rel_object_id and " . TABLE_PREFIX . "tags.tag = " . DB::escape($tag) . " and " . TABLE_PREFIX . "tags.rel_object_manager ='ProjectTasks' ) > 0 ";
     }
     $assignedToStr = "";
     if ($assigned_to_company) {
         $assignedToStr .= " AND `assigned_to_company_id` = " . DB::escape($assigned_to_company) . " ";
     }
     if ($assigned_to_user) {
         $assignedToStr .= " AND `assigned_to_user_id` = " . DB::escape($assigned_to_user) . " ";
     }
     $assignedByStr = "";
     if ($assigned_by_user) {
         $assignedByStr .= " AND (`created_by_id` = " . DB::escape($assigned_by_user) . " OR `updated_by_id` = " . DB::escape($assigned_by_user) . ") ";
     }
     if ($pending) {
         $pendingstr = " AND `completed_on` = " . DB::escape(EMPTY_DATETIME) . " ";
     } else {
         $pendingstr = "";
     }
     if ($archived) {
         $archived_cond = "AND `archived_by_id` <> 0";
     } else {
         $archived_cond = "AND `archived_by_id` = 0";
     }
     $permissionstr = ' AND ( ' . permissions_sql_for_listings(ProjectTasks::instance(), ACCESS_LEVEL_READ, logged_user()) . ') ';
     $otherConditions = $milestonestr . $parentstr . $projectstr . $tagstr . $assignedToStr . $assignedByStr . $pendingstr . $permissionstr . $archived_cond;
     $conditions = array(' `is_template` = false ' . $otherConditions);
     list($tasks, $pagination) = ProjectTasks::paginate(array('conditions' => $conditions, 'order' => $order_by), $tasks_per_page, $page);
     if (!is_array($tasks)) {
         $tasks = array();
     }
     return array($tasks, $pagination);
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:72,代码来源:ProjectTasks.class.php


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