forked from udaytonapps/flashcards
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AllCards.php
119 lines (93 loc) · 3.74 KB
/
AllCards.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?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);
$set = $flashcardsDAO->getFlashcardSetById($setId);
$Total = count($cardsInSet);
include("menu.php");
echo('
<ul class="breadcrumb">
<li><a href="index.php">All Card Sets</a></li>
<li>' .$set["CardSetName"].'</li>
</ul>
<div class="row cardRow">
<p>
<a class="btn btn-success" href="AddCard.php?SetID='.$setId.'"><span class="fa fa-plus"></span> Add New Card</a>
</p>
<h2>Cards in "'.$set["CardSetName"].'" <span class="badge">'.$Total.' Cards</span></h2>
');
if ($Total == 0) {
echo('<p><em>There are currently no cards in this set.</em></p>');
} else {
usort($cardsInSet, array('FlashcardUtils', 'compareCardNum'));
$cardNum = 1;
foreach ( $cardsInSet as $row ) {
echo('
<div class="col-md-6">
<div class="panel panel-info">
<div class="panel-heading list-card">
<a class="btn btn-danger pull-right deleteCard" href="actions/DeleteCard.php?CardID='.$row["CardID"].'&SetID='.$row["SetID"].'" onclick="return ConfirmDeleteCard();"><span class="fa fa-trash-o"></span></a>
<a class="btn btn-primary pull-right" href="EditCard.php?CardID='.$row["CardID"].'&SetID='.$row["SetID"].'">Edit</a>
<h3 class="card-order">
'.$cardNum.'.
');
if($cardNum != 1) {
echo('
<a href="actions/Move.php?CardID=' . $row["CardID"] . '&CardNum=' . $row["CardNum"] . '&SetID=' . $_GET["SetID"] . '&Flag=1">
<span class="fa fa-chevron-circle-up"></span>
</a>
');
}
if($cardNum != $Total) {
echo('
<a href="actions/Move.php?CardID=' . $row["CardID"] . '&CardNum=' . $row["CardNum"] . '&SetID=' . $_GET["SetID"] . '&Flag=0">
<span class="fa fa-chevron-circle-down"></span>
</a>
');
}
echo('
</h3>
</div>
<div class="panel-body">
<div class="col-sm-6 sideA">
<h5 class="text-muted">Side A</h5>
');
if($row["TypeA"] == "Image" || $row["TypeA"] == "mp3" || $row["TypeA"] == "Video") {
echo('<a href="'.$row["SideA"].'" target="_blank">'.$row["SideA"].'</a>');
} else {
echo($row["SideA"]);
}
echo('
</div>
<div class="col-sm-6 sideB">
<h5 class="text-muted">Side B</h5>
'.$row["SideB"].'
</div>
</div>
</div>
</div>
');
/* Make sure only two cards per row */
if ($cardNum % 2 == 0) {
echo('</div><div class="row cardRow">');
}
$cardNum++;
}
}
echo('</div>');
}
$OUTPUT->footerStart();
include("tool-footer.html");
$OUTPUT->footerEnd();