From 7b2b1a915cb033cc5174f5a10d8feb8292d60dc2 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Tue, 21 Jul 2009 09:45:27 +0000 Subject: [PATCH] blocks editing: MDL-19889 edit tags block form. --- blocks/tags/block_tags.php | 34 +--------------------- blocks/tags/config_instance.html | 27 ------------------ blocks/tags/edit_form.php | 48 ++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 60 deletions(-) delete mode 100644 blocks/tags/config_instance.html create mode 100644 blocks/tags/edit_form.php diff --git a/blocks/tags/block_tags.php b/blocks/tags/block_tags.php index b079c7d752..70fb6a7dc5 100644 --- a/blocks/tags/block_tags.php +++ b/blocks/tags/block_tags.php @@ -63,7 +63,7 @@ class block_tags extends block_base { /// Get a list of tags - require_once($CFG->dirroot.'/tag/lib.php'); + require_once($CFG->dirroot.'/tag/locallib.php'); if (empty($CFG->block_tags_showcoursetags) or !$CFG->block_tags_showcoursetags) { @@ -318,37 +318,5 @@ EOT; return $this->content; } - - function instance_config_print() { - global $CFG; - - /// set up the numberoftags select field - $numberoftags = array(); - for($i=1;$i<=200;$i++) $numberoftags[$i] = $i; - - if (is_file($CFG->dirroot .'/blocks/'. $this->name() .'/config_instance.html')) { - print_simple_box_start('center', '', '', 5, 'blockconfigglobal'); - include($CFG->dirroot .'/blocks/'. $this->name() .'/config_instance.html'); - print_simple_box_end(); - } else { - notice(get_string('blockconfigbad'), str_replace('blockaction=', 'dummy=', qualified_me())); - } - } - - /* - * function removed until rsslib supports dc/cc - */ - /* - function cron() { - global $CFG; - if ($CFG->block_tags_showcoursetags) { - require_once($CFG->dirroot.'/tag/coursetagslib.php'); - return coursetag_rss_feeds(); - } else { - return TRUE; -} - } - */ - } ?> diff --git a/blocks/tags/config_instance.html b/blocks/tags/config_instance.html deleted file mode 100644 index 0b17765192..0000000000 --- a/blocks/tags/config_instance.html +++ /dev/null @@ -1,27 +0,0 @@ -config->title)) { - $this->config->title = get_string('blocktagstitle', 'tag'); - } - if (empty($this->config->numberoftags)) { - $this->config->numberoftags = 80; - } -?> - - - - - - - - - - - - - - - - - -
:
:config->numberoftags) ?>
" />
- diff --git a/blocks/tags/edit_form.php b/blocks/tags/edit_form.php new file mode 100644 index 0000000000..060202b212 --- /dev/null +++ b/blocks/tags/edit_form.php @@ -0,0 +1,48 @@ +. + +/** + * Form for editing tag block instances. + * + * @package moodlecore + * @copyright 2009 Tim Hunt + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +/** + * Form for editing tag block instances. + * + * @copyright 2009 Tim Hunt + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class block_tags_edit_form extends block_edit_form { + protected function specific_definition($mform) { + // Fields for editing HTML block title and contents. + $mform->addElement('header', 'configheader', get_string('blocksettings', 'block')); + + $mform->addElement('text', 'config_title', get_string('blocktagstitle', 'tag')); + $mform->setType('config_title', PARAM_MULTILANG); + $mform->setDefault('config_title', get_string('blocktagstitle', 'tag')); + + $numberoftags = array(); + for ($i = 1; $i <= 200; $i++) { + $numberoftags[$i] = $i; + } + $mform->addElement('select', 'config_numberoftags', get_string('numberoftags', 'blog'), $numberoftags); + $mform->setDefault('config_numberoftags', 80); + } +} -- 2.39.5