settings_form.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  1. <?php
  2. /**
  3. * Form to add and edit interactive Learning Module (iLM).
  4. * The fields are initially filled at locallib.php:add_edit_copy_ilm($ilm_id, $action)
  5. * The final processing is performed by 'locallib.php', that is called by './settings_ilm.php' (with ilm_settings::copy_new_version_ilm($formdata))
  6. * then by 'ilm_handlers/(html5 or java).php' with copy_new_version_ilm($param, $files_extract)'
  7. *
  8. * Release Notes:
  9. * - v 2.0.1 2024/05/10
  10. * + Improved messages to "Add iLM" and "Import iLM"
  11. * - v 2.0.1 2022/09/15
  12. * + Considering table 'iassign_ilm': messages to fields 'evaluate', 'reevaluate', 'editingbehavior'; fixes to allow the edition of 'reevaluate', 'editingbehavior'
  13. * - v 1.6.3 2020/04/28
  14. * + Fixed detail: undefinde variable 'if ($filejars!='')' - it was '$filejar'
  15. * - v 1.6.2 2020/01/20
  16. * + Avoid presence of ' and " in DB to close string to put JavaScript (avoid error)
  17. * - v 1.6.1 2017/12/02
  18. * + New help button, improvements on some helps, new code comments and indentation.
  19. * - v 1.6 2013/12/12
  20. * + Insert support of import iLM from zip packages.
  21. * - v 1.5 2013/10/31
  22. * + Insert support of import iLM from zip packages.
  23. * - v 1.4 2013/10/24
  24. * + Fix required upload an file for new iLM.
  25. * - v 1.3 2013/07/12
  26. * + Fix error messages of 'setType' in debug mode for hidden fields.
  27. * + Form now accept actions: add, edit, copy (new version from an iLM), and new version (empty new version).
  28. *
  29. * To use help button. For instance, to a field named 'file_class' use
  30. * $mform->addHelpButton('file_class', 'file_class_form_help', 'iassign');
  31. * it means that the first parameter is used as 'title' (mouseover) and the second when user "clickover"
  32. * In lang, it is necessary
  33. * file_class_form_help = 'to the title - when mouse over'
  34. * file_class_form_help_help = 'to the complete explanation, when the user click over the help signal'
  35. * 'auto_evaluate_help'] = 'If the iLM has automatic evaluation select Yes to use an activity with it.'; // 'What is automatic evaluation
  36. *
  37. * @see ./locallib.php : 'add_edit_copy_ilm($ilm_id,$action)' load this script and provides data to it (defines initial values to the form fields)
  38. * @see ./settings_ilm.php : load and process this form, it uses data under the name $param, calling 'locallib.php!add_edit_copy_ilm(.)'
  39. * @see ./ilm_handlers/html5.php : save_ilm_by_xml($application_xml, $files_extract): return null;
  40. *
  41. * @author Patricia Alves Rodrigues
  42. * @author Leo^nidas de Oliveira Branda~o
  43. * @version v 2.0.2 2023/05/10
  44. * @package mod_iassign_settings
  45. * @since 2010/09/27
  46. * @copyright iMatica (<a href="http://www.matematica.br">iMath</a>) - Computer Science Dep. of IME-USP (Brazil)
  47. *
  48. * <b>License</b>
  49. * - http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  50. */
  51. // Moodle core defines constant MOODLE_INTERNAL which shall be used to make sure that the script is included and not called directly.
  52. if (!defined('MOODLE_INTERNAL')) {
  53. die('Direct access to this script is forbidden.'); // By security reasons, this must be included in all Moodle pages!
  54. }
  55. require_once($CFG->libdir . '/formslib.php');
  56. require_once($CFG->dirroot . '/course/moodleform_mod.php');
  57. require_once($CFG->dirroot . '/mod/iassign/lib.php');
  58. /// This class create form based moodleform.
  59. // @see moodleform
  60. class mod_ilm_form extends moodleform {
  61. /// Add elements to form
  62. function definition () {
  63. global $CFG, $COURSE, $USER, $DB;
  64. global $description; // defined in 'settings_ilm.php'
  65. // $mform = & $this->_form;
  66. $mform = $this->_form; //leo
  67. if ($CFG->action_ilm != 'import') {
  68. if ($CFG->action_ilm == 'add') {
  69. // $params = array('parent' => '0');
  70. // $tmps = $DB->get_records_sql("SELECT s.id, s.name, s.extension, s.file_jar
  71. // FROM {iassign_ilm} s WHERE s.parent = :parent", $params); // " - jed/emacs
  72. $tmps = $DB->get_records('iassign_ilm', array('parent' => 0));
  73. }
  74. else {
  75. // $params = array('id' => $CFG->ilm_id);
  76. // $tmps = $DB->get_records_sql("SELECT s.id, s.name, s.extension, s.file_jar
  77. // FROM {iassign_ilm} s WHERE s.id != :id AND s.parent = 0", $params); // " - jed/emacs
  78. $tmps = $DB->get_records('iassign_ilm', array('id' => $CFG->ilm_id));
  79. }
  80. $extensions = "";
  81. $names = "";
  82. $versions = "";
  83. $filejars = "";
  84. foreach ($tmps as $tmp) {
  85. $exts = explode(",", $tmp->extension);
  86. foreach ($exts as $ext) {
  87. $extensions .= "'" . $ext . "',";
  88. }
  89. $names .= "'" . $tmp->name . "',";
  90. $filejars .= "'" . $tmp->file_jar . "',";
  91. }
  92. if (!$tmps)
  93. $iassign_ilm = $DB->get_record('iassign_ilm', array('id' => $CFG->ilm_id));
  94. else
  95. $iassign_ilm = $tmps; // it already has these data
  96. if (!$iassign_ilm) {
  97. $iassign_ilm = new stdClass();
  98. $iassign_ilm->parent = 0;
  99. }
  100. //TODO JavaScript code, verify alternatives.
  101. $code_javascript = "\n <script type='text/javascript'>
  102. //<![CDATA[
  103. document.getElementById('id_data_file_html').style.display = 'none'
  104. document.getElementById('id_data_file_jar').classList.remove('collapsed');
  105. document.getElementById('id_data_ilm').classList.remove('collapsed');
  106. function search_name (name) {
  107. var i;
  108. var names = new Array(";
  109. if ($names != '')
  110. $code_javascript .= addslashes($names) . "');\n"; // if the name has ' it implies close JavaScript string => error!
  111. $code_javascript .= "
  112. for (i=0;i<names.length;i++) {
  113. if (names[i].toLowerCase()==name.toLowerCase()) {
  114. document.forms['mform1'].name.value='';
  115. confirm('" . get_string('invalid_name_ilm', 'iassign') . " '+names[i]+'!');
  116. }
  117. }";
  118. $code_javascript .= " }
  119. function search_extension(extensions) {
  120. var i;
  121. var ext_inserteds = extensions.split(',');
  122. var ext_exists = new Array(";
  123. $code_javascript .= $extensions . "'');" . chr(13);
  124. $code_javascript .= "
  125. for (k=0;k<ext_inserteds.length;k++) {
  126. for (i=0;i<ext_exists.length;i++) {
  127. if (ext_exists[i].toLowerCase()==ext_inserteds[k].toLowerCase()) {
  128. document.forms['mform1'].extension.value='';
  129. confirm('" . get_string('invalid_extension_ilm', 'iassign') . " '+ext_exists[i]+'!');
  130. }
  131. }
  132. }\n";
  133. $code_javascript .= " }
  134. function search_filejar (fullfilejar) {
  135. var i;
  136. var tmp = fullfilejar.split('/');
  137. var filejar = tmp[tmp.length-1];
  138. var filejars = new Array("; // close for JavaScript code
  139. if ($filejars!='')
  140. $code_javascript .= addslashes($filejars) . "');" . chr(13); // if the name has ' it implies close JavaScript string => error!
  141. $code_javascript .= "
  142. for (i=0;i<filejars.length;i++) {
  143. if (filejars[i].toLowerCase()==filejar.toLowerCase()) {
  144. document.forms['mform1'].file_jar[0].value='';
  145. confirm('" . get_string('invalid_filejar_ilm', 'iassign') . " '+filejars[i]+'!');
  146. }
  147. }\n";
  148. $code_javascript .= " }
  149. function change_language (lang) {
  150. if (document.forms['mform1'].description_lang.value != '') {
  151. descriptions = eval('(' + document.forms['mform1'].description_lang.value + ')');
  152. descriptions[document.forms['mform1'].set_lang.value] = tinyMCE.activeEditor.getContent();
  153. document.forms['mform1'].description_lang.value = JSON.stringify(descriptions);
  154. if (descriptions[lang] != undefined)
  155. tinyMCE.activeEditor.setContent(descriptions[lang]);
  156. else
  157. tinyMCE.activeEditor.setContent('');
  158. }
  159. else {
  160. document.forms['mform1'].description_lang.value = '{ \"' + document.forms['mform1'].set_lang.value + '\" : \"' + tinyMCE.activeEditor.getContent() + '\" }';
  161. tinyMCE.activeEditor.setContent('');
  162. }
  163. document.forms['mform1'].set_lang.value = lang;
  164. }
  165. //]]>
  166. </script>\n";
  167. //-------------------------------------------------------------------------------
  168. /// Adding the "data_ilm" fieldset, where all the common settings are showed
  169. if (true) { // here are the fields that will be used to new entry of table {iassign_ilm}
  170. // $mform->addElement('header', 'type_ilm', get_string('type_ilm', 'iassign'));
  171. // // Adding the select option for HTML5 or Java
  172. // $options = array('Java' => 'Java', 'HTML5' => 'HTML5');
  173. // $mform->addElement('select', 'ilm_type', get_string('ilm_type', 'iassign'), $options);
  174. // $mform->setDefault('ilm_type', PARAM_TEXT);
  175. // $mform->addHelpButton('ilm_type', 'ilm_type', 'iassign');
  176. // $mform->addElement('header', 'data_ilm', get_string('data_ilm', 'iassign'));
  177. // Add information about this Importer: add_ilm_iassign_help="See a more complete description of iLM"; add_ilm_iassign_about_ilm=
  178. // A <a href="https://www.matematica.br/ia/#iLM" title="see a more complete description" target="_blank">iLM</a> is any education Web system
  179. // $msg1 = get_string('add_ilm_iassign_help', 'iassign');
  180. // $msg2 = get_string('add_ilm_iassign_about_ilm', 'iassign');
  181. // $html_div = '<div id="form_import_explain" class="box generalbox formsettingheading" style="padding: 35px; padding-left: 0;">' . $msg2 . "</div>\n";
  182. // $html_div .= '<div id="form_import_required" class="fitem required fitem_fgroup" style="padding: 35px; padding-left: 0;">' . chr(13);
  183. // $html_div .= '<span><a><i class="icon fa fa-exclamation-circle text-danger fa-fw " title=""></i>'. $msg . '</span></div>' . "\n";
  184. // Text explaining the "Add iLM" process and the meaning of the 'ilm-application.xml' description file
  185. $msg1 = get_string('add_ilm_iassign_about_ilm', 'iassign'); //
  186. $msg2 = get_string('add_ilm_iassign_help', 'iassign'); //
  187. $html_div = '<div id="form_import_explain" class="box generalbox formsettingheading" style="padding: 35px; padding-left: 0;">' . $msg1 . "</div>\n";
  188. $html_div .= '<div id="form_import_explain" class="fitem required fitem_fgroup" style="padding: 35px; padding-left: 0;">' . chr(13);
  189. $html_div .= '<span><a><i class="icon fa fa-exclamation-circle text-danger fa-fw " title=""></i>'. $msg2 . "</span></div>\n";
  190. $mform->addElement('html', $html_div);
  191. // Adding the standard "name" field: {iassign_ilm}.name
  192. if ($CFG->action_ilm != 'add') {
  193. $mform->addElement('static', 'name_ilm', get_string('name_ilm', 'iassign'));
  194. $mform->addElement('hidden', 'name');
  195. $mform->setType('name', PARAM_TEXT);
  196. }
  197. else {
  198. $mform->addElement('text', 'name', get_string('name_ilm', 'iassign'), array('size' => '55', 'onchange' => 'search_name(this.value);'));
  199. $mform->setType('name', PARAM_TEXT);
  200. }
  201. // Adding the standard "version" field: {iassign_ilm}.version
  202. $mform->addElement('text', 'version', get_string('version_ilm', 'iassign'), array('size' => '55'));
  203. $mform->setType('version', PARAM_TEXT);
  204. $mform->addHelpButton('version', 'version_ilm', 'iassign');
  205. // Adding the type of iLM: {iassign_ilm}.type
  206. // $mform->addElement('static', 'ilm_type', get_string('type_ilm', 'iassign'));
  207. // $mform->addElement('hidden', 'type'); $mform->setType('type', PARAM_TEXT);
  208. $selectElem = array("HTML5", "Java"); // 0 = package JavaScript; 1 = package Java (JAR)
  209. $mform->addElement('select', 'type', get_string('type_ilm', 'iassign'), $selectElem);
  210. $mform->setDefault('type', 0); // default is "HTML5"
  211. $mform->addHelpButton('type', 'type_ilm', 'iassign');
  212. // Adding the standard "url" field: {iassign_ilm}.url
  213. $mform->addElement('text', 'url', get_string('url_ilm', 'iassign'), array('size' => '55'));
  214. $mform->setType('url', PARAM_TEXT);
  215. // ./lib/moodlelib.php: function get_string_manager($forcereload=false): $singleton=new core_string_manager_standard($CFG->langotherroot, $CFG->langlocalroot, $translist, $transaliases);
  216. $list_of_lang = get_string_manager()->get_list_of_translations(); // ./lib/classes/string_manager_standard.php: class core_string_manager_standard implements core_string_manager
  217. $array_lang = array('onChange' => 'change_language(this.value);');
  218. $mform->addElement('select', 'lang', get_string('language_label', 'iassign'), $list_of_lang, $array_lang); // languages
  219. $mform->setDefault('lang', current_language());
  220. //D Came from 'settings_ilm.php: if ($action == 'edit')
  221. //D With 'editor' does not work!
  222. //D $param = $description; // ilm_settings::add_edit_copy_ilm($ilm_id, $action);
  223. //D $param = $mform->get_data(); - erro, function not defined
  224. //D echo "settings_form.php: param="; print_r($param); echo "<br/>";
  225. //D echo "description=" . $description . "<br/>";
  226. // Adding the standard "description" field: {iassign_ilm}.description
  227. //moodle2 $mform->addElement('htmleditor', 'description', get_string('description', 'iassign'));
  228. //TODO $mform->addElement('editor', 'description', get_string('description', 'iassign'), $description); // moodle3 => 'editor', but not working
  229. $mform->addElement('text', 'description', get_string('description', 'iassign'), array('size' => '80'));
  230. $mform->setType('description', PARAM_RAW);
  231. // Adding the "data_file_jar" fieldset, where all the common settings are showed ---
  232. //REVER texto 'Pacote do novo iMA (Java) a ser inserido (JAR)'
  233. $mform->addElement('header', 'data_file_jar', get_string('data_file_jar', 'iassign'));
  234. $mform->addElement('static', 'file_jar_static', get_string('fields_info', 'iassign')); // non editable text
  235. // Field 'file_jar': {iassign_ilm}.file_jar
  236. $mform->addElement('text', 'file_jar', get_string('file_jar_path', 'iassign'), array('size' => '55')); // editable text
  237. $mform->setType('file_jar', PARAM_TEXT); // 'The iLM name of its main directory (HTML/JS) or iLM package (Java JAR)'
  238. $mform->addHelpButton('file_jar', 'file_jar_help', 'iassign'); // messages 'file_jar_help' and 'file_jar_help_help'
  239. // Field 'file_class': {iassign_ilm}.file_class
  240. $mform->addElement('text', 'file_class', get_string('file_class', 'iassign')); // editable text
  241. $mform->setType('file_class', PARAM_TEXT);
  242. $mform->addHelpButton('file_class', 'file_class_form', 'iassign'); // messages 'file_class_form_help' and 'file_class_form_help_help'
  243. //TODO : acho que vale a pena incluir o campo 'file_jar'...
  244. // $mform->addElement('static', 'file_jar', get_string('file_jar', 'iassign'));
  245. // $mform->addElement('hidden', 'file_jar'); - already bellow! line 288/320
  246. // $mform->setType('file_jar', PARAM_TEXT);
  247. //TD // Adding the standard "file_jar" field
  248. //TD $mform->addElement('text', 'file_jar', get_string('file_jar', 'iassign'), array('size' => '55'));
  249. //TD $mform->setType('file_jar', PARAM_TEXT);
  250. //TD $mform->addHelpButton('file_jar', 'file_jar_form_help', 'iassign'); // first => field name; second => text to be presented
  251. // Adding the standard "extension" field: {iassign_ilm}.extension
  252. $mform->addElement('text', 'extension', get_string('extension', 'iassign'), array('size' => '30', 'onchange' => 'search_extension(this.value);'));
  253. $mform->setType('extension', PARAM_TEXT);
  254. //$mform->addRule('extension', get_string('required', 'iassign'), 'required');
  255. $mform->addHelpButton('extension', 'extension', 'iassign');
  256. // Adding the standard "width" field: {iassign_ilm}.width
  257. $mform->addElement('text', 'width', get_string('width', 'iassign'), array('size' => '10'));
  258. $mform->setType('width', PARAM_TEXT);
  259. //$mform->addRule('width', get_string('required', 'iassign'), 'required');
  260. // Adding the standard "height" field: {iassign_ilm}.height
  261. $mform->addElement('text', 'height', get_string('height', 'iassign'), array('size' => '10'));
  262. $mform->setType('height', PARAM_TEXT);
  263. //$mform->addRule('height', get_string('required', 'iassign'), 'required');
  264. // Adding the field "evaluate": {iassign_ilm}.evaluate
  265. $mform->addElement('selectyesno', 'evaluate', get_string('auto_evaluate', 'iassign'));
  266. $mform->setDefault('evaluate', 1);
  267. //$mform->addRule('evaluate', get_string('required', 'iassign'), 'required');
  268. $mform->addHelpButton('evaluate', 'auto_evaluate', 'iassign');
  269. // Adding the field "reevaluate"
  270. $mform->addElement('selectyesno', 'reevaluate', get_string('auto_reevaluate', 'iassign'));
  271. $mform->setDefault('reevaluate', 1);
  272. $mform->addHelpButton('reevaluate', 'auto_reevaluate', 'iassign');
  273. // Adding the field "editingbehavior"
  274. $mform->addElement('selectyesno', 'editingbehavior', get_string('auto_editingbehavior', 'iassign'));
  275. $mform->setDefault('editingbehavior', 1);
  276. $mform->addHelpButton('editingbehavior', 'auto_editingbehavior', 'iassign');
  277. // Adding the field "submissionbehavior": behaviour after submission
  278. // + 'iassign_ilm.submissionbehavior' = { 0 => remains on the same page; 1 => changes the current page; ... }
  279. $mform->addElement('text', 'submissionbehavior', get_string('auto_evaluate', 'iassign'));
  280. $mform->setType('submissionbehavior', PARAM_INT);
  281. // "Basic information about the new iLM"
  282. // Adding the "data_file_html" fieldset, where all the common settings are showed
  283. $mform->addElement('header', 'data_file_html', get_string('data_file_html', 'iassign'));
  284. // Adding static text --- do not use this options (since it produce a frame with few columns), prefer 'html' bellow
  285. // $mform->addElement('static', 'data_file_html_static', get_string('data_file_html_static', 'iassign'));
  286. $msg = get_string('data_file_html_static', 'iassign'); // "To add an iLM (encoded in HTML/JS), it is sufficient to submit the file in the field below."
  287. $html_div = '<div id="form_import_explain" class="box generalbox formsettingheading" style="padding: 35px; padding-left: 0;">' . $msg . "</div>\n";
  288. $mform->addElement('html', $html_div);
  289. } // if ($CFG->action_ilm != 'add')
  290. // // Upload file ilm
  291. // $mform->addElement('header', 'upload_jar', get_string('upload_jar', 'iassign'));
  292. // //$mform->setExpanded('upload_jar');
  293. // $options = array('subdirs' => 0, 'maxbytes' => $CFG->userquota, 'maxfiles' => -1, 'accepted_types' => '*');
  294. // $mform->addElement('filemanager', 'file', null, null, $options);
  295. $mform->addElement('header', 'upload_jar', get_string('upload_jar', 'iassign'));
  296. $options = array('subdirs' => 0, 'maxbytes' => $CFG->userquota, 'maxfiles' => 1, 'accepted_types' => array('*'));
  297. $mform->addElement('filepicker', 'file', null, null, $options);
  298. $mform->addRule('file', get_string('required', 'iassign'), 'required');
  299. if ($CFG->action_ilm == 'add' || $CFG->action_ilm == 'copy' || $CFG->action_ilm == 'new_version')
  300. $mform->addRule('file', get_string('required', 'iassign'), 'required');
  301. /// Adding the standard "hidden" field
  302. if ($CFG->action_ilm == 'edit') {
  303. $mform->addElement('hidden', 'id');
  304. $mform->setType('id', PARAM_INT);
  305. }
  306. $mform->addElement('hidden', 'set_lang');
  307. $mform->setType('set_lang', PARAM_TEXT);
  308. $mform->setDefault('set_lang', current_language());
  309. $mform->addElement('hidden', 'description_lang');
  310. $mform->setType('description_lang', PARAM_TEXT);
  311. // $mform->addElement('hidden', 'file_jar'); //Remove inserted above to allow to edit this field
  312. // $mform->setType('file_jar', PARAM_TEXT); //Remove idem
  313. $mform->addElement('hidden', 'author');
  314. $mform->setType('author', PARAM_TEXT);
  315. $mform->addElement('hidden', 'action');
  316. $mform->setType('action', PARAM_TEXT); //DEBUG: is it necessary?
  317. $mform->addElement('hidden', 'timecreated');
  318. $mform->setType('timecreated', PARAM_TEXT);
  319. $mform->addElement('hidden', 'timemodified');
  320. $mform->setType('timemodified', PARAM_TEXT);
  321. $mform->addElement('hidden', 'parent');
  322. $mform->setType('parent', PARAM_INT);
  323. $mform->addElement('hidden', 'enable');
  324. $mform->setType('enable', PARAM_INT);
  325. $mform->addElement('html', $code_javascript);
  326. } // if ($CFG->action_ilm != 'import')
  327. else {
  328. // This is used to insert new iLM using the IPZ package
  329. // In it all fields to the table {iassign_ilm} is defined by the file 'ilm-application.xml'
  330. // Header: Upload package iLM
  331. $mform->addElement('header', 'upload_ilm', get_string('upload_ilm', 'iassign'));
  332. // Text explaining the Import process and the meaning of the 'ilm-application.xml' description file
  333. $msg1 = get_string('import_ilm_about', 'iassign'); // Under this option, it is possible to insert a new iLM ...
  334. $msg2 = get_string('import_ilm_help', 'iassign'); // Import a new iLM , using a IPZ package: it must have the file 'ilm-application.xml'...
  335. $html_div = '<div id="form_import_explain" class="box generalbox formsettingheading" style="padding: 35px; padding-left: 0;">' . $msg1 . "</div>\n";
  336. $html_div .= '<div id="form_import_explain" class="fitem required fitem_fgroup" style="padding: 35px; padding-left: 0;">' . chr(13);
  337. $html_div .= '<span><a><i class="icon fa fa-exclamation-circle text-danger fa-fw " title=""></i>'. $msg2 . "</span></div>\n";
  338. $mform->addElement('html', $html_div);
  339. //$mform->setExpanded('upload_ilm');
  340. $options = array('subdirs' => 0, 'maxbytes' => $CFG->userquota, 'maxfiles' => 1, 'accepted_types' => array('*'));
  341. $mform->addElement('filepicker', 'file', null, null, $options);
  342. $mform->addRule('file', get_string('required', 'iassign'), 'required');
  343. $mform->addElement('hidden', 'action'); //DEBUG: is it necessary?
  344. $mform->setType('action', PARAM_TEXT);
  345. }
  346. $this->add_action_buttons();
  347. } // function definition()
  348. } // class mod_ilm_form extends moodleform