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()); }
/** * <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 object $rq <p> * The current HttpRequest. * </p> * @return void */ public function executeLoadCurrentLocationsView($rq) { $modules = $this->app()->router()->selectedRoute()->phpModules(); $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::MapCurrentProjectLocations); } //Fetch tooltip data from xml and pass to view as an array $tooltip_array = \Applications\PMTool\Helpers\PopUpHelper::getTooltipMsgForAttribute('{"targetcontroller":"map", "targetaction": "currentProjectLocations", "targetattr": ["question-map-h3", "map-info-ruler", "map-info-shape", "map-info-add"]}', $this->app->name()); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Popup::tooltip_message, $tooltip_array); //Fetch prompt box data from xml and pass to view as an array $prompt_msg = \Applications\PMTool\Helpers\PopUpHelper::getPromptBoxMsg('{"targetcontroller":"map", "targetaction": "loadCurrentLocationsView", "operation": ["addNullCheckAddPrompt"]}', $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":"map", "targetaction": "loadMaps", "operation": ["addUniqueCheck","noPhotos", "checkCoordinates"]}', $this->app->name()); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Popup::confirm_message, $alert_msg); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::currentProject, $sessionProject[\Library\Enums\SessionKeys::ProjectObject]); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::form_modules, $modules); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Map::default_active_control, $rq->getData('active') ?: 'pan'); }
public function executeListAll(\Library\HttpRequest $rq) { $tabsStatus = \Applications\PMTool\Helpers\CommonHelper::GetTabsStatus($this->user(), \Library\Enums\SessionKeys::TabActiveAnalyte); if ($tabsStatus === NULL) { \Applications\PMTool\Helpers\AnalyteHelper::AddTabsStatus($this->user()); $tabsStatus = \Applications\PMTool\Helpers\CommonHelper::GetTabsStatus($this->user(), \Library\Enums\SessionKeys::TabActiveAnalyte); } $this->page()->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::tabStatus, $tabsStatus); $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::AnalyteListAll); } $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::currentProject, $sessionProject[\Library\Enums\SessionKeys::ProjectObject]); //Fetch tooltip data from xml and pass to view as an array $tooltip_array = \Applications\PMTool\Helpers\PopUpHelper::getTooltipMsgForAttribute('{"targetcontroller":"analyte", "targetaction": "list", "targetattr": ["active-fieldanalyte-header","inactive-fieldanalyte-header","active-labanalyte-header","inactive-labanalyte-header"]}', $this->app->name()); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Popup::tooltip_message, $tooltip_array); //Get confirm msg for analyte deletion from showForm screen $confirm_msg = \Applications\PMTool\Helpers\PopUpHelper::getConfirmBoxMsg('{"targetcontroller":"analyte", "targetaction": "list", "operation": ["deleteField", "deleteLab", "noAnalyteForProject", "noAnalyteAvailable", "faExists"]}', $this->app->name()); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Popup::confirm_message, $confirm_msg); $pm = \Applications\PMTool\Helpers\PmHelper::GetCurrentSessionPm($this->user()); if (!isset($pm[\Library\Enums\SessionKeys::PmFieldAnalytes]) && count($pm[\Library\Enums\SessionKeys::PmFieldAnalytes]) > 0) { \Applications\PMTool\Helpers\AnalyteHelper::StoreListsData($this); } $pm = \Applications\PMTool\Helpers\PmHelper::GetCurrentSessionPm($this->user()); //Fetch prompt box data from xml and pass to view as an array $prompt_msg = \Applications\PMTool\Helpers\PopUpHelper::getPromptBoxMsg('{"targetcontroller":"analyte", "targetaction": "listAll", "operation": ["edit"]}', $this->app->name()); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Popup::prompt_message, $prompt_msg); //variables for the field analyte module $field_object_properties = \Applications\PMTool\Helpers\CommonHelper::SetDynamicPropertyNamesForDualList("field_analyte", \Applications\PMTool\Helpers\AnalyteHelper::GetListPropertiesForFieldAnalyte()); $field_analytes = $pm[\Library\Enums\SessionKeys::PmFieldAnalytes]; $project_field_analytes = \Applications\PMTool\Helpers\AnalyteHelper::FilterAnalytesByProjectAnalytesList($this); $field_analytes = \Applications\PMTool\Helpers\CommonHelper::FilterObjectsToExcludeRelatedObject($field_analytes, $project_field_analytes, "field_analyte_id"); $data_field_analyte = array(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::module => "fieldanalyte", \Applications\PMTool\Resources\Enums\ViewVariablesKeys::objects_list_right => $field_analytes, \Applications\PMTool\Resources\Enums\ViewVariablesKeys::objects_list_left => $project_field_analytes, \Applications\PMTool\Resources\Enums\ViewVariablesKeys::properties_right => $field_object_properties, \Applications\PMTool\Resources\Enums\ViewVariablesKeys::properties_left => $field_object_properties); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Analyte::data_field_analyte, $data_field_analyte); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::form_modules, $this->app()->router()->selectedRoute()->phpModules()); }
public function executeUploadCommonAnalytes(\Library\HttpRequest $rq) { $tabsStatus = \Applications\PMTool\Helpers\CommonHelper::GetTabsStatus($this->user(), \Library\Enums\SessionKeys::TabActiveAnalyte); if ($tabsStatus === NULL) { \Applications\PMTool\Helpers\AnalyteHelper::AddTabsStatus($this->user()); $tabsStatus = \Applications\PMTool\Helpers\CommonHelper::GetTabsStatus($this->user(), \Library\Enums\SessionKeys::TabActiveAnalyte); } $this->page()->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::tabStatus, $tabsStatus); $this->page()->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::form_modules, $this->app()->router()->selectedRoute()->phpModules()); \Applications\PMTool\Helpers\AnalyteHelper::StoreCommonListData($this); //Fetch prompt box data from xml and pass to view as an array $prompt_msg = \Applications\PMTool\Helpers\PopUpHelper::getPromptBoxMsg('{"targetcontroller":"analyte", "targetaction": "uploadCommonAnalytes", "operation": ["edit"]}', $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":"analyte", "targetaction": "uploadCommonAnalytes", "operation": ["addUniqueCheck", "deleteCommonLab"]}', $this->app->name()); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Popup::confirm_message, $alert_msg); $data_common_lab_analyte = array(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::module => "common_lab_analyte", \Applications\PMTool\Resources\Enums\ViewVariablesKeys::objects => \Applications\PMTool\Helpers\CommonHelper::GetValueInSession($this->user(), \Library\Enums\SessionKeys::CommonLabAnalytes), \Applications\PMTool\Resources\Enums\ViewVariablesKeys::properties => \Applications\PMTool\Helpers\CommonHelper::SetPropertyNamesForDualList("common_lab_analyte")); $this->page()->addVar("data_common_lab_analyte", $data_common_lab_analyte); }
public function executeAddPrompt(\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::TaskAddPrompt); } if (!\Applications\PMTool\Helpers\TaskHelper::UserHasTasks($this->user(), 0)) { $this->executeGetList($rq, NULL, FALSE); } //Fetch prompt box data from xml and pass to view as an array $prompt_msg = \Applications\PMTool\Helpers\PopUpHelper::getPromptBoxMsg('{"targetcontroller":"task", "targetaction": "addPrompt", "operation": ["addNullCheckAddPrompt"]}', $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":"task", "targetaction": "view", "operation": ["addUniqueCheck"]}', $this->app->name()); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariables\Popup::confirm_message, $alert_msg); $this->page->addVar(\Applications\PMTool\Resources\Enums\ViewVariablesKeys::form_modules, $this->app()->router()->selectedRoute()->phpModules()); }
/** * 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]); }
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]); }