本文整理汇总了PHP中ProjectTasks::populateData方法的典型用法代码示例。如果您正苦于以下问题:PHP ProjectTasks::populateData方法的具体用法?PHP ProjectTasks::populateData怎么用?PHP ProjectTasks::populateData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectTasks
的用法示例。
在下文中一共展示了ProjectTasks::populateData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: new_list_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();
if ($externalMilestonesTemp) {
示例2: index
function index()
{
if (!can_manage_time(logged_user(), true)) {
flash_error(lang('no access permissions'));
ajx_current("empty");
return;
}
$tasksUserId = array_var($_GET, 'tu');
if (is_null($tasksUserId)) {
$tasksUserId = user_config_option('TM tasks user filter', logged_user()->getId());
} else {
if (user_config_option('TM tasks user filter') != $tasksUserId) {
set_user_config_option('TM tasks user filter', $tasksUserId, logged_user()->getId());
}
}
$timeslotsUserId = array_var($_GET, 'tsu');
if (is_null($timeslotsUserId)) {
$timeslotsUserId = user_config_option('TM user filter', 0);
} else {
if (user_config_option('TM user filter') != $timeslotsUserId) {
set_user_config_option('TM user filter', $timeslotsUserId, logged_user()->getId());
}
}
$showTimeType = array_var($_GET, 'stt');
if (is_null($showTimeType)) {
$showTimeType = user_config_option('TM show time type', 0);
} else {
if (user_config_option('TM show time type') != $showTimeType) {
set_user_config_option('TM show time type', $showTimeType, logged_user()->getId());
}
}
$start = array_var($_GET, 'start', 0);
$limit = 20;
$tasksUser = Users::findById($tasksUserId);
$timeslotsUser = Users::findById($timeslotsUserId);
//Active tasks view
$tasks = ProjectTasks::getOpenTimeslotTasks($tasksUser, logged_user());
ProjectTasks::populateData($tasks);
$tasks_array = array();
//Timeslots view
$total = 0;
switch ($showTimeType) {
case 0:
//Show only timeslots added through the time panel
$timeslots = Timeslots::getProjectTimeslots(logged_user()->getWorkspacesQuery(), $timeslotsUser, active_project(), $start, $limit);
$total = Timeslots::countProjectTimeslots(logged_user()->getWorkspacesQuery(), $timeslotsUser, active_project());
break;
case 1:
//Show only timeslots added through the tasks panel / tasks
throw new Error('not yet implemented' . $showTimeType);
/*if (active_project() instanceof Project){
$workspacesCSV = active_project()->getAllSubWorkspacesQuery(false,logged_user());
} else {
$workspacesCSV = logged_user()->getWorkspacesQuery();
}
$taskTimeslots = Timeslots::getTaskTimeslots(null, $timeslotsUser, $workspacesCSV, null , null, null, null,0,20);*/
//break;
/*if (active_project() instanceof Project){
$workspacesCSV = active_project()->getAllSubWorkspacesQuery(false,logged_user());
} else {
$workspacesCSV = logged_user()->getWorkspacesQuery();
}
$taskTimeslots = Timeslots::getTaskTimeslots(null, $timeslotsUser, $workspacesCSV, null , null, null, null,0,20);*/
//break;
case 2:
//Show timeslots added through both the time and tasks panel / tasks
throw new Error('not yet implemented' . $showTimeType);
//break;
//break;
default:
throw new Error('Unrecognised TM show time type: ' . $showTimeType);
}
//Get Users Info
if (logged_user()->isMemberOfOwnerCompany()) {
$users = Users::getAll();
} else {
$users = logged_user()->getCompany()->getUsers();
}
//Get Companies Info
if (logged_user()->isMemberOfOwnerCompany()) {
$companies = Companies::getCompaniesWithUsers();
} else {
$companies = array(logged_user()->getCompany());
}
tpl_assign('timeslots', $timeslots);
tpl_assign('tasks', $tasks);
tpl_assign('users', $users);
tpl_assign('start', $start);
tpl_assign('limit', $limit);
tpl_assign('total', $total);
tpl_assign('companies', $companies);
ajx_set_no_toolbar(true);
}