mirror of
https://github.com/moodle/moodle.git
synced 2025-02-21 01:48:45 +01:00
Integrated with Moodle: - Install automatically. - Update course->blockinfo for each course at installation time. - Modified course creation to insert into blockinfo field. - Modified restore to insert into blockinfo field. - Admin options (hide, show, delete, config) from admin page. - Lang strings inserted (en only). - Database support to mysql and postgresql (not tested!!). Moodle, backup and block versions updated to 2004041800. Tested with mysql: Install fresh and upgrade from previous. section_activities block renamed to social_activities and created its own lang file to support name "Social Activities". This can be changed at any time. TODO: ===== Support it really in backup/restore. ???? Enjoy!! Ciao :-)
43 lines
1.4 KiB
Plaintext
43 lines
1.4 KiB
Plaintext
CREATING NEW BLOCKS
|
|
-------------------------------------------------------------------------------
|
|
|
|
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)
|
|
2. Sets $this->header (BLOCK_SHOW_HEADER or BLOCK_HIDE_HEADER)
|
|
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 AND of one or more COURSE_FORMAT_XXX defined
|
|
constants.
|
|
|
|
* Select a "preferred" width which the course format will try to honor.
|
|
To do so:
|
|
|
|
1. Define a method preferred_width() which returns a number
|
|
measured in pixels.
|
|
|
|
* Declare that the block is going to hide its header.
|
|
To do so:
|
|
|
|
1. Define a method hide_header() {return true;}
|