官术网_书友最值得收藏!

The scope of creating an activity module

As we start to make an activity module, it's important to note that activity modules are inherently more complex than both blocks and filters. An activity module has roughly ten required PHP files, over a dozen functions, three sub folders, and an icon graphic. This is in sharp contrast to the other module types that we created in earlier chapters. Following is a listing of the structure of an empty activity module. We will flesh out each component of the listing as we progress through the chapter:

  • ./README.txt
  • ./lib.php
  • ./restorelib.php
  • ./lang
  • ./lang/en_utf8
  • ./lang/en_utf8/foo.php
  • ./lang/en_utf8/help
  • ./lang/en_utf8/help/newmodule
  • ./lang/en_utf8/help/newmodule/index.html
  • ./lang/en_utf8/help/newmodule/mods.html
  • ./version.php
  • ./mod_form.php
  • ./backuplib.php
  • ./submit_form.php
  • ./view.php
  • ./icon.gif
  • ./index.php
  • ./db
  • ./db/access.php
  • ./db/upgrade.php
  • ./db/install.xml

See http://docs.moodle.org/en/Development:Modules for the official project documentation on activity module development.

Included in this chapter's source code files is an empty template folder for starting a new activity module. The folder is named NEWMODULE.

Most new modules are created by using the NEWMODULE template, which is a contributed module. This means that the module is not part of the Moodle core distribution, but has been donated to the Moodle project under the same GPL. The module can be downloaded from http://moodle.org/mod/data/view.php?d=13&rid=715&filter=1. NEWMODULE is a useful starting point for creating our activity. However, it does miss a few important functional requirements. The most notable of these is the lack of backup and restore functionality. The code in this chapter, while based on NEWMODULE, also includes adapted components from other core modules, especially in places where NEWMODULE is incomplete. This method of examining the core code, as a way to learn how Moodle works, is common practice in the Moodle development community. In the next section, we will describe the features of the module that we will be creating in this chapter.

主站蜘蛛池模板: 广东省| 白山市| 子长县| 花垣县| 韶山市| 长宁区| 顺昌县| 汽车| 荆门市| 温州市| 富民县| 红河县| 岳阳市| 南昌市| 方城县| 当涂县| 荣昌县| 遵义县| 万安县| 罗平县| 宜城市| 日土县| 亳州市| 无锡市| 天气| 巴东县| 大关县| 都江堰市| 文昌市| 永昌县| 淳安县| 蓬安县| 济南市| 宿迁市| 丁青县| 金华市| 宣汉县| 甘洛县| 漳浦县| 枝江市| 收藏|