/** * 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; // The weeks $weekManager = new RowManager_WeekManager(); $weekManager->setSemesterID($this->semester_id); $weekManager->setSortByDate(); $staffArray = array(); // figure out all the people we want to report on $isCD = $this->permManager->isCD(); if ($isCD) { // get all the people from this campus who have reported stats $wklyReportManager = new RowManager_WeeklyReportManager(); $wklyReportManager->setCampusID($this->campus_id); $anotherWeekManager = new RowManager_WeekManager(); $anotherWeekManager->setSemesterID($this->semester_id); $multiTableManager = new MultiTableManager(); $multiTableManager->addRowManager($wklyReportManager); $multiTableManager->addRowManager($anotherWeekManager, new JoinPair($wklyReportManager->getJoinOnWeekID(), $anotherWeekManager->getJoinOnWeekID())); $this->listIterator = $multiTableManager->getListIterator(); $this->listIterator->setFirst(); while ($this->listIterator->moveNext()) { $reportRow = $this->listIterator->getCurrent(new RowManager_WeeklyReportManager()); $staffArray[] = $reportRow->getStaffID(); } $staffArray = array_unique($staffArray); // echo '<pre>'.print_r($staffArray, true).'</pre>'; } else { // just get the stats for the staff viewing the page $staffArray[] = $this->staff_id; } $infoArray = array(); foreach ($staffArray as $indx => $staffID) { //IndSemesterInfo $indInfo = new IndSemesterInfo(); $staffManager = new RowManager_StaffManager($staffID); $personID = $staffManager->getPersonID(); $personManager = new RowManager_PersonManager($personID); $personManager->setLabelTemplateLastNameFirstName(); $indInfo->staffName = $personManager->getLabel(); $indInfo->staffID = $staffID; // calendar $indInfo->calendar = array(); $currentMonth = 0; // actual data // dataArray[weekID] = arrayOfData $indInfo->dataArray = array(); $weekList = new ListIterator($weekManager); $weekList->setFirst(); while ($weekList->moveNext()) { $week = $weekList->getCurrent(new RowManager_WeekManager()); $weekID = $week->getID(); // setup stuff for the calendar in the report $endDate = $week->getEndDate(); list($year, $month, $day) = explode('-', $endDate); $month = ltrim($month, "0"); // $day = ltrim($day, "0"); if ($currentMonth != $month) { // echo 'start new array<br/>'; $currentMonth = $month; } $indInfo->calendar[$currentMonth][$day] = $weekID; // end calendar stuff // check if an entry exists in the table for $weeklyReport = new RowManager_WeeklyReportManager($weekID, $staffID, $this->campus_id); if ($weeklyReport->isLoaded()) { // echo $week->getEndDate() . ' loaded <br/>'; $indInfo->dataArray[$weekID] = $weeklyReport->getArrayOfValues(); // echo '<pre>'.print_r( $weeklyReport->getArrayOfValues() ).'</pre>'; } else { $indInfo->dataArray[$weekID] = null; // echo $week->getEndDate() . ' NOT loaded <br/>'; } } // echo '<pre>'.print_r($calendar,true).'</pre>'; $infoArray[] = $indInfo; } /* * Update any label tags ... */ // example: // $name = $user->getName(); // $this->labels->setLabelTag( '[Title]', '[userName]', $name); $campusJumpLinkSelectedValue = $this->linkValues['campusJumpLink'] . $this->campus_id; $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( 'calendar', $calendar ); // $this->template->set( 'dataArray', $dataArray ); $this->template->set('infoArray', $infoArray); $this->template->set('campusJumpLinkSelectedValue', $campusJumpLinkSelectedValue); $this->template->set('semesterJumpLinkSelectedValue', $semesterJumpLinkSelectedValue); // campus list $jumpLink = $this->linkValues['campusJumpLink']; $campusArray = array(); $this->campusListIterator->setFirst(); while ($this->campusListIterator->moveNext()) { $campusObject = $this->campusListIterator->getCurrent(new RowManager_CampusManager()); $region_id = $campusObject->getRegionID(); if ($region_id == 1 || $region_id == 2 || $region_id == 3) { $campusArray[$jumpLink . $campusObject->getID()] = $campusObject->getLabel(); } } // echo '<pre>'.print_r($campusArray, true ).'</pre>'; $this->template->set('list_campus_id', $campusArray); // semester list $jumpLink = $this->linkValues['semesterJumpLink']; $semesterArray = array(); $semesterManager = new RowManager_SemesterManager(); $this->semesterListIterator = $semesterManager->getListIterator(); $this->semesterListIterator->setFirst(); while ($this->semesterListIterator->moveNext()) { $semesterObject = $this->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_StaffSemesterReport.php'; // otherwise use the generic site template //$templateName = ''; return $this->template->fetch($templateName); }