-
Notifications
You must be signed in to change notification settings - Fork 3
/
link_edit_form.php
50 lines (38 loc) · 1.62 KB
/
link_edit_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
<?php
defined('MOODLE_INTERNAL') || die();
require_once(dirname(__FILE__) . '/../../config.php');
require_once($CFG->libdir . '/formslib.php');
class equella_links_edit_form extends moodleform {
protected $isadding;
protected $title = '';
protected $description = '';
function __construct($actionurl, $isadding = false) {
$this->isadding = $isadding;
parent::moodleform($actionurl);
}
function definition() {
$mform =& $this->_form;
// Then show the fields about where this block appears.
if ($this->isadding) {
$mform->addElement('header', 'addinglinkheader', get_string('addinglinkheader', 'block_equella_links'));
} else {
$mform->addElement('header', 'editinglinkheader', get_string('editinglinkheader', 'block_equella_links'));
}
$mform->addElement('hidden', 'linkid', '');
$mform->setType('linkid', PARAM_INT);
$mform->addElement('text', 'title', get_string('linktitle', 'block_equella_links'), array('size' => 60));
$mform->setType('title', PARAM_NOTAGS);
$mform->addRule('title', null, 'required');
$mform->addElement('text', 'url', get_string('equellaurl', 'block_equella_links'), array('size' => 60));
$mform->setType('url', PARAM_URL);
$mform->addRule('url', null, 'required');
$submitlabal = null; // Default
if ($this->isadding) {
$submitlabal = get_string('addnewlink', 'block_equella_links');
}
$this->add_action_buttons(true, $submitlabal);
}
function set_data($params) {
parent::set_data($params);
}
}