本文整理汇总了PHP中ProjectMilestones::getActiveMilestonesInPeriodByUser方法的典型用法代码示例。如果您正苦于以下问题:PHP ProjectMilestones::getActiveMilestonesInPeriodByUser方法的具体用法?PHP ProjectMilestones::getActiveMilestonesInPeriodByUser怎么用?PHP ProjectMilestones::getActiveMilestonesInPeriodByUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectMilestones
的用法示例。
在下文中一共展示了ProjectMilestones::getActiveMilestonesInPeriodByUser方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: weekly_schedule
/**
* Shows weekly schedule in a calendar view
*
* @param void
* @return null
*/
function weekly_schedule()
{
$this->addHelper('textile');
// Gets desired view 'detail', 'list' or 'calendar'
// $view_type is from URL, Cookie or set to default: 'calendar'
$view_type = array_var($_GET, 'view', Cookie::getValue('weeklyScheduleViewType', 'calendar'));
$expiration = Cookie::getValue('remember' . TOKEN_COOKIE_NAME) ? REMEMBER_LOGIN_LIFETIME : null;
Cookie::setValue('weeklyScheduleViewType', $view_type, $expiration);
$monthYear = array_var($_GET, 'month');
if (!isset($monthYear) || trim($monthYear) == '' || preg_match('/^(\\d{4})(\\d{2})$/', $monthYear, $matches) == 0) {
$year = gmdate('Y');
$month = gmdate('m');
} else {
list(, $year, $month) = $matches;
}
// TODO make first day of week configurable
$from_date = DateTimeValueLib::makeFromString('monday' . (date('w') == 1 ? '' : ' last week'));
$to_date = $from_date->advance(60 * 60 * 24 * 7 * 3, false);
// +3 weeks
$upcoming_milestones = ProjectMilestones::getActiveMilestonesInPeriodByUser(logged_user(), $from_date, $to_date);
$upcoming_tickets = array();
if (plugin_active('tickets')) {
$upcoming_tickets = ProjectTickets::getOpenTicketsInPeriodByUser(logged_user(), $from_date, $to_date);
}
$active_projects = array();
$projects_index = array();
$counter = 1;
if (is_array($upcoming_milestones)) {
foreach ($upcoming_milestones as $milestone) {
if (!isset($projects_index[$milestone->getProjectId()])) {
$projects_index[$milestone->getProjectId()] = $counter;
$active_projects[] = $milestone->getProject();
$counter++;
}
// if
}
// foreach
}
// if
if (is_array($upcoming_tickets)) {
foreach ($upcoming_tickets as $ticket) {
if (!isset($projects_index[$ticket->getProjectId()])) {
$projects_index[$ticket->getProjectId()] = $counter;
$active_projects[] = $ticket->getProject();
$counter++;
}
// if
}
// foreach
}
// if
tpl_assign('from_date', $from_date);
tpl_assign('to_date', $to_date);
tpl_assign('view_type', $view_type);
tpl_assign('upcoming_tickets', $upcoming_tickets);
tpl_assign('late_tickets', array());
// logged_user()->getLateTickets());
tpl_assign('upcoming_milestones', $upcoming_milestones);
tpl_assign('late_milestones', array());
// logged_user()->getLateMilestones());
tpl_assign('projects', $active_projects);
tpl_assign('projects_index', $projects_index);
}