Ejemplo n.º 1
0
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;
}
Ejemplo n.º 2
0
 public static function assignments($history)
 {
     $results = Queries::assignments($history);
     $now_pos = 0;
     foreach ($results as $index => $entry) {
         if (strtotime($entry->end_date . ' ' . $entry->end_time) < strtotime('now')) {
             $now_pos = $index + 1;
         }
         $entry->start_date = DateFormat::dateTable($entry->start_date);
         $entry->end_date = DateFormat::dateTable($entry->end_date);
         $entry->end_time = DateFormat::timeDefault($entry->end_time);
     }
     $today = new stdClass();
     $today->todayRow = true;
     $today->id = 'today';
     $today->completion = false;
     $today->end_date = '<b>' . DateFormat::dateTable();
     $today->end_time = DateFormat::timeDefault() . '</b>';
     $today->subject_name = '</a><b>Today is a gift</b><a href="">';
     $today->desc_short = '</a><b>Thats why it\'s called the present</b><a href="">';
     $today->team = '';
     $today->state = '<b>-</b>';
     array_splice($results, $now_pos, 0, array($today));
     return $results;
 }