]> git.mjollnir.org Git - moodle.git/commitdiff
blocks editing: MDL-19889 edit tags block form.
authortjhunt <tjhunt>
Tue, 21 Jul 2009 09:45:27 +0000 (09:45 +0000)
committertjhunt <tjhunt>
Tue, 21 Jul 2009 09:45:27 +0000 (09:45 +0000)
blocks/tags/block_tags.php
blocks/tags/config_instance.html [deleted file]
blocks/tags/edit_form.php [new file with mode: 0644]

index b079c7d75285ec6317a86bc71103678be05c0e17..70fb6a7dc5f896f4e7db1871131b9ce17cb45ceb 100644 (file)
@@ -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 (file)
index 0b17765..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-    if (empty($this->config->title)) {
-        $this->config->title = get_string('blocktagstitle', 'tag');
-    }
-    if (empty($this->config->numberoftags)) {
-        $this->config->numberoftags = 80;
-    }
-?>
-
-<table cellpadding="9" cellspacing="0" class="blockconfigtable">
-
-<tr valign="top">
-<td align="right"><?php print_string("blocktitle","blog") ?>:</td>
-<td><input type="text" name="title" size="50" value="<?php p($this->config->title) ?>" /></td>
-</tr>
-
-<tr valign="top">
-<td align="right"><?php print_string("numberoftags","blog") ?>:</td>
-<td><?php choose_from_menu($numberoftags,"numberoftags",$this->config->numberoftags) ?></td>
-</tr>
-
-<tr>
-    <td colspan="2" align="center"><input type="submit" value="<?php print_string("savechanges") ?>" /></td>
-</tr>
-
-</table>
-
diff --git a/blocks/tags/edit_form.php b/blocks/tags/edit_form.php
new file mode 100644 (file)
index 0000000..060202b
--- /dev/null
@@ -0,0 +1,48 @@
+<?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/>.
+
+/**
+ * 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);
+    }
+}