Non-core contributed modules

Create the custom theme block.

Details

  • Type: Sub-task Sub-task
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.9.1
  • Fix Version/s: None
  • Labels:
    None
  • Database:
    MySQL
  • Affected Branches:
    MOODLE_19_STABLE

Description

Develop a block with the following features (custom_theme block):-

  • Provide the only means of access to the page to customize theme. The user is presented with the link to the page that allows to customize the theme.
  • Creation of database tables. The database has a field for each of the CSS element that the user wishes to customize and the corresponding id of the user who customized it. The database was created using the XMLDB editor. Information about database is stored in upgrade.php and install.xml
  • Support for a capability to show or hide the block. The custom_theme: Display capability controls who can see the block (and hence modify the theme). Using the has_capability() function, we can control the access to the block.

Activity

Hide
Akshit Sharma added a comment - - edited

<screenshot 1>The block provides the access to the page to customize theme

Show
Akshit Sharma added a comment - - edited <screenshot 1>The block provides the access to the page to customize theme
Hide
Akshit Sharma added a comment - - edited

<screenshot 2>The database has a field for each of the CSS element that the user wishes to customize and the corresponding id of the user who customized it.

Show
Akshit Sharma added a comment - - edited <screenshot 2>The database has a field for each of the CSS element that the user wishes to customize and the corresponding id of the user who customized it.
Hide
Akshit Sharma added a comment - - edited

<screenshot 3>The custom_theme: Display - This capability controls who can see the block.

Show
Akshit Sharma added a comment - - edited <screenshot 3>The custom_theme: Display - This capability controls who can see the block.
Hide
Helen Foster added a comment -

Assigning to Akshit

Show
Helen Foster added a comment - Assigning to Akshit
Hide
Shane Elliott added a comment -

I noticed the block name was changed from customtheme to custom_theme in CVS contrib. The class file needs the name changed to match ie block_custom_theme.php and the name of the class within the file also needs to be changed to match. Without the changes the block will not install.

Show
Shane Elliott added a comment - I noticed the block name was changed from customtheme to custom_theme in CVS contrib. The class file needs the name changed to match ie block_custom_theme.php and the name of the class within the file also needs to be changed to match. Without the changes the block will not install.
Hide
Shane Elliott added a comment -

Nothing overly important .... just a couple of comments about the language strings eg line 4 in block_custom_theme.php
$this->title = get_string('Configure Theme', 'block_customtheme');

The first parameter is an array key that moodle uses so while it can contain spaces it's not ideal. Generally we use lower case concatenated words eg configurecustomtheme

The second parameter is the name of the language file - while not necessary it should probably match the block name just to be consistent with the other block lang files eg block_custom_theme

You can create the language file within the block code:
blocks/custom_theme/lang/en_utf8/block_custom_theme.php
Have a look in any of the other language files on the site for the format.

Show
Shane Elliott added a comment - Nothing overly important .... just a couple of comments about the language strings eg line 4 in block_custom_theme.php $this->title = get_string('Configure Theme', 'block_customtheme'); The first parameter is an array key that moodle uses so while it can contain spaces it's not ideal. Generally we use lower case concatenated words eg configurecustomtheme The second parameter is the name of the language file - while not necessary it should probably match the block name just to be consistent with the other block lang files eg block_custom_theme You can create the language file within the block code: blocks/custom_theme/lang/en_utf8/block_custom_theme.php Have a look in any of the other language files on the site for the format.
Hide
Akshit Sharma added a comment -

Thanks Shane for the comment.

1. Block name changed in the various files to custom_theme (from customtheme).
2. Language file created and added to the CVS.

Show
Akshit Sharma added a comment - Thanks Shane for the comment. 1. Block name changed in the various files to custom_theme (from customtheme). 2. Language file created and added to the CVS.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: