]> git.mjollnir.org Git - moodle.git/commitdiff
Tweaked class MoodleBlock some. Removed a useless function (how did it get in here?)
authordefacer <defacer>
Fri, 19 Nov 2004 02:41:32 +0000 (02:41 +0000)
committerdefacer <defacer>
Fri, 19 Nov 2004 02:41:32 +0000 (02:41 +0000)
and renamed handle_config(), print_config() to config_save(), config_print() for
consistency with the new instance_ functions().

Removed that old and obsolete README file.

blocks/README.txt [deleted file]
blocks/moodleblock.class.php

diff --git a/blocks/README.txt b/blocks/README.txt
deleted file mode 100644 (file)
index 6a84808..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
--------------------------------------------------------------------------------
-CREATING NEW BLOCKS
--------------------------------------------------------------------------------
-
--------------------------------------------------------------------------------
-WARNING - PRELIMINARY DOCUMENTATION
-This is designed to point new block developers in the right direction. At times
-it may NOT be fully up-to-date with the source, or it may even contain some
-tiny bit of misinformation that has slipped our notice. If you encounter such a
-case, please:
-    1. Use the existing block code as reference
-    2. Come to the moodle.org forums and tell the world! :) We 'll help you!
--------------------------------------------------------------------------------
-
-You have to derive a class that extends MoodleBlock.
-
-The derived class MUST:
-
-    * Implement a constructor that:
-        1. Sets $this->content_type (BLOCK_TYPE_LIST or BLOCK_TYPE_TEXT)
-        3. Sets $this->title
-        4. Sets $this->version
-        5. Sets $this->course equal to its only argument
-
-The derived class MAY:
-
-    * Declare that the block has a configuration interface.
-      To do so:
-
-        1. Define a method has_config() {return true;}
-        2. Define a method print_config() that prints whatever
-           configuration interface you want to have.
-        3. Define a method handle_config($data) that does what
-           is needed. $data comes straight from data_submitted().
-
-    * Limit the course formats it can be displayed in.
-      To do so:
-
-        1. Define a method applicable_formats() which returns a bitwise
-           OR of one or more COURSE_FORMAT_XXX defined constants. These
-           are defined in lib/blocklib.php.
-
-    * Select a "preferred" width which the course format will try to honor.
-      To do so:
-
-        1. Define a method preferred_width() which returns an integer.
-           This is the block's preferred width in pixels.
-
-    * Declare that the block is going to hide its header. This will result
-      in a more lightweight appearance. Ideal for announcements/notices.
-      To do so:
-
-        1. Define a method hide_header() {return true;}
index f2411737d5ab44570df06d3026b3e473e15a4724..4ea24d6dbc30590bbd62c69a6e802af2de93ff9c 100644 (file)
@@ -42,7 +42,7 @@ class MoodleBlock {
     var $str;
 
     /**
-     * The title of the block to be displayed in the block header area.
+     * The title of the block to be displayed in the block title area.
      * @var string $title
      */
     var $title         = NULL;
@@ -168,19 +168,6 @@ class MoodleBlock {
         return $this->version;
     }
 
-    /**
-     * Returns the class $header var value.
-     *
-     * Intentionally doesn't check if a header is set. 
-     * This is already done in {@link _self_test()}
-     *
-     * @return string $this->header
-     */
-    function get_header() {
-        // Intentionally doesn't check if a header is set. This is already done in _self_test()
-        return $this->header;
-    }
-
     /**
      * First sets the current value of $this->content to NULL
      * then calls the block's {@link get_content()} function
@@ -404,7 +391,7 @@ class MoodleBlock {
      * @uses $THEME
      * @return boolean
      */
-    function print_config() {
+    function config_print() {
         // Default behavior: print the config_global.html file
         // You don't need to override this if you're satisfied with the above
         if (!$this->has_config()) {
@@ -421,16 +408,13 @@ class MoodleBlock {
      * Default behavior: save all variables as $CFG properties
      * You don't need to override this if you 're satisfied with the above
      *
-     * @param array $config
+     * @param array $data
      * @return boolean
      */
-    function handle_config($config) {
+    function config_save($data) {
         // Default behavior: save all variables as $CFG properties
         // You don't need to override this if you 're satisfied with the above
-        if (!$this->has_config()) {
-            return false;
-        }
-        foreach ($config as $name => $value) {
+        foreach ($data as $name => $value) {
             set_config($name, $value);
         }
         return true;
@@ -497,7 +481,6 @@ class MoodleBlock {
      */
     function specialization() {
         // Just to make sure that this method exists.
-        return;
     }
 
     /**
@@ -541,7 +524,7 @@ class MoodleBlock {
         if (!$this->instance_allow_multiple() && !$this->instance_allow_config()) {
             return false;
         }
-        global $CFG, $USER, $THEME;
+        global $CFG, $THEME;
 
         if (is_file($CFG->dirroot .'/blocks/'. $this->name() .'/config_instance.html')) {
             print_simple_box_start('center', '', $THEME->cellheading);