-
Notifications
You must be signed in to change notification settings - Fork 9
/
cardsedit_form.php
53 lines (40 loc) · 1.85 KB
/
cardsedit_form.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
<?php
require_once($CFG->libdir . '/formslib.php');
class flashcard_cardsedit_form extends moodleform {
protected $numelements = 10;
protected function definition() {
global $COURSE, $CFG, $DB, $PAGE;
$mform = $this->_form;
if (isset($this->_customdata['noaddbutton']) && $this->_customdata['noaddbutton']) {
$noaddbutton = true;
} else {
$noaddbutton = false;
}
$context = $this->_customdata['context'];
$mform->addElement('hidden', 'id');
$mform->addElement('hidden', 'view');
for ($i = 0; $i < $this->numelements; $i++) {
$mform->addElement('editor', "question[$i]", get_string('question', 'flashcard'), null,
array('context' => $context, 'maxfiles' => EDITOR_UNLIMITED_FILES,'noclean'=>true));
$mform->addElement('editor', "answer[$i]", get_string('answer', 'flashcard'), null,
array('context' => $context, 'maxfiles' => EDITOR_UNLIMITED_FILES,'noclean'=>true));
$mform->addElement('hidden', "cardid[$i]");
}
//-------------------------------------------------------------------------------
// $mform->addElement('header', 'general', get_string('general', 'form'));
// echo 'ok';
/*
$mform->addElement('editor', 'page', get_string('content', 'page'));//, null, array('context'=>$context,'changeformat'=>1,'trusttext'=>1));
return;
*/
/*
foreach($cards as $card) {
$mform->addElement('editor', "question[{$card->id}]", 'question');//, null, array('context'=>$context,'changeformat'=>1,'trusttext'=>1));
}
*/
if (!$noaddbutton) {
$mform->addElement('submit', 'addmore', get_string('saveadd', 'flashcard'));
}
$this->add_action_buttons();
}
}