/** * function __construct * <pre> * Initialize the object. * </pre> * @param $pathModuleRoot [STRING] The path to the module's root dir. * @param $viewer [OBJECT] The viewer object. * @return [void] */ function __construct($pathModuleRoot, $viewer, $staff_id, $campus_id = "", $semester_id = "") { parent::__construct(); // initialzie the object values $this->pathModuleRoot = $pathModuleRoot; $this->viewer = $viewer; $this->permManager = new PermissionManager($this->viewer->getViewerID()); // for looking up the person_id of this staff member $this->staff_id = $staff_id; $staffManager = new RowManager_StaffManager($this->staff_id); // echo 'the staff_id['.$this->staff_id.']<br/>'; // figure out what campuses to display $multiTableManager = new MultiTableManager(); $campusManager = new RowManager_CampusManager(); $campusManager->setSortOrder('campus_desc'); $isRT = $this->permManager->isRegional(); if ($isRT) { // get all the campuses across the country $multiTableManager->addRowManager($campusManager); } else { // get only the campuses the staff is assigned to $assignmentManager = new RowManager_AssignmentsManager(); $this->person_id = $staffManager->getPersonID(); $assignmentManager->setPersonID($this->person_id); $assignmentManager->setAssignmentStatusID(CA_STAFF); $multiTableManager->addRowManager($assignmentManager); $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'); } } // echo 'the campus_id['.$this->campus_id.']<br/>'; if ($semester_id != '') { $this->semester_id = $semester_id; } else { // set a default semester id $this->semester_id = 4; // TODO set this properly } // echo 'the semester_id['.$this->semester_id.']<br/>'; // 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 = page_CampusWeeklyStatsReport::MULTILINGUAL_PAGE_KEY; $this->labels = new MultilingualManager($languageID, $seriesKey, $pageKey); }
/** * function __construct * <pre> * Initialize the object. * </pre> * @param $pathModuleRoot [STRING] The path to the module's root dir. * @param $viewer [OBJECT] The viewer object. * @param $sortBy [STRING] Field data to sort listManager by. * @param $managerInit [INTEGER] Initialization value for the listManager. * @return [void] */ function __construct($pathModuleRoot, $viewer, $sortBy, $year_id = "", $campus_id = "") { parent::__construct(page_ViewStudentYearInSchool::DISPLAY_FIELDS); $this->pathModuleRoot = $pathModuleRoot; $this->viewer = $viewer; $this->year_id = $year_id; $this->campus_id = $campus_id; // echo 'campusID['.$this->campus_id.']<br/>'; // $this->managerInit = $managerInit; // Now load the access Priviledge manager of this viewer $this->adminManager = new RowManager_AdminManager(); // Get the person ID $accessManager = new RowManager_AccessManager(); $accessManager->loadByViewerID($this->viewer->getViewerID()); $personID = $accessManager->getPersonID(); // Get the permissions the person has. $this->adminManager->loadByPersonID($personID); // need to filter displayed data by campus associated with campus admin $campusAdminSearchCondition = ''; if ($this->adminManager->hasSitePriv()) { $campusManager = new RowManager_CampusManager(); $campusManager->setSortOrder('campus_desc'); $this->campusList = $campusManager->getListIterator(); $this->accessibleCampuses = $this->campusList->getDropListArray(); } else { if ($this->adminManager->hasCampusPriv()) { $campusAdminManager = new RowManager_CampusAdminManager(); $adminID = $this->adminManager->getID(); // echo 'adminID['.$adminID.']<br/>'; $campusAdminManager->setAdminID($adminID); $campusList = $campusAdminManager->getListIterator(); //$multiTableManager->getListIterator(); $campusArray = $campusList->getDataList(); $campusIDsList = ""; // init the CSV of campus IDs associated with admin reset($campusArray); foreach (array_keys($campusArray) as $k) { $record = current($campusArray); $campusIDsList .= $record['campus_id'] . ','; // create list of admin campuses next($campusArray); } $campusIDsList = substr($campusIDsList, 0, -1); // remove last comma $campusAdminSearchCondition = 'cim_hrdb_assignment.campus_id in (' . $campusIDsList . ')'; } else { if ($this->adminManager->isStaff($viewer->getID())) { $staffManager = new RowManager_StaffManager(); $staffManager->setPersonID($personID); $multiTableManager = new MultiTableManager(); $multiTableManager->addRowManager($staffManager); $multiTableManager->setSortOrder('campus_desc'); $assignmentManager = new RowManager_AssignmentsManager(); $multiTableManager->addRowManager($assignmentManager, new JoinPair($assignmentManager->getJoinOnPersonID(), $staffManager->getJoinOnPersonID())); $campusManager = new RowManager_CampusManager(); $multiTableManager->addRowManager($campusManager, new JoinPair($campusManager->getJoinOnCampusID(), $assignmentManager->getJoinOnCampusID())); $this->campusList = $multiTableManager->getListIterator(); $campusIDsList = ""; // init the CSV of campus IDs associated with admin $this->campusList->setFirst(); while ($this->campusList->moveNext()) { $campusAssignObject = $this->campusList->getCurrent(new RowManager_AssignmentsManager()); $campusObject = $this->campusList->getCurrent(new RowManager_CampusManager()); $campusIDsList .= $campusAssignObject->getCampusID() . ','; // create list of admin campuses } $campusIDsList = substr($campusIDsList, 0, -1); // remove last comma $campusAdminSearchCondition = 'cim_hrdb_assignment.campus_id in (' . $campusIDsList . ')'; } } } $yearManager = new RowManager_YearInSchoolManager(); $yearManager->setSortOrder('year_id'); $this->yearValueList = $yearManager->getListIterator(); $this->yearValues = $this->yearValueList->getDropListArray(); // Add value to drop-list for showing person data for people not having person_year record $keys = array_keys($this->yearValues); $this->UNASSIGNED_IDX = $keys[count($this->yearValues) - 1] + 1; // assumes autoincrement is active on table $this->yearValues[$this->UNASSIGNED_IDX] = page_ViewStudentYearInSchool::UNASSIGNED; // echo 'values = <pre>'.print_r($this->yearValues, true).'</pre>'; // modify the year_id if necessary if ($this->year_id == page_ViewStudentYearInSchool::DISPLAY_ALL_ID) { // setting the year_id to blank will get entries from all the years $this->year_id = ''; } else { if ($this->year_id == '') { // no campus has been specified // choose a default campus if none specified // echo 'No campus specified<br/>'; // get the first element from the accessible list foreach ($this->yearValues as $key => $value) { $this->year_id = $key; break; } // assert campus_id should now be something if ($this->year_id == '') { die("ERROR - year_id not set to anything<br/>"); } } } $dataAccessObject = new MultiTableManager(); // Check if regular choice made (i.e. person has some year_in_school record) if ($this->year_id != $this->UNASSIGNED_IDX) { $personYearManager = new RowManager_PersonYearManager(); $personYearManager->setYear($this->year_id); // SOMEWHAT REDUNDANT GIVEN addSearchCondition (which is required) $dataAccessObject->addRowManager($personYearManager); $yearManager = new RowManager_YearInSchoolManager(); $joinPair = new JoinPair($personYearManager->getJoinOnYearID(), $yearManager->getJoinOnYearID()); $dataAccessObject->addRowManager($yearManager, $joinPair); $personManager = new RowManager_PersonManager(); $joinPair1 = new JoinPair($personManager->getJoinOnPersonID(), $personYearManager->getJoinOnPersonID()); $dataAccessObject->addRowManager($personManager, $joinPair1); $assignmentManager = new RowManager_AssignmentsManager(); $joinPair2 = new JoinPair($personYearManager->getJoinOnPersonID(), $assignmentManager->getJoinOnPersonID()); $dataAccessObject->addRowManager($assignmentManager, $joinPair2); $campusManager = new RowManager_CampusManager(); $joinPair3 = new JoinPair($assignmentManager->getJoinOnCampusID(), $campusManager->getJoinOnCampusID()); $dataAccessObject->addRowManager($campusManager, $joinPair3); if ($sortBy == '') { $sortBy = 'campus_shortDesc,person_lname'; } if ($this->year_id != '') { $dataAccessObject->addSearchCondition('cim_hrdb_person_year.year_id = ' . $this->year_id); } // filter by campuses assigned to this campus admin if ($campusAdminSearchCondition != '') { $dataAccessObject->addSearchCondition($campusAdminSearchCondition); } $dataAccessObject->setSortOrder($sortBy); $this->listManager = $dataAccessObject->getListIterator(); } else { // $personYearManager = new RowManager_PersonYearManager(); // $personYearManager->setYear($this->year_id); // SOMEWHAT REDUNDANT GIVEN addSearchCondition (which is required) // $dataAccessObject->addRowManager( $personYearManager ); // // $yearManager = new RowManager_YearInSchoolManager(); // $joinPair = new JoinPair($personYearManager->getJoinOnYearID(), $yearManager->getJoinOnYearID()); // $dataAccessObject->addRowManager( $yearManager, $joinPair ); $personManager = new RowManager_PersonManager(); $dataAccessObject->addRowManager($personManager); $assignmentManager = new RowManager_AssignmentsManager(); $joinPair2 = new JoinPair($personManager->getJoinOnPersonID(), $assignmentManager->getJoinOnPersonID()); $dataAccessObject->addRowManager($assignmentManager, $joinPair2); $campusManager = new RowManager_CampusManager(); $joinPair3 = new JoinPair($assignmentManager->getJoinOnCampusID(), $campusManager->getJoinOnCampusID()); $dataAccessObject->addRowManager($campusManager, $joinPair3); if ($sortBy == '') { $sortBy = 'campus_shortDesc,person_lname'; } // get sub-query data for filtering out registrants that have already been registered for event $subManager = new RowManager_PersonYearManager(); $personYearManager = new MultiTableManager(); $personYearManager->addRowManager($subManager); $personYearManager->setFieldList('person_id'); $registered_SQL = $personYearManager->createSQL(); // echo "<br>CREATED SQL 1 = ".$registered_SQL; // actually creates the sub-query ensuring that registrants listed do NOT have personyear records $negateSubQuery = true; $addSubQuery = true; $dataAccessObject->constructSubQuery('person_id', $registered_SQL, $negateSubQuery, $addSubQuery); // filter by campuses assigned to this campus admin if ($campusAdminSearchCondition != '') { $dataAccessObject->addSearchCondition($campusAdminSearchCondition); } $dataAccessObject->setSortOrder($sortBy); $this->listManager = $dataAccessObject->getListIterator(); } /** TEST **/ // $values = $this->listManager->getDataList(); // echo 'values found = <pre>'.print_r($values,true).'</pre>'; /** END TEST **/ // now initialize the labels for this page // start by loading the default field labels for this Module $languageID = $viewer->getLanguageID(); $seriesKey = modulecim_hrdb::MULTILINGUAL_SERIES_KEY; $pageKey = modulecim_hrdb::MULTILINGUAL_PAGE_FIELDS; $this->labels = new MultilingualManager($languageID, $seriesKey, $pageKey); // then load the page specific labels for this page $pageKey = page_ViewStudentYearInSchool::MULTILINGUAL_PAGE_KEY; $this->labels->loadPageLabels($pageKey); $this->labels->setSeriesKey(SITE_LABEL_SERIES_SITE); $this->labels->loadPageLabels(SITE_LABEL_PAGE_FORM_LINKS); }
/** * 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); }
/** * function getHTML * <pre> * This method returns the HTML data generated by this object. * </pre> * @return [STRING] HTML Display data. */ function getHTML() { $regSummaries = new RegSummaryTools(); // Uncomment the following line if you want to create a template // tailored for this page: $path = $this->pathModuleRoot . 'templates/'; // Otherwise use the standard Templates for the site: //$path = SITE_PATH_TEMPLATES; /* * Update any label tags ... */ // example: // $name = $user->getName(); $event = new RowManager_EventManager($this->event_id); $this->labels->setLabelTag('[Instr]', '[eventName]', $event->getEventName()); // NOTE: this parent method prepares the $this->template with the // common Display data. $this->prepareTemplate($path); // pass in the labels for the outer template // $labels = new MultiLingual_Labels( GPC_SITE_LABEL, GPC_SERIES_LABEL, TEMPLATE_PAGE, $langID ); // $page->set('labels', $labels ); // get privileges for the current viewer $privManager = new PrivilegeManager($this->viewer->getID()); if ($privManager->isEventAdmin($this->event_id) == true) { $this->template->set('isEventAdmin', true); // display messages based on balance owing recalculation status switch ($this->recalcStatus) { // display balance owing recalculation COMPLETED message case FinancialTools::RECALC_COMPLETE: $this->template->set('isRecalculated', true); $completedMsg = $this->labels->getLabel('[RecalcCompleteMsg]'); $this->template->set('recalcMessage', $completedMsg); break; // display balance owing recalculation NEEDED message // display balance owing recalculation NEEDED message case FinancialTools::RECALC_NEEDED: $this->template->set('needsRecalculation', true); $completedMsg = $this->labels->getLabel('[RecalcNeededMsg]'); $this->template->set('recalcMessage', $completedMsg); break; default: break; } } $this->template->set('backLink', $this->linkValues['BackLink']); //$superAdminPrefix = 'superAdmin_'; //$this->template->set('superAdminPrefix', $superAdminPrefix ); $superAdminLevelLinks = array(); $campusLevelLinks = array(); $eventLevelLinks = array(); $financeLevelLinks = array(); if ($privManager->isSuperAdmin() == true) { $this->template->set('isSuperAdmin', true); //Super Admin Level links (order is important == viewing order) $superAdminLevelLinks['AddSuperAdmins'] = $this->linkValues['AddSuperAdmins']; $superAdminLevelLinks['EditPrivilegeTypes'] = $this->linkValues['EditPrivilegeTypes']; $superAdminLevelLinks['EditFieldTypes'] = $this->linkValues['EditFieldTypes']; $superAdminLevelLinks['EditPriceRuleTypes'] = $this->linkValues['EditPriceRuleTypes']; $superAdminLevelLinks['EditCreditCardTypes'] = $this->linkValues['EditCreditCardTypes']; $superAdminLevelLinks['EditStatusTypes'] = $this->linkValues['EditStatusTypes']; $this->template->set('superAdminLevelLinks', $superAdminLevelLinks); } //Campus Level links /** TODO: move the below code into an earlier page and pass on priv. info OR put in helper function ***/ /** ALSO: make use of this or similar code for restricting access to campus-level registrations **/ /** CHECK PRIVILEGE LEVEL IN ORDER TO DETERMINE WHICH CAMPUS REGISTRATION LINKS TO SHOW **/ // $viewer_id = $this->viewer->getViewerID(); // $accessAll = false; // $accessCampuses = array(); // // $superAdmin = new RowManager_SuperAdminAssignmentManager(); // $superAdmin->setViewerID($viewer_id); // $superAdminList = new ListIterator($superAdmin); // $superAdminArray = $superAdminList->getDropListArray(); // // echo "super: <pre>".print_r($superAdminArray, true)."</pre>"; // // // all campuses can be accessed if user/viewer is super-admin // if (count($superAdminArray) > 0) // { // $accessAll = true; // } // else // check if viewer is finance-level, event-level, or campus-level admin // { // // TODO: retrieve these constants from the database using PrivilegeTypeManager // $EVENT_LEVEL = 3; // $FINANCE_LEVEL = 2; // $CAMPUS_LEVEL = 4; // // $eventAdmin = new RowManager_EventAdminAssignmentManager(); // $eventAdmin->setEventID($this->event_id); // $eventAdmin->setViewerID($viewer_id); // $eventAdmin->setPrivilege($EVENT_LEVEL." or ".$FINANCE_LEVEL); // $eventAdminList = new ListIterator($eventAdmin); // $eventAdminArray = $eventAdminList->getDropListArray(); // // echo "eventAdmin: <pre>".print_r($eventAdminArray, true)."</pre>"; // // grant access to all campuses if viewer is event-level or finance-level admin // if (count($eventAdminArray) < 0) // { // $accessAll = true; // } // else // TODO: retrieve campus list if viewer has campus-level admin privileges // { // $eventAdmin2 = new RowManager_EventAdminAssignmentManager(); // $eventAdmin2->setEventID($this->event_id); // $eventAdmin2->setViewerID($viewer_id); // $eventAdmin2->setPrivilege($CAMPUS_LEVEL); // $eventAdminList2 = new ListIterator($eventAdmin2); // $eventAdminArray2 = $eventAdminList2->getDropListArray(); // // echo "eventAdmin2: <pre>".print_r($eventAdminArray2, true)."</pre>"; // } // // } /** END PRIVILEGE CHECKING **/ // $is_campus_admin = false; if ($privManager->isBasicAdmin($this->event_id) == true) { $this->template->set('isCampusAdmin', true); /** RETRIEVE CAMPUS REGISTRATION SUMMARY DATA ***/ //TODO?: put some/all of this into a helper method // initialized template arrays $campusLevelLinks = array(); $summaryTotals = array(); $summaryTotals['numMales'] = 0; $summaryTotals['numFemales'] = 0; $summaryTotals['campusTotal'] = 0; $summaryTotals['cancellations'] = 0; // get all campuses $campuses = new RowManager_CampusManager(); $campuses->setSortOrder('campus_desc'); $campusList = $campuses->getListIterator(); $campusArray = $campusList->getDataList(); reset($campusArray); // echo 'campus array = <pre>'.print_r($campusArray,true).'</pre>'; // retrieve cancellations (for current event) $results_cancelled = array(); $results_cancelled = $regSummaries->getCampusRegistrations($this->event_id, '', true); // retrieve total registrations and total females registered (for current event) $results = array(); $results_female = array(); $results = $regSummaries->getCampusRegistrations($this->event_id, ''); $results_female = $regSummaries->getCampusRegistrations($this->event_id, 'female'); // retrieve total complete registrations and total incomplete registrations (for current event) $results_complete = array(); $results_incomplete = array(); $results_complete = $regSummaries->getCampusRegistrations($this->event_id, '', false, '', '', RowManager_RegistrationManager::STATUS_REGISTERED); $results_incomplete = $regSummaries->getCampusRegistrations($this->event_id, '', false, '', '', RowManager_RegistrationManager::STATUS_INCOMPLETE); // $results = array_merge( $results_male, $results_female ); reset($results); // reset($results_male); // reset($results_female); // go through total registrations in parallel with other results foreach (array_keys($campusArray) as $k) { $total = current($results); $regCampusID = key($results); $campusID = key($campusArray); //key($results); // retrieve campus name given the campus ID $campus = new RowManager_CampusManager($campusID); $campusName = $campus->getDesc(); // process registration total if it matches the current campus ID if ($regCampusID == $campusID) { // set total valid non-cancelled registrations for current campus (and event) if (isset($results_cancelled[$campusID])) { $cancelled = $results_cancelled[$campusID]; // $total = $total - $cancelled; } else { $cancelled = 0; } // set total females registered for current campus (and event) if (isset($results_female[$campusID])) { $females = $results_female[$campusID]; } else { $females = 0; } // set total complete registrations for current campus (and event) if (isset($results_complete[$campusID])) { $completes = $results_complete[$campusID]; } else { $completes = 0; } // set total incomplete registrations for current campus (and event) if (isset($results_incomplete[$campusID])) { $incompletes = $results_incomplete[$campusID]; } else { $incompletes = 0; } // $females = current($results_female); // $males = $results_male[$campusName]; // set total registered males $males = $total - $females; //current($results_male);// // echo $campusName.': '.$total.' : '.$males.' : '.$females.'<br>'; // echo 'cancelled : '.$cancelled.'<br>'; // set registration summary values for current campus $aCampus = array(); $aCampus['campus_desc'] = $campusName; $aCampus['regLink'] = '#'; //$this->linkValues[ 'CampusLink' ].$campusID;//$this->event_id."_".$campusID; $aCampus['numMales'] = $males; $aCampus['numFemales'] = $females; $aCampus['campusTotal'] = $total; $aCampus['cancellations'] = $cancelled; $aCampus['completes'] = $completes; $aCampus['incompletes'] = $incompletes; // $summaryTotals['numMales'] += $males; // $summaryTotals['numFemales'] += $females; // $summaryTotals['campusTotal'] += $total; // $summaryTotals['cancellations'] += $cancelled; next($results); // increment array-pointer for registration totals array } else { // set registration summary values for current campus $aCampus = array(); $aCampus['campus_desc'] = $campusName; $aCampus['regLink'] = '#'; //$this->linkValues[ 'CampusLink' ].$campusID;//$this->event_id."_".$campusID; $aCampus['numMales'] = 0; $aCampus['numFemales'] = 0; $aCampus['campusTotal'] = 0; $aCampus['cancellations'] = 0; $aCampus['completes'] = 0; $aCampus['incompletes'] = 0; } // $editLink = $this->getCallBack( modulecim_reg::PAGE_ADMINEVENTHOME, $this->sortBy, $parameters ); // $editLink .= "&". modulecim_reg::REG_ID . "="; // CampusLink if ($privManager->isCampusAdmin($this->event_id, $campusID) == true) { $aCampus['regLink'] = $this->linkValues['CampusLink'] . $campusID; //$this->event_id."_".$campusID; } // <START> USED TO BE INSIDE CAMPUS ADMIN PRIV. CHECK // BUT NOW ALL CAMPUS ADMINS CAN SEE SUMMARY DATA... ONLY REGISTRATION LINKS NOT SHOWN FOR INVALID CAMPUSES // store campus summary info in array indexed by campus name $campusLevelLinks[$campusName] = $aCampus; // if ($is_campus_admin == false) { // $this->template->set('isCampusAdmin', true); // $is_campus_admin = true; // } // <END> next($campusArray); // next($results_female); // next($results_male); } /*** END CAMPUS REGISTRATION SUMMARY DATA RETRIEVAL ***/ $this->template->set('linkText', 'Registrations'); $this->template->set('campusLevelLinks', $campusLevelLinks); /**** SET TOTAL *UNIQUE* REGISTRATIONS *******/ $totalRegs = array(); $totalRegs = $regSummaries->getUniqueRegistrations($this->event_id); // echo "Total unique regs: ".count($totalRegs); $femaleRegs = array(); $gender = 'female'; $femaleRegs = $regSummaries->getUniqueRegistrations($this->event_id, $gender); // echo "<br>Total male regs: ".(count($totalRegs)-count($femaleRegs)); // echo "<br>Total female regs: ".count($femaleRegs); $cancelledRegs = array(); $gender = ''; $areCancelled = true; $cancelledRegs = $regSummaries->getUniqueRegistrations($this->event_id, $gender, $areCancelled); // echo "<br>Total cancelled regs: ".count($cancelledRegs); $completeRegs = array(); $gender = ''; $areCancelled = false; $status = RowManager_RegistrationManager::STATUS_REGISTERED; $completeRegs = $regSummaries->getUniqueRegistrations($this->event_id, $gender, $areCancelled, $status); $incompleteRegs = array(); $gender = ''; $areCancelled = false; $status = RowManager_RegistrationManager::STATUS_INCOMPLETE; $incompleteRegs = $regSummaries->getUniqueRegistrations($this->event_id, $gender, $areCancelled, $status); $summaryTotals['numMales'] = count($totalRegs) - count($femaleRegs); $summaryTotals['numFemales'] = count($femaleRegs); $summaryTotals['campusTotal'] = count($totalRegs); $summaryTotals['cancellations'] = count($cancelledRegs); $summaryTotals['completes'] = count($completeRegs); $summaryTotals['incompletes'] = count($incompleteRegs); $this->template->set('summaryTotals', $summaryTotals); } if ($privManager->isEventAdmin($this->event_id) == true) { //Event Level links $eventLevelLinks['AddEventAdmins'] = $this->linkValues['AddEventAdmins']; $eventLevelLinks['AddCampusAdmins'] = $this->linkValues['AddCampusAdmins']; $eventLevelLinks['RecalculateBalances'] = $this->linkValues['RecalculateBalances']; $eventLevelLinks['EditEventDetails'] = $this->linkValues['EditEventDetails']; $eventLevelLinks['EditEventFormFields'] = $this->linkValues['EditEventFormFields']; $eventLevelLinks['EditEventPriceRules'] = $this->linkValues['EditEventPriceRules']; $eventLevelLinks['EventDataDump'] = $this->linkValues['EventDataDump']; $eventLevelLinks['EventScholarshipList'] = $this->linkValues['EventScholarshipList']; $this->template->set('eventLevelLinks', $eventLevelLinks); //$editEventDetailsLink = $this->linkValues[ 'editEventDetailsLink' ]; //$this->template->set('editEventDetailsLink', $editEventDetailsLink ); } if ($privManager->isFinanceAdmin($this->event_id) == true) { $this->template->set('isFinanceAdmin', true); //Finance Level links } // uncomment this line if you are creating a template for this page $templateName = 'page_AdminEventHome.php'; // otherwise use the generic site template //$templateName = ''; return $this->template->fetch($templateName); }
/** * function getHTML * <pre> * This method returns the HTML data generated by this object. * </pre> * @return [STRING] HTML Display data. */ function getHTML() { // Uncomment the following line if you want to create a template // tailored for this page: //$path = $this->pathModuleRoot.'templates/'; // Otherwise use the standard Templates for the site: $path = SITE_PATH_TEMPLATES; /* * store the link values */ // example: // $this->linkValues[ 'view' ] = 'add/new/href/data/here'; // store the link labels $this->linkLabels['edit'] = $this->labels->getLabel('[Edit]'); $this->linkLabels['del'] = $this->labels->getLabel('[Delete]'); $this->linkLabels['cont'] = $this->labels->getLabel('[Continue]'); // $this->linkLabels[ 'view' ] = 'new link label here'; /* * store any additional link Columns */ // example: //$title = $this->labels->getLabel( '[title_groups]'); //$columnLabel = $this->labels->getLabel( '[groups]'); //$link = $this->linkValues[ 'groups' ]; //$fieldName = 'accessgroup_id'; //$this->addLinkColumn( $title, $columnLabel, $link, $fieldName); /* * Update any label tags ... */ // example: // $name = $user->getName(); // $this->labels->setLabelTag( '[Title]', '[userName]', $name); // NOTE: this parent method prepares the $this->template with the // common AdminBox data. $this->prepareTemplate($path); // store the statevar id to edit $this->template->set('editEntryID', $this->assignment_id); // store all the fields to the template $this->setFormFieldsToTemplate(); /* * Form related Template variables: */ /* * Insert the date start/end values for the following date fields: */ // example: //$this->template->set( 'startYear_[fieldName]', 2000); //$this->template->set( 'endYear_[fieldName]', 2010); /* * List related Template variables : */ // Store the XML Node name for the Data Access Field List $xmlNodeName = RowManager_EditCampusAssignmentManager::XML_NODE_NAME; $this->template->set('rowManagerXMLNodeName', $xmlNodeName); // store the primary key field name for the data being displayed $this->template->set('primaryKeyFieldName', 'assignment_id'); // store data list to the template // NOTE: we initialize it here to make sure we capture any new data // from a recent processData() call. $dataAccessManager = new RowManager_EditCampusAssignmentManager(); $dataAccessManager->setPersonID($this->person_id); $dataAccessManager->setSortOrder($this->sortBy); // $this->dataList = new EditCampusAssignmentList( $this->sortBy ); $this->dataList = $dataAccessManager->getListIterator(); $this->template->setXML('dataList', $this->dataList->getXML()); /* * Add any additional data required by the template here */ $campusManager = new RowManager_CampusManager(); $campusManager->setSortOrder('campus_desc'); $campusList = $campusManager->getListIterator(); $campusArray = $campusList->getDropListArray(); $this->template->set('list_campus_id', $campusArray); // TODO - we probably should restrict this list of options, since people // could assign themselves as staff and that could (implementation dependent) // allow them access to other systems $statusManager = new RowManager_CampusAssignmentStatusManager(); $statusList = $statusManager->getListIterator(); $statusArray = $statusList->getDropListArray(); $this->template->set('list_assignmentstatus_id', $statusArray); $templateName = 'siteAdminBox.php'; // if you are creating a custom template for this page then // replace $templateName with the following: //$templateName = 'page_EditMyCampusAssignment.php'; return $this->template->fetch($templateName); }
/** * function getHTML * <pre> * This method returns the HTML data generated by this object. * </pre> * @return [STRING] HTML Display data. */ function getHTML() { // Make a new Template object $path = SITE_PATH_TEMPLATES; // Replace $path with the following line if you want to create a // template tailored for this page: //$path = $this->pathModuleRoot.'templates/'; // store the link values // $this->linkValues[ 'view' ] = 'add/new/href/data/here'; // store the link labels $this->linkLabels['add'] = $this->labels->getLabel('[Add]'); $this->linkLabels['edit'] = $this->labels->getLabel('[Edit]'); $this->linkLabels['del'] = $this->labels->getLabel('[Delete]'); $this->linkLabels['cont'] = $this->labels->getLabel('[Continue]'); // $this->linkLabels[ 'view' ] = 'new link label here'; // store any additional link Columns // example: //$title = $this->labels->getLabel( '[title_groups]'); //$columnLabel = $this->labels->getLabel( '[groups]'); //$link = $this->linkValues[ 'groups' ]; //$fieldName = 'accessgroup_id'; //$this->addLinkColumn( $title, $columnLabel, $link, $fieldName); // store the page labels // NOTE: use this location to update any label tags ... // example: // $name = $user->getName(); // $this->labels->setLabelTag( '[Title]', '[userName]', $name); $this->prepareTemplate($path); // store the Row Manager's XML Node Name // $this->template->set( 'rowManagerXMLNodeName', RowManager_GroupManager::XML_NODE_NAME ); $this->template->set('rowManagerXMLNodeName', MultiTableManager::XML_NODE_NAME); // store the primary key field name for the data being displayed $this->template->set('primaryKeyFieldName', 'group_id'); /* * Set up any additional data transfer to the Template here... */ // get a list of the different group types $groupType = new RowManager_GroupTypeManager(); $groupTypeList = new ListIterator($groupType); $groupArray = $groupTypeList->getDropListArray(); $this->template->set('list_groupType_id', $groupArray); // echo "<pre>Group:".print_r($groupArray, true)."</pre>"; // get a list of all campus_ids $campus = new RowManager_CampusManager(); $campus->setSortOrder('campus_desc'); $campusList = new ListIterator($campus); $campusArray = $campusList->getDropListArray(); //echo "<pre>Campus:".print_r($campusArray, true)."</pre>"; $this->template->set('list_campus_id', $campusArray); $templateName = 'siteDataList.php'; // if you are creating a custom template for this page then // replace $templateName with the following: //$templateName = 'page_ViewGroups.php'; return $this->template->fetch($templateName); }
/** * function getHTML * <pre> * This method returns the HTML data generated by this object. * </pre> * @return [STRING] HTML Display data. */ function getHTML() { // Uncomment the following line if you want to create a template // tailored for this page: //$path = $this->pathModuleRoot.'templates/'; // Otherwise use the standard Templates for the site: $path = SITE_PATH_TEMPLATES; /* * store the link values */ // example: // $this->linkValues[ 'view' ] = 'add/new/href/data/here'; // store the link labels $this->linkLabels['edit'] = $this->labels->getLabel('[Edit]'); $this->linkLabels['del'] = $this->labels->getLabel('[Delete]'); $this->linkLabels['cont'] = $this->labels->getLabel('[Continue]'); // $this->linkLabels[ 'view' ] = 'new link label here'; /* * store any additional link Columns */ // example: //$title = $this->labels->getLabel( '[title_groups]'); //$columnLabel = $this->labels->getLabel( '[groups]'); //$link = $this->linkValues[ 'groups' ]; //$fieldName = 'accessgroup_id'; //$this->addLinkColumn( $title, $columnLabel, $link, $fieldName); /* * Update any label tags ... */ // example: // $name = $user->getName(); // $this->labels->setLabelTag( '[Title]', '[userName]', $name); // NOTE: this parent method prepares the $this->template with the // common AdminBox data. $this->prepareTemplate($path); // store the statevar id to edit $this->template->set('editEntryID', $this->campusaccess_id); // store all the fields to the template $this->setFormFieldsToTemplate(); /* * Form related Template variables: */ /* * Insert the date start/end values for the following date fields: */ // example: //$this->template->set( 'startYear_[fieldName]', 2000); //$this->template->set( 'endYear_[fieldName]', 2010); /* * List related Template variables : */ // Store the XML Node name for the Data Access Field List // // NOTE: Hobbe, here are the original two lines that I moved to below // // $xmlNodeName = RowManager_EventAdminCampusAssignmentManager::XML_NODE_NAME; // $this->template->set( 'rowManagerXMLNodeName', $xmlNodeName); // store the primary key field name for the data being displayed $this->template->set('primaryKeyFieldName', 'campusaccess_id'); // Russ' Debugging Methodoloy // 1. Try and create a multi-table manager that returns the // result set I want and put it into and array. Then figure // out why that is not making it through to the template. // // Result: Hobbe, indeed you were creating the multi-table // manager correctly (I just renamed the one row manager), // otherwise your code was fine. // // 2. Ok, try and figure out why the template doesn't like // XML it is getting. // // a. first I check another example (FormProcessor_AddSuperAdmin) // of where an adminbox type template is generated. Yes, it // appears we are sending the xml properly // // b. i notice the call to ->set('primaryKeyFieldName', ... ) // in the example I'm checking, that too seems to be okay // // c. I notice the xmlNodeName parameter being set in the // templates, i realize that we are not setting this properly // and refactor the code a little to get the xmlNodeName from // the multitablemanager instead. // store data list to the template // NOTE: we initialize it here to make sure we capture any new data // from a recent processData() call. $campusAdminManager = new RowManager_EventAdminCampusAssignmentManager(); //*** ADDED JOIN TO FILTER BY EVENT ***/ $eventAdminManager = new RowManager_EventAdminAssignmentManager(); // echo "The eventID is [".$this->event_id."]<br/>"; $eventAdminManager->setEventID($this->event_id); $multiTableManager = new MultiTableManager(); $multiTableManager->addRowManager($campusAdminManager); $multiTableManager->addRowManager($eventAdminManager, new JoinPair($eventAdminManager->getJoinOnEventAdminID(), $campusAdminManager->getJoinOnEventAdminID())); // code to check the result set in the multi-table manager // $i = 0; // $listIt = $multiTableManager->getListIterator(); // $listIt->setFirst(); // while( $listIt->moveNext() ) // { // echo "ith [".$i."] element"; // $i++; // } // end multi-table manager check // $this->dataList = $multiTableManager->getListIterator(); // echo "<pre>List: ".print_r($this->dataList,true)."</pre>"; //*** END ADD ***/ $this->dataList = $multiTableManager->getListIterator(); // Hobbe, I added/moved these two lines and now it works! // It has to do with how the template understands the // XML that it is passed $xmlNodeName = $this->dataList->getRowManagerXMLNodeName(); $this->template->set('rowManagerXMLNodeName', $xmlNodeName); $this->template->setXML('dataList', $this->dataList->getXML()); /* * Add any additional data required by the template here */ $eventAdmin = new RowManager_EventAdminAssignmentManager(); $eventAdmin->setEventID($this->event_id); $viewer = new RowManager_ViewerManager(); $multiTableManager2 = new MultiTableManager(); $multiTableManager2->addRowManager($eventAdmin); $multiTableManager2->addRowManager($viewer, new JoinPair($eventAdmin->getJoinOnViewerID(), $viewer->getJoinOnViewerID())); // $multiTableManager2->constructSearchCondition( 'event_id', '=', $this->event_id, true ); $multiTableManager2->setSortOrder('viewer_userID'); $multiTableManager2->setLabelTemplate('viewer_userID', '[viewer_userID]'); $listIterator = $multiTableManager2->getListIterator(); // code to check the result set in the multi-table manager /* echo "<pre>List: ".print_r($listIterator,true)."</pre>"; $i = 0; $listIt = $multiTableManager2->getListIterator(); $listIt->setFirst(); while( $listIt->moveNext() ) { echo "ith [".$i."] element"; $i++; } */ // end multi-table manager check // echo print_r($listIterator,true); /* $viewer = new RowManager_ViewerManager(); $viewer->setSortOrder( 'viewer_userID' ); $viewerList = new ListIterator($viewer); $viewerArray = $viewerList->getDropListArray(); */ $viewerArray = $listIterator->getDropListArray(); //$listIterator $this->template->set('list_eventadmin_id', $viewerArray); // echo print_r($viewerArray,true); $campus = new RowManager_CampusManager(); // $campus->setEventID( $this->event_id); $campus->setSortOrder('campus_id'); $campusList = new ListIterator($campus); $campusArray = $campusList->getDropListArray(); $this->template->set('list_campus_id', $campusArray); $templateName = 'siteAdminBox.php'; // if you are creating a custom template for this page then // replace $templateName with the following: //$templateName = 'page_AddCampusAdmin.php'; return $this->template->fetch($templateName); }
/** * function __construct * <pre> * Initialize the object. * </pre> * @param $pathModuleRoot [STRING] The path to the module's root dir. * @param $viewer [OBJECT] The viewer object. * @param $sortBy [STRING] Field data to sort listManager by. * @param $managerInit [INTEGER] Initialization value for the listManager. * @return [void] */ function __construct($pathModuleRoot, $viewer, $sortBy, $campus_id = "") { parent::__construct(page_PeoplebyCampuses::DISPLAY_FIELDS); $this->pathModuleRoot = $pathModuleRoot; $this->viewer = $viewer; $this->campus_id = $campus_id; // echo 'campusID['.$this->campus_id.']<br/>'; // $this->managerInit = $managerInit; // Now load the access Priviledge manager of this viewer $this->adminManager = new RowManager_AdminManager(); // Get the person ID $accessManager = new RowManager_AccessManager(); $accessManager->loadByViewerID($this->viewer->getViewerID()); $personID = $accessManager->getPersonID(); // Get the permissions the person has. $this->adminManager->loadByPersonID($personID); if ($this->adminManager->hasSitePriv()) { $campusManager = new RowManager_CampusManager(); $campusManager->setSortOrder('campus_desc'); $this->campusList = $campusManager->getListIterator(); $this->accessibleCampuses = $this->campusList->getDropListArray(); } else { if ($this->adminManager->hasCampusPriv()) { $campusAdminManager = new RowManager_CampusAdminManager(); $adminID = $this->adminManager->getID(); // echo 'adminID['.$adminID.']<br/>'; $campusAdminManager->setAdminID($adminID); $multiTableManager = new MultiTableManager(); $multiTableManager->addRowManager($campusAdminManager); $multiTableManager->setSortOrder('campus_desc'); $campusManager = new RowManager_CampusManager(); $multiTableManager->addRowManager($campusManager, new JoinPair($campusManager->getJoinOnCampusID(), $campusAdminManager->getJoinOnCampusID())); $this->campusList = $multiTableManager->getListIterator(); $this->accessibleCampuses = array(); $this->campusList->setFirst(); while ($this->campusList->moveNext()) { $campusAdminObject = $this->campusList->getCurrent(new RowManager_CampusAdminManager()); $campusObject = $this->campusList->getCurrent(new RowManager_CampusManager()); $this->accessibleCampuses[$campusAdminObject->getCampusID()] = $campusObject->getLabel(); } } else { if ($this->adminManager->isStaff($viewer->getID())) { $staffManager = new RowManager_StaffManager(); $staffManager->setPersonID($personID); $multiTableManager = new MultiTableManager(); $multiTableManager->addRowManager($staffManager); $multiTableManager->setSortOrder('campus_desc'); $assignmentManager = new RowManager_AssignmentsManager(); $multiTableManager->addRowManager($assignmentManager, new JoinPair($assignmentManager->getJoinOnPersonID(), $staffManager->getJoinOnPersonID())); $campusManager = new RowManager_CampusManager(); $multiTableManager->addRowManager($campusManager, new JoinPair($campusManager->getJoinOnCampusID(), $assignmentManager->getJoinOnCampusID())); $this->campusList = $multiTableManager->getListIterator(); $this->accessibleCampuses = array(); $this->campusList->setFirst(); while ($this->campusList->moveNext()) { $campusAssignObject = $this->campusList->getCurrent(new RowManager_AssignmentsManager()); $campusObject = $this->campusList->getCurrent(new RowManager_CampusManager()); $this->accessibleCampuses[$campusAssignObject->getCampusID()] = $campusObject->getLabel(); } } else { $campusManager = new RowManager_CampusManager(); $campusManager->setSortOrder('campus_desc'); $this->campusList = $campusManager->getListIterator(); $this->accessibleCampuses = $this->campusList->getDropListArray(); } } } // modify the campus_id if necessary if ($this->campus_id == page_PeoplebyCampuses::DISPLAY_ALL_ID) { // setting the campus id to blank will get entries from all the campuses $this->campus_id = ''; } else { if ($this->campus_id == '') { // no campus has been specified // choose a default campus if none specified // echo 'No campus specified<br/>'; // get the first element from the accessible list foreach ($this->accessibleCampuses as $key => $value) { $this->campus_id = $key; break; } // assert campus_id should now be something if ($this->campus_id == '') { die("ERROR - campusID not set to anything<br/>"); } } } $dataAccessObject = new MultiTableManager(); $assignmentsManager = new RowManager_AssignmentsManager(); $assignmentsManager->setCampusID($this->campus_id); $dataAccessObject->addRowManager($assignmentsManager); $personManager = new RowManager_PersonManager(); $joinPair = new JoinPair($personManager->getJoinOnPersonID(), $assignmentsManager->getJoinOnPersonID()); $dataAccessObject->addRowManager($personManager, $joinPair); $this->accessManager = new RowManager_AccessManager(); $joinPair2 = new JoinPair($personManager->getJoinOnPersonID(), $this->accessManager->getJoinOnPersonID(), JOIN_TYPE_LEFT); $dataAccessObject->addRowManager($this->accessManager, $joinPair2); $this->viewerManager = new RowManager_UserManager(); $joinPair3 = new JoinPair($this->accessManager->getJoinOnViewerID(), $this->viewerManager->getJoinOnViewerID(), JOIN_TYPE_LEFT); $dataAccessObject->addRowManager($this->viewerManager, $joinPair3); if ($sortBy == '') { $sortBy = 'person_lname'; } $dataAccessObject->setSortOrder($sortBy); $this->listManager = $dataAccessObject->getListIterator(); // now initialize the labels for this page // start by loading the default field labels for this Module $languageID = $viewer->getLanguageID(); $seriesKey = modulecim_hrdb::MULTILINGUAL_SERIES_KEY; $pageKey = modulecim_hrdb::MULTILINGUAL_PAGE_FIELDS; $this->labels = new MultilingualManager($languageID, $seriesKey, $pageKey); // then load the page specific labels for this page $pageKey = page_PeoplebyCampuses::MULTILINGUAL_PAGE_KEY; $this->labels->loadPageLabels($pageKey); $this->labels->setSeriesKey(SITE_LABEL_SERIES_SITE); $this->labels->loadPageLabels(SITE_LABEL_PAGE_FORM_LINKS); }
/** * function getHTML * <pre> * This method returns the HTML data generated by this object. * </pre> * @return [STRING] HTML Display data. */ function getHTML() { // Uncomment the following line if you want to create a template // tailored for this page: $path = $this->pathModuleRoot . 'templates/'; // Otherwise use the standard Templates for the site: //$path = SITE_PATH_TEMPLATES; /* * Update any label tags ... */ // example: // $name = $user->getName(); // $this->labels->setLabelTag( '[Title]', '[userName]', $name); // do the join // campuses $campusManager = new RowManager_CampusManager(); $campusManager->setSortOrder('campus_desc'); $multiTableManager = new MultiTableManager(); $multiTableManager->addRowManager($campusManager); // prcs $prcManager = new RowManager_PRCManager(); $multiTableManager->addRowManager($prcManager, new JoinPair($campusManager->getJoinOnCampusID(), $prcManager->getJoinOnCampusID())); // semester $semesterManager = new RowManager_SemesterManager(); // TODO update the semester $semesterManager->setSemesterID(1); $multiTableManager->addRowManager($semesterManager, new JoinPair($prcManager->getJoinOnSemesterID(), $prcManager->getJoinOnSemesterID())); // prc method $prcMethodManager = new RowManager_PrcMethodManager(); $multiTableManager->addRowManager($prcMethodManager, new JoinPair($prcManager->getJoinOnPrcMethodID(), $prcMethodManager->getJoinOnPrcMethodID())); // get ready to make the xml $xmlObject = new XMLObject(); // HEADER //$reportInfoXMLObject = new XMLObject('PRC_REPORT'); //$xmlObject->addXMLObject( $reportInfoXMLObject ); // END HEADER // BODY $bodyXMLObject = new XMLObject('PRC_FOR_SEMESTER'); // construct the iterator $list = new ListIterator($multiTableManager); $list->setFirst(); while ($list->moveNext()) { $itemXMLObject = $list->getCurrentRowXMLObject(false, 'IndividualPRC'); // Finally add this row into the bigger picture $bodyXMLObject->addXMLObject($itemXMLObject); } // multiTableManager->moveNext() $xmlObject->addXMLObject($bodyXMLObject); $xmlDoc = new DOMDocument(); $xmlDoc->loadXML($xmlObject->getXML(false, 'PRCReport')); $numBytesWritten = $xmlDoc->save($this->pathModuleRoot . 'prcReport.xml'); // echo 'Written '.$numBytesWritten.' bytes'; // save the xml data onto the server // return $xmlDoc->saveXML(); // ------- PART 2 -------- // WEEKLY STATS $multiTableManager = new MultiTableManager(); $weeklyManager = new RowManager_WeeklyReportManager(); $multiTableManager->addRowManager($weeklyManager); $campusManager = new RowManager_CampusManager(); $campusManager->setSortOrder('campus_desc'); $multiTableManager->addRowManager($campusManager, new JoinPair($campusManager->getJoinOnCampusID(), $weeklyManager->getJoinOnCampusID())); $weekManager = new RowManager_WeekManager(); $multiTableManager->addRowManager($weekManager, new JoinPair($weekManager->getJoinOnWeekID(), $weeklyManager->getJoinOnWeekID())); $staffManager = new RowManager_StaffManager(); $multiTableManager->addRowManager($staffManager, new JoinPair($weeklyManager->getJoinOnStaffID(), $staffManager->getJoinOnStaffID())); $personManager = new RowManager_PersonManager(); $multiTableManager->addRowManager($personManager, new JoinPair($personManager->getJoinOnPersonID(), $staffManager->getJoinOnPersonID())); // get ready to make the xml $xmlObject = new XMLObject(); // HEADER //$reportInfoXMLObject = new XMLObject('PRC_REPORT'); //$xmlObject->addXMLObject( $reportInfoXMLObject ); // END HEADER // BODY $bodyXMLObject = new XMLObject('WEEKLY_FOR_SEMESTER'); // construct the iterator $list = new ListIterator($multiTableManager); $list->setFirst(); while ($list->moveNext()) { $itemXMLObject = $list->getCurrentRowXMLObject(false, 'IndividualWeek'); // Finally add this row into the bigger picture $bodyXMLObject->addXMLObject($itemXMLObject); } // multiTableManager->moveNext() $xmlObject->addXMLObject($bodyXMLObject); $xmlDoc = new DOMDocument(); $xmlDoc->loadXML($xmlObject->getXML(false, 'Report')); $numBytesWritten = $xmlDoc->save($this->pathModuleRoot . 'weeklyReport.xml'); // echo 'Written '.$numBytesWritten.' bytes'; // save the xml data onto the server // return $xmlDoc->saveXML(); // ------- PART 3 -------- $multiTableManager = new MultiTableManager(); $campusStatsManager = new RowManager_MoreStatsManager(); $multiTableManager->addRowManager($campusStatsManager); $campusManager = new RowManager_CampusManager(); $campusManager->setSortOrder('campus_desc'); $multiTableManager->addRowManager($campusManager, new JoinPair($campusManager->getJoinOnCampusID(), $campusStatsManager->getJoinOnCampusID())); $weekManager = new RowManager_WeekManager(); $multiTableManager->addRowManager($weekManager, new JoinPair($campusStatsManager->getJoinOnWeekID(), $weekManager->getJoinOnWeekID())); $expTypeManager = new RowManager_ExposureTypeManager(); $multiTableManager->addRowManager($expTypeManager, new JoinPair($campusStatsManager->getJoinOnExpTypeID(), $expTypeManager->getJoinOnExpTypeID())); $count = 0; // get ready to make the xml $xmlObject = new XMLObject(); // HEADER //$reportInfoXMLObject = new XMLObject('PRC_REPORT'); //$xmlObject->addXMLObject( $reportInfoXMLObject ); // END HEADER // BODY $bodyXMLObject = new XMLObject('CAMPUS_REPORT'); // construct the iterator $list = new ListIterator($multiTableManager); $list->setFirst(); while ($list->moveNext()) { $itemXMLObject = $list->getCurrentRowXMLObject(false, 'Activity'); $count++; // Finally add this row into the bigger picture $bodyXMLObject->addXMLObject($itemXMLObject); } // multiTableManager->moveNext() echo 'the count is [' . $count . ']<br/>'; $xmlObject->addXMLObject($bodyXMLObject); $xmlDoc = new DOMDocument(); $xmlDoc->loadXML($xmlObject->getXML(false, 'Report')); $numBytesWritten = $xmlDoc->save($this->pathModuleRoot . 'campusReport.xml'); // echo 'Written '.$numBytesWritten.' bytes'; // save the xml data onto the server // return $xmlDoc->saveXML(); // --------------- // OK DONE! // NOTE: this parent method prepares the $this->template with the // common Display data. $this->prepareTemplate($path); // uncomment this line if you are creating a template for this page $templateName = 'page_Reports.php'; // otherwise use the generic site template //$templateName = ''; return $this->template->fetch($templateName); }
/** * function getHTML * <pre> * This method returns the HTML data generated by this object. * </pre> * @return [STRING] HTML Display data. */ function getHTML() { // Uncomment the following line if you want to create a template // tailored for this page: //$path = $this->pathModuleRoot.'templates/'; // Otherwise use the standard Templates for the site: $path = SITE_PATH_TEMPLATES; /* * store the link values */ // example: // $this->linkValues[ 'view' ] = 'add/new/href/data/here'; // store the link labels $this->linkLabels['edit'] = $this->labels->getLabel('[Edit]'); $this->linkLabels['del'] = $this->labels->getLabel('[Delete]'); $this->linkLabels['cont'] = $this->labels->getLabel('[Continue]'); // $this->linkLabels[ 'view' ] = 'new link label here'; /* * store any additional link Columns */ // example: //$title = $this->labels->getLabel( '[title_groups]'); //$columnLabel = $this->labels->getLabel( '[groups]'); //$link = $this->linkValues[ 'groups' ]; //$fieldName = 'accessgroup_id'; //$this->addLinkColumn( $title, $columnLabel, $link, $fieldName); /* * Update any label tags ... */ // example: // $name = $user->getName(); // $this->labels->setLabelTag( '[Title]', '[userName]', $name); // temporarily reset the form values so the defaults show up properly in the jumplists $this->formValues['week_id'] = $this->linkValues['weekJumpLink'] . $this->week_id; $this->formValues['campus_id'] = $this->linkValues['campusJumpLink'] . $this->campus_id; // NOTE: this parent method prepares the $this->template with the // common AdminBox data. $this->prepareTemplate($path); // store the statevar id to edit $this->template->set('editEntryID', $this->morestats_id); // store all the fields to the template $this->setFormFieldsToTemplate(); /* * Form related Template variables: */ /* * Insert the date start/end values for the following date fields: */ // example: //$this->template->set( 'startYear_[fieldName]', 2000); //$this->template->set( 'endYear_[fieldName]', 2010); /* * List related Template variables : */ // Store the XML Node name for the Data Access Field List $xmlNodeName = RowManager_MoreStatsManager::XML_NODE_NAME; $this->template->set('rowManagerXMLNodeName', $xmlNodeName); // store the primary key field name for the data being displayed $this->template->set('primaryKeyFieldName', 'morestats_id'); // store data list to the template // NOTE: we initialize it here to make sure we capture any new data // from a recent processData() call. $dataAccessManager = new RowManager_MoreStatsManager(); // echo 'This campus ID['.$this->campus_id.']<br/>'; $dataAccessManager->setCampusID($this->campus_id); $dataAccessManager->setWeekID($this->week_id); $dataAccessManager->setSortOrder($this->sortBy); // $this->dataList = new MoreStatsList( $this->sortBy ); $this->dataList = $dataAccessManager->getListIterator(); $this->template->setXML('dataList', $this->dataList->getXML()); /* * Add any additional data required by the template here */ // week list $jumpLink = $this->linkValues['weekJumpLink']; $weekManager = new RowManager_WeekManager(); $weekManager->setSortOrder('week_endDate'); $weekList = new ListIterator($weekManager); $jumpList = $weekList->getDropListArray(null, $jumpLink); $this->template->set('list_week_id', $jumpList); // for looking up the person_id of this staff member $staffManager = new RowManager_StaffManager($this->staff_id); // campus list $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())); $jumpLink = $this->linkValues['campusJumpLink']; $campusList = $multiTableManager->getListIterator(); $campusArray = array(); $campusList->setFirst(); while ($campusList->moveNext()) { $campusObject = $campusList->getCurrent(new RowManager_CampusManager()); $campusArray[$jumpLink . $campusObject->getID()] = $campusObject->getLabel(); } // echo '<pre>'.print_r($campusArray, true ).'</pre>'; $this->template->set('list_campus_id', $campusArray); // method list $typeManager = new RowManager_ExposureTypeManager(); $typeManager->setSortOrder('exposuretype_desc'); $typeList = $typeManager->getListIterator(); $typeArray = $typeList->getDropListArray(); $this->template->set('list_exposuretype_id', $typeArray); $templateName = 'siteFormDataList.php'; // if you are creating a custom template for this page then // replace $templateName with the following: //$templateName = 'page_MoreStats.php'; return $this->template->fetch($templateName); }
/** * function getHTML * <pre> * This method returns the HTML data generated by this object. * </pre> * @return [STRING] HTML Display data. */ function getHTML() { // Uncomment the following line if you want to create a template // tailored for this page: //$path = $this->pathModuleRoot.'templates/'; // Otherwise use the standard Templates for the site: $path = SITE_PATH_TEMPLATES; /* * store the link values */ // example: // $this->linkValues[ 'view' ] = 'add/new/href/data/here'; // store the link labels $this->linkLabels['edit'] = $this->labels->getLabel('[Edit]'); $this->linkLabels['del'] = $this->labels->getLabel('[Delete]'); $this->linkLabels['cont'] = $this->labels->getLabel('[Continue]'); // $this->linkLabels[ 'view' ] = 'new link label here'; /* * store any additional link Columns */ // example: //$title = $this->labels->getLabel( '[title_groups]'); //$columnLabel = $this->labels->getLabel( '[groups]'); //$link = $this->linkValues[ 'groups' ]; //$fieldName = 'accessgroup_id'; //$this->addLinkColumn( $title, $columnLabel, $link, $fieldName); /* * Update any label tags ... */ // example: // $name = $user->getName(); // $this->labels->setLabelTag( '[Title]', '[userName]', $name); // NOTE: this parent method prepares the $this->template with the // common AdminBox data. $this->prepareTemplate($path); // echo 'the campus_id['.$this->campus_id.']<br/>'; // store the statevar id to edit $this->template->set('editEntryID', $this->campus_id); // if ($this->db_error_msg != '') // MOVED INTO GENERAL PageDisplay CLASS // { // $this->template->set( 'error_msg', $this->db_error_msg ); // } // store all the fields to the template $this->setFormFieldsToTemplate(); /* * Form related Template variables: */ /* * Insert the date start/end values for the following date fields: */ // example: //$this->template->set( 'startYear_[fieldName]', 2000); //$this->template->set( 'endYear_[fieldName]', 2010); /* * List related Template variables : */ // Store the XML Node name for the Data Access Field List $xmlNodeName = RowManager_CampusManager::XML_NODE_NAME; $this->template->set('rowManagerXMLNodeName', $xmlNodeName); // store the primary key field name for the data being displayed $this->template->set('primaryKeyFieldName', 'campus_id'); // store data list to the template // NOTE: we initialize it here to make sure we capture any new data // from a recent processData() call. $dataAccessManager = new RowManager_CampusManager(); if ($this->sortBy == '') { $this->sortBy = 'campus_desc'; } $dataAccessManager->setSortOrder($this->sortBy); // $this->dataList = new CampusList( $this->campus_id, $this->sortBy ); $this->dataList = $dataAccessManager->getListIterator(); // echo "<pre>".print_r( $this->dataList, true )."</pre>"; $this->template->setXML('dataList', $this->dataList->getXML()); /* * Add any additional data required by the template here */ $regionManager = new RowManager_RegionManager(); $regionList = $regionManager->getListIterator(); $regionArray = $regionList->getDropListArray(); $this->template->set('list_region_id', $regionArray); $templateName = 'siteAdminBox.php'; // if you are creating a custom template for this page then // replace $templateName with the following: //$templateName = 'page_Campuses.php'; return $this->template->fetch($templateName); }
/** * function getHTML * <pre> * This method returns the HTML data generated by this object. * </pre> * @return [STRING] HTML Display data. */ function getHTML() { // Uncomment the following line if you want to create a template // tailored for this page: $path = $this->pathModuleRoot . 'templates/'; // Otherwise use the standard Templates for the site: //$path = SITE_PATH_TEMPLATES; /* * Update any label tags ... */ // example: // $name = $user->getName(); // $this->labels->setLabelTag( '[Title]', '[userName]', $name); $semesterJumpLinkSelectedValue = $this->linkValues['semesterJumpLink'] . $this->semester_id; // NOTE: this parent method prepares the $this->template with the // common Display data. $this->prepareTemplate($path); $this->template->set('semesterJumpLinkSelectedValue', $semesterJumpLinkSelectedValue); $campusPRCArray = array(); $pageTotal = 0; // get a list of all the campuses $campusManager = new RowManager_CampusManager(); $campusManager->setSortOrder('campus_desc'); $campusList = $campusManager->getListIterator(); while ($campus = $campusList->getNext()) { $totalPRC = 0; $item = array(); $item['desc'] = $campus->getDesc(); $item['link'] = '#'; $prcManager = new RowManager_PRCManager(); $prcManager->setSemester($this->semester_id); $prcManager->setCampus($campus->getID()); $prcList = $prcManager->getListIterator(); while ($prcList->getNext()) { $totalPRC++; } $item['totalPRC'] = $totalPRC; $pageTotal += $totalPRC; $campusPRCArray[] = $item; } $this->template->set('campusPRCArray', $campusPRCArray); $this->template->set('pageTotal', $pageTotal); // semester list $jumpLink = $this->linkValues['semesterJumpLink']; $semesterArray = array(); $semesterManager = new RowManager_SemesterManager(); $semesterListIterator = $semesterManager->getListIterator(); $semesterListIterator->setFirst(); while ($semesterListIterator->moveNext()) { $semesterObject = $semesterListIterator->getCurrent(new RowManager_SemesterManager()); $semesterArray[$jumpLink . $semesterObject->getID()] = $semesterObject->getLabel(); } // echo '<pre>'.print_r($campusArray, true ).'</pre>'; $this->template->set('list_semester_id', $semesterArray); // uncomment this line if you are creating a template for this page $templateName = 'page_PRC_ReportByCampus.php'; // otherwise use the generic site template //$templateName = ''; return $this->template->fetch($templateName); }
/** * function getHTML * <pre> * This method returns the HTML data generated by this object. * </pre> * @return [STRING] HTML Display data. */ function getHTML() { // Uncomment the following line if you want to create a template // tailored for this page: //$path = $this->pathModuleRoot.'templates/'; // Otherwise use the standard Templates for the site: $path = SITE_PATH_TEMPLATES; // store the page labels in XML format... // NOTE: use this location to update any label tags ... // $name = $user->getName(); // $this->labels->setLabelTag( '[Title]', '[userName]', $name); // NOTE: this parent method prepares the $this->template with the // common Form data. $this->prepareTemplate($path); /* * Form related Template variables: */ // store the button label $this->template->set('buttonText', $this->labels->getLabel('[Continue]')); // Insert the date start/end values for the following date fields: // example: //$this->template->set( 'startYear_[fieldName]', 2000); //$this->template->set( 'endYear_[fieldName]', 2010); /* * Add any additional data required by the template here */ // semester list $semesterManager = new RowManager_SemesterManager(); $semesterList = $semesterManager->getListIterator(); $semesterArray = $semesterList->getDropListArray(); $this->template->set('list_semester_id', $semesterArray); // for looking up the person_id of this staff member $staffManager = new RowManager_StaffManager($this->staff_id); // campus list $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())); $campusList = $multiTableManager->getListIterator(); $campusArray = array(); $campusList->setFirst(); while ($campusList->moveNext()) { $campusObject = $campusList->getCurrent(new RowManager_CampusManager()); $campusArray[$campusObject->getID()] = $campusObject->getLabel(); } $this->template->set('list_campus_id', $campusArray); // uncomment this line if you are creating a template for this page //$templateName = 'page_SelectPrcSemesterCampus.php'; // otherwise use the generic admin box template $templateName = 'siteFormSingle.php'; return $this->template->fetch($templateName); }
/** * 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 $ [INTEGER] Value used to initialize the rowManager * @return [void] */ function __construct($pathModuleRoot, $viewer, $formAction, $person_id, $campus_id, $person_year_id = '') { // NOTE: be sure to call the parent constructor before trying to // use the ->formXXX arrays... parent::__construct($formAction, FormProcessor_EditStudentYearInSchool::FORM_FIELDS, FormProcessor_EditStudentYearInSchool::FORM_FIELD_TYPES); $this->pathModuleRoot = $pathModuleRoot; $this->viewer = $viewer; $this->formAction = $formAction; $this->campus_id = $campus_id; $this->person_id = $person_id; $this->person_year_id = $person_year_id; // if ($person_year_id == '') // { // if (isset($person_id)) // { // if (isset($campus_id)) // { // } // } // } /**** Check privileges and initialize campus drop-down list ***/ // Now load the access Priviledge manager of this viewer $this->adminManager = new RowManager_AdminManager(); // Get the person ID $accessManager = new RowManager_AccessManager(); $accessManager->loadByViewerID($this->viewer->getViewerID()); $personID = $accessManager->getPersonID(); // Get the permissions the person has. $this->adminManager->loadByPersonID($personID); if ($this->adminManager->hasSitePriv()) { $campusManager = new RowManager_CampusManager(); $campusManager->setSortOrder('campus_desc'); $this->campusList = $campusManager->getListIterator(); $this->accessibleCampuses = $this->campusList->getDropListArray(); } else { if ($this->adminManager->hasCampusPriv()) { $campusAdminManager = new RowManager_CampusAdminManager(); $adminID = $this->adminManager->getID(); // echo 'adminID['.$adminID.']<br/>'; $campusAdminManager->setAdminID($adminID); $multiTableManager = new MultiTableManager(); $multiTableManager->addRowManager($campusAdminManager); $multiTableManager->setSortOrder('campus_desc'); $campusManager = new RowManager_CampusManager(); $multiTableManager->addRowManager($campusManager, new JoinPair($campusManager->getJoinOnCampusID(), $campusAdminManager->getJoinOnCampusID())); $this->campusList = $multiTableManager->getListIterator(); $this->accessibleCampuses = array(); $this->campusList->setFirst(); while ($this->campusList->moveNext()) { $campusAdminObject = $this->campusList->getCurrent(new RowManager_CampusAdminManager()); $campusObject = $this->campusList->getCurrent(new RowManager_CampusManager()); $this->accessibleCampuses[$campusAdminObject->getCampusID()] = $campusObject->getLabel(); } } else { if ($this->adminManager->isStaff($viewer->getID())) { $staffManager = new RowManager_StaffManager(); $staffManager->setPersonID($personID); $multiTableManager = new MultiTableManager(); $multiTableManager->addRowManager($staffManager); $multiTableManager->setSortOrder('campus_desc'); $assignmentManager = new RowManager_AssignmentsManager(); $multiTableManager->addRowManager($assignmentManager, new JoinPair($assignmentManager->getJoinOnPersonID(), $staffManager->getJoinOnPersonID())); $campusManager = new RowManager_CampusManager(); $multiTableManager->addRowManager($campusManager, new JoinPair($campusManager->getJoinOnCampusID(), $assignmentManager->getJoinOnCampusID())); $this->campusList = $multiTableManager->getListIterator(); $this->accessibleCampuses = array(); $this->campusList->setFirst(); while ($this->campusList->moveNext()) { $campusAssignObject = $this->campusList->getCurrent(new RowManager_AssignmentsManager()); $campusObject = $this->campusList->getCurrent(new RowManager_CampusManager()); $this->accessibleCampuses[$campusAssignObject->getCampusID()] = $campusObject->getLabel(); } } else { $campusManager = new RowManager_CampusManager(); $campusManager->setSortOrder('campus_desc'); $this->campusList = $campusManager->getListIterator(); $this->accessibleCampuses = $this->campusList->getDropListArray(); } } } // modify the campus_id if necessary if ($this->campus_id == FormProcessor_EditStudentYearInSchool::DISPLAY_ALL_ID) { // setting the campus id to blank will get entries from all the campuses $this->campus_id = ''; } else { if ($this->campus_id == '') { // no campus has been specified // choose a default campus if none specified // echo 'No campus specified<br/>'; // get the first element from the accessible list foreach ($this->accessibleCampuses as $key => $value) { $this->campus_id = $key; break; } // assert campus_id should now be something if ($this->campus_id == '') { die("ERROR - campusID not set to anything<br/>"); } } } /*** end privilege checking and campus droplist setup ***/ // echo 'campus = '.$this->campus_id; // create new rowManager (a List Iterator obj.) $statuses = '0,1,6'; // filter by assignment status in ('undefined', 'current student', 'unknown') $this->rowManager = new PersonYearList($this->campus_id, $statuses, 'year_id,person_lname'); // figure out the important fields for the rowItems $fieldsOfInterest = implode(',', $this->formFields); $this->primaryIDs = array(); // for each row item ... $this->rowManager->setFirst(); $i = 0; $valid_values = explode(',', RowManager_PersonYearManager::FIELD_LIST); while ($rowItem = $this->rowManager->getNext()) { // make sure rowItems have valid entries in the DB if (!$rowItem->isLoaded()) { $rowItem->createNewEntry(); } // set the fields of interest ... $rowItem->setFieldsOfInterest($fieldsOfInterest); // get the primaryID of this rowItem $primaryID = $rowItem->getPrimaryKeyValue(); $this->primaryIDs[$i] = $primaryID; $person_id = -1; // now initialize beginning form values from rowItem object for ($indx = 0; $indx < count($this->formFields); $indx++) { $key = $this->formFields[$indx]; if (in_array($key, $valid_values)) { $this->formValues[$key . $primaryID] = $rowItem->getValueByFieldName($key); if ($key == 'person_id') { $person_id = $this->formValues[$key . $primaryID]; } } else { if ($person_id != '-1') { $person_manager = new RowManager_PersonManager($person_id); $this->formValues[$key . $primaryID] = $person_manager->getValueByFieldName($key); } else { $this->formValues[$key . $primaryID] = ""; } } } // next field $i++; } // next rowItem in rowManager // echo 'array = <pre>'.print_r($this->formValues,true).'</pre>'; // now initialize the labels for this page // start by loading the default field labels for this Module $languageID = $viewer->getLanguageID(); $seriesKey = modulecim_hrdb::MULTILINGUAL_SERIES_KEY; $pageKey = modulecim_hrdb::MULTILINGUAL_PAGE_FIELDS; $this->labels = new MultilingualManager($languageID, $seriesKey, $pageKey); // then load the page specific labels for this page $pageKey = FormProcessor_EditStudentYearInSchool::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); }