Exemplo n.º 1
0
    $l10n->localizeArray($semester, 'previous3_long');
    $l10n->localizeArray($semester, 'next_long');
    $l10n->localizeArray($semester, 'next1_long');
    require_once FS_PHP . '/header-external.php';
    require_once 'views/list-courses.php';
    require_once FS_PHP . '/footer-external.php';
} elseif ($_GET['page'] === "excel") {
    $semester = \Ventus\Utilities\Functions::fetchSemester();
    if (!isset($_GET['sem'])) {
        $selected_semester = $semester['now_short'];
    } else {
        $selected_semester = $_GET['sem'];
    }
    $l10n->addResource(FS_L10N . '/filenames.json');
    $l10n->addResource(__DIR__ . '/l10n/list-courses.json');
    $result = $model->fetchAllCoursesExamsExcel($SESSION->user_id, $selected_semester);
    foreach ($result as &$r) {
        $r["column5"] = $l10n->__($r["column5"]);
        //The exam type is stored in English in the database
        $r["column7"] = $l10n->__($r["column7"]);
        //The alternate status is stored in English in the database
        for ($i = 0; $i < sizeof($r); $i++) {
            $r[$l10n->__("csvColumn" . $i)] = $r["column" . $i];
            unset($r["column" . $i]);
        }
    }
    $csv = new \Ventus\Utilities\CSV($result);
    $csv->generate($l10n->__('file.faculty_course_list'));
} else {
    header('location: https://' . URL_PHP . '/error-external.php?eid=F002');
}