コード例 #1
0
 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());
 }
コード例 #2
0
 /**
  * The following function returns the Field Data Matrix from DB
  * in Json format
  */
 public static function GetFieldMatrixDataFromDB($caller, $task_id, $loc_id)
 {
     $dal = $caller->managers()->getManagerOf("FieldAnalyteLocation");
     $data = $dal->getAllMatrixDataForTaskLocation($task_id, $loc_id);
     if (empty($data)) {
         $output_arr = array('msg' => 'No field analyte found', 'data_matrix' => $data);
     } else {
         $final_result_arr = array();
         //loop and format the array
         foreach ($data as $key => $value) {
             $fa = \Applications\PMTool\Helpers\AnalyteHelper::getAnalyteRecordFromDB($caller, $value->field_analyte_id());
             $matrix_data = array('matrix_rec' => $value, 'fa_name' => $fa[0]->field_analyte_name_unit());
             array_push($final_result_arr, $matrix_data);
         }
         //Stuff up
         $output_arr = array('msg' => 'Records found', 'data_matrix' => $final_result_arr);
     }
     //Return json
     //return json_encode($output_arr);
     return $output_arr;
 }
コード例 #3
0
 /**
  * AJAX response for getting common master lab analytes for auto complete
  */
 public function executeGetMasterLabAnalytesAutoComplete()
 {
     // Init result
     $result = $this->InitResponseWS();
     $manager = $this->managers()->getManagerOf('MasterLabAnalyte');
     $masterLabAnalytes = $manager->getMatchingMasterLabAnalytes($this->dataPost['search']);
     //Our final matches are stored in
     $matches = \Applications\PMTool\Helpers\AnalyteHelper::GetMasterLabsForAutoComplete($masterLabAnalytes);
     //\Applications\PMTool\Helpers\CommonHelper::pr($match);
     $result['matches'] = $matches;
     $match_found = false;
     if (count($matches) > 0) {
         $match_found = true;
     }
     $this->SendResponseWS($result, array("resx_file" => \Applications\PMTool\Resources\Enums\ResxFileNameKeys::LabAnalyte, "resx_key" => $this->action(), "step" => $match_found ? "success" : "error"));
 }
コード例 #4
0
 public function executeUpdateItems(\Library\HttpRequest $rq)
 {
     $result = \Applications\PMTool\Helpers\AnalyteHelper::UpdateProjectAnalytes($this);
     //
     //    $tabsStatus = \Applications\PMTool\Helpers\CommonHelper::GetTabsStatus($this->user(), \Library\Enums\SessionKeys::TabActiveAnalyte);
     //
     //    \Applications\PMTool\Helpers\CommonHelper::SetActiveTab(
     //            $this->user(), \Applications\PMTool\Resources\Enums\AnalyteTabKeys::FieldTab, \Library\Enums\SessionKeys::TabActiveAnalyte);
     $this->SendResponseWS($result, array("resx_file" => \Applications\PMTool\Resources\Enums\ResxFileNameKeys::FieldAnalyte, "resx_key" => $this->action(), "step" => $result["rows_affected"] === count($result["arrayOfValues"]) ? "success" : "error"));
 }
コード例 #5
0
 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"));
 }
コード例 #6
0
 /**
  * Checks if any analyte (based on analyte type)
  * and location exists for the passed task.
  *
  * Returns true if both are present, false if
  * either doesn't.
  */
 public static function DoesAnalytesAndLocationsExistsFor($sessionTask, $caller, $analyte_type = 'Lab')
 {
     $sessionProject = \Applications\PMTool\Helpers\ProjectHelper::GetCurrentSessionProject($caller->app()->user());
     //Store all analytes for this task
     \Applications\PMTool\Helpers\AnalyteHelper::StoreListsData($caller);
     //Task specific locations
     $project_locations = \Applications\PMTool\Helpers\LocationHelper::GetProjectLocations($caller, $sessionProject);
     $task_locations = \Applications\PMTool\Helpers\LocationHelper::GetAndStoreTaskLocations($caller, $sessionTask);
     $analyte_count = 0;
     if ($analyte_type === 'Lab') {
         //check for LAB analytes
         //Get task specific lab analytes
         $task_lab_analytes = \Applications\PMTool\Helpers\AnalyteHelper::GetAndStoreTaskLabAnalytes($caller, $sessionTask);
         //\Applications\PMTool\Helpers\CommonHelper::pr($task_locations);
         $analyte_count = count($task_lab_analytes);
     } else {
         //check for FIELD analytes
         $task_field_analytes = \Applications\PMTool\Helpers\AnalyteHelper::GetAndStoreTaskFieldAnalytes($caller, $sessionTask);
         $analyte_count = count($task_field_analytes);
     }
     if ($analyte_count > 0 && count($task_locations) > 0) {
         return true;
     } else {
         return false;
     }
 }