Source for file module_base.php

Documentation is available at module_base.php

  1. <?php
  2.     // This file is part of the Sloodle project (www.sloodle.org)
  3.     
  4.     /**
  5.     * This file defines the base class for Sloodle modules.
  6.     * (Each module is effectively a sub-type of the Moodle module).
  7.     *
  8.     * @package sloodle
  9.     * @copyright Copyright (c) 2008 Sloodle (various contributors)
  10.     * @license http://www.gnu.org/licenses/gpl-3.0.html GNU GPL v3
  11.     *
  12.     * @contributor Peter R. Bloomfield
  13.     */
  14.     
  15.     /**
  16.     * Sloodle module base class.
  17.     * An abstract class which must be overridden by sub-classes.
  18.     * @package sloodle
  19.     */
  20.     class SloodleModule
  21.     {
  22.     // DATA //
  23.     
  24.         /**
  25.         * Reference to the containing {@link SloodleSession} object.
  26.         * If null, then this module is being used outwith the framework.
  27.         * <b>Always check the status of the variable before using it!</b>
  28.         * @var object 
  29.         * @access protected
  30.         */
  31.         var $_session = null;
  32.         
  33.     
  34.     // FUNCTIONS //
  35.     
  36.         /**
  37.         * Constructor - initialises the session variable
  38.         * @param object &$_session A reference to the containing {@link SloodleSession} object, if available.
  39.         */
  40.         function SloodleModule(&$_session)
  41.         {
  42.             if (!is_null($_session)) $this->_session = &$_session;
  43.         }
  44.         
  45.         
  46.         /**
  47.         * Loads data from the database.
  48.         * Note: even if the function fails, it may still have overwritten some or all existing data in the object.
  49.         * @param mixed $id The site-wide unique identifier for all modules. Type depends on VLE. On Moodle, it is an integer course module identifier ('id' field of 'course_modules' table)
  50.         * @return bool True if successful, or false otherwise
  51.         */
  52.         function load($id)
  53.         {
  54.             return true;
  55.         }
  56.         
  57.         
  58.     // ACCESSORS //
  59.     
  60.         /**
  61.         * Gets the name of this module instance.
  62.         * @return string The name of this controller
  63.         */
  64.         function get_name()
  65.         {
  66.             return '';
  67.         }
  68.         
  69.         /**
  70.         * Gets the intro description of this module instance, if available.
  71.         * @return string The intro description of this controller
  72.         */
  73.         function get_intro()
  74.         {
  75.             return '';
  76.         }
  77.         
  78.         /**
  79.         * Gets the identifier of the course this controller belongs to.
  80.         * @return mixed Course identifier. Type depends on VLE. (In Moodle, it will be an integer).
  81.         */
  82.         function get_course_id()
  83.         {
  84.             return 0;
  85.         }
  86.         
  87.         /**
  88.         * Gets the time at which this instance was created, or 0 if unknown.
  89.         * @return int Timestamp
  90.         */
  91.         function get_creation_time()
  92.         {
  93.             return 0;
  94.         }
  95.         
  96.         /**
  97.         * Gets the time at which this instance was last modified, or 0 if unknown.
  98.         * @return int Timestamp
  99.         */
  100.         function get_modification_time()
  101.         {
  102.             return 0;
  103.         }
  104.         
  105.         
  106.         /**
  107.         * Gets the short type name of this instance.
  108.         * @return string 
  109.         */
  110.         function get_type()
  111.         {
  112.             return '';
  113.         }
  114.  
  115.         /**
  116.         * Gets the full type name of this instance, according to the current language pack, if available.
  117.         * Note: should be overridden by sub-classes.
  118.         * @return string Full type name if possible, or the short name otherwise.
  119.         */
  120.         function get_type_full()
  121.         {
  122.             return '';
  123.         }
  124.     }
  125.  
  126. ?>

Documentation generated on Mon, 07 Jul 2008 12:32:49 +0100 by phpDocumentor 1.4.0