-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
50 lines (35 loc) · 1.17 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
require_once('../config.php');
require_once('dao/FlashcardsDAO.php');
use \Tsugi\Core\LTIX;
use \Flashcards\DAO\FlashcardsDAO;
// Retrieve the launch data if present
$LAUNCH = LTIX::requireData();
$p = $CFG->dbprefix;
$flashcardsDAO = new FlashcardsDAO($PDOX, $p);
// Start of the output
$OUTPUT->header();
include("tool-header.html");
$OUTPUT->bodyStart();
$_SESSION["UserName"] = $USER->email;
$_SESSION["FullName"] = $USER->displayname;
if ( $USER->instructor ) {
include("menu.php");
include("instructor-home.php");
}else{ // student
$linkId = $LINK->id;
$shortcut = $flashcardsDAO->getShortcutSetIdForLink($linkId);
if (isset($shortcut["SetID"])) {
$theSet = $flashcardsDAO->getFlashcardSetById($shortcut["SetID"]);
if ($theSet["Active"] == 1) {
header( 'Location: '.addSession('PlayCard.php?SetID='.$shortcut["SetID"].'&CardNum=1&CardNum2=0&Flag=A&Shortcut=1"') ) ;
} else {
echo('<h3>Flashcards</h3><p><em>This flashcard set is not currently available.</em></p>');
}
} else {
include("student-home.php");
}
}
$OUTPUT->footerStart();
include("tool-footer.html");
$OUTPUT->footerEnd();