Fitness Challenge

[insert_php]
$monthId = $_GET[“monthId”];

require_once $_SERVER[‘DOCUMENT_ROOT’] . “/sysadmin/db.php”;
require_once $_SERVER[‘DOCUMENT_ROOT’] . “/sysadmin/common.php”;

require_once $_SERVER[‘DOCUMENT_ROOT’] . “/sysadmin/model/AgeRange.php”;
require_once $_SERVER[‘DOCUMENT_ROOT’] . “/sysadmin/model/Student.php”;
require_once $_SERVER[‘DOCUMENT_ROOT’] . “/sysadmin/model/Exercise.php”;
require_once $_SERVER[‘DOCUMENT_ROOT’] . “/sysadmin/model/FitnessChallenge.php”;

require_once $_SERVER[‘DOCUMENT_ROOT’] . “/sysadmin/model/FcConfig.php”;
require_once $_SERVER[‘DOCUMENT_ROOT’] . “/sysadmin/model/Month.php”;
require_once $_SERVER[‘DOCUMENT_ROOT’] . “/sysadmin/model/MonthExercise.php”;

require_once $_SERVER[‘DOCUMENT_ROOT’] . “/sysadmin/service/FcConfigService.php”;
require_once $_SERVER[‘DOCUMENT_ROOT’] . “/sysadmin/service/MonthService.php”;
require_once $_SERVER[‘DOCUMENT_ROOT’] . “/sysadmin/service/MonthExerciseService.php”;
require_once $_SERVER[‘DOCUMENT_ROOT’] . “/sysadmin/service/StudentMonthService.php”;
require_once $_SERVER[‘DOCUMENT_ROOT’] . “/sysadmin/service/StudentMonthExerciseService.php”;

$studentMonthService = new StudentMonthService();
$studentMonthExerciseService = new StudentMonthExerciseService();

$fitnessChallenge = new FitnessChallenge();
$ageRangeCount = count($fitnessChallenge->ageRangeArr);

$fcConfigService = new FcConfigService();
$fcConfig = $fcConfigService->getConfig();
$activeMonthId = $fcConfig->getActiveMonth();

if ($monthId != “”)
{
$activeMonthId = $monthId;
}

$monthService = new MonthService();
$activeMonthRec = $monthService->getMonthRec($activeMonthId);
$months = $monthService->getMonthList();
$monthCount = count($months);

$monthExerciseService = new MonthExerciseService();
$monthExercises = $monthExerciseService->getMonthExerciseList($activeMonthId );
$monthExerciseCount = count($monthExercises);

$fitnessChallenge = new FitnessChallenge();
$ageRangeCount = count($fitnessChallenge->ageRangeArr);

//——–
$activeMonth = $activeMonthId;
echo “

“;
//——–

//echo “

” . $activeMonthRec ->getText() . “

\n”;

//———————————————
// init max values to zero
$maxExerciseArr = array();
$maxExerciseArr = resetMaxArr($maxExerciseArr, $monthExercises);

echo “

\n”;
echo “

\n”;
echo ”

\n”;
echo ”

\n”;
echo ”

\n”;

for ($i=0; $i < $monthExerciseCount ; $i++) { $currExercise = $monthExercises[$i]; echo "

\n”;
}

echo ”

\n”;
echo ”

\n”;
echo ”

\n”;

// iterate through the age ranges
for ($ageRangeIdx = 0; $ageRangeIdx < $ageRangeCount; $ageRangeIdx++) { $currAgeRange = $fitnessChallenge->ageRangeArr[$ageRangeIdx];

// init max values to zero
$maxExerciseArr = array();
resetMaxArr($maxExerciseArr, $monthExercises);

// get the student / exercise recs that are in this age range
$ageRangeRecArr = $studentMonthService->getAgeRangeRecArr($activeMonthId , $currAgeRange->getMinAge(), $currAgeRange->getMaxAge());
$ageRangeRecCount = count($ageRangeRecArr);

$colspanCount = $monthExerciseCount + 1;
$ageLineEntry = “Ages ” . $currAgeRange->getDesc();

if ($ageRangeRecCount == 0)
{
$ageLineEntry .= ” : No Entries Found.”;
}

// generate age line
echo “

\n”;
echo ”

\n”;
echo “

\n”;

// process all the records in the age range
if ($ageRangeRecCount > 0)
{
// reset the max values to zero
resetMaxArr($maxExerciseArr, $monthExercises);

// collect all exercise records for the age group
$allAgeRangeStudentExercises = getAllExerciseRecsForRange($ageRangeRecArr, $studentMonthExerciseService);

// set the max values for each exercise
setAgeRangeMaxValues($maxExerciseArr, $monthExercises, $allAgeRangeStudentExercises);

//echo $ageLineEntry . ” : For age range, total number of exercises = ” . count($allAgeRangeStudentExercises) . “
“;

// show max values
//showMaxValues($maxExerciseArr, $monthExercises);

// output the values
for ($i=0; $i < $ageRangeRecCount ; $i++) { // get the current student record $currStudentMonthExerciseRec = $ageRangeRecArr [$i]; echo "

\n”;

$monthExerciseArrForStudent = getMonthExerciseArrForStudent($monthExercises, $studentMonthExerciseService, $currStudentMonthExerciseRec->getId());

// outout exercise values
outputExerciseValues($monthExercises, $monthExerciseArrForStudent, $maxExerciseArr);

echo “

\n”;
}
}

}

echo ”

\n”;
echo “

Name ” . $currExercise->getDesc() . “
” . $ageLineEntry . “
” . $currStudentMonthExerciseRec->getLname() . “, ” . $currStudentMonthExerciseRec->getFname() . “

\n”;
echo “

\n”;
[/insert_php]

Top