Exemplo n.º 1
0
 /** 
  * @function processData
  *
  * @abstract Provided function to allow an object to process it's data.
  *
  */
 function processData()
 {
     // if this was a form submit ...
     // NOTE: our forms should have a hidden variable named Process on them.
     if (isset($_REQUEST['Process'])) {
         // if form data is valid ...
         if ($this->pageDisplay->isDataValid()) {
             // process the data
             $this->pageDisplay->processData();
             // now switch to the proper next page ...
             switch ($this->page) {
                 case modulecim_stats::PAGE_STAFFWEEKLYREPORT:
                     $this->WEEK_ID = '';
                     $this->page = modulecim_stats::PAGE_PRC;
                     // echo '<pre>'.print_r($_REQUEST, true).'</pre>';
                     // need the semester id and campus id for the PRC page
                     if (isset($_REQUEST[modulecim_stats::CAMPUS_ID])) {
                         $this->CAMPUS_ID = $_REQUEST[modulecim_stats::CAMPUS_ID];
                     } else {
                         // figure out the campus id from a query string form value
                         $this->CAMPUS_ID = $this->getQSValueLocal(modulecim_stats::CAMPUS_ID, $_REQUEST['campus_id']);
                     }
                     // echo '$this->CAMPUS_ID['.$this->CAMPUS_ID.']<br/>';
                     // get the week_id
                     $weekID = $this->getQSValueLocal(modulecim_stats::WEEK_ID, $_REQUEST['week_id']);
                     // create a week manager
                     $weekManager = new RowManager_WeekManager($weekID);
                     $weekDate = $weekManager->getEndDate();
                     // echo '$weekDate['.$weekDate.']<br/>';
                     $semesterManager = new RowManager_SemesterManager();
                     if ($semesterManager->loadByDate($weekDate)) {
                         $this->SEMESTER_ID = $semesterManager->getID();
                     } else {
                         if ($semesterManager->checkIfFirstSemester($weekDate)) {
                             $this->SEMESTER_ID = $semesterManager->getID();
                         } else {
                             die('ERROR - could not find semester - processData - staffWeeklyReport transition');
                         }
                     }
                     $this->SEMESTER_ID = $semesterManager->getID();
                     // echo '$this->SEMESTER_ID['.$this->SEMESTER_ID.']<br/>';
                     $this->loadPRC();
                     break;
                 case modulecim_stats::PAGE_SEMESTERREPORT:
                     $this->SEMESTER_ID = '';
                     $this->page = modulecim_stats::PAGE_STATSHOME;
                     $this->loadStatsHome();
                     break;
                 case modulecim_stats::PAGE_PRCMETHOD:
                     // NOTE: after a successful submit on an AdminBox style
                     // form, set the managerInit variable back to ''
                     $this->METHOD_ID = '';
                     $this->loadPrcMethod(true);
                     break;
                 case modulecim_stats::PAGE_PRC:
                     // NOTE: after a successful submit on an AdminBox style
                     // form, set the managerInit variable back to ''
                     $this->PRC_ID = '';
                     $this->loadPRC(true);
                     break;
                 case modulecim_stats::PAGE_SELECTPRCSEMESTERCAMPUS:
                     // echo print_r($_REQUEST, true);
                     // HACK: not really sure how else to get these values
                     $this->SEMESTER_ID = $_REQUEST['semester_id'];
                     $this->CAMPUS_ID = $_REQUEST['campus_id'];
                     $this->loadPRC();
                     break;
                 case modulecim_stats::PAGE_EXPOSURETYPES:
                     // NOTE: after a successful submit on an AdminBox style
                     // form, set the managerInit variable back to ''
                     $this->EXPOSURE_ID = '';
                     $this->loadExposureTypes(true);
                     break;
                 case modulecim_stats::PAGE_MORESTATS:
                     // NOTE: after a successful submit on an AdminBox style
                     // form, set the managerInit variable back to ''
                     $this->MORESTATS_ID = '';
                     $this->loadMoreStats(true);
                     break;
                 case modulecim_stats::PAGE_STAFFADDITIONALWEEKLYSTATS:
                     $this->WEEK_ID = '';
                     $this->page = modulecim_stats::PAGE_STATSHOME;
                     $this->loadStatsHome();
                     break;
                     /*[RAD_PAGE_TRANSITION]*/
             }
         }
         // end if data valid
     }
     // end if Process
 }