-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathedit_form.php
More file actions
150 lines (128 loc) · 5.73 KB
/
Copy pathedit_form.php
File metadata and controls
150 lines (128 loc) · 5.73 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
<?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/>.
/**
* The pcast episode configuration form
*
* It uses the standard core Moodle formslib. For more info about them, please
* visit: http://docs.moodle.org/en/Development:lib/formslib.php
*
* @package mod_pcast
* @copyright 2010 Stephen Bourget
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
require_once($CFG->dirroot . '/lib/formslib.php');
require_once(dirname(__FILE__) . '/locallib.php');
/**
* The pcast episode configuration form
*
* It uses the standard core Moodle formslib. For more info about them, please
* visit: http://docs.moodle.org/en/Development:lib/formslib.php
*
* @package mod_pcast
* @copyright 2010 Stephen Bourget
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class mod_pcast_entry_form extends moodleform {
/**
* Mform definition.
*/
public function definition() {
global $CFG, $pcast;
$mform =& $this->_form;
$cm = $this->_customdata['cm'];
$currententry = $this->_customdata['current'];
$context = $this->_customdata['context'];
// Adding the "general" fieldset, where all the common settings are showed.
$mform->addElement('header', 'general', get_string('general', 'form'));
// Adding the standard "name" field.
$mform->addElement('text', 'name', get_string('name', 'pcast'), ['size' => '64']);
if (!empty($CFG->formatstringstriptags)) {
$mform->setType('name', PARAM_TEXT);
} else {
$mform->setType('name', PARAM_CLEAN);
}
$mform->addRule('name', null, 'required', null, 'client');
$mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
$mform->addElement(
'editor',
'summary',
get_string('summary', 'pcast'),
null,
['maxfiles' => EDITOR_UNLIMITED_FILES, 'context' => $context],
);
$mform->setType('summary', PARAM_RAW);
$mform->addRule('summary', get_string('required'), 'required', null, 'client');
// Attachment.
$mform->addElement('header', 'attachments', get_string('attachment', 'pcast'));
// Media File.
$mform->addElement(
'filemanager',
'mediafile',
get_string('pcastmediafile', 'pcast'),
null,
['subdirs' => 0,
'maxfiles' => 1,
'maxbytes' => $pcast->maxbytes,
'accepted_types' => pcast_get_supported_file_types($pcast),
'return_types' => FILE_INTERNAL | FILE_EXTERNAL,
'returnvalue' => 'ref_id',
],
);
$mform->addRule('mediafile', get_string('required'), 'required', null, 'client');
// ITunes Settings.
$mform->addElement('header', 'itunes', get_string('itunes', 'pcast'));
// Subtitle.
$mform->addElement('text', 'subtitle', get_string('subtitle', 'pcast'), ['size' => '64']);
$mform->addRule('subtitle', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
$mform->setType('subtitle', PARAM_NOTAGS);
$mform->addHelpButton('subtitle', 'subtitle', 'pcast');
// Keywords.
$mform->addElement('text', 'keywords', get_string('keywords', 'pcast'), ['size' => '64']);
$mform->addRule('keywords', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
$mform->setType('keywords', PARAM_NOTAGS);
$mform->addHelpButton('keywords', 'keywords', 'pcast');
// Disable if turned off on module settings page.
if ($pcast->userscancategorize) {
// Category form element, Set the default to the podcast category.
$mform->addElement('selectgroups', 'category', get_string('category', 'pcast'), pcast_get_categories());
$mform->setDefault('category', (($pcast->topcategory * 1000) + $pcast->nestedcategory));
$mform->addHelpButton('category', 'category', 'pcast');
$mform->disabledIf('category', 'enablerssitunes', 'eq', 0);
}
// Content.
$explicit = [];
$explicit[0] = get_string('yes');
$explicit[1] = get_string('no');
$explicit[2] = get_string('clean', 'pcast');
$mform->addElement('select', 'explicit', get_string('explicit', 'pcast'), $explicit);
$mform->addHelpButton('explicit', 'explicit', 'pcast');
$mform->setDefault('explicit', 2);
// Tags.
if (core_tag_tag::is_enabled('mod_pcast', 'pcast_episodes')) {
$mform->addElement('header', 'tagshdr', get_string('tags', 'tag'));
$mform->addElement('tags', 'tags', get_string('tags'), ['itemtype' => 'pcast_episodes', 'component' => 'mod_pcast']);
}
// Hidden.
$mform->addElement('hidden', 'id');
$mform->setType('id', PARAM_INT);
$mform->addElement('hidden', 'cmid');
$mform->setType('cmid', PARAM_INT);
// Add standard buttons, common to all modules.
$this->add_action_buttons();
$this->set_data($currententry);
}
}