/** * 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 $weeklyReport_id [INTEGER] Value used to initialize the dataManager * @return [void] */ function __construct($pathModuleRoot, $viewer, $formAction, $weeklyReport_id, $staff_id, $week_id = '', $campus_id = '') { // NOTE: be sure to call the parent constructor before trying to // use the ->formXXX arrays... $fieldList = FormProcessor_StaffAdditionalWeeklyStats::FORM_FIELDS; $fieldDisplayTypes = FormProcessor_StaffAdditionalWeeklyStats::FORM_FIELD_TYPES; parent::__construct($formAction, $fieldList, $fieldDisplayTypes); $this->pathModuleRoot = $pathModuleRoot; $this->viewer = $viewer; $this->weeklyReport_id = $weeklyReport_id; $this->campus_id = $campus_id; $this->staff_id = $staff_id; if ($week_id != '') { // echo 'week_id is SET ['.$week_id.']<br/>'; $this->week_id = $week_id; } else { // give a default value to the week id $weekManager = new RowManager_WeekManager(); if ($weekManager->loadByDate(date('Y-m-d', time()))) { $this->week_id = $weekManager->getID(); } else { die("ERROR - couldn't see week_id - page_StaffAdditionalWeeklyReport.php"); } } // 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_WeeklyReportManager($this->week_id, $this->staff_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_StaffAdditionalWeeklyStats::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); }