RECENT ADVANCES IN APPLIED MATHEMATICS AND COMPUTATIONAL AND INFORMATION SCIENCES - Volume II

Activity Module Development for Moodle: A Sample Activity Module, EduGame

SERKAN CANKAYA Department of Computer Education & Instructional Technologies Anadolu University, Institute of Educational Sciences, Eskisehir, TURKEY [email protected]

SERKAN IZMIRLI Department of Computer Education & Instructional Technologies Anadolu University, Institute of Educational Sciences, Eskisehir, TURKEY [email protected]

Abstract: - Moodle, one of the most popular course management systems (CMSs), has a highly extendable infrastructure. Moodle is an open source CMS. Everyone can easily contribute to the development of Moodle with plug-ins, activity modules, blocks and so on. The most used contribution method is activity modules. Moodle has a list of activities by default (forums, quizzes, assignments, etc.). Teachers can use these activities in their classroom to support lessons. But sometimes default activities do not meet the needs of teachers. Therefore, activity module development can be important for efficient use of Moodle in some circumstances. In this study, Moodle infrastructure and development steps of a sample activity module, EduGame, will be explained in a step by step manner. EduGame activity module is a tool to integrate educational flash games into the Moodle. It also saves the game points of students into the Moodle database. Educational computer games are great ways for teachers to pique children’s interest in the learning process. So integrating educational computer games to Moodle can be crucial for computer game based learning.

Key-Words: - CMS, Moodle, Activity module

1 Introduction provide to upload and share materials, hold online chats, In the 21st century, ongoing technological developments give quizzes, gather and reviewing assignments and affect all part of human life. Especially with the record grades [3]. CMS provide automation of emergence of Internet, there has been a paradigm shift in educational activities. Systems like Moodle life. Education has also taken its share. As a result, (www.moodle.org), Atutor (www.atutor.ca), Blackboard virtual learning environments and Web-based learning (http://www.blackboard.com), Dokeos environments came on the scene. Educational (www.dokeos.com) are the examples of CMSs. Among environments started to be designed considering these sytems Moodle is widely used by the users. individual differences. Web-based education is more student centered rather 2 Moodle Infrastructure than teacher centered [1]. 21st century students want to Moodle is a CMS and also known as a Learning learn from pictures, sound and . One of these Management System (LMS). The acronym Moodle students’ characteristics is to learn from interactive and stands for “Modular Object-Oriented Dynamic Learning networked environment more effectively than face to Environment”. Moodle’s aim is to deliver online courses face environment [2]. So in today’s world it is not and to supplement face to face courses. It is used by enough to teach them in face to face learning universities, K-schools, businesses and individuals. It is environments. These students want to engage in the an open source CMS that means anyone can use it for Web. Although their limited knowledge about free and develop it. programming, teachers need to use the Web as an aid to Moodle’s founder and lead developer is Martin teach their lessons. One of the ways of using web Dougiamas. He lives in Perth, Western Australia [4]. effectively is to use Course Management Systems Moodle is developed and upgraded by developers (CMSs). every day. The latest Moodle was released in 28th CMSs provide educators tools that are easy to use to January 2009. It was officially named Moodle 1.9.4. create a course web site. They provide access control and You can download it from the official web site of offer tools to make a course effective. Moreover, they Moodle, http://download.moodle.org. Moodle requires a

ISSN: 1790-5117 366 ISBN: 978-960-474-071-0 RECENT ADVANCES IN APPLIED MATHEMATICS AND COMPUTATIONAL AND INFORMATION SCIENCES - Volume II

platform running Apache, MySQL and PHP. There are Chat: The Chat activity module allows students to currently a total of 78 language packs. have a real-time synchronous discussion via the web. Some characteristics of Moodle are given in the Forum: Forum activity module allows students to following. discuss on a topic. Everyone in the course can contribute • It supports learning theory of constructivism. to the discussion. Students can attach files to their posts. • It is an alternative to high-priced CMSs like Also teacher can lead the discussions. WebCT& Blackboard. Wiki: Wiki activity module enables students to create • It has lots of developers. documents that can be edited by everyone • It has learning communication tools that are collaboratively. In another words, it enables participants discussion board, forum, calendar and chat. to work together on web pages to add, expand and • With search box users can search in forums. change the content. • Teachers can add discussions and course activities to any date they want. • There are four kinds of users: administrator, 4 Activity Module Development teacher, student and guest. There is a template module file, NEWMODULE.zip, on • Users should have a user name and password for the official web site of Moodle authentication (http://download.moodle.org/plugins19/mod/NEWMOD • It provides some standard question types: essay, ULE.zip). This template module file has directories and multiple-choice, matching, embedded answers files which contain default codes and related (cloze test/gap fill), short answer and so on. explanations as comments. This file is a good starting • All information like forum writings, homework, point for activity module development. and student’s access time are logged to the Activity modules reside in the '' directory. Each Moodle for teachers. module is in a separate subdirectory and consists of the Because of its open source nature, lots of institutions following mandatory elements (plus extra scripts unique including universities use Moodle to do Internet based to each module). courses In Turkey. Some Universities using Moodle are: • mod_form.php - a form to set up or update an • Anadolu University: instance of this module. http://moodle.anadolu.edu.tr/ • version.php - defines some meta-info. • Canakkale Onsekiz Mart University: • icon.gif - a 16x16 icon for the module. http://bue.comu.edu.tr • index.php - a page to list all instances in a • Kocaeli University: http://moodle.kou.edu.tr/ course. • Selcuk University: http://www.sutef.gen.tr/ • view.php - a page to view a particular instance. Moodle has open source license and it is modular. • lib.php - any/all functions defined by the module This means that anyone can develop additional should be in here. There are some mandatory functionality. Developers can add new themes, blocks functions that the developer must implement. and activity modules. A Moodle theme does not affect Descriptions of these functions as PHP functions of Moodle, it is affect how it looks. All comments can be found in the “lib.php” file. information in a course is organized in separate blocks. • db/install.xml - defines the structure of database For example, the Upcoming Events block displays future tables for all database types. It is used during events. Activities block used by teacher to add an module installation. activity (forums, assignments, quizzes and so on). • db/upgrade.php - defines changes in the Activity modules are activities that teachers add to their structure of database tables. It is used during courses to supply resources for students. module upgrade. NEWMODULE.zip file is extracted into NEWMODULE directory. And NEWMODULE 3 Activity Module directory is renamed as “edugame”. Moodle contains a wide range of activity modules. In A database table needs to be created for modules with this part popular activity modules are explained. the same name as new module. This table must have at Assignment: Assignment activity module is used to least three fields: id, course and name. give homework to students. Student can upload their EduGame activitiy module should have two tables in homework as file within the given time period. Then the Moodle database. First table, which is named as teacher can look at the students’ homework and give “edugame”, is for module information and contains the them feedbacks. following fields:

ISSN: 1790-5117 367 ISBN: 978-960-474-071-0 RECENT ADVANCES IN APPLIED MATHEMATICS AND COMPUTATIONAL AND INFORMATION SCIENCES - Volume II

• id: auto-increment and mandatory for all Moodle Moodle to create tables automatically while installing tables. the module. This template file is in XML format and has • course: id of the course including the module. sample lines that can guide developer to write module • name: the name of the activity. specific table information. Edugame and • intro: description of the activity. edugame_points tables’ field information is written to • introformat: format of the intro field (PLAIN, the db/install.xml file. HTML,...). There are language files in the lang directory. The • timecreated: the time the activity created. default language file is in lang/en_utf8/newmodule.php. This file should be renamed and edited when necessary. • timemodified: the time the activity updated. After writing appropriate install.xml file, all • file: uploaded SWF file name. “newmodule” words should be replaced by “edugame” Second table is named as “edugame_points”. This word in all files in edugame directory. table contains the students’ points of the games uploaded Incomplete edugame directory then can moved to the and has the following fields: mod directory of Moodle for installation. After moving, id: auto-increment and mandatory for all Moodle • clicking Site Administration / Notifications link installs tables. the edugame activity module and its tables. • edugameid: reference to the activity. After installing edugame, mod_form.php file should • userid: reference to the user. be edited. This file shows an html form to set up or • point: student’s points. update an instance of this module. This file looks like the • time: when student plays the games. following. These two tables can be created directly in the Moodle database. But the best way of doing it is writing table information into db/install.xml file and letting the global $COURSE; $mform =& $this->_form; $mform->addElement('header', 'general', get_string('general', 'form')); $mform->addElement('text', 'name', get_string('edugame', 'edugame'), array('size'=>'64')); $mform->setType('name', PARAM_TEXT); $mform->addRule('name', null, 'required', null, 'client'); $mform->addElement('htmleditor', 'intro', get_string('edugameintro', 'edugame')); $mform->setType('intro', PARAM_RAW); $mform->addRule('intro', get_string('required'), 'required', null, 'client'); $mform->addElement('format', 'introformat', get_string('format')); $mform->addElement('choosecoursefile', 'file', get_string('file', 'edugame'), array('courseid'=>$COURSE->id)); $mform->addRule('file', get_string('required'), 'required', null, 'client'); $this->standard_coursemodule_elements(); $this->add_action_buttons(); After modifying mod_form.php file, teachers or administrators can add EduGame activities to their In “Adding a new EduGame” page (Figure 2), after classes. To add EduGame activity, EduGame option filling in the required fields and pressing “Save and should be selected from the activities list (Figure 1). Return to course” button, the activity is added to the class. In this process, edugame_add_instance() function is called in the lib.php file. The default content of this function is enough to save the activity data to the edugame table in the database.

Figure 1. Activity list

ISSN: 1790-5117 368 ISBN: 978-960-474-071-0 RECENT ADVANCES IN APPLIED MATHEMATICS AND COMPUTATIONAL AND INFORMATION SCIENCES - Volume II

Figure 2. Adding a new EduGame

To enable students to view the edugame activity activity module the following codes are written in the module, view.php file should be modified. For edugame place of "YOUR CODE GOES HERE" line.

$click_to_play = get_string("click_to_play","edugame"); $edugame_link = "".$edugame->name.""; $table->head = array ($edugame->name); $table->align = array ("CENTER"); $table->data[] = array( $edugame->intro ); $table->data[] = array( $click_to_play . $edugame_link ); print_table($table); echo "

"; print_string("top10","edugame"); echo ""; $table2->head = array ( get_string("firstname","edugame" ),get_string("lastname","edugame" ),get_string("point","edugame" ),get_string("time","edugame" )); $table2->align = array ("LEFT","LEFT","RIGHT","RIGHT"); $edugame_points_sql = 'SELECT * FROM '. $CFG->prefix . 'edugame_points where edugameid=\''.$edugame->id.'\' order by point DESC' ; $edugame_points_result = mysql_query($edugame_points_sql ); $i=0; while($edugame_points_row=mysql_fetch_array($edugame_points_result,MYSQL_BOTH)){ $edugame_user = get_record("user","id",$edugame_points_row["userid"]); $table2->data[] = array( $edugame_user->firstname, $edugame_user->lastname, $edugame_points_row["point"], userdate($edugame_points_row["time"]) ); $i++; if($i == 10) break; } print_table($table2);

ISSN: 1790-5117 369 ISBN: 978-960-474-071-0 RECENT ADVANCES IN APPLIED MATHEMATICS AND COMPUTATIONAL AND INFORMATION SCIENCES - Volume II

When students click on the link of activity module students who played the game and achieved the top 10 added by teacher, they see the web page in Figure 3. score. In addition, this score list includes the times when There are two tables in this web page. In the table above, the students played the games. there is information about the activity and a link to start the flash game. In the table below, there is a score list of

Figure 3. Output of view.php file

As seen in the view.php source code, there should be opened and the flash game in the activity starts. When another file named play.php. This file is for students to the student finishes playing the game, play.php file play the educational games. When student click on the shows the web page in Figure 4. This page shows the “Click to Play” link in view.php file, play.php file is student’s own top 10 points.

Figure 4. Student’s own top 10 points

Flash game should be modified to run with EduGame getURL(wwwroot+"/mod/edugame/play.php?userid="+u activity module appropriately. The variables which are serid+"&point="+point+"&id="+id); “course ID”, “user ID”, “first name”, “last name” and The complete package of EduGame activity module “the URL of Moodle web site” are sent to the flash game can be downloaded from the Internet address, with using html tag in play.php file. Also flash http://moodle.org/mod/data/view.php?d=13&rid=2197. game should send the student’s game points to the play.php file using the following code when the game finishes.

ISSN: 1790-5117 370 ISBN: 978-960-474-071-0 RECENT ADVANCES IN APPLIED MATHEMATICS AND COMPUTATIONAL AND INFORMATION SCIENCES - Volume II

5 Conclusion In today’s world, students have used technological tools in all of their life. This situation has affected their opinions, lifestyles, and expectation substantially. Therefore, it is not enough to teach them in face to face learning environments. 21st century students want to learn from multimedia which is an interactive and networked environment including pictures, sound and video. Because Moodle is an application of multimedia, it can be used effectively for 21st century students. Moodle, php, and MySql are all free . Therefore, installing a Moodle system for an educational institute costs little. Because Moodle has lots of developers all over the world, it is a highly secure system in spite of costless. EduGame activity module was coded and installed to the Moodle system easily. Because Moodle has a higly extendable and user friendly infrastructure. Therefore, everyone can write their own activity modules by following a few easy steps. The official Moodle web site has documentation and forum pages which developers share their experiences. Because Moodle is developed with php language and uses mostly MySql database management system, mastering php and MySql is crucial for activity module development.

References: [1] Knowlton, Dave S. (2000). A theoretical framework for the classroom: A defense and delineation of student-centered pedagogy. In R. E, Weiss, D. S. Knowlton, & B.W. Speck, (Eds.) Principles of effective teaching in the online classroom. (pp. 5- 14). San Francisco, CA.: Jossey-Bass. [2]. Rodgers, M., Runyon, D., Starrett, D. ve Holzen, R. V. (2006). The 21st century learner. Retrieved February 10, 2009, from http://www.wisc.edu/depd/series/06_4168.pdf [3] Cole, J. & Foster, H. (2007). Using Moodle: Teaching with the Popular Open Source Course Management System (2nd Edition). Farnham: O'Reilly. [4] Dougiamas, M. (2007). Dougiamas. Retrieved February 10, 2009, from http://dougiamas.com/

ISSN: 1790-5117 371 ISBN: 978-960-474-071-0