forked from udaytonapps/flashcards
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AddCard.php
102 lines (74 loc) · 3.15 KB
/
AddCard.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php
require_once "../config.php";
require_once "dao/FlashcardsDAO.php";
require_once "util/FlashcardUtils.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);
$OUTPUT->header();
include("tool-header.html");
$OUTPUT->bodyStart();
if ( $USER->instructor ) {
$setId = $_GET["SetID"];
$cardsInSet = $flashcardsDAO->getCardsInSet($setId);
usort($cardsInSet, array('FlashcardUtils', 'compareCardNum'));
$set = $flashcardsDAO->getFlashcardSetById($setId);
$Total = count($cardsInSet);
$Next = $Total + 1;
include("menu.php");
echo('
<ul class="breadcrumb">
<li><a href="index.php">All Card Sets</a></li>
<li><a href="AllCards.php?SetID=' .$setId.'">'.$set["CardSetName"].'</a></li>
<li>Add New Card</li>
</ul>
');
?>
<form method="post" action="actions/AddCard_Submit.php">
<div class="row">
<div class="col-sm-offset-1 col-sm-8">
<h3>Adding Card <?php echo($Next); ?></h3>
</div>
<div class="col-sm-offset-1 col-sm-8">
<div class="form-group">
<label class="control-label" for="TypeA">Side A Type</label>
<select class="form-control" id="TypeA" name="TypeA">
<option value="Text" selected>Text</option>
<option value="Image">Image</option>
<option value="mp3">Audio (mp3)</option>
<option value="Video">YouTube / Warpwire</option>
</select>
</div>
<div class="form-group">
<label class="control-label" for="SideA">Side A</label>
<textarea class="form-control" name="SideA" id="SideA" rows="5" autofocus required></textarea>
</div>
<div class="form-group">
<label class="control-label" for="TypeB">Side B Type</label>
<select class="form-control" id="TypeB" name="TypeB">
<option value="Text" selected>Text</option>
<option value="Image">Image</option>
</select>
</div>
<div class="form-group">
<label class="control-label" for="SideB">Side B</label>
<textarea class="form-control" name="SideB" id="SideB" rows="5" required></textarea>
</div>
<input type="hidden" name="SetID" value="<?php echo $_GET["SetID"];?>"/>
<input type="hidden" name="CardNum" value="<?php echo $Next; ?>"/>
<input type="submit" value="Add Card" class="btn btn-primary">
<a href="AllCards.php?SetID=<?php echo $_GET["SetID"];?>" class="btn btn-danger">Cancel</a>
</div>
</div>
</form>
<?php
} else {
// student so send back to index
header( 'Location: '.addSession('index.php') ) ;
}
$OUTPUT->footerStart();
include("tool-footer.html");
$OUTPUT->footerEnd();