public function executeManageCoc(\Library\HttpRequest $rq) { \Applications\PMTool\Helpers\TaskHelper::SetActiveTab($this->user(), \Applications\PMTool\Resources\Enums\TaskTabKeys::CocTab); $sessionProject = \Applications\PMTool\Helpers\ProjectHelper::GetCurrentSessionProject($this->user()); $sessionTask = \Applications\PMTool\Helpers\TaskHelper::GetCurrentSessionTask($this->user()); //Task tab status $tab_status_arr = \Applications\PMTool\Helpers\TaskHelper::TabStatusFor($sessionTask); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Task::task_tab_status_keys, $tab_status_arr); //Task tab status //Analyte Matrix tab status $showLabMatrixTabs = \Applications\PMTool\Helpers\TaskAnalyteMatrixHelper::DoesAnalytesAndLocationsExistsFor($sessionTask, $this, 'Lab'); $showFieldMatrixTabs = \Applications\PMTool\Helpers\TaskAnalyteMatrixHelper::DoesAnalytesAndLocationsExistsFor($sessionTask, $this, 'Field'); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Task::task_show_lab_matrix, $showLabMatrixTabs); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Task::task_show_field_matrix, $showFieldMatrixTabs); //Analyte Matrix tab status $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::currentProject, $sessionProject[\Library\Enums\SessionKeys::ProjectObject]); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::currentTask, $sessionTask[\Library\Enums\SessionKeys::TaskObj]); $labServices = \Applications\PMTool\Helpers\TaskHelper::getLabServicesForTask($this, $sessionTask, "Laboratory"); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::labServices, $labServices); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::currentPm, \Applications\PMTool\Helpers\PmHelper::GetCurrentSessionPm($this->user())); if ($rq->getData("mode") === "edit") { $this->page->addVar("task_editing_header", $this->resxData["task_legend_edit"]); } else { $this->page->addVar("task_editing_header", $this->resxData["task_legend_add"]); } $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::tabStatus, \Applications\PMTool\Helpers\TaskHelper::GetTabsStatus($this->app()->user())); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::form_modules, $this->app()->router()->selectedRoute()->phpModules()); }
public function executeShowForm(\Library\HttpRequest $rq) { $sessionProject = \Applications\PMTool\Helpers\ProjectHelper::GetCurrentSessionProject($this->app()->user()); //Check if a project needs to be selected in order to display this page if (!$sessionProject) { $this->Redirect(\Library\Enums\ResourceKeys\UrlKeys::ProjectsSelectProject . "?onSuccess=" . \Library\Enums\ResourceKeys\UrlKeys::LocationShowForm); } $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::currentProject, $sessionProject[\Library\Enums\SessionKeys::ProjectObject]); //Get confirm msg for location deletion $confirm_msg = \Applications\PMTool\Helpers\PopUpHelper::getConfirmBoxMsg('{"targetcontroller":"location", "targetaction": "view", "operation": ["delete", "addUniqueCheck"]}', $this->app->name()); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Popup::confirm_message, $confirm_msg); //Fetch prompt box data from xml and pass to view as an array $prompt_msg = \Applications\PMTool\Helpers\PopUpHelper::getPromptBoxMsg('{"targetcontroller":"location", "targetaction": "showForm", "operation": ["promptEnterLocation"]}', $this->app->name()); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Popup::prompt_message, $prompt_msg); //Fetch alert box data /*$alert_msg = \Applications\PMTool\Helpers\PopUpHelper::getConfirmBoxMsg('{"targetcontroller":"location", "targetaction": "view", "operation": ["addUniqueCheck"]}', $this->app->name()); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Popup::confirm_message, $alert_msg);*/ if ($rq->getData("mode") === "edit") { $this->page->addVar("location_editing_header", $this->resxData["location_legend_edit"]); } else { $this->page->addVar("location_editing_header", $this->resxData["location_legend_add"]); } //Which module? $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::form_modules, $this->app()->router()->selectedRoute()->phpModules()); }
public function executeServiceDiscussion(\Library\HttpRequest $rq) { $discussionId = $rq->getData("discussion_id"); $currentUserObject = $this->user->getAttribute(\Library\Enums\SessionKeys::UserConnected); $data["username"] = $rq->getData("username"); $data["pwd"] = $rq->getData("password"); $data["encrypted_pwd"] = true; //check if user is already logged in and if username and password aren't sent through url if ($currentUserObject instanceof \Applications\PMTool\Models\Dao\User && !isset($data["username"]) && !isset($data["pwd"])) { } else { $authProvider = new \Applications\PMTool\AuthProvider($this->app->config->get("encryption_key"), $this->managers->getManagerOf('Login')); $authProvider->prepareUser($data); if ($authProvider->getUser() instanceof \Library\Interfaces\IUser) { $this->app->auth->authenticate($authProvider->getUser()); $this->user->setAttribute(\Library\Enums\SessionKeys::UserTypeObject, $authProvider->getUserType()); if ($authProvider->getUser()) { $user = $this->app->user; $routes = array_filter($this->app->router->routes(), function ($route) use($user) { return count($route->role()) == 0 || in_array($user->getRole(), $route->role()); }); \Applications\PMTool\Helpers\UserHelper::SaveRoutes($user, $routes); switch ($authProvider->getUser()->getType()) { case 'technician_id': break; case 'pm_id': \Applications\PMTool\Helpers\PmHelper::StoreSessionPm($this, $authProvider->getUserType(), true); break; } } } $currentUserObject = $this->user->getAttribute(\Library\Enums\SessionKeys::UserConnected); } $discussionArray = \Applications\PMTool\Helpers\DiscussionHelper::GetDiscussionByIdFromDB($this, $discussionId); $user = \Applications\PMTool\Helpers\CommonHelper::FindObjectByIntValue(intval($currentUserObject->user_id()), 'user_id', $discussionArray[\Library\Enums\SessionKeys::DiscussionPeople]); //check if logged in user is the part of this discussion if ($user) { \Applications\PMTool\Helpers\DiscussionHelper::SetCurrentDiscussion($this->user, $discussionArray[\Library\Enums\SessionKeys::DiscussionObj], $discussionArray[\Library\Enums\SessionKeys::DiscussionPeople]); $currentDiscussion = $discussionArray; if ($currentDiscussion) { $manager = $this->managers()->getManagerOf('User'); $discussion_person = \Applications\PMTool\Helpers\CommonHelper::FindObjectByIntValue(1, 'discussion_person_is_author', $currentDiscussion[\Library\Enums\SessionKeys::DiscussionPeople]); $discussion_user_type = $manager->selectUserTypeObjectByUserId($discussion_person->user_id()); if ($discussion_user_type) { $currentDiscussion['comm_with'] = $discussion_user_type; $currentDiscussion['comm_type'] = \Applications\PMTool\Helpers\UserHelper::FindUserTypeFromObject($discussion_user_type); } $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::currentDiscussion, $currentDiscussion); } } else { \Applications\PMTool\Helpers\DiscussionHelper::UnsetCurrentDiscussion($this->user); } $modules = $this->app()->router()->selectedRoute()->phpModules(); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::form_modules, $modules); }
/** * <p> Method to load the Map view as configured in routes.xml </p> * <p> Set the modules for the route to the page object </p> * @param \Library\HttpRequest $rq <p> * The current HttpRequest. * </p> * @return void */ public function executeLoadView($rq) { //Fetch tooltip data from xml and pass to view as an array $tooltip_array = \Applications\PMTool\Helpers\PopUpHelper::getTooltipMsgForAttribute('{"targetcontroller":"map", "targetaction": "allProjects", "targetattr": ["map-info-add","map-info-shape","map-info-ruler","question-map-h3"]}', $this->app->name()); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Popup::tooltip_message, $tooltip_array); $alert_msg = \Applications\PMTool\Helpers\PopUpHelper::getConfirmBoxMsg('{"targetcontroller":"map", "targetaction": "loadMaps", "operation": ["addUniqueCheck","checkCoordinates"]}', $this->app->name()); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Popup::confirm_message, $alert_msg); $modules = $this->app()->router()->selectedRoute()->phpModules(); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::form_modules, $modules); //Fetch prompt box data from xml and pass to view as an array $infoWindow = \Applications\PMTool\Helpers\PopUpHelper::getPromptBoxMsg('{"targetcontroller":"map", "targetaction": "loadProjectInfo", "operation": ["addNullCheckAddPrompt"]}', $this->app->name()); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Map::popup_project_info, $infoWindow); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Map::default_active_control, $rq->getData('active') ?: 'pan'); }
public function executeLabMatrix(\Library\HttpRequest $rq) { $sessionProject = \Applications\PMTool\Helpers\ProjectHelper::GetCurrentSessionProject($this->app()->user()); \Applications\PMTool\Helpers\AnalyteHelper::StoreListsData($this); $pm = \Applications\PMTool\Helpers\PmHelper::GetCurrentSessionPm($this->user()); $sessionTask = \Applications\PMTool\Helpers\TaskHelper::GetCurrentSessionTask($this->user()); //Task tab status $tab_status_arr = \Applications\PMTool\Helpers\TaskHelper::TabStatusFor($sessionTask); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Task::task_tab_status_keys, $tab_status_arr); //Task tab status //Analyte Matrix tab status $showLabMatrixTabs = \Applications\PMTool\Helpers\TaskAnalyteMatrixHelper::DoesAnalytesAndLocationsExistsFor($sessionTask, $this, 'Lab'); $showFieldMatrixTabs = \Applications\PMTool\Helpers\TaskAnalyteMatrixHelper::DoesAnalytesAndLocationsExistsFor($sessionTask, $this, 'Field'); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Task::task_show_lab_matrix, $showLabMatrixTabs); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Task::task_show_field_matrix, $showFieldMatrixTabs); //Analyte Matrix tab status //Get task specific lab analytes $task_lab_analytes = \Applications\PMTool\Helpers\AnalyteHelper::GetAndStoreTaskLabAnalytes($this, $sessionTask); //Check which page to render $pg = is_null($rq->getData('pg')) ? 1 : intval($rq->getData('pg')) == 0 ? 1 : intval($rq->getData('pg')); //Calculate pages $pages = \Applications\PMTool\Helpers\TaskAnalyteMatrixHelper::returnTotalPagesOfAnalytes($task_lab_analytes, $this->app); //Filter paged result set of analytes //$task_lab_analytes = \Applications\PMTool\Helpers\TaskAnalyteMatrixHelper::returnPagedAnalyteObjects($task_lab_analytes, $pg, $this->app); //Fetch ELLIPSIS tooltip settings from xml and pass to view as an array $ellipsis_tooltip_settings = \Applications\PMTool\Helpers\PopUpHelper::getTooltipEllipsisSettings('{"targetcontroller":"taskLabAnalyte", "targetaction": "labMatrix"}', $this->app->name()); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Popup::ellipsis_tooltip_settings, $ellipsis_tooltip_settings); //Task specific locations $project_locations = \Applications\PMTool\Helpers\LocationHelper::GetProjectLocations($this, $sessionProject); $task_locations = \Applications\PMTool\Helpers\LocationHelper::GetAndStoreTaskLocations($this, $sessionTask); //Get LocationLabMatrix relation $id_map = \Applications\PMTool\Helpers\TaskAnalyteMatrixHelper::GetAnalyteMatrixForTask($this, $sessionTask[\Library\Enums\SessionKeys::TaskObj]->task_id(), 'Lab'); \Applications\PMTool\Helpers\TaskHelper::SetActiveTab($this->user(), \Applications\PMTool\Resources\Enums\TaskTabKeys::LabSampleMatrixTab); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::currentProject, $sessionProject[\Library\Enums\SessionKeys::ProjectObject]); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::currentTask, $sessionTask[\Library\Enums\SessionKeys::TaskObj]); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::task_locations, $task_locations); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::task_lab_analytes, $task_lab_analytes); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::task_analytes_pages, $pages); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::current_page, $pg); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::task_lab_analytes_idmap, $id_map); //tab status $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::tabStatus, \Applications\PMTool\Helpers\TaskHelper::GetTabsStatus($this->user())); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::form_modules, $this->app()->router()->selectedRoute()->phpModules()); }
public function executeViewSessionArrays(\Library\HttpRequest $rq) { $output = array(); switch ($rq->getData("type")) { case "pm": $output = var_dump(\Applications\PMTool\Helpers\PmHelper::GetSessionPms($this->user())); break; case "project": $output = var_dump(\Applications\PMTool\Helpers\ProjectHelper::GetSessionProjects($this->user())); break; case "task": $output = var_dump(\Applications\PMTool\Helpers\TaskHelper::GetSessionTasks($this->user())); break; case "route": $output = var_dump($this->user->getAttribute(\Library\Enums\SessionKeys::SessionRoutes)); break; default: break; } echo '<pre>', print_r($output), '</pre>'; //\Library\HttpResponse::encodeJson($output); die; }
/** * Method that loads the select project view for controller * This is when any other action of any other controller * is selected but that is dependent on a project which is * already selected. What this action does is, lets the user * know if the action they selected is dependent on a project * and let's them select a project. If a project is already * selected, it just redirects to the actual action user * wanted to visit. * * @param \Library\HttpRequest $rq: the request */ public function executeSelectTask(\Library\HttpRequest $rq) { //Fetch prompt box data from xml and pass to view as an array $urlParts = explode("/", $rq->getData('onSuccess')); $prompt_msg = \Applications\PMTool\Helpers\PopUpHelper::getPromptBoxMsg('{"targetcontroller":"' . $urlParts[0] . '", "targetaction": "' . $urlParts[1] . '", "operation": ["checkCurrentTask"]}', $this->app->name()); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Popup::prompt_message, $prompt_msg); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::redirect_on_success, $rq->getData('onSuccess')); if (!\Applications\PMTool\Helpers\TaskHelper::UserHasTasks($this->user(), 0)) { $this->executeGetList($rq, NULL, FALSE); } $data = array(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::module => strtolower($this->module()), \Applications\PMTool\Resources\Enums\ViewVariablesKeys::objects => \Applications\PMTool\Helpers\TaskHelper::GetFilteredTaskObjectsList($this->app()->user()), \Applications\PMTool\Resources\Enums\ViewVariablesKeys::properties => \Applications\PMTool\Helpers\CommonHelper::SetPropertyNamesForDualList(strtolower($this->module()))); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::data, $data); $modules = $this->app()->router()->selectedRoute()->phpModules(); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Popup::popup_prompt_list, $modules[\Applications\PMTool\Resources\Enums\PhpModuleKeys::active_list]); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Popup::popup_msg, $modules[\Applications\PMTool\Resources\Enums\PhpModuleKeys::popup_msg]); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Popup::prompt_msg, $modules[\Applications\PMTool\Resources\Enums\PhpModuleKeys::popup_selector_module]); }
public function executeFieldData(\Library\HttpRequest $rq) { \Applications\PMTool\Helpers\ActiveTaskHelper::AddTabsStatus($this->user()); \Applications\PMTool\Helpers\AnalyteHelper::StoreListsData($this); $sessionProject = \Applications\PMTool\Helpers\ProjectHelper::GetCurrentSessionProject($this->user()); \Applications\PMTool\Helpers\AnalyteHelper::StoreListsData($this); //Check if a project needs to be selected in order to display this page if (!$sessionProject) { $this->Redirect(\Library\Enums\ResourceKeys\UrlKeys::ProjectsSelectProject . "?onSuccess=" . \Library\Enums\ResourceKeys\UrlKeys::TaskAddPrompt); } $sessionTask = \Applications\PMTool\Helpers\TaskHelper::SetCurrentSessionTask($this->user(), NULL, $rq->getData("task_id")); //Get task specific field analytes $task_field_analytes = \Applications\PMTool\Helpers\AnalyteHelper::GetAndStoreTaskFieldAnalytes($this, $sessionTask); //Check which page to render $pg = is_null($rq->getData('pg')) ? 1 : intval($rq->getData('pg')) == 0 ? 1 : intval($rq->getData('pg')); //Calculate pages $pages = \Applications\PMTool\Helpers\TaskAnalyteMatrixHelper::returnTotalPagesOfAnalytes($task_field_analytes, $this->app); //Filter paged result set of analytes //$task_field_analytes = \Applications\PMTool\Helpers\TaskAnalyteMatrixHelper::returnPagedAnalyteObjects($task_field_analytes, $pg, $this->app); //Task specific locations $project_locations = \Applications\PMTool\Helpers\LocationHelper::GetProjectLocations($this, $sessionProject); $task_locations = \Applications\PMTool\Helpers\LocationHelper::GetAndStoreTaskLocations($this, $sessionTask); //Get LocationLabMatrix relation $id_map = \Applications\PMTool\Helpers\TaskAnalyteMatrixHelper::GetFieldDataMatrixForTaskWithResult($this, $sessionTask[\Library\Enums\SessionKeys::TaskObj]->task_id()); //\Applications\PMTool\Helpers\CommonHelper::pr($id_map); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::currentProject, $sessionProject[\Library\Enums\SessionKeys::ProjectObject]); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::currentTask, $sessionTask[\Library\Enums\SessionKeys::TaskObj]); \Applications\PMTool\Helpers\ActiveTaskHelper::SetActiveTab($this->user(), \Applications\PMTool\Resources\Enums\ActiveTaskTabKeys::ActiveTaskFieldDataTab); //Fetch tooltip data from xml and pass to view as an array $tooltip_array = \Applications\PMTool\Helpers\PopUpHelper::getTooltipMsgForAttribute('{"targetcontroller":"activeTask", "targetaction": "showForm", "targetattr": ["h4-taskstatus-leftcol-gi", "h4-taskstatus-rightcol-gi", "h4-taskstatus-notes-gi", "h4-taskstatus-notesrecord-gi"]}', $this->app->name()); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Popup::tooltip_message, $tooltip_array); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::activeTaskTabStatus, \Applications\PMTool\Helpers\ActiveTaskHelper::GetTabsStatus($this->app()->user())); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::form_modules, $this->app()->router()->selectedRoute()->phpModules()); //-------- $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::task_locations, $task_locations); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::task_field_analytes, $task_field_analytes); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::task_analytes_pages, $pages); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::current_page, $pg); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::task_field_analytes_idmap, $id_map); //footer task id $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::task_id, $rq->getData("task_id")); }
/** * Method that loads the select project view for controller * This is when any other action of any other controller * is selected but that is dependent on a project which is * already selected. What this action does is, lets the user * know if the action they selected is dependent on a project * and let's them select a project. If a project is already * selected, it just redirects to the actual action user * wanted to visit. * * @param \Library\HttpRequest $rq: the request */ public function executeSelectProject(\Library\HttpRequest $rq) { //Fetch prompt box data from xml and pass to view as an array $urlParts = explode("/", $rq->getData('onSuccess')); $prompt_msg = \Applications\PMTool\Helpers\PopUpHelper::getPromptBoxMsg('{"targetcontroller":"' . $urlParts[0] . '", "targetaction": "' . $urlParts[1] . '", "operation": ["checkCurrentProject"]}', $this->app->name()); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Popup::prompt_message, $prompt_msg); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::redirect_on_success, $rq->getData('onSuccess')); $data = array(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::module => $this->resxfile, \Applications\PMTool\Resources\Enums\ViewVariablesKeys::objects => \Applications\PMTool\Helpers\CommonHelper::GetListObjectsInSessionByKey($this->app()->user(), \Library\Enums\SessionKeys::ProjectObject), \Applications\PMTool\Resources\Enums\ViewVariablesKeys::properties => \Applications\PMTool\Helpers\CommonHelper::SetPropertyNamesForDualList($this->resxfile)); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::data, $data); $modules = $this->app()->router()->selectedRoute()->phpModules(); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Popup::popup_prompt_list, $modules[\Applications\PMTool\Resources\Enums\PhpModuleKeys::active_list]); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Popup::popup_msg, $modules[\Applications\PMTool\Resources\Enums\PhpModuleKeys::popup_msg]); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Popup::prompt_msg, $modules[\Applications\PMTool\Resources\Enums\PhpModuleKeys::popup_selector_module]); }
/** * Method that logout a user from the session and then redirect him to Login page. * * @param \Library\HttpRequest $rq */ public function executeCreate(\Library\HttpRequest $rq) { $protect = new \Library\BL\Core\Encryption(); $data = array("user_login" => $rq->getData("login"), "user_password" => $rq->getData("password"), "user_type" => $rq->getData("type"), "user_role" => \Applications\PMTool\Helpers\UserHelper::GetRoleFromType($rq->getData("type"))); $user = \Applications\PMTool\Helpers\CommonHelper::PrepareUserObject($data, new Applications\PMTool\Models\Dao\User()); $user->setUser_password($protect->Encrypt($this->app->config->get("encryption_key"), $user->user_password())); $loginDal = $this->managers->getManagerOf("Login"); $id = $loginDal->add($pm); $redirect = intval($id) > 0 ? TRUE : FALSE; if ($redirect) { $this->Redirect("login"); } }
public function executeListTasks(\Library\HttpRequest $rq) { $modules = $this->app()->router()->selectedRoute()->phpModules(); \Applications\PMTool\Helpers\DiscussionHelper::UnsetCurrentDiscussion($this->user()); $technician = $this->user()->getAttribute(\Library\Enums\SessionKeys::UserTypeObject); $project = new \Applications\PMTool\Models\Dao\Project(); $project->setPm_id($technician->pm_id()); //Load interface to query the database for projects $manager = $this->managers->getManagerOf('Project'); $lists[\Library\Enums\SessionKeys::UserProjects] = $manager->selectMany($project, "pm_id"); //Load interface to query the database for facilities $manager = $this->managers->getManagerOf('Facility'); $lists[\Library\Enums\SessionKeys::UserProjectFacilityList] = $manager->selectMany($project, "pm_id"); //Load interface to query the database for clients $manager = $this->managers->getManagerOf('Client'); $lists[\Library\Enums\SessionKeys::UserProjectClientList] = $manager->selectMany($project, "pm_id"); //SessionPM $manager = $this->managers->getManagerOf('Pm'); $pm = new \Applications\PMTool\Models\Dao\Project_manager(); $pm->setPm_id($technician->pm_id()); $pms = $manager->selectMany($pm, 'pm_id'); \Applications\PMTool\Helpers\PmHelper::StoreSessionPm($this, $pms[0], true); $ProjectsSession = \Applications\PMTool\Helpers\ProjectHelper::StoreSessionProjects($this, $lists); \Applications\PMTool\Helpers\TaskHelper::GetTasksForTechnician($this, $technician); $tasks = \Applications\PMTool\Helpers\TaskHelper::GetSessionTasks($this->user()); if (!is_array($tasks)) { $tasks = array(); } $task_id = $rq->getData("task_id"); $data = array(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::module => 'task', \Applications\PMTool\Resources\Enums\ViewVariablesKeys::objects => \Applications\PMTool\Helpers\CommonHelper::GetObjectListFromSessionArrayBySessionKey($tasks, \Library\Enums\SessionKeys::TaskObj), \Applications\PMTool\Resources\Enums\ViewVariablesKeys::properties => \Applications\PMTool\Helpers\CommonHelper::SetPropertyNamesForDualList(strtolower('task'))); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::data, $data); $sessionTask = \Applications\PMTool\Helpers\TaskHelper::GetCurrentSessionTask($this->user()); if ($sessionTask) { \Applications\PMTool\Helpers\ProjectHelper::GetAndStoreCurrentProject($this->user(), $sessionTask[\Library\Enums\SessionKeys::TaskObj]->project_id()); } else { $this->user()->unsetAttribute(\Library\Enums\SessionKeys::CurrentProject); } if (count($tasks) == 1) { $firstTask = reset($tasks); $task_id = $firstTask[\Library\Enums\SessionKeys::TaskObj]->task_id(); } //Set passed task as current task if ($task_id !== '' && !is_null($task_id)) { $sessionTask = \Applications\PMTool\Helpers\TaskHelper::SetCurrentSessionTask($this->user(), NULL, $task_id); $taskObj = $sessionTask[\Library\Enums\SessionKeys::TaskObj]; $manager = $this->managers()->getManagerOf('Project'); $project = new \Applications\PMTool\Models\Dao\Project(); $project->setProject_id($taskObj->project_id()); $projects = $manager->selectMany($project, 'project_id'); if ($projects) { \Applications\PMTool\Helpers\ProjectHelper::GetAndStoreCurrentProject($this->user(), $taskObj->project_id()); } //check if we passed a redirect URL too if ($rq->getData("onSuccess") !== '' && !is_null($rq->getData("onSuccess"))) { //rediect to it $this->Redirect($rq->getData("onSuccess")); } } $sessionProject = \Applications\PMTool\Helpers\ProjectHelper::GetCurrentSessionProject($this->user); if (count($tasks) == 1) { $this->Redirect(\Library\Enums\ResourceKeys\UrlKeys::MobileMap); } $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::currentTask, $sessionTask[\Library\Enums\SessionKeys::TaskObj]); //Fetch tooltip data from xml and pass to view as an array $tooltip_array = \Applications\PMTool\Helpers\PopUpHelper::getTooltipMsgForAttribute('{"targetcontroller":"task", "targetaction": "list", "targetattr": ["active-task-header","inactive-task-header"]}', $this->app->name()); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Popup::tooltip_message, $tooltip_array); //Get confirm msg for project deletion from context menu $confirm_msg = \Applications\PMTool\Helpers\PopUpHelper::getConfirmBoxMsg('{"targetcontroller":"task", "targetaction": "list", "operation": ["activate","addUniqueCheck"]}', $this->app->name()); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Popup::confirm_message, $confirm_msg); //Fetch prompt box data from xml and pass to view as an array //Also let's just fetch the message for the showForm view and reuse it $prompt_msg = \Applications\PMTool\Helpers\PopUpHelper::getPromptBoxMsg('{"targetcontroller":"task", "targetaction": "view", "operation": ["addNullCheck","addNullCheckForCopy"]}', $this->app->name()); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Popup::prompt_message, $prompt_msg); $modules = $this->app()->router()->selectedRoute()->phpModules(); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::active_list, $modules[\Applications\PMTool\Resources\Enums\PhpModuleKeys::active_list]); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Popup::popup_msg, $modules[\Applications\PMTool\Resources\Enums\PhpModuleKeys::popup_msg]); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Popup::prompt_msg, $modules[\Applications\PMTool\Resources\Enums\PhpModuleKeys::popup_prompt]); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Popup::tooltip_message_module, $modules[\Applications\PMTool\Resources\Enums\PhpModuleKeys::tooltip_msg]); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::currentProject, $sessionProject[\Library\Enums\SessionKeys::ProjectObject]); }