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;
}
Пример #2
0
function createPage($smarty)
{
    $subject = DB::instance()->get("subjects", array("", "abbreviation", "=", Input::get('subject', 'get')))->first();
    if (empty($subject->id)) {
        Redirect::error(404);
    }
    $smarty->assign('subject', $subject);
    $smarty->assign('links', json_decode($subject->links));
    $smarty->assign('events', Tables::events(true, $subject->abbreviation));
    $smarty->assign('table_parentT', 'subjects');
    $smarty->assign('table_parentI', $subject->id);
    $smarty->assign('planning', Tables::planning(true, 'subjects', $subject->id));
    return $smarty;
}