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

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.

主站蜘蛛池模板: 固安县| 宜兴市| 佛学| 开封县| 隆化县| 万州区| 当阳市| 沙洋县| 饶河县| 报价| 日喀则市| 章丘市| 崇礼县| 铜梁县| 绍兴市| 正镶白旗| 石家庄市| 南宫市| 民勤县| 略阳县| 花垣县| 刚察县| 扬州市| 芷江| 汝城县| 南和县| 仙居县| 中山市| 施秉县| 台北市| 扎赉特旗| 沂南县| 潮州市| 内江市| 瑞金市| 布拖县| 班玛县| 乳源| 台州市| 桐庐县| 瓦房店市|