forked from GibbonEdu/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstars.php
More file actions
executable file
·235 lines (213 loc) · 9.9 KB
/
stars.php
File metadata and controls
executable file
·235 lines (213 loc) · 9.9 KB
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<?php
/*
Gibbon, Flexible & Open School System
Copyright (C) 2010, Ross Parker
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
print "<div class='trail'>" ;
print "<div class='trailHead'><a href='" . $_SESSION[$guid]["absoluteURL"] . "'>" . _("Home") . "</a> > </div><div class='trailEnd'>" . _("Stars") . "</div>" ;
print "</div>" ;
print "<p>" ;
print _("This page shows you a break down of how your stars have been earned, as well as where your most recent stars in each category have come from.") ;
print "</p>" ;
//Count planner likes
try {
$dataLike=array("gibbonPersonID"=>$_SESSION[$guid]["gibbonPersonID"], "gibbonSchoolYearID"=>$_SESSION[$guid]["gibbonSchoolYearID"]);
$sqlLike="SELECT timestamp, gibbonPerson.gibbonPersonID, surname, preferredName, gibbonRoleIDPrimary, image_75, gibbonRoleIDPrimary, gibbonPlannerEntry.name, gibbonCourse.nameShort AS course, gibbonCourseClass.nameShort AS class, gibbonCourseClass.gibbonCourseClassID FROM gibbonPlannerEntryLike JOIN gibbonPlannerEntry ON (gibbonPlannerEntryLike.gibbonPlannerEntryID=gibbonPlannerEntry.gibbonPlannerEntryID) JOIN gibbonCourseClass ON (gibbonPlannerEntry.gibbonCourseClassID=gibbonCourseClass.gibbonCourseClassID) JOIN gibbonCourse ON (gibbonCourse.gibbonCourseID=gibbonCourseClass.gibbonCourseID) JOIN gibbonCourseClassPerson ON (gibbonCourseClassPerson.gibbonCourseClassID=gibbonCourseClass.gibbonCourseClassID) JOIN gibbonPerson ON (gibbonPerson.gibbonPersonID=.gibbonPlannerEntryLike.gibbonPersonID) WHERE gibbonCourseClassPerson.gibbonPersonID=:gibbonPersonID AND role='Teacher' AND gibbonSchoolYearID=:gibbonSchoolYearID ORDER BY timestamp DESC" ;
$resultLike=$connection2->prepare($sqlLike);
$resultLike->execute($dataLike);
}
catch(PDOException $e) {
print "<div class='error'>" . $e->getMessage() . "</div>" ;
}
if ($resultLike->rowCount()>0) {
print "<h2>" ;
print _("Planner Stars") . " <span style='font-size: 65%; font-style: italic; font-weight: normal'> x" . $resultLike->rowCount() . "</span>" ;
print "</h2>" ;
print "<table cellspacing='0' style='width: 100%'>" ;
print "<tr class='head'>" ;
print "<th style='width: 90px'>" ;
print _("Photo") ;
print "</th>" ;
print "<th style='width: 180px'>" ;
print _("Name") ;
print "</th>" ;
print "<th>" ;
print _("Class/Lesson") ;
print "</th>" ;
print "<th style='width: 70px'>" ;
print _("Date") ;
print "</th>" ;
print "</tr>" ;
$count=0;
$rowNum="odd" ;
while ($row=$resultLike->fetch() AND $count<20) {
if ($count%2==0) {
$rowNum="even" ;
}
else {
$rowNum="odd" ;
}
$count++ ;
//COLOR ROW BY STATUS!
print "<tr class=$rowNum>" ;
print "<td>" ;
print getUserPhoto($guid, $row["image_75"], 75) ;
print "</td>" ;
print "<td>" ;
$roleCategory=getRoleCategory($row["gibbonRoleIDPrimary"], $connection2) ;
if ($roleCategory=="Student" AND isActionAccessible($guid, $connection2, "/modules/Students/student_view_details.php")) {
print "<a href='" . $_SESSION[$guid]["absoluteURL"] . "/index.php?q=/modules/Students/student_view_details.php&gibbonPersonID=" . $row["gibbonPersonID"] . "'>" . formatName("", $row["preferredName"], $row["surname"], $roleCategory, false) . "</a><br/>" ;
print "<i>$roleCategory</i>" ;
}
else {
print formatName("", $row["preferredName"], $row["surname"], $roleCategory, false) . "<br/>" ;
print "<i>$roleCategory</i>" ;
}
print "</td>" ;
print "<td>" ;
print "<a href='" . $_SESSION[$guid]["absoluteURL"] . "/index.php?q=/modules/Planner/planner.php&viewBy=class&gibbonCourseClassID=" . $row["gibbonCourseClassID"] . "'>" . $row["course"] . "." . $row["class"] . "</a><br/>" ;
print $row["name"] ;
print "</td>" ;
print "<td>" ;
print dateConvertBack($guid, substr($row["timestamp"],0,10)) ;
print "</td>" ;
print "</tr>" ;
}
print "</table>" ;
}
//Count positive haviour
try {
$dataLike=array("gibbonPersonID"=>$_SESSION[$guid]["gibbonPersonID"], "gibbonSchoolYearID"=>$_SESSION[$guid]["gibbonSchoolYearID"]);
$sqlLike="SELECT descriptor, comment, timestamp, surname, preferredName, gibbonRoleIDPrimary, image_75, gibbonRoleIDPrimary FROM gibbonBehaviour JOIN gibbonPerson ON (gibbonPerson.gibbonPersonID=gibbonBehaviour.gibbonPersonIDCreator) WHERE gibbonBehaviour.gibbonPersonID=:gibbonPersonID AND type='Positive' AND gibbonSchoolYearID=:gibbonSchoolYearID ORDER BY timestamp DESC" ;
$resultLike=$connection2->prepare($sqlLike);
$resultLike->execute($dataLike);
}
catch(PDOException $e) {
print "<div class='error'>" . $e->getMessage() . "</div>" ;
}
if ($resultLike->rowCount()>0) {
print "<h2>" ;
print _("Behaviour Stars") . " <span style='font-size: 65%; font-style: italic; font-weight: normal'> x" . $resultLike->rowCount() . "</span>" ;
print "</h2>" ;
print "<table cellspacing='0' style='width: 100%'>" ;
print "<tr class='head'>" ;
print "<th style='width: 90px'>" ;
print _("Photo") ;
print "</th>" ;
print "<th style='width: 180px'>" ;
print _("Name") ;
print "</th>" ;
print "<th>" ;
print _("Details") ;
print "</th>" ;
print "<th style='width: 70px'>" ;
print _("Date") ;
print "</th>" ;
print "</tr>" ;
$count=0;
$rowNum="odd" ;
while ($row=$resultLike->fetch() AND $count<10) {
if ($count%2==0) {
$rowNum="even" ;
}
else {
$rowNum="odd" ;
}
$count++ ;
//COLOR ROW BY STATUS!
print "<tr class=$rowNum>" ;
print "<td>" ;
print getUserPhoto($guid, $row["image_75"], 75) ;
print "</td>" ;
print "<td>" ;
$roleCategory=getRoleCategory($row["gibbonRoleIDPrimary"], $connection2) ;
print formatName("", $row["preferredName"], $row["surname"], $roleCategory, false) . "<br/>" ;
print "</td>" ;
print "<td>" ;
print "<b>" . $row["descriptor"] . "</b><br/>" ;
if ($row["comment"]!="") {
print "<i>\"" . $row["comment"] . "\"</i>" ;
}
print "</td>" ;
print "<td>" ;
print dateConvertBack($guid, substr($row["timestamp"],0,10)) ;
print "</td>" ;
print "</tr>" ;
}
print "</table>" ;
}
//Count crowd assessment likes
try {
$dataLike=array("gibbonPersonID"=>$_SESSION[$guid]["gibbonPersonID"], "gibbonSchoolYearID"=>$_SESSION[$guid]["gibbonSchoolYearID"]);
$sqlLike="SELECT gibbonPlannerEntryHomework.gibbonPlannerEntryHomeworkID, gibbonPlannerEntry.gibbonPlannerEntryID, gibbonPerson.gibbonPersonID, surname, preferredName, gibbonRoleIDPrimary, image_75, gibbonPlannerEntry.name, gibbonCrowdAssessLike.timestamp FROM gibbonCrowdAssessLike JOIN gibbonPlannerEntryHomework ON (gibbonCrowdAssessLike.gibbonPlannerEntryHomeworkID=gibbonPlannerEntryHomework.gibbonPlannerEntryHomeworkID) JOIN gibbonPlannerEntry ON (gibbonPlannerEntryHomework.gibbonPlannerEntryID=gibbonPlannerEntry.gibbonPlannerEntryID) JOIN gibbonPerson ON (gibbonCrowdAssessLike.gibbonPersonID=gibbonPerson.gibbonPersonID) JOIN gibbonCourseClass ON (gibbonPlannerEntry.gibbonCourseClassID=gibbonCourseClass.gibbonCourseClassID) JOIN gibbonCourse ON (gibbonCourseClass.gibbonCourseID=gibbonCourse.gibbonCourseID) WHERE gibbonPlannerEntryHomework.gibbonPersonID=:gibbonPersonID AND gibbonSchoolYearID=:gibbonSchoolYearID ORDER BY timestamp DESC" ;
$resultLike=$connection2->prepare($sqlLike);
$resultLike->execute($dataLike);
}
catch(PDOException $e) {
print "<div class='error'>" . $e->getMessage() . "</div>" ;
}
if ($resultLike->rowCount()>0) {
print "<h2>" ;
print _("Crowd Assessment Stars") ." <span style='font-size: 65%; font-style: italic; font-weight: normal'> x" . $resultLike->rowCount() . "</span>" ;
print "</h2>" ;
print "<table cellspacing='0' style='width: 100%'>" ;
print "<tr class='head'>" ;
print "<th style='width: 90px'>" ;
print _("Photo") ;
print "</th>" ;
print "<th style='width: 180px'>" ;
print _("Name") ;
print "</th>" ;
print "<th>" ;
print _("Lesson") ;
print "</th>" ;
print "<th style='width: 70px'>" ;
print _("Date") ;
print "</th>" ;
print "</tr>" ;
$count=0;
$rowNum="odd" ;
while ($row=$resultLike->fetch() AND $count<10) {
if ($count%2==0) {
$rowNum="even" ;
}
else {
$rowNum="odd" ;
}
$count++ ;
//COLOR ROW BY STATUS!
print "<tr class=$rowNum>" ;
print "<td>" ;
print getUserPhoto($guid, $row["image_75"], 75) ;
print "</td>" ;
print "<td>" ;
$roleCategory=getRoleCategory($row["gibbonRoleIDPrimary"], $connection2) ;
if ($roleCategory=="Student" AND isActionAccessible($guid, $connection2, "/modules/Students/student_view_details.php")) {
print "<a href='" . $_SESSION[$guid]["absoluteURL"] . "/index.php?q=/modules/Students/student_view_details.php&gibbonPersonID=" . $row["gibbonPersonID"] . "'>" . formatName("", $row["preferredName"], $row["surname"], $roleCategory, false) . "</a><br/>" ;
print "<i>$roleCategory</i>" ;
}
else {
print "<i>$roleCategory</i>" ;
}
print "</td>" ;
print "<td>" ;
print "<a href='" . $_SESSION[$guid]["absoluteURL"] . "/index.php?q=/modules/Crowd Assessment/crowdAssess_view_discuss.php&gibbonPlannerEntryID=" . $row["gibbonPlannerEntryID"] . "&gibbonPlannerEntryHomeworkID=" . $row["gibbonPlannerEntryHomeworkID"] . "&gibbonPersonID=" . $_SESSION[$guid]["gibbonPersonID"] . "'>" . $row["name"] . "</a>" ;
print "</td>" ;
print "<td>" ;
print dateConvertBack($guid, substr($row["timestamp"],0,10)) ;
print "</td>" ;
print "</tr>" ;
}
print "</table>" ;
}
?>