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


PHP ProjectMilestones::findAll方法代码示例

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


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

示例1: getActiveMilestonesByUser

 /**
  * Returns milestones from active context and parent members of the active context
  *
  * @param User $user
  * @return array
  */
 static function getActiveMilestonesByUser(Contact $user, $context = null)
 {
     if (is_null($context)) {
         $context = active_context();
     }
     $filter_option = config_option('milestone_selector_filter');
     $members = array();
     $parents = array();
     if ($filter_option == 'current_and_parents' || $filter_option == 'current') {
         foreach ($context as $k => $member) {
             if ($member instanceof Member) {
                 if ($member->getDimension()->getCode() == 'tags') {
                     continue;
                 }
                 $members[] = $member->getId();
                 if ($filter_option == 'current_and_parents') {
                     $tmp = $member->getParentMember();
                     while ($tmp != null) {
                         $parents[] = $tmp->getId();
                         $tmp = $tmp->getParentMember();
                     }
                 }
             }
         }
     }
     $members = array_merge($members, $parents);
     $pgs = logged_user()->getPermissionGroupIds();
     if (count($pgs) == 0) {
         $pgs[] = 0;
     }
     $permission_conditions = "EXISTS(SELECT sh.object_id FROM " . TABLE_PREFIX . "sharing_table sh WHERE sh.object_id=o.id AND sh.group_id IN (" . implode(',', $pgs) . "))";
     if ($filter_option != 'all' && count($members) > 0) {
         $member_conditions = " AND EXISTS(SELECT om.object_id FROM " . TABLE_PREFIX . "object_members om WHERE om.object_id=o.id AND om.member_id IN (" . implode(',', $members) . "))";
     } else {
         $member_conditions = "";
     }
     $conditions = "trashed_by_id = 0 AND archived_by_id = 0 AND {$permission_conditions} {$member_conditions}";
     $milestones = ProjectMilestones::findAll(array('conditions' => $conditions, 'order' => 'name'));
     return $milestones;
 }
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:46,代码来源:ProjectMilestones.class.php

示例2: getUsersMilestones

 /**
  * Return array of milestones that are assigned to specific user or his company
  *
  * @param User $user
  * @return array
  */
 function getUsersMilestones(User $user)
 {
     $conditions = DB::prepareString('`project_id` = ? AND ((`assigned_to_user_id` = ? AND `assigned_to_company_id` = ?) OR (`assigned_to_user_id` = ? AND `assigned_to_company_id` = ?) OR (`assigned_to_user_id` = ? AND `assigned_to_company_id` = ?)) AND `completed_on` = ?', array($this->getId(), $user->getId(), $user->getCompanyId(), 0, $user->getCompanyId(), 0, 0, EMPTY_DATETIME));
     if (!$user->isMemberOfOwnerCompany()) {
         $conditions .= DB::prepareString(' AND `is_private` = ?', array(0));
     }
     // if
     return ProjectMilestones::findAll(array('conditions' => $conditions, 'order' => '`due_date`'));
 }
开发者ID:swenson,项目名称:projectpier,代码行数:15,代码来源:Project.class.php

示例3: new_list_tasks


//.........这里部分代码省略.........
             $task_status_condition = " AND `completed_on` = " . DB::escape(EMPTY_DATETIME) . " AND `due_date` <= '{$now}'";
             break;
         case 20:
             // Actives task by current user
             $task_status_condition = " AND `completed_on` = " . DB::escape(EMPTY_DATETIME) . " AND `start_date` <= '{$now}' AND `assigned_to_contact_id` = " . logged_user()->getId();
             break;
         case 21:
             // Subscribed tasks by current user
             $res20 = DB::execute("SELECT object_id FROM " . TABLE_PREFIX . "object_subscriptions WHERE `contact_id` = " . logged_user()->getId());
             $subs_rows = $res20->fetchAll($res20);
             foreach ($subs_rows as $row) {
                 $subs[] = $row['object_id'];
             }
             unset($res20, $subs_rows, $row);
             $task_status_condition = " AND `completed_on` = " . DB::escape(EMPTY_DATETIME) . " AND `id` IN(" . implode(',', $subs) . ")";
             break;
         case 2:
             // All tasks
             break;
         default:
             throw new Exception('Task status "' . $status . '" not recognised');
     }
     $conditions = "AND {$template_condition} {$task_filter_condition} {$task_status_condition}";
     //Now get the tasks
     //$tasks = ProjectTasks::getContentObjects(active_context(), ObjectTypes::findById(ProjectTasks::instance()->getObjectTypeId()), null, null, $conditions,null)->objects;
     $tasks = ProjectTasks::instance()->listing(array("extra_conditions" => $conditions, "start" => 0, "limit" => 501, "count_results" => false))->objects;
     $pendingstr = $status == 0 ? " AND `completed_on` = " . DB::escape(EMPTY_DATETIME) . " " : "";
     $milestone_conditions = " AND `is_template` = false " . $pendingstr;
     //Find all internal milestones for these tasks
     //$internalMilestones = ProjectMilestones::getContentObjects(active_context(), ObjectTypes::findById(ProjectMilestones::instance()->getObjectTypeId()), null, null, $milestone_conditions,null)->objects;
     $internalMilestones = ProjectMilestones::instance()->listing(array("extra_conditions" => $milestone_conditions))->objects;
     //Find all external milestones for these tasks, external milestones are the ones that belong to a parent member and have tasks in the current member
     $milestone_ids = array();
     if ($tasks) {
         foreach ($tasks as $task) {
             if ($task->getMilestoneId() != 0) {
                 $milestone_ids[$task->getMilestoneId()] = $task->getMilestoneId();
             }
         }
     }
     $int_milestone_ids = array();
     foreach ($internalMilestones as $milestone) {
         $int_milestone_ids[] = $milestone->getId();
     }
     $milestone_ids = array_diff($milestone_ids, $int_milestone_ids);
     if (count($milestone_ids) == 0) {
         $milestone_ids[] = 0;
     }
     $ext_milestone_conditions = " `is_template` = false " . $pendingstr . ' AND `object_id` IN (' . implode(',', $milestone_ids) . ')';
     $externalMilestones = ProjectMilestones::findAll(array('conditions' => $ext_milestone_conditions));
     // Get Users Info
     $users = allowed_users_in_context(ProjectTasks::instance()->getObjectTypeId(), active_context(), ACCESS_LEVEL_READ);
     $allUsers = Contacts::getAllUsers();
     $user_ids = array(-1);
     foreach ($users as $user) {
         $user_ids[] = $user->getId();
     }
     // only companies with users
     $companies = Contacts::findAll(array("conditions" => "e.is_company = 1", "join" => array("table" => Contacts::instance()->getTableName(), "jt_field" => "object_id", "j_sub_q" => "SELECT xx.object_id FROM " . Contacts::instance()->getTableName(true) . " xx WHERE \n\t\t\t\t\txx.is_company=0 AND xx.company_id = e.object_id AND xx.object_id IN (" . implode(",", $user_ids) . ") LIMIT 1")));
     tpl_assign('tasks', $tasks);
     if (config_option('use tasks dependencies')) {
         $dependency_count = array();
         foreach ($tasks as $task) {
             $previous = 0;
             $ptasks = ProjectTaskDependencies::getDependenciesForTask($task->getId());
             foreach ($ptasks as $pdep) {
                 $ptask = ProjectTasks::findById($pdep->getPreviousTaskId());
                 if ($ptask instanceof ProjectTask && !$ptask->isCompleted()) {
                     $previous++;
                 }
             }
             $dependants = ProjectTaskDependencies::getDependantsForTask($task->getId());
             $dep_csv = "";
             foreach ($dependants as $dep) {
                 $dep_csv .= ($dep_csv == "" ? "" : ",") . $dep->getTaskId();
             }
             $dependency_count[] = array('id' => $task->getId(), 'count' => $previous, 'dependants' => $dep_csv);
         }
         tpl_assign('dependency_count', $dependency_count);
     }
     if (!$isJson) {
         $all_templates = COTemplates::findAll(array('conditions' => '`trashed_by_id` = 0 AND `archived_by_id` = 0'));
         tpl_assign('all_templates', $all_templates);
         if (user_config_option('task_display_limit') > 0 && count($tasks) > user_config_option('task_display_limit')) {
             tpl_assign('displayTooManyTasks', true);
             array_pop($tasks);
         }
         tpl_assign('object_subtypes', array());
         tpl_assign('internalMilestones', $internalMilestones);
         tpl_assign('externalMilestones', $externalMilestones);
         tpl_assign('users', $users);
         tpl_assign('allUsers', $allUsers);
         tpl_assign('companies', $companies);
         $userPref = array();
         $userPref = array('filterValue' => isset($filter_value) ? $filter_value : '', 'filter' => $filter, 'status' => $status, 'showWorkspaces' => user_config_option('tasksShowWorkspaces', 1), 'showTime' => user_config_option('tasksShowTime'), 'showDates' => user_config_option('tasksShowDates'), 'showTags' => user_config_option('tasksShowTags', 0), 'showEmptyMilestones' => user_config_option('tasksShowEmptyMilestones', 1), 'showTimeEstimates' => user_config_option('tasksShowTimeEstimates', 1), 'groupBy' => user_config_option('tasksGroupBy', 'milestone'), 'orderBy' => user_config_option('tasksOrderBy', 'priority'), 'defaultNotifyValue' => user_config_option('can notify from quick add'));
         hook::fire('tasks_user_preferences', null, $userPref);
         tpl_assign('userPreferences', $userPref);
         ajx_set_no_toolbar(true);
     }
 }
开发者ID:rorteg,项目名称:fengoffice,代码行数:101,代码来源:TaskController.class.php

示例4: new_list_tasks


//.........这里部分代码省略.........
             // Today + Overdue tasks
             $now = date('Y-m-j 00:00:00');
             $task_status_condition = " AND `completed_on` = " . DB::escape(EMPTY_DATETIME) . " AND `due_date` <= '{$now}'";
             break;
         case 20:
             // Actives task by current user
             $now = date('Y-m-j 00:00:00');
             $task_status_condition = " AND `completed_on` = " . DB::escape(EMPTY_DATETIME) . " AND `start_date` <= '{$now}' AND `assigned_to_user_id` = " . logged_user()->getId();
             break;
         case 21:
             // Subscribed tasks by current user
             $res20 = DB::execute("SELECT object_id FROM " . TABLE_PREFIX . "object_subscriptions WHERE `object_manager` LIKE 'ProjectTasks' AND `user_id` = " . logged_user()->getId());
             $subs_rows = $res20->fetchAll($res20);
             foreach ($subs_rows as $row) {
                 $subs[] = $row['object_id'];
             }
             unset($res20, $subs_rows, $row);
             $now = date('Y-m-j 00:00:00');
             $task_status_condition = " AND `completed_on` = " . DB::escape(EMPTY_DATETIME) . " AND `id` IN(" . implode(',', $subs) . ")";
             break;
         case 2:
             // All tasks
             break;
         default:
             throw new Exception('Task status "' . $status . '" not recognised');
     }
     if (!$tag) {
         $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 ";
     }
     $conditions = $template_condition . $task_filter_condition . $task_status_condition . $permissions . $tagstr . $projectstr . " AND `trashed_by_id` = 0 AND `archived_by_id` = 0";
     //Now get the tasks
     $tasks = ProjectTasks::findAll(array('conditions' => $conditions, 'order' => 'created_on DESC', 'limit' => user_config_option('task_display_limit') > 0 ? user_config_option('task_display_limit') + 1 : null));
     ProjectTasks::populateData($tasks);
     //Find all internal milestones for these tasks
     $internalMilestones = ProjectMilestones::getProjectMilestones(active_or_personal_project(), null, 'DESC', "", null, null, null, $status == 0, false);
     ProjectMilestones::populateData($internalMilestones);
     //Find all external milestones for these tasks
     $milestone_ids = array();
     if ($tasks) {
         foreach ($tasks as $task) {
             if ($task->getMilestoneId() != 0) {
                 $milestone_ids[$task->getMilestoneId()] = $task->getMilestoneId();
             }
         }
     }
     $milestone_ids_condition = '';
     if (count($milestone_ids) > 0) {
         $milestone_ids_condition = ' OR id in (' . implode(',', $milestone_ids) . ')';
     }
     if ($status == 0) {
         $pendingstr = " AND `completed_on` = " . DB::escape(EMPTY_DATETIME) . " ";
     } else {
         $pendingstr = "";
     }
     if (!$tag) {
         $tagstr = "";
     } else {
         $tagstr = " AND (select count(*) from " . TABLE_PREFIX . "tags where " . TABLE_PREFIX . "project_milestones.id = " . TABLE_PREFIX . "tags.rel_object_id and " . TABLE_PREFIX . "tags.tag = " . DB::escape($tag) . " and " . TABLE_PREFIX . "tags.rel_object_manager ='ProjectMilestones' ) > 0 ";
     }
     $projectstr = " AND (" . ProjectMilestones::getWorkspaceString($pids) . $milestone_ids_condition . ")";
     $archivedstr = " AND `archived_by_id` = 0 ";
     $milestone_conditions = " `is_template` = false " . $archivedstr . $projectstr . $pendingstr;
     $externalMilestonesTemp = ProjectMilestones::findAll(array('conditions' => $milestone_conditions));
     $externalMilestones = array();
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:67,代码来源:TaskController.class.php

示例5: new_list_tasks

 function new_list_tasks()
 {
     //load config options into cache for better performance
     load_user_config_options_by_category_name('task panel');
     $isJson = array_var($_GET, 'isJson', false);
     if ($isJson) {
         ajx_current("empty");
     }
     $request_conditions = $this->get_tasks_request_conditions();
     $conditions = $request_conditions['conditions'];
     $filter_value = $request_conditions['filterValue'];
     $filter = $request_conditions['filter'];
     $status = $request_conditions['status'];
     $tasks = array();
     $pendingstr = $status == 0 ? " AND `e`.`completed_on` = " . DB::escape(EMPTY_DATETIME) . " " : "";
     $milestone_conditions = " AND `is_template` = false " . $pendingstr;
     //Find all internal milestones for these tasks
     $internalMilestones = ProjectMilestones::instance()->listing(array("extra_conditions" => $milestone_conditions))->objects;
     //Find all external milestones for these tasks, external milestones are the ones that belong to a parent member and have tasks in the current member
     $milestone_ids = array();
     $task_ids = array();
     if ($tasks) {
         foreach ($tasks as $task) {
             $task_ids[] = $task['id'];
             if ($task['milestone_id'] != 0) {
                 $milestone_ids[$task['milestone_id']] = $task['milestone_id'];
             }
         }
         // generate request cache
         ObjectMembers::instance()->getCachedObjectMembers(0, $task_ids);
         ProjectTasks::instance()->findByRelatedCached(0, $task_ids);
     }
     $cp_values = array();
     if (count($task_ids) > 0) {
         $cp_rows = DB::executeAll("SELECT * FROM " . TABLE_PREFIX . "custom_property_values WHERE object_id IN (" . implode(',', $task_ids) . ")");
         if (is_array($cp_rows)) {
             foreach ($cp_rows as $row) {
                 if (!isset($cp_values[$row['object_id']])) {
                     $cp_values[$row['object_id']] = array();
                 }
                 if (!isset($cp_values[$row['object_id']][$row['custom_property_id']])) {
                     $cp_values[$row['object_id']][$row['custom_property_id']] = array();
                 }
                 $cp_values[$row['object_id']][$row['custom_property_id']][] = $row['value'];
             }
         }
     }
     tpl_assign('cp_values', $cp_values);
     $int_milestone_ids = array();
     foreach ($internalMilestones as $milestone) {
         $int_milestone_ids[] = $milestone->getId();
     }
     $milestone_ids = array_diff($milestone_ids, $int_milestone_ids);
     if (count($milestone_ids) == 0) {
         $milestone_ids[] = 0;
     }
     $ext_milestone_conditions = " `is_template` = false " . $pendingstr . ' AND `object_id` IN (' . implode(',', $milestone_ids) . ')';
     $externalMilestones = ProjectMilestones::findAll(array('conditions' => $ext_milestone_conditions));
     // Get Users Info
     if (logged_user()->isGuest()) {
         $users = array(logged_user());
     } else {
         $users = allowed_users_in_context(ProjectTasks::instance()->getObjectTypeId(), active_context(), ACCESS_LEVEL_READ, '', true);
     }
     $allUsers = Contacts::getAllUsers(null, true);
     $user_ids = array(-1);
     foreach ($allUsers as $user) {
         $user_ids[] = $user->getId();
     }
     // only companies with users
     $companies = Contacts::findAll(array("conditions" => "e.is_company = 1", "join" => array("table" => Contacts::instance()->getTableName(), "jt_field" => "object_id", "j_sub_q" => "SELECT xx.object_id FROM " . Contacts::instance()->getTableName(true) . " xx WHERE \r\n\t\t\t\t\txx.is_company=0 AND xx.company_id = e.object_id AND xx.object_id IN (" . implode(",", $user_ids) . ") LIMIT 1")));
     tpl_assign('tasks', $tasks);
     if (!$isJson) {
         $all_templates = COTemplates::findAll(array('conditions' => '`trashed_by_id` = 0 AND `archived_by_id` = 0'));
         tpl_assign('all_templates', $all_templates);
         if (user_config_option('task_display_limit') > 0 && count($tasks) > user_config_option('task_display_limit')) {
             tpl_assign('displayTooManyTasks', true);
             array_pop($tasks);
         }
         tpl_assign('object_subtypes', array());
         tpl_assign('internalMilestones', $internalMilestones);
         tpl_assign('externalMilestones', $externalMilestones);
         tpl_assign('users', $users);
         tpl_assign('allUsers', $allUsers);
         tpl_assign('companies', $companies);
         if (strtotime(user_config_option('tasksDateStart'))) {
             //this return null if date is 0000-00-00 00:00:00
             $dateStart = new DateTime('@' . strtotime(user_config_option('tasksDateStart')));
             $dateStart = $dateStart->format(user_config_option('date_format'));
         } else {
             $dateStart = '';
         }
         if (strtotime(user_config_option('tasksDateEnd'))) {
             //this return null if date is 0000-00-00 00:00:00
             $dateEnd = new DateTime('@' . strtotime(user_config_option('tasksDateEnd')));
             $dateEnd = $dateEnd->format(user_config_option('date_format'));
         } else {
             $dateEnd = '';
         }
         $userPref = array();
//.........这里部分代码省略.........
开发者ID:abhinay100,项目名称:feng_app,代码行数:101,代码来源:TaskController.class.php

示例6: get_assignable_milestones

	/**
	 * Returns the milestones included in the present workspace and all of its parents. This is because tasks from a particular workspace
	 * can only be assigned to milestones from that workspace and from any of its parents.
	 */
	function get_assignable_milestones() {
		ajx_current("empty");
		$ms = ProjectMilestones::findAll();
		if ($ms === null) $ms = array();
		$ms_info = array();
		foreach ($ms as $milestone) {
			$ms_info[] = $milestone->getArrayInfo();
		}
		ajx_extra_data(array('milestones' => $ms_info));
	}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:14,代码来源:MilestoneController.class.php


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