/** * 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); $regionJumpLinkSelectedValue = $this->linkValues['regionJumpLink'] . $this->region_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('regionJumpLinkSelectedValue', $regionJumpLinkSelectedValue); $this->template->set('semesterJumpLinkSelectedValue', $semesterJumpLinkSelectedValue); // changed by RM on June 4, 2009 to reflect new reporting guidelines // $fieldsOfInterest = "weeklyReport_1on1SpConv,weeklyReport_1on1SpConvStd,weeklyReport_1on1GosPres,weeklyReport_1on1GosPresStd,weeklyReport_1on1HsPres,weeklyReport_1on1HsPresStd,weeklyReport_7upCompleted,weeklyReport_7upCompletedStd,weeklyReport_cjVideo,weeklyReport_mda,weeklyReport_otherEVMats,weeklyReport_rlk,weeklyReport_siq"; $fieldsOfInterest = "weeklyReport_1on1SpConv,weeklyReport_1on1SpConvStd,weeklyReport_1on1GosPres,weeklyReport_1on1GosPresStd,weeklyReport_1on1HsPres"; $fieldsArray = explode(",", $fieldsOfInterest); // changed by RM on June 4, 2009 to reflect new reporting guidelines, we are no longer collecting these measurements // $semesterReportFields = 'semesterreport_avgPrayer,semesterreport_avgWklyMtg,semesterreport_numStaffChall,semesterreport_numInternChall,semesterreport_numFrosh,semesterreport_numStaffDG,semesterreport_numInStaffDG,semesterreport_numStudentDG,semesterreport_numInStudentDG,semesterreport_numSpMultStaffDG,semesterreport_numSpMultStdDG'; $semesterReportFields = ''; $semesterReportFieldArray = explode(",", $semesterReportFields); // other 'weekly campus stats', based on exposure type /* // no longer need the exposure type fields of interest - RM June 4, 2009 $exposureFieldsOfInterest = ""; $exposureFieldsArray = array(); $exposureTypePrefix = "expType"; $isFirst = true; $exposureTypeManager = new RowManager_ExposureTypeManager(); $exIt = $exposureTypeManager->getListIterator(); $exIt->setFirst(); while( $exIt->moveNext() ) { $anEx = $exIt->getCurrent( new RowManager_ExposureTypeManager() ); $typeID = $anEx->getID(); $fieldName = $exposureTypePrefix.$typeID; $exposureFieldsArray[$typeID] = $fieldName; if ( !$isFirst ) { $exposureFieldsOfInterest .= ','; } $exposureFieldsOfInterest .= $fieldName; $isFirst = false; } // while */ // removed concatentation of $semesterReportFields and $exposureFieldsOfInterest - June 4, 2009 by RM // $fieldsOfInterest = 'prcTotal,'.$fieldsOfInterest . ',' . $semesterReportFields . ','. $exposureFieldsOfInterest; $fieldsOfInterest = 'prcTotal,' . $fieldsOfInterest; // get all the campuses for the given region $campusManager = new RowManager_CampusManager(); $campusManager->setRegionID($this->region_id); $campusListIt = $campusManager->getListIterator(); $campusInfoArray = array(); $campusListIt->setFirst(); while ($campusListIt->moveNext()) { $sumArray = array(); foreach ($fieldsArray as $key => $fieldName) { $sumArray[$fieldName] = 0; } $campusObj = $campusListIt->getCurrent(new RowManager_CampusManager()); $campusID = $campusObj->getID(); $indCampusInfo = new IndCampusSemesterInfo(); $indCampusInfo->campusID = $campusID; $indCampusInfo->shortName = $campusObj->getShortDesc(); // check if an entry exists in the table for $weeklyReport = new RowManager_WeeklyReportManager(); $weeklyReport->setCampusID($campusID); $weekManager = new RowManager_WeekManager(); $weekManager->setSemesterID($this->semester_id); $multiTableManager = new MultiTableManager(); $multiTableManager->addRowManager($weeklyReport); $multiTableManager->addRowManager($weekManager, new JoinPair($weeklyReport->getJoinOnWeekID(), $weekManager->getJoinOnWeekID())); $listIterator = $multiTableManager->getListIterator(); $listIterator->setFirst(); $dataArray = array(); while ($listIterator->moveNext()) { $aWklyReport = $listIterator->getCurrent(new RowManager_WeeklyReportManager()); $dataArray = $aWklyReport->getArrayOfValues(); $this->combineValues($sumArray, $dataArray); } // $indCampusInfo->dataArray = array('weeklyReport_1on1SpConv'=>7,'weeklyReport_1on1SpConvStd'=>21); $indCampusInfo->dataArray = $sumArray; // get semster stats $semesterCampusReport = new RowManager_SemesterReportManager($this->semester_id, $campusID); $campusDataArray = $semesterCampusReport->getArrayOfValues(); if (count($campusDataArray) <= 0) { // no data // echo 'no data<br/>'; foreach ($semesterReportFieldArray as $key => $semFieldName) { // put zeros into the array $campusDataArray[$semFieldName] = 0; } } // echo '<pre>'.print_r($campusDataArray, true).'</pre>'; // combine personal ministry totals array with other semester stats $indCampusInfo->dataArray = array_merge($indCampusInfo->dataArray, $campusDataArray); // add the 'campus weekly stats' $exposureTypeManager = new RowManager_ExposureTypeManager(); $exIt = $exposureTypeManager->getListIterator(); $exIt->setFirst(); while ($exIt->moveNext()) { $anEx = $exIt->getCurrent(new RowManager_ExposureTypeManager()); // echo $anEx->getLabel().'->'.$anEx->getID().'<br/>'; $typeID = $anEx->getID(); $sumThisType = 0; // get the sum of all the exposures of this type, this semester $moreManager = new RowManager_MoreStatsManager(); $moreManager->setCampusID($campusID); $moreManager->setExposureTypeID($typeID); $wkManager = new RowManager_WeekManager(); $wkManager->setSemesterID($this->semester_id); $multiTableManager = new MultiTableManager(); $multiTableManager->addRowManager($moreManager); $multiTableManager->addRowManager($wkManager, new JoinPair($moreManager->getJoinOnWeekID(), $wkManager->getJoinOnWeekID())); $listIterator = $multiTableManager->getListIterator(); $listIterator->setFirst(); while ($listIterator->moveNext()) { $moreStatsObj = $listIterator->getCurrent(new RowManager_MoreStatsManager()); $sumThisType += $moreStatsObj->getNumExposures(); } // while // echo 'campusID['.$campusID.'] semesterID['.$this->semester_id.'] typeID['.$typeID.'] total['.$sumThisType.']<br/>'; $indCampusInfo->dataArray[$exposureFieldsArray[$typeID]] = $sumThisType; } // while // add the number of indicated decisions $prcManager = new RowManager_PRCManager(); $prcManager->setSemester($this->semester_id); $prcManager->setCampus($campusID); $prcList = $prcManager->getListIterator(); $numPRC = $prcList->getNumRows(); // echo $numPRC.'<br/>'; $indCampusInfo->dataArray['prcTotal'] = $numPRC; $campusInfoArray[] = $indCampusInfo; } $this->template->set('campusInfoArray', $campusInfoArray); $this->template->set('fieldsOfInterest', $fieldsOfInterest); $campusSummaryJumpLink = $this->linkValues['campusSummaryJumpLink']; $campusSummaryJumpLink = str_replace('SSS', $this->semester_id, $campusSummaryJumpLink); // in case where semester was not provided (usual case) // look up the year associated with this semester $semObj = new RowManager_SemesterManager($this->semester_id); $year_id = $semObj->getYearID(); $campusSummaryJumpLink = str_replace('YYY', $year_id, $campusSummaryJumpLink); // in case where semester was not provided (usual case) /*$personalMinLink = $this->linkValues['campusPersonalJumpLink']; $personalMinLink = str_replace( 'SSS', $this->semester_id, $personalMinLink ); // in case where semester was not provided (usual case) $campusWideLink = $this->linkValues['campusWideJumpLink']; $campusWideLink = str_replace( 'SSS', $this->semester_id, $campusWideLink ); // in case where semester was not provided (usual case) $indicatedDecLink = $this->linkValues['indicatedDecLink']; $indicatedDecLink = str_replace( 'SSS', $this->semester_id, $indicatedDecLink ); // in case where semester was not provided (usual case) $this->template->set('linksArray', array('[personalMin]'=>$personalMinLink, '[campusWideMin]'=>$campusWideLink, '[decLink]'=>$indicatedDecLink ) );*/ $this->template->set('linksArray', array('[campusSummaryJumpLink]' => $campusSummaryJumpLink)); // 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); // region list $jumpLink = $this->linkValues['regionJumpLink']; $regionManager = new RowManager_RegionManager(); $regionListIt = new ListIterator($regionManager); $regionArray = $regionListIt->getDropListArray(null, $jumpLink); // echo '<pre>'.print_r( $regionArray, true ).'</pre>'; $this->template->set('list_region_id', $regionArray); // uncomment this line if you are creating a template for this page $templateName = 'page_RegionalSemesterReport.php'; // otherwise use the generic site template //$templateName = ''; return $this->template->fetch($templateName); }