forked from gtn/qcreate
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathrenderable.php
More file actions
252 lines (238 loc) · 9.29 KB
/
Copy pathrenderable.php
File metadata and controls
252 lines (238 loc) · 9.29 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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle 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.
//
// Moodle 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 Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This file contains the definition for the renderable classes for the qcreatement
*
* @package mod_qcreate
* @copyright 2014 Jean-Michel Vedrine
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
/**
* Renderable course index summary
* @package mod_qcreate
* @copyright 2014 Jean-Michel Vedrine
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qcreate_course_index_summary implements renderable {
/** @var array qcreates - A list of course module info and question counts */
public $qcreates = array();
/** @var boolean usesections - Does this course format support sections? */
public $usesections = false;
/** @var string courseformat - The current course format name */
public $courseformatname = '';
/**
* constructor
*
* @param boolean $usesections - True if this course format uses sections
* @param string $courseformatname - The id of this course format
*/
public function __construct($usesections, $courseformatname) {
$this->usesections = $usesections;
$this->courseformatname = $courseformatname;
}
/**
* Add a row of data to display on the course index page
*
* @param int $cmid - The course module id for generating a link
* @param string $cmname - The course module name for generating a link
* @param string $sectionname - The name of the course section (only if $usesections is true)
* @param int $timeopen - The due date for the qcreate - may be 0 if no timeopen
* @param int $timeclose - The due date for the qcreate - may be 0 if no timeclose
* @param int $questions - Number of created questions (for user or for all users)
* @param string $gradeinfo - The current users grade if they have been graded and it is not hidden.
*/
public function add_qcreate_info($cmid, $cmname, $sectionname, $timeopen, $timeclose, $questions, $gradeinfo) {
$this->qcreates[] = array('cmid' => $cmid,
'cmname' => $cmname,
'sectionname' => $sectionname,
'timeopen' => $timeopen,
'timeclose' => $timeclose,
'questions' => $questions,
'gradeinfo' => $gradeinfo);
}
}
/**
* Renderable header
* @package mod_qcreate
* @copyright 2014 Jean-Michel Vedrine
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qcreate_header implements renderable {
/** @var stdClass the qcreate record */
public $qcreate = null;
/** @var mixed context|null the context record */
public $context = null;
/** @var bool $showintro - show or hide the intro */
public $showintro = false;
/** @var int coursemoduleid - The course module id */
public $coursemoduleid = 0;
/** @var string $subpage optional subpage (extra level in the breadcrumbs) */
public $subpage = '';
/** @var string $preface optional preface (text to show before the heading) */
public $preface = '';
/**
* Constructor
*
* @param stdClass $qcreate - the qcreate database record
* @param mixed $context context|null the course module context
* @param bool $showintro - show or hide the intro
* @param int $coursemoduleid - the course module id
* @param string $subpage - an optional sub page in the navigation
* @param string $preface - an optional preface to show before the heading
*/
public function __construct(stdClass $qcreate,
$context,
$showintro,
$coursemoduleid,
$subpage='',
$preface='') {
$this->qcreate = $qcreate;
$this->context = $context;
$this->showintro = $showintro;
$this->coursemoduleid = $coursemoduleid;
$this->subpage = $subpage;
$this->preface = $preface;
}
}
/**
* Implements a renderable message notification
* @package mod_qcreate
* @copyright 2018 Jean-Michel Vedrine
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qcreate_gradingmessage implements renderable {
/** @var string $heading is the heading to display to the user */
public $heading = '';
/** @var string $message is the message to display to the user */
public $message = '';
/** @var int $coursemoduleid */
public $coursemoduleid = 0;
/** @var int $gradingerror should be set true if there was a problem grading */
public $gradingerror = null;
/**
* Constructor
* @param string $heading This is the heading to display
* @param string $message This is the message to display
* @param bool $gradingerror Set to true to display the message as an error.
* @param int $coursemoduleid
* @param int $page This is the current quick grading page
*/
public function __construct($heading, $message, $coursemoduleid, $gradingerror = false, $page = null) {
$this->heading = $heading;
$this->message = $message;
$this->coursemoduleid = $coursemoduleid;
$this->gradingerror = $gradingerror;
$this->page = $page;
}
}
/**
* Renderable overview
* @package mod_qcreate
* @copyright 2014 Jean-Michel Vedrine
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qcreate_teacher_overview implements renderable {
/** @var stdClass the qcreate record */
public $qcreate = null;
/** @var mixed context|null the context record */
public $context = null;
/** @var int coursemoduleid - The course module id */
public $coursemoduleid = 0;
public $available;
public $timenow;
public $required;
public $allowed;
/**
* Constructor
*
* @param stdClass $qcreate - the qcreate database record
* @param mixed $context context|null the course module context
* @param int $coursemoduleid - the course module id
*/
public function __construct(stdClass $qcreate,
$context,
$coursemoduleid,
$available) {
$this->qcreate = $qcreate;
$this->context = $context;
$this->coursemoduleid = $coursemoduleid;
$this->available = $available;
$this->timenow = time();
}
}
/**
* Renderable view page
* @package mod_qcreate
* @copyright 2014 Jean-Michel Vedrine
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qcreate_student_view implements renderable {
/** @var stdClass the qcreate record */
public $qcreate = null;
public $cm;
public $cat;
public $requiredquestions;
public $extraquestions;
public $qtyperequired;
public $extraquestionsgraded;
public $extraquestionsdone;
public $extras;
public $studentgrade;
public $qtypesallowed;
/** @var mixed context|null the context record */
public $context = null;
/** @var int coursemoduleid - The course module id */
public $coursemoduleid = 0;
public $available;
public $timenow;
/**
* Constructor
*
* @param stdClass $qcreate - the qcreate database record
* @param mixed $context context|null the course module context
* @param int $coursemoduleid - the course module id
*/
public function __construct(stdClass $qcreate,
$cm,
$cat,
$requiredquestions,
$extraquestions,
$qtyperequired,
$extraquestionsgraded,
$extraquestionsdone,
$extras,
$studentgrade,
$qtypesallowed,
$context,
$coursemoduleid,
$available) {
$this->qcreate = $qcreate;
$this->cm = $cm;
$this->cat = $cat;
$this->requiredquestions = $requiredquestions;
$this->extraquestions = $extraquestions;
$this->extraquestionsgraded = $extraquestionsgraded;
$this->extraquestionsdone = $extraquestionsdone;
$this->extras = $extras;
$this->studentgrade = $studentgrade;
$this->qtypesallowed = $qtypesallowed;
$this->context = $context;
$this->coursemoduleid = $coursemoduleid;
$this->available = $available;
$this->timenow = time();
}
}