function createPage($smarty)
{
    $subjects = Queries::subjects();
    foreach ($subjects as $index => $subject) {
        $assignments = Queries::assignments(true, $subject->abbreviation);
        $exams = Queries::exams(true, $subject->abbreviation);
        $subjects[$index]->ass_line_index = -1;
        $subjects[$index]->ex_line_index = -1;
        $subjects[$index]->assignments = $assignments;
        $subjects[$index]->exams = $exams;
        foreach ($assignments as $index2 => $assigment) {
            if (strtotime($assigment->end_date . ' ' . $assigment->end_time) < strtotime('now')) {
                $subjects[$index]->ass_line_index = $index2;
            }
        }
        foreach ($exams as $index2 => $exam) {
            if (strtotime($exam->date) < strtotime('today')) {
                $subjects[$index]->ex_line_index = $index2;
            }
        }
    }
    $smarty->assign('subjects', $subjects);
    $smarty->assign('events', Tables::events(true));
    return $smarty;
}
Example #2
0
 public static function exams($history)
 {
     $results = Queries::exams($history);
     $now_pos = 0;
     foreach ($results as $index => $entry) {
         if (strtotime($entry->date) < strtotime('today')) {
             $now_pos = $index + 1;
         }
         $entry->date = DateFormat::dateTable($entry->date);
     }
     $today = new stdClass();
     $today->todayRow = true;
     $today->id = 'today';
     $today->completion = false;
     $today->date = '<b>' . DateFormat::dateTable() . '</b>';
     $today->weight = '</a><b>Today is a gift</b><a href="">';
     $today->subject_name = '</a><b>Thats why it\'s called the present</b><a href="">';
     $today->mark = '<b>-</b>';
     array_splice($results, $now_pos, 0, array($today));
     return $results;
 }