/** * Contruct time report controller * * @param Request $request * @return ProjectTimeReportsController */ function __construct($request) { parent::__construct($request); if (!$this->logged_user->isAdministrator() && !$this->logged_user->getSystemPermission('use_time_reports')) { $this->httpError(HTTP_ERR_FORBIDDEN); } // if $this->wireframe->addBreadCrumb(lang('Reports'), timetracking_module_reports_url($this->active_project)); $report_id = $this->request->getId('report_id'); if ($report_id) { $this->active_report = TimeReports::findById($report_id); } // if if (instance_of($this->active_report, 'TimeReport')) { $this->wireframe->addBreadCrumb($this->active_report->getName(), $this->active_report->getUrl()); } else { $this->active_report = new TimeReport(); } // if $this->wireframe->page_actions = array(); if (TimeReport::canAdd($this->logged_user)) { $this->wireframe->addPageAction(lang('New Report'), assemble_url('global_time_report_add', array('project_id' => $this->active_project->getId()))); } // if $this->smarty->assign('active_report', $this->active_report); }
/** * Construct timetracking controller * * @param Request $request * @return TimetrackingController */ function __construct($request) { parent::__construct($request); if ($this->logged_user->getProjectPermission('timerecord', $this->active_project) < PROJECT_PERMISSION_ACCESS) { $this->httpError(HTTP_ERR_FORBIDDEN); } // if $time_url = timetracking_module_url($this->active_project); $time_add_url = timetracking_module_add_record_url($this->active_project); $this->wireframe->addBreadCrumb(lang('Time'), $time_url); if ($this->logged_user->isAdministrator() || $this->logged_user->getSystemPermission('use_time_reports')) { $this->wireframe->addPageAction(lang('Reports'), timetracking_module_reports_url($this->active_project), null, array('id' => 'timetracking_reports')); } // if $time_id = $this->request->getId('time_id'); if ($time_id) { $this->active_time = TimeRecords::findById($time_id); } // if if (!instance_of($this->active_time, 'TimeRecord')) { $this->active_time = new TimeRecord(); } // if $object_id = $this->request->getId('for'); if ($object_id) { $this->active_object = ProjectObjects::findById($object_id); } // if if (instance_of($this->active_object, 'ProjectObject')) { $time_url = timetracking_module_url($this->active_project, $this->active_object); $time_add_url = timetracking_module_add_record_url($this->active_project, array('for' => $this->active_object->getId())); $this->wireframe->addBreadCrumb($this->active_object->getName(), $time_url); } // if $this->smarty->assign(array('active_time' => $this->active_time, 'active_object' => $this->active_object, 'time_url' => $time_url, 'add_url' => $time_add_url, 'page_tab' => 'time', 'can_manage' => $this->logged_user->getProjectPermission('timerecord', $this->active_project) >= PROJECT_PERMISSION_MANAGE)); }