]> git.mjollnir.org Git - moodle.git/commitdiff
Added Jon's html block from contrib! Thanks, Jon!
authormoodler <moodler>
Sat, 29 Jan 2005 03:48:45 +0000 (03:48 +0000)
committermoodler <moodler>
Sat, 29 Jan 2005 03:48:45 +0000 (03:48 +0000)
blocks/html/block_html.php [new file with mode: 0755]
blocks/html/config_instance.html [new file with mode: 0755]
lang/en/block_html.php [new file with mode: 0755]

diff --git a/blocks/html/block_html.php b/blocks/html/block_html.php
new file mode 100755 (executable)
index 0000000..20b4c56
--- /dev/null
@@ -0,0 +1,36 @@
+<?php //$Id$
+
+class block_html extends block_base {
+
+    function init() {
+        $this->title = get_string('html', 'block_html');
+        $this->content_type = BLOCK_TYPE_TEXT;
+        $this->version = 2004123000;
+    }
+
+    function specialization() {
+        // Does not check if $this->config or $this->config->title
+        // are empty because if they are then the user wishes the title
+        // of the block to be hidden anyway
+        $this->title = $this->config->title;
+    }
+
+    function instance_allow_multiple() {
+        return true;
+    }
+
+    function get_content() {
+        global $CFG;
+        require_once($CFG->dirroot .'/lib/weblib.php');
+        if ($this->content !== NULL) {
+            return $this->content;
+        }
+
+        $this->content = new stdClass;
+        $this->content->text = $this->config->text;
+        $this->content->footer = '';
+
+        return $this->content;
+    }
+}
+?>
diff --git a/blocks/html/config_instance.html b/blocks/html/config_instance.html
new file mode 100755 (executable)
index 0000000..965b5a2
--- /dev/null
@@ -0,0 +1,15 @@
+<table cellpadding="9" cellspacing="0">
+<tr valign="top">
+    <td align="right"><p><?php print_string('configtitle', 'block_html'); ?>:</td>
+    <td><input type="text" name="title" size="30" value="<?php echo $this->config->title; ?>" /> (<?php print_string('leaveblanktohide', 'block_html'); ?>)</td>
+</tr>
+<tr valign="top">
+    <td align="right"><p><?php print_string('configcontent', 'block_html'); ?>:</td>
+    <td><?php print_textarea(true, 10, 50, 0, 0, 'text', $this->config->text); ?></td>
+</tr>
+<tr>
+    <td colspan="3" align="center">
+    <input type="submit" value="<?php print_string('savechanges') ?>" /></td>
+</tr>
+</table>
+<?php use_html_editor(); ?>
\ No newline at end of file
diff --git a/lang/en/block_html.php b/lang/en/block_html.php
new file mode 100755 (executable)
index 0000000..35ec4c9
--- /dev/null
@@ -0,0 +1,8 @@
+<?php // $Id$ 
+
+$string['html'] = 'HTML';
+$string['configtitle'] = 'Block Title';
+$string['configcontent'] = 'Content';
+$string['leaveblanktohide'] = 'leave blank to hide the title';
+
+?>
\ No newline at end of file