/**
  * Constructor
  *
  * @param Request $request
  * @return ChecklistsController
  */
 function __construct($request)
 {
     parent::__construct($request);
     if ($this->logged_user->getProjectPermission('checklist', $this->active_project) < PROJECT_PERMISSION_ACCESS) {
         $this->httpError(HTTP_ERR_FORBIDDEN);
     }
     // if
     $checklists_url = checklists_module_url($this->active_project);
     $checklists_archive_url = checklists_module_archive_url($this->active_project);
     $add_checklist_url = false;
     $this->wireframe->addBreadCrumb(lang('Checklists'), $checklists_url);
     if (Checklist::canAdd($this->logged_user, $this->active_project)) {
         $add_checklist_url = checklists_module_add_checklist_url($this->active_project);
         $this->wireframe->addPageAction(lang('New Checklist'), $add_checklist_url);
     }
     // if
     $checklist_id = $this->request->getId('checklist_id');
     if ($checklist_id) {
         $this->active_checklist = ProjectObjects::findById($checklist_id);
     }
     // if
     if (instance_of($this->active_checklist, 'Checklist')) {
         if ($this->active_checklist->isCompleted()) {
             $this->wireframe->addBreadCrumb(lang('Archive'), checklists_module_archive_url($this->active_project));
         }
         // if
         $this->wireframe->addBreadCrumb($this->active_checklist->getName(), $this->active_checklist->getViewUrl());
     } else {
         $this->active_checklist = new Checklist();
     }
     // if
     $this->smarty->assign(array('active_checklist' => $this->active_checklist, 'checklists_url' => $checklists_url, 'checklists_archive_url' => $checklists_archive_url, 'add_checklist_url' => $add_checklist_url, 'page_tab' => 'checklists'));
 }
 /**
  * Constructor
  *
  * @param Request $request
  * @return FilesController
  */
 function __construct($request)
 {
     parent::__construct($request);
     if ($this->logged_user->getProjectPermission('file', $this->active_project) < PROJECT_PERMISSION_ACCESS) {
         $this->httpError(HTTP_ERR_FORBIDDEN);
     }
     // if
     $files_url = files_module_url($this->active_project);
     $attachments_url = files_module_url($this->active_project, array('show_attachments' => true));
     $this->wireframe->addBreadCrumb(lang('Files'), $files_url);
     $upload_url = false;
     if (File::canAdd($this->logged_user, $this->active_project)) {
         if ($this->active_category->isLoaded()) {
             $upload_url = files_module_upload_url($this->active_project, array('category_id' => $this->active_category->getId()));
         } else {
             $upload_url = files_module_upload_url($this->active_project);
         }
         // if
         $this->wireframe->addPageAction(lang('Upload Files'), $upload_url);
     }
     // if
     $file_id = $this->request->getId('file_id');
     if ($file_id) {
         $this->active_file = ProjectObjects::findById($file_id);
     }
     // if
     if (instance_of($this->active_file, 'File')) {
         $this->wireframe->addBreadCrumb($this->active_file->getName(), $this->active_file->getViewUrl());
     } else {
         $this->active_file = new File();
     }
     // if
     $this->smarty->assign(array('active_file' => $this->active_file, 'files_url' => $files_url, 'attachments_url' => $attachments_url, 'upload_url' => $upload_url, 'page_tab' => 'files'));
 }
 /**
  * Construct discussions controller
  *
  * @param Request $request
  * @return DiscussionsController
  */
 function __construct($request)
 {
     parent::__construct($request);
     if ($this->logged_user->getProjectPermission('discussion', $this->active_project) < PROJECT_PERMISSION_ACCESS) {
         $this->httpError(HTTP_ERR_FORBIDDEN);
     }
     // if
     $discussions_url = discussions_module_url($this->active_project);
     $this->wireframe->addBreadCrumb(lang('Discussions'), $discussions_url);
     $add_discussion_url = false;
     if (Discussion::canAdd($this->logged_user, $this->active_project)) {
         if ($this->active_category->isLoaded()) {
             $add_discussion_url = discussions_module_add_discussion_url($this->active_project, array('category_id' => $this->active_category->getId()));
         } else {
             $add_discussion_url = discussions_module_add_discussion_url($this->active_project);
         }
         // if
         $this->wireframe->addPageAction(lang('New Discussion'), $add_discussion_url);
     }
     // if
     $discussion_id = $this->request->getId('discussion_id');
     if ($discussion_id) {
         $this->active_discussion = ProjectObjects::findById($discussion_id);
     }
     // if
     if (instance_of($this->active_discussion, 'Discussion')) {
         $this->wireframe->addBreadCrumb($this->active_discussion->getName(), $this->active_discussion->getViewUrl());
     } else {
         $this->active_discussion = new Discussion();
     }
     // if
     $this->smarty->assign(array('active_discussion' => $this->active_discussion, 'discussions_url' => $discussions_url, 'add_discussion_url' => $add_discussion_url, 'page_tab' => 'discussions'));
 }
 /**
  * Construct controller
  *
  * @param Request $parent
  * @param mixed $context
  */
 function __construct($parent, $context = null)
 {
     parent::__construct($parent, $context);
     if ($this->getControllerName() == 'frosso_tab') {
         //$this->categories_delegate = $this->__delegate('categories', CATEGORIES_FRAMEWORK_INJECT_INTO, 'project_asset');
     }
 }
 /**
  * Construct tags controller
  *
  * @param Request $request
  * @return TagsController
  */
 function __construct($request)
 {
     parent::__construct($request);
     $tags_url = Tags::getTagsUrl($this->active_project);
     $this->wireframe->addBreadCrumb(lang('Tags'), $tags_url);
     $this->wireframe->addPageAction(lang('Browse'), $tags_url);
     $this->smarty->assign(array('tags_url' => $tags_url));
 }
 /**
  * Constructor
  *
  * @param Request $request
  * @return TicketsController
  */
 function __construct($request)
 {
     parent::__construct($request);
     if (!$this->logged_user->isAdministrator() && !$this->logged_user->isProjectLeader($this->active_project) && !$this->logged_user->isProjectManager()) {
         $this->httpError(HTTP_ERR_FORBIDDEN);
     }
     // if
     $this->wireframe->print_button = false;
 }
 /**
  * Class constructor
  *
  * @param unknown_type $request
  */
 function __construct($request)
 {
     parent::__construct($request);
     if ($this->logged_user->getProjectPermission('repository', $this->active_project) < PROJECT_PERMISSION_ACCESS) {
         $this->httpError(HTTP_ERR_FORBIDDEN);
     }
     // if
     $source_module_url = source_module_url($this->active_project);
     $add_repository_url = source_module_add_repository_url($this->active_project);
     // wireframe
     $this->wireframe->addBreadCrumb(lang('Source'), $source_module_url);
     $this->wireframe->print_button = false;
     $repository_id = $this->request->get('repository_id');
     $this->active_repository = Repositories::findById($repository_id);
     if (instance_of($this->active_repository, 'Repository')) {
         // load repository engine
         if (!$this->active_repository->loadEngine()) {
             flash_error('Failed to load repository engine class');
             $this->redirectToUrl($source_module_url);
         }
         // if
         $this->repository_engine = new RepositoryEngine($this->active_repository);
         $this->active_repository->mapped_users = SourceUsers::findByRepository($this->active_repository);
         if (!$this->repository_engine->executableExists()) {
             $this->wireframe->addPageMessage(lang("Source executable not found. You won't be able to use this module"), 'error');
         }
         // if
         // active commit
         $this->active_revision = intval($this->request->get('r'));
         $this->active_commit = Commits::findByRevision($this->active_revision, $this->active_repository);
         js_assign('update_url', $this->active_repository->getupdateurl());
         js_assign('active_revision', intval($this->request->get('r')));
         if (!$this->active_repository->isNew()) {
             $this->wireframe->addBreadCrumb(clean($this->active_repository->getName()), $this->active_repository->getHistoryUrl());
         }
         // if
     } else {
         $this->active_repository = new Repository();
         $this->active_repository->setRepositoryType(1);
         $this->active_repository->loadEngine();
         $this->repository_engine = new RepositoryEngine($this->active_repository);
     }
     // if
     if (!instance_of($this->active_commit, 'Commit')) {
         $this->active_commit = new Commit();
     }
     // if
     // active file
     $this->active_file = urldecode($this->request->get('path'));
     $path_info = pathinfo($this->active_file);
     $this->active_file_basename = array_var($path_info, 'basename', null);
     // smarty stuff
     $this->smarty->assign(array('project_tab' => SOURCE_MODULE, 'active_repository' => $this->active_repository, 'active_revision' => $this->active_revision, 'active_commit' => $this->active_commit, 'active_file' => $this->active_file, 'active_file_basename' => $this->active_file_basename, 'page_tab' => 'source', 'add_repository_url' => $add_repository_url));
 }
 /**
  * Constructor
  *
  * @param Request $request
  * @return TicketsController
  */
 function __construct($request)
 {
     parent::__construct($request);
     if ($this->logged_user->getProjectPermission('ticket', $this->active_project) < PROJECT_PERMISSION_ACCESS) {
         $this->httpError(HTTP_ERR_FORBIDDEN);
     }
     // if
     $tickets_url = tickets_module_url($this->active_project);
     $archive_url = assemble_url('project_tickets_archive', array('project_id' => $this->active_project->getId()));
     $this->wireframe->addBreadCrumb(lang('Tickets'), $tickets_url);
     /*$_options = new NamedList();
       $_options->add('_category', array('url' => $tickets_url, 'text' => lang('Category')));
       $_options->add('_star', array('url' => $tickets_url, 'text' => lang('Star')));
       $_options->add('_priority', array('url' => $tickets_url, 'text' => lang('Priority')));
       $_options->add('_name', array('url' => $tickets_url, 'text' => lang('Name')));
       $_options->add('_owner', array('url' => $tickets_url, 'text' => lang('Owner')));
       $this->wireframe->addPageAction(lang('Sort by'), $tickets_url, $_options, null, '0');*/
     $add_ticket_url = false;
     if (Ticket::canAdd($this->logged_user, $this->active_project)) {
         $params = null;
         if ($this->active_category->isLoaded()) {
             $params = array('category_id' => $this->active_category->getId());
         }
         // if
         $add_ticket_url = tickets_module_add_ticket_url($this->active_project, $params);
         $this->wireframe->addPageAction(lang('New Ticket'), $add_ticket_url, null, '1');
         //$this->wireframe->addPageAction(lang('New Ticket'), $add_ticket_url);
     }
     // if
     $ticket_id = $this->request->getId('ticket_id');
     if ($ticket_id) {
         $this->active_ticket = Tickets::findByTicketId($this->active_project, $ticket_id);
     }
     // if
     if (instance_of($this->active_category, 'Category') && $this->active_category->isLoaded()) {
         $this->wireframe->addBreadCrumb($this->active_category->getName(), $this->active_category->getViewUrl());
     }
     // if
     if (instance_of($this->active_ticket, 'Ticket')) {
         if ($this->active_ticket->isCompleted()) {
             $this->wireframe->addBreadCrumb(lang('Archive'), $archive_url);
         }
         // if
         $this->wireframe->addBreadCrumb($this->active_ticket->getName(), $this->active_ticket->getViewUrl());
     } else {
         $this->active_ticket = new Ticket();
     }
     // if
     $this->smarty->assign(array('tickets_url' => $tickets_url, 'tickets_archive_url' => $archive_url, 'add_ticket_url' => $add_ticket_url, 'active_ticket' => $this->active_ticket, 'page_tab' => 'tickets', 'mass_edit_tickets_url' => assemble_url('project_tickets_mass_edit', array('project_id' => $this->active_project->getId()))));
 }
 /**
  * Construct comments controller
  *
  * @param Request $request
  * @return CommentsController
  */
 function __construct($request)
 {
     parent::__construct($request);
     $comment_id = $this->request->getId('comment_id');
     if ($comment_id > 0) {
         $this->active_comment = ProjectObjects::findById($comment_id);
     }
     // if
     if (!instance_of($this->active_comment, 'Comment')) {
         $this->active_comment = new Comment();
     }
     // if
     $this->smarty->assign(array('active_comment' => $this->active_comment, 'page_tab' => $this->active_comment->getProjectTab()));
 }
 /**
  * Constructor
  *
  * @param Request $request
  * @return TicketsController
  */
 function __construct($request)
 {
     parent::__construct($request);
     if (!$this->logged_user->isAdministrator() && !$this->logged_user->isProjectLeader($this->active_project) && !$this->logged_user->isProjectManager()) {
         $this->httpError(HTTP_ERR_FORBIDDEN);
     }
     // if
     $repository_id = $this->request->get('github_repository_id');
     $this->active_repository = GithubRepositories::findById($repository_id);
     if (!instance_of($this->active_repository, 'GithubRepository')) {
         $this->active_repository = new GithubRepository();
     }
     $this->wireframe->print_button = false;
     $this->smarty->assign(array('active_repository' => $this->active_repository, 'project_tab' => GITHUB_MODULE, 'page_tab' => 'github', 'add_repository_url' => github_module_add_repository_url($this->active_project)));
 }
 /**
  * Constructor
  *
  * @param Request $request
  * @return ProjectObjectsController
  */
 function __construct($request)
 {
     parent::__construct($request);
     $object_id = (int) $this->request->getId('object_id');
     if ($object_id) {
         $this->active_object = ProjectObjects::findById($object_id);
     }
     // if
     if (instance_of($this->active_object, 'ProjectObject')) {
         $this->active_object->prepareProjectSectionBreadcrumb($this->wireframe);
         $this->wireframe->addBreadCrumb($this->active_object->getName(), $this->active_object->getViewUrl());
     } else {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     $this->smarty->assign(array('active_object' => $this->active_object, 'page_tab' => $this->active_object->getProjectTab()));
 }
 /**
  * Constructor
  *
  * @param Request $request
  * @return MilestonesController
  */
 function __construct($request)
 {
     parent::__construct($request);
     if ($this->logged_user->getProjectPermission('milestone', $this->active_project) < PROJECT_PERMISSION_ACCESS) {
         $this->httpError(HTTP_ERR_FORBIDDEN);
     }
     // if
     $milestones_url = milestones_module_url($this->active_project);
     $add_milestone_url = milestones_module_add_url($this->active_project);
     $this->wireframe->addBreadCrumb(lang('Milestones'), $milestones_url);
     if (Milestone::canAdd($this->logged_user, $this->active_project)) {
         $this->wireframe->addPageAction(lang('New Milestone'), $add_milestone_url);
     }
     // if
     //$this->wireframe->addPageAction(lang('Today'), assemble_url('project_user_today_page', array('project_id' => $this->active_project->getId(), 'user_id' => $this->logged_user->getId())));
     $milestone_id = $this->request->getId('milestone_id');
     if ($milestone_id) {
         $this->active_milestone = ProjectObjects::findById($milestone_id);
     }
     // if
     //BOF: task 03 | AD
     $order_by_val = $_GET['order_by'];
     if (!empty($order_by_val)) {
         $this->order_by = $order_by_val;
     }
     $sort_order_val = $_GET['sort_order'];
     if (!empty($sort_order_val)) {
         $this->sort_order = $sort_order_val;
     }
     //EOF: task 03 | AD
     if (instance_of($this->active_milestone, 'Milestone')) {
         if ($this->active_milestone->getCompletedOn()) {
             $this->wireframe->addBreadCrumb(lang('Archive'), assemble_url('project_milestones_archive', array('project_id' => $this->active_project->getId())));
         }
         // if
         $this->wireframe->addBreadCrumb($this->active_milestone->getName(), $this->active_milestone->getViewUrl());
     } else {
         $this->active_milestone = new Milestone();
     }
     // if
     $this->smarty->assign(array('active_milestone' => $this->active_milestone, 'milestones_url' => $milestones_url, 'add_milestone_url' => $add_milestone_url, 'page_tab' => 'milestones', 'mass_edit_milestones_url' => assemble_url('project_milestones_mass_edit', array('project_id' => $this->active_project->getId()))));
 }
 /**
  * Construct project_people controller
  *
  * @param Request $request
  * @return ProjectPeopleController
  */
 function __construct($request)
 {
     parent::__construct($request);
     $this->wireframe->addBreadCrumb(lang('People'), $this->active_project->getPeopleUrl());
     if ($this->active_project->canEdit($this->logged_user)) {
         $this->wireframe->addPageAction(lang('Add People'), $this->active_project->getAddPeopleUrl());
     }
     // if
     //$this->wireframe->addPageAction(lang('Milestones'), assemble_url('project_user_assigned_milestones', array('project_id' => $this->active_project->getId(), 'user_id' => $this->logged_user->getId())));
     //BOF: task 01 | AD
     $order_by_val = $_GET['order_by'];
     if (!empty($order_by_val)) {
         $this->order_by = $order_by_val;
     }
     $sort_order_val = $_GET['sort_order'];
     if (!empty($sort_order_val)) {
         $this->sort_order = $sort_order_val;
     }
     //EOF: task 01 | AD
     $this->smarty->assign('page_tab', 'people');
 }
 /**
  * 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));
 }
 /**
  * Constructor
  *
  * @param Request $request
  * @return TasksController
  */
 function __construct($request)
 {
     parent::__construct($request);
     $task_id = $this->request->getId('task_id');
     if ($task_id) {
         $this->active_task = Tasks::findById($task_id);
     }
     // if
     if (instance_of($this->active_task, 'Task')) {
         $this->active_task_parent = $this->active_task->getParent();
         if (instance_of($this->active_task_parent, 'ProjectObject')) {
             $this->active_task_parent->prepareProjectSectionBreadcrumb($this->wireframe);
         }
         // if
     } else {
         $this->active_task = new Task();
         $parent_id = $this->request->getId('parent_id');
         if ($parent_id) {
             $parent = ProjectObjects::findById($parent_id);
             if (instance_of($parent, 'ProjectObject')) {
                 $this->active_task_parent = $parent;
                 $this->active_task_parent->prepareProjectSectionBreadcrumb($this->wireframe);
             }
             // if
         }
         // if
     }
     // if
     if (instance_of($this->active_task_parent, 'ProjectObject')) {
         $this->wireframe->addBreadCrumb($this->active_task_parent->getName(), $this->active_task_parent->getViewUrl());
     } else {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     $this->smarty->assign(array('active_task' => $this->active_task, 'active_task_parent' => $this->active_task_parent, 'page_tab' => $this->active_task->getProjectTab()));
 }
 public function __construct()
 {
     parent::__construct();
     $this->checkMenu();
 }
 /**
  * Constructor
  *
  * @param Request $request
  * @return PagesController
  */
 function __construct($request)
 {
     parent::__construct($request);
     //echo $this->logged_user->getProjectPermission('page', $this->active_project);
     if ($this->logged_user->getProjectPermission('page', $this->active_project) < PROJECT_PERMISSION_ACCESS) {
         $this->httpError(HTTP_ERR_FORBIDDEN);
     }
     // if
     $section_url = pages_module_url($this->active_project);
     $this->wireframe->addBreadCrumb(lang('Pages'), $section_url);
     if ($this->active_category->isLoaded()) {
         $this->wireframe->addBreadCrumb($this->active_category->getName(), assemble_url('project_pages', array('project_id' => $this->active_project->getId(), 'category_id' => $this->active_category->getId())));
     }
     // if
     $page_id = $this->request->get('page_id');
     if ($page_id) {
         $this->active_page = Pages::findById($page_id);
     }
     // if
     if (instance_of($this->active_page, 'Page')) {
         $parents = array();
         $parent = $this->active_page->getParent();
         while (instance_of($parent, 'ProjectObject')) {
             if (instance_of($parent, 'Page')) {
                 if (array_key_exists($parent->getId(), $parents)) {
                     break;
                     // avoid dead loops
                 }
                 // if
                 $parents[$parent->getId()] = $parent;
                 $parent = $parent->getParent();
             } elseif (instance_of($parent, 'Category')) {
                 $parents[$parent->getId()] = $parent;
                 break;
             } else {
                 break;
             }
             // if
         }
         // while
         $parents = array_reverse($parents);
         foreach ($parents as $parent) {
             if (instance_of($parent, 'Page')) {
                 $this->wireframe->addBreadCrumb($parent->getName(), $parent->getViewUrl());
             } elseif (instance_of($parent, 'Category')) {
                 $this->wireframe->addBreadCrumb($parent->getName(), assemble_url('project_pages', array('project_id' => $this->active_project->getId(), 'category_id' => $parent->getId())));
             }
             // if
         }
         // foreach
         $this->wireframe->addBreadCrumb($this->active_page->getName(), $this->active_page->getViewUrl());
     } else {
         $this->active_page = new Page();
     }
     // if
     if (Page::canAdd($this->logged_user, $this->active_project)) {
         if ($this->active_page->isLoaded()) {
             $add_page_url = pages_module_add_page_url($this->active_project, array('parent' => $this->active_page));
         } elseif ($this->active_category->isLoaded()) {
             $add_page_url = pages_module_add_page_url($this->active_project, array('parent' => $this->active_category));
         } else {
             $add_page_url = pages_module_add_page_url($this->active_project);
         }
         // if
         $this->wireframe->addPageAction(lang('New Page'), $add_page_url);
     }
     // if
     $this->smarty->assign(array('active_page' => $this->active_page, 'pages_url' => $section_url, 'add_page_url' => $add_page_url, 'page_tab' => 'pages'));
 }
 /**
  * Constructor
  *
  * @param Request $request
  * @return ProjectCalendarController
  */
 function __construct($request)
 {
     parent::__construct($request);
     $this->wireframe->addBreadCrumb(lang('Calendar'), Calendar::getProjectCalendarUrl($this->active_project));
 }
 /**
  * Construct controller
  *
  * @param Request $parent
  * @param mixed $context
  */
 function __construct($parent, $context = null)
 {
     parent::__construct($parent, $context);
 }