Advanced Moodle Course List - Research Paper
Advanced Moodle Course List - Research Paper
I. INTRODUCTION
2
As the content of the block, you can create a file or several
files implanting your functions. More important thing here is
all your implementation must encapsulate within a class name
block_[your_block_folder_name]. And also it must inherited
from the class block_base or any sub class which inherit from
block_base class. In there you have to override function
get_content() method which returns the content of the block
to be displayed. If you want to provide settings for your block,
a settings.php file can be implemented in the block folder.
This is optional.
Block types are controlled by moodleblock.class.php file.
It includes concrete classes for block implementation. In here
it can create new class types too.
All the operations regarding on blocks are done by
blocklib.php file in the lib folder in Moodles root
directory. It contains all the functions like printing block
headers, contents and footers, controlling behavior of block
etc. It is not mandatory to use blocklib.php class to your
block. If anyone like to have different functions than there
exists, can be created a separate file and call those functions
via moodleblock.class.php file.
III. DEMAND
Current course list has some issues regarding when increase
of number of courses in the list. Users like to have clean and
clear course list on their view to grab courses quickly. But this
does not meet with current course list. Users like to see
completed subjects to be hidden if they want to see them and
provide that too - and save space on the block. Also it is desire
to categorize courses according to the level it belongs to and it
makes clear cut of selecting courses quickly.
While providing those features we cant forget basic user
requirements that Moodle users are expecting. Like simplicity,
clearness, performance etc. All those have to be addressed by
the solution.
IV. IMPLEMENTATION
Before any implementation is to be started I searched for a
tree structure which I can use in my course list. First I thought
about external tree structure which will be available in
internet. But later I found out that there is already an internal
tree structure which is using for administrator option
displaying. (The tree list in the left hand side of the main page
of administrator logged-in) More observations has done by me
especially about where its origin and how the implementation
of it has been done. This admin tree is located same directory
in blocks. But the implementation is not generic, that is it is
not reusable for other things due to the hardcode of nodes and
all other things. So I had to look on another way to reuse it in
my project.
Idea was raised in my mind to create a new tree list block
type which may helps to other developers too in their future
developments. So, I examined how to create a new block type.
To create a new block type it has to use
moodleblock.class.php file. Inside it we can create a new
class with new parameters which may help to build a tree list
Description
Stores node identification number.
Display text of node.
Array indicating children items of
node. Just only by text.
icons[]*
Array indication icon for each
children node.
visibility[]*
Array storing the visibility of each
children node.
flags[]
Array of storing extra information on
processing each node.
recent_activities[] Array of storing number of recent
activities for each course.
footer
Footer text for node.
Node structure in tree list
* - mandatory when implementing your own tree list.
3
already modified its module as they want and replacing that
same module with ours may not have those changed
functionalities at all. By all those reasons led me to create a
separate library module. It also may helpful even when
installing process.
Now the important part has to be implemented in that
library module that is printing function of the tree block. We
cant use currently existing printing function or change it
because it supports only text type and list type blocks. Since
tree functions are more different than above those two types I
had to create a new function for printing. As usual there
should have three printing functions one is for block header
printing, one for content printing and the other is for footer
printing. In my case, header printing is same as other blocks
but content and footer is different.
Content printing is the most complex part. Because PHP
doesnt have in-built sorting functions which helpful in my
case to filter courses according to completeness. All things
have to be implemented by myself very carefully with having
consistent code too. In sorting currently on-going subjects
have to be filtered on top of the node items while completed
ones are at the bottom. Following indicates the pseudo code
for sorting method.
for each (node in tree)
while (not all items in node are added)
for each (item in node)
if (item has on-going)
print node item
mark the node as added
block_course_treelist.php
moodleblock.class.php
block_course_list
settings.php
Setting
Type of categorization
coursetreelib.php
5/375
0/52
Functions
/Lines
9/1110
3/90
V. FLEXIBILITY
Description
0/49
Images
Following images have been used for the project and tree
list.
Image
Image File Name
Description
expandall.gif
Used for settings icons
collapseall.gif
tick_green_big.gif
Completed course icon
arrow_collapsed.gif
Node status icons
arrow_expanded.gif
course.gif
General course icon
Module summary
Module
Description
Type of categorization
whether nodes are sorted
according to completeness
or by levels.
Show/hide number of
recent activities since
user's last log-on.
Which font-size to be used
for completed subjects.
Automatically hides nodes
which all courses are
completed.
Automatically collapse
nodes which all courses are
completed.
Use distinguishable icons
for differentiate completed
and on-going courses.
Shows/hides the personal
settings for course block.
The level which
postgraduate courses are
started.
4
These administrator settings are displayed under Modules >
Blocks > Course in administrator main page. Those settings
are never accessible by general users. So Moodle
administrator should aware the best settings which suitable for
their institute.
Other type of setting is Personal settings which allow
individual users to customize the behavior according to their
personal desires. This is more limited section than
administrator settings, but assumes more powerful. These
settings are shown just above the course tree list contents in
the block. There are one check box and two links. Check box
used to quickly show/hide the completed courses in tree list.
When the number of courses are increasing, the unnecessary
courses completed courses may not want to display or
sometimes users may want to access to completed courses. To
provide this ability it is poor design to implement this setting
on administrator side. Other two links are used to quickly
expand and collapse tree nodes. This is extremely important in
time saving by reducing some clicks. More important thing
regarding on these personal settings is it has the ability to save
your personalized settings even you logged-out by using
cookies. In next time you logged-in to the system those saved
settings will be automatically loaded. Not only settings but
also the node status like it is expanded or not are capable
of saving and restoring. This ability is so much valuable in
users side because user may not want to do same adjustments
again and again. There is one thing to remember that those
settings are saved only for 30 days period. That is if you didnt
log in to system for a 30 day period, your settings will be
expired and default settings may take in place. If you want to
change the length of time taken to store settings can be
increased via the code by changing only value in a variable.
VI. CONCLUSION
In this paper I proposed a comprehensive course list has
been implemented by using a tree list for Moodle users to
easier their course picking. In future I hope to extend this
project into which the recent activities are shown in tool tips
when you move your cursor on the course item. Then there
wont be any necessary to click the course and search for
where are the recent updates.
ACKNOWLEDGMENT
Special thanks goes to my parents for helping throughout
this project even they dont know nothing about computer but
providing recourses when I am in trouble. Also thanks goes to
our level 3 project advisors and coordinator Ms. Shahani
Markus Weerawarne who taught us more important concepts
and principles about software engineering and its field. And
also all the other staff who helps me throughout this project
development period. They all are warmly acknowledged.
REFERENCES
[Online]: http://docs.moodle.org/en/Development :
Developer Documentation of Moodle, 6th of March 2011.
[Online]:http://www.w3schools.com/PHP/php_cookies.asp :
PHP Cookies, 6th of March 2011.
[Online]: http://www.w3schools.com/php/default.asp : PHP,
6th March 2011.