/** * @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 }
/** * function __construct * <pre> * Initialize the object. * </pre> * @param $pathModuleRoot [STRING] The path to this module's root directory * @param $viewer [OBJECT] The viewer object. * @param $formAction [STRING] The action on a form submit * @param $semesterreport_id [INTEGER] Value used to initialize the dataManager * @param $semester_id [INTEGER] The foreign key data for the data Manager * @param $campus_id [INTEGER] The foreign key data for the data Manager * @return [void] */ function __construct($pathModuleRoot, $viewer, $formAction, $semesterreport_id, $semester_id = '', $campus_id = '', $staff_id = '') { // NOTE: be sure to call the parent constructor before trying to // use the ->formXXX arrays... $fieldList = FormProcessor_SemesterReport::FORM_FIELDS; $fieldDisplayTypes = FormProcessor_SemesterReport::FORM_FIELD_TYPES; parent::__construct($formAction, $fieldList, $fieldDisplayTypes); $this->pathModuleRoot = $pathModuleRoot; $this->viewer = $viewer; $this->semesterreport_id = $semesterreport_id; $this->staff_id = $staff_id; // check the semester id $this->semester_id = $semester_id; if ($this->semester_id == '') { // echo 'semester NOT set, giving default value... '; $semesterManager = new RowManager_SemesterManager(); $today = date('Y-m-d', time()); if ($semesterManager->loadByDate($today)) { $this->semester_id = $semesterManager->getID(); } else { if ($semesterManager->checkIfFirstSemester($today)) { // echo "in base case<br/>"; $this->semester_id = $semesterManager->getID(); } else { die('ERROR - could not set semester - page_SemesterReport.php'); } } } // echo '$this->semester_id['.$this->semester_id.']<br/>'; // for looking up the person_id of this staff member $staffManager = new RowManager_StaffManager($this->staff_id); // setup the $assignmentManager = new RowManager_AssignmentsManager(); $assignmentManager->setPersonID($staffManager->getPersonID()); $assignmentManager->setAssignmentStatusID(CA_STAFF); $multiTableManager = new MultiTableManager(); $multiTableManager->addRowManager($assignmentManager); $campusManager = new RowManager_CampusManager(); $campusManager->setSortOrder('campus_desc'); $multiTableManager->addRowManager($campusManager, new JoinPair($campusManager->getJoinOnCampusID(), $assignmentManager->getJoinOnCampusID())); $this->campusListIterator = $multiTableManager->getListIterator(); if ($campus_id != '') { // echo 'campus_id is SET ['.$campus_id.']<br/>'; $this->campus_id = $campus_id; } else { // set a default campus id // echo 'Choosing a default campus<br/>'; $this->campusListIterator->setFirst(); if ($this->campusListIterator->moveNext()) { $campusObject = $this->campusListIterator->getCurrent(new RowManager_CampusManager()); $this->campus_id = $campusObject->getID(); } else { die('ERROR - unable to set campus_id - page_StaffWeeklyReport'); } } // figure out the important fields for the dataManager $fieldsOfInterest = implode(',', $this->formFields); $this->dataManager = new RowManager_SemesterReportManager($this->semester_id, $this->campus_id); $this->dataManager->setFieldsOfInterest($fieldsOfInterest); $this->formValues = $this->dataManager->getArrayOfValues(); // now initialize the labels for this page // start by loading the default field labels for this Module $languageID = $viewer->getLanguageID(); $seriesKey = modulecim_stats::MULTILINGUAL_SERIES_KEY; $pageKey = modulecim_stats::MULTILINGUAL_PAGE_FIELDS; $this->labels = new MultilingualManager($languageID, $seriesKey, $pageKey); // then load the page specific labels for this page $pageKey = FormProcessor_SemesterReport::MULTILINGUAL_PAGE_KEY; $this->labels->loadPageLabels($pageKey); // load the site default form link labels $this->labels->setSeriesKey(SITE_LABEL_SERIES_SITE); $this->labels->loadPageLabels(SITE_LABEL_PAGE_FORM_LINKS); $this->labels->loadPageLabels(SITE_LABEL_PAGE_FORMERRORS); }