- Goto course/format/ (read the README.txt there)
- Copy topics folder to a new folder (e.g. yourformat)
- Goto yourformat/lang/en/
- Rename "format_topics.php" to "format_yourformat.php"
- Open format_yourformat.php
- Change the $string
- Done.
2011年2月27日 星期日
Create a new format
2011年2月22日 星期二
Add a field to Module Update page
By Module Update page, i mean the page shown when you add a new activity or update it.
Note: You should add a field to the database first if you want to save the entered field information.
Note2: your_field is the field name in the database of table mdl_your_mod, the field information will save to the table
Note3: To show the field, just use $your_mod->your_field
Note: You should add a field to the database first if you want to save the entered field information.
- Open mod\your_mod\mod_form.php
- Add this line: $mform->addElement('text', 'your_field', 'label_shown', array('size'=>'64'));
- Done
Note2: your_field is the field name in the database of table mdl_your_mod, the field information will save to the table
Note3: To show the field, just use $your_mod->your_field
Add a field to Module Database
- Site administration -> Development -> XMLDB editor
- Find your module and click [Load]
- Click [Edit]
- At the Tables section, click the table you want to add field
- Click [New field] and fill in the detail
- [View PHP code]
- Select action: add field
- Select field/key/index: your_new_field_name
- Click "View"
- Copy the code to mod/your_mod/db/upgrade.php
- Change XXXXXXXXXX to new version number (e.g. 2011022301)
- Open mod/your_mod/version.php, change $module->version to the new version number
- Notification
- Done
A good way to print message
Use: print_string( 'the_message', 'your_module_name' );
Then, at mod\your_mod\lang\en\your_mod.php, add:
$string[ 'the_message' ] = 'Welcome!!!';
Then, at mod\your_mod\lang\en\your_mod.php, add:
$string[ 'the_message' ] = 'Welcome!!!';
Remove a Module
- Goto: Site administration -> Plugins -> Activity modules -> Manage activities
- Find your module and click Delete
- Remove the module from mod/ folder
- Done
2011年2月17日 星期四
Show Block on My Moodle page
By default, some of the blocks cannot be shown on My Moodle page. However, we can force them, but you need to take the risk that the block may be work on My Moodle page. (e.g. some course level functions)
- Go to blocks/your_block/ folder
- Edit block_your_block.php
- Go to function applicable_formats()
- Change "'my' => false" to "'my' => true"
- Done.
Redirect to My Moodle page after login
Site administrator -> Appearance -> Navigation -> Default home page for users -> My Moodle
訂閱:
文章 (Atom)