function servePostRequest($params) { //logger("POST Params : ".print_r($params, true) ); switch ($params['task']) { case 'UPDATE_MODULE': $ret = updateLineItem($params); break; // Handles the case when a module/project/item has to be marked complete. Identifiers in $params['identifier'] // Handles the case when a module/project/item has to be marked complete. Identifiers in $params['identifier'] case 'MARK_COMPLETE': $tmp = $params['identifier']['project_name']; $tmp_proj = new ProjectController(); $tmp_proj->markAsComplete($params); logger("{$tmp} is COMPLETE"); break; // Handles the case when a module/project/item is to be marked invalid. Identifiers in $params['identifier'] // Handles the case when a module/project/item is to be marked invalid. Identifiers in $params['identifier'] case 'MARK_DISABLED': $tmp = $params['identifier']['project_name']; $tmp_proj = new ProjectController(); $tmp_proj->markAsInactive($params); logger("{$tmp} is INVALID"); break; case 'NEW_PROJECT': $ret = addNewProject($params); //$ret = "New project initiated"; break; default: # code... break; } return $ret; }
/** * 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')); }
/** * 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')); }
/** * 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')); }
/** * 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; }
public static function index() { $projects = Project::getAll(); set('user', dfUser::getCurrentName()); set('projects', $projects); $myProjects = ProjectController::getMyProjects($projects); set('myProjects', $myProjects); output('/projects/index.html.php'); }
/** * 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)); }
/** * 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->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())))); }
/** * 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))); }
function index() { parent::index(); $this->sorting_by(); $this->order_name_by(); if ($this->request->get('order_name')) { $this->wireframe->breadcrumbs->add('frosso_tab_route_order', $this->request->get('order_name'), Router::assemble('frosso_tab_route_order', array('project_slug' => $this->active_project->getSlug(), 'order_name' => $this->smarty->getVariable('order_name')))); $this->wireframe->breadcrumbs->add('frosso_tab_route_order_custom', self::$task_sort_by, Router::assemble('frosso_tab_route_order_custom', array('project_slug' => $this->active_project->getSlug(), 'order_name' => $this->smarty->getVariable('order_name'), 'sorting' => self::$task_sort_by))); } $tasks = self::findForOutline($this->active_project, $this->logged_user); $milestones = self::getNotEmptyIdNameMap($this->active_project); $milestones[0] = lang('Unknown Milestone'); $this->response->assign('tasks', $tasks); $this->response->assign('map', $milestones); $this->response->assign('active_user', $this->logged_user); }
/** * 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())); }
$proj->setDetail(""); } $proj->setStatus(1); $id = $this->projectrepository->insert($proj); } public function selectProject() { $project = $this->projectrepository->get_by_id($_GET['p_id']); include_once ROOT_PATH . 'profile/views/container.php'; } public function error_page() { include_once ROOT_PATH . 'profile/views/error_page.php'; } } $project_controller = new ProjectController(); if (isset($_GET['id'])) { $user_profile_id = $_GET['id']; $user = NULL; if (isset($_GET['p_id'])) { $p_id = $_GET['p_id']; $project_controller->selectProject($user_profile_id, $p_id); } if (isset($_SESSION['user_hash'])) { $user = $_SESSION['user_hash']; } switch ($user_profile_id) { case $user: if ($_SESSION['user_type'] == "organization") { if (isset($_GET['m'])) { $method = $_GET['m'];
foreach ($variables as $variable) { if ($path2) { continue; } if (array_key_exists($variable, $_SERVER)) { $path2 = substr($_SERVER[$variable], 0, strrpos($_SERVER[$variable], '/')) . '/'; } } if (!$path2) { $path2 = '/'; } die("<p>Votre Iconito n'est pas encore installé — <a href=\"" . $path2 . "install/index.php\">Cliquez ici</a></p>"); } // tentative de création du controlleur try { $coord = new ProjectController($path . '/../project/config/copix.conf.php'); $coord->process(); // on gère les exceptions de type CopixCredentialException différement, elles redirigent au lieu de s'afficher, et ne génèrent pas de log } catch (CopixCredentialException $e) { header('location: ' . CopixUrl::get('auth||', array('noCredential' => 1, 'auth_url_return' => _url('#')))); exit; // toutes les exceptions de Copix passeront ici, sauf CopixCredentialException } catch (CopixException $e) { $extras = array('file' => $e->getFile(), 'line' => $e->getLine(), 'exception' => get_class($e)); _log($e->getMessage(), 'errors', CopixLog::EXCEPTION, $extras); // si l'exception générée est dans la création du coordinateur, on ne peut pas faire un bon affichage de l'exception if (!isset($coord)) { echo $e->getMessage(); } else { // on vérifie que le coordinateur arrive bien à afficher l'exception, il se peut qu'il n'y arrive pas try {
protected function renderFramework($params, $tpl) { $content = $this->view->fetch($params, $tpl); $file = __DIR__ . '/template/backend.php'; parent::renderFramework(array('backendContent' => $content), $file); }
}); $routes->get('/login', function () { UserController::login(); }); $routes->post('/login', function () { UserController::handle_login(); }); $routes->get('/logout', function () { UserController::logout(); }); $routes->get('/project', function () { ProjectController::index(); }); $routes->post('/project', function () { ProjectController::store(); }); $routes->get('/project/new', function () { ProjectController::create(); }); $routes->get('/project/:id', function ($id) { ProjectController::show($id); }); $routes->post('/project/:id/destroy', function ($id) { ProjectController::destroy($id); }); $routes->get('/project/:id/edit', function ($id) { ProjectController::edit($id); }); $routes->post('/project/:id/edit', function ($id) { ProjectController::update($id); });
if (substr($route[1], 0, 11) == "project.php") { $temp = explode("=", $route[1]); $route[2] = $temp[1]; $route[1] = "project"; } //end of url translantion if (!isset($_SESSION['user_id']) && count($route) <= 1) { //langing page of collap $homeController = new HomeController(); $homeController->render(); } else { $page = $route[1]; //single page app switch ($page) { case "project": $projectController = new ProjectController($route[2]); $where = $route[3]; switch ($where) { case 'activities': $projectController->getNextActivities(); break; case 'activity': $dashboardController->postActivity(); break; case 'logout': $homeController->logout(); break; case 'forgetPassword': $homeController->forgetPassword(); break; default:
/** * 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')); }
ProjectController::getCompaniesForProject($data->data); break; case "getExcludedCompaniesForProject": ProjectController::getExcludedCompaniesForProject($data->data); break; case "closeProject": echo json_encode(ProjectController::closeProject($data->data)); break; case "getCompaniesForProject": ProjectController::getCompaniesForProject($data->data); break; case "getProjectList": ProjectController::getProjectList(); break; case "getSiteTrackingProjectList": ProjectController::getSiteTrackingProjectList(); break; case "getInvoiceOfProject": ProjectController::getInvoicesByProject($data->projectId); break; case "getProjectSiteFollowup": if (isset($data->projectId)) { ProjectController::getProjectSiteFollowup($data->projectId); } else { echo AppUtil::getReturnStatus("fail", "Please select project"); } break; case "getProjectListWithoutCostCenter": ProjectController::getProjectListWithoutCostCenter(); break; }
function index() { parent::index(); $milestones_t = Milestones::findAllByProject($this->active_project); $tasks_t = Tasks::findByProject($this->active_project, $this->logged_user); $milestones = array(); $tasks = array(); // voglio il task non categorizzato che inizia prima di tutti, quindi setto questo nel futuro $first_task_time = new DateValue(time() + time()); $trovato = false; if (is_foreachable($tasks_t)) { foreach ($tasks_t as $task) { $res = array(); $res['id'] = $task->getTaskId(); $res['name'] = $task->getName(); $task->complete()->describe($this->logged_user, true, true, $completion_description); $task_description = $task->describe($this->logged_user, true, true); $res['is_completed'] = $completion_description['is_completed']; $res['completed_on'] = $completion_description['completed_on']; $res['due_on'] = $completion_description['due_on']; // non è sempre settato $res['milestone_id'] = $task_description['milestone_id'] ? $task_description['milestone_id'] : 0; $res['created_on_d'] = $task->getCreatedOn()->getDay(); $res['created_on_m'] = $task->getCreatedOn()->getMonth() - 1; $res['created_on_y'] = $task->getCreatedOn()->getYear(); // La data di inizio non è sempre presente. Quindi se non c'è, prendo la data di creazione del task. // Inoltre questo campo dipende dal modulo TaskPlus if (AngieApplication::isModuleLoaded('tasks_plus') && TaskPlus::getStartOn($task)) { $start_on = TaskPlus::getStartOn($task); } else { $start_on = $task->getCreatedOn(); } $res['start_on_d'] = $start_on->getDay(); $res['start_on_m'] = $start_on->getMonth() - 1; //javascript merda parte da Gennaio = 0 $res['start_on_y'] = $start_on->getYear(); // giorni in più $days = 60 * 60 * 24 * 15; //15 giorni in più if ($completion_description['is_completed']) { $completion_date = $completion_description['completed_on']; } else { if ($completion_description['due_on']) { // non è completata ma ha data di fine settata $completion_date = $completion_description['due_on']; } else { if (!$completion_description['due_on']) { // non è completata e non ha data di fine settata $completion_date = $start_on->advance($days, false); // (data_inizio || data_creazione) + 15 giorni } } } $res['finish_on_d'] = $completion_date->getDay(); $res['finish_on_m'] = $completion_date->getMonth() - 1; //javascript merda parte da Gennaio = 0 $res['finish_on_y'] = $completion_date->getYear(); $res['durata'] = $start_on->daysBetween($completion_date) * 8; //giorni_differenza * ore_lavorative if ($res['is_completed']) { $res['percent_completion'] = 100; } else { list($total_subtasks, $open_subtasks) = ProjectProgress::getObjectProgress($task); $completed_subtasks = $total_subtasks - $open_subtasks; if ($open_subtasks) { $res['percent_completion'] = ceil($completed_subtasks / $total_subtasks * 100); } else { $res['percent_completion'] = 0; } } $tasks[] = $res; if ($res['milestone_id'] == 0 && $first_task_time->getTimestamp() > $start_on->getTimestamp()) { $first_task_time = $start_on; $trovato = false; } } } if ($trovato) { //Aggiungo la milestone per tasks non categorizzati $milestones[0]['id'] = 0; $milestones[0]['name'] = lang("Uncategorized"); $milestones[0]['start_on_d'] = $first_task_time->getDay(); $milestones[0]['start_on_m'] = $first_task_time->getMonth() - 1; $milestones[0]['start_on_y'] = $first_task_time->getYear(); $milestones[0]['durata'] = 1; } if (is_foreachable($milestones_t)) { foreach ($milestones_t as $milestone) { $res = array(); $res['id'] = $milestone->getId(); $res['name'] = $milestone->getName(); $res['start_on_d'] = $milestone->getStartOn()->getDay(); $res['start_on_m'] = $milestone->getStartOn()->getMonth() - 1; //javascript merda parte da Gennaio = 0 $res['start_on_y'] = $milestone->getStartOn()->getYear(); $res['durata'] = ($milestone->getDueOn()->getTimestamp() - $milestone->getStartOn()->getTimestamp()) / (60 * 60 * 24) * 8; //giorni * ore lavorative $milestones[] = $res; } } $this->smarty->assign(array('milestones' => $milestones, 'tasks' => $tasks)); }
<?php require_once 'Controller/ProjectController.php'; require_once 'Controller/userStoryController.php'; require_once 'Controller/userController.php'; require_once 'Controller/SprintController.php'; require_once 'Controller/TaskController.php'; $userController = new UserController(); $projectController = new ProjectController(); $userStoryController = new UserStoryController(); $sprintController = new SprintController(); $taskController = new TaskController(); if (isset($_GET["p"])) { switch ($_GET["p"]) { case 'home': $userController->home(); break; case 'authentify': $userController->authentify(); break; case 'logout': $userController->logout(); break; case 'registerView': $userController->registerView(); break; case 'register': $userController->register($_POST); break; case 'loginView': $userController->loginView();
*/ header('Content-Type: application/json'); include "page_start.php"; /* * dispatch.php * * Rather than including all my application code and logic * here i moved my functions to separate php classes and routed * to them using the switch() statement in this file */ // verifies that the action post variable is set and then choses // which function to fire based on the POST['action'] value if (isset($_POST['action'])) { // instantiate classes to call functions from $UserController = new UserController(); $ProjectController = new ProjectController(); $PageController = new PageController(); // handle which function to call switch ($_POST['action']) { // User Methods case "createUser": $UserController->createUser(); break; case "deleteUser": $UserController->deleteUser(); break; case "getUser": $UserController->getUser(); break; case "checkLoggedIn": $UserController->checkLoggedIn();
/** * Constructor * * @param Request $request * @return ProjectCalendarController */ function __construct($request) { parent::__construct($request); $this->wireframe->addBreadCrumb(lang('Calendar'), Calendar::getProjectCalendarUrl($this->active_project)); }