You are here

The synonym block

21 January, 2016 - 14:46

Another proposal to solve the difficulty of XML tags discrepancy is to use a specially implemented Synonym block. This mechanism provides the e-learning platform with the functionality for defining words and their synonyms, as it is shown in (Figure 2.17).

There were several reasons for the choice of this type of the MOODLE environment component. The main one was the possibility of adding this kind of object to any module and any course, and, hence, achieving an opportunity to its later usage in other than the XML modules. The SQL modules that were developed in the previous research (Harężlak&Werner, 2010) can be a good example of such situation.

media/image17.png
Figure 2.17 The Synonym block 
 

In that case, the synonym block might be useful in situations, when the schema of a database queried by learners by the usage of SQL module, would change. Then, the typical action performed by a course trainer, would be to rewrite all query tasks (i.e. SQL activities) added to the topic previously and to change the names of the altered columns to a new ones. Whereas, giving the teachers the ability to use the synonym block element, would eliminate this disadvantage.

In that case, the synonym block might be useful in situations, when the schema of a database queried by learners by the usage of SQL module, would change. Then, the typical action performed by a course trainer, would be to rewrite all query tasks (i.e. SQL activities) added to the topic previously and to change the names of the altered columns to a new ones. Whereas, giving the teachers the ability to use the synonym block element, would eliminate this disadvantage.

In order to define a new block, the /blocks folder of the MOODLE home directory was changed. As it was mentioned before, the MOODLE software has the modular structure and all its units have similar construction. The same applies to the block element. In practice, in order to define a new synonym block, a new subfolder with the name corresponding to the name of being defined block, with a known set of PHP and HTML files is created. The chosen, mandatory, elements of /synonym folder, are listed in (Table 2.2 ).

Table 2.2 The elements of /synonym folder

Chosen elements of /synonym folder

Content description

/db

Defines the structure of back-end MOODLE database table,that is created especially for defined block. It is used during block installation

/images

Includes two icons shown in fig. 17 that are next to the links forwarding the user to word or synonyms defining pages

/lang

Includes subfolders with translation files that consists of string mappings, realizing different language versions of block fields‘ headers

block_synonym.php

Provides block class definition with functions displaying inter alia - the title and version of synonym block

synonym.php

This file name must be the same, as the name of defined block

 

Besides, there are a few HTML files that provide block class, in /synonym subfolder with specific - instance or global level - configuration.

The most important file is the block_synonym.php, where - inter alia - two Web links,referencing to separate PHP files, providing the desired functionality, are specified:

$this->content->items[ ] = '<a href="word.php">Store new word</a>';

$this->content->items[ ] = '<a href="synonym.php">Store synonym</a>';

Thus, the major modifications of the new block functionality were made in above mentioned files. It is worth emphasizing that these files are located both - in MOODLE home directory and its /course subfolder. Such duplication was necessary to make files accessible for MOODLE users both - at the site, and the course, levels (Figure 2.18).

media/image18.png
Figure 2.18 Adding the Synonym block at the site level 
 

New added data - i.e. word itself, word id, annotation and the number of course, the word is defined for is inserted into described earlier synonyms table. The last attribute was intended to enable the word definition only to the selected course that – consequently – reduces the number of searched table rows. New rows are inserted to these table by the use of the especially prepared files - word.php and synonym.php ones.

The existence of two separate PHP files causes that in an independent manner - i.e. not necessarily at the same time - words and their synonyms can be defined. The result of the word.php file acting is presented in (Figure 2.19).