moodle/blocks
2004-06-05 11:57:11 +00:00
..
activity_modules Files for postgresql 2004-04-19 04:30:55 +00:00
admin Merging the changes from 1.4 dev branch (site index blocks + various bugfixes) 2004-05-28 10:53:54 +00:00
calendar_month Merging the changes from 1.4 dev branch (site index blocks + various bugfixes) 2004-05-28 10:53:54 +00:00
calendar_upcoming Merging the changes from 1.4 dev branch (site index blocks + various bugfixes) 2004-05-28 10:53:54 +00:00
course_list Make sure course list block is never empty. 2004-06-01 09:47:28 +00:00
course_summary Bugfix: blocks with no content at all show up as shadows when editing. 2004-05-28 13:57:09 +00:00
db First versions for postgressql 2004-04-19 04:15:24 +00:00
news_items Merging the changes from 1.4 dev branch (site index blocks + various bugfixes) 2004-05-28 10:53:54 +00:00
online_users Merging the changes from 1.4 dev branch (site index blocks + various bugfixes) 2004-05-28 10:53:54 +00:00
participants Fixed relative links in People block so that they work on the site home page. 2004-05-30 11:43:29 +00:00
recent_activity Fix for bug #1280: the "showrecent" course setting has to go. 2004-04-29 10:29:23 +00:00
search_forums Files for postgresql 2004-04-19 04:30:55 +00:00
section_links Fixed bug 1531, section links to invisible sections now greyed out or hidden 2004-06-05 11:57:11 +00:00
site_main_menu Fixed activity blocks for social format and site format so that they 2004-05-29 06:22:30 +00:00
social_activities Fixed activity blocks for social format and site format so that they 2004-05-29 06:22:30 +00:00
moodleblock.class.php As per Gustav's suggestion in bug 1507, changing the default behavior for 2004-06-01 10:45:12 +00:00
README.txt Fixed/added some things so that the instructions are mostly correct. 2004-04-19 07:39:43 +00:00
version.php Merging the changes from 1.4 dev branch (site index blocks + various bugfixes) 2004-05-28 10:53:54 +00:00

-------------------------------------------------------------------------------
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;}