https://www.mediawiki.org/wiki/Special:Code/MediaWiki/111469

Revision: 111469
Author:   jeroendedauw
Date:     2012-02-14 18:12:22 +0000 (Tue, 14 Feb 2012)
Log Message:
-----------
follow up to r111468

Modified Paths:
--------------
    trunk/extensions/EducationProgram/EducationProgram.php
    trunk/extensions/EducationProgram/includes/EPCA.php
    trunk/extensions/EducationProgram/includes/EPCourse.php
    trunk/extensions/EducationProgram/includes/EPInstructor.php
    trunk/extensions/EducationProgram/includes/EPOA.php
    trunk/extensions/EducationProgram/includes/EPOrg.php
    trunk/extensions/EducationProgram/includes/EPOrgPager.php
    trunk/extensions/EducationProgram/includes/EPPager.php
    trunk/extensions/EducationProgram/includes/EPRevision.php
    trunk/extensions/EducationProgram/includes/EPRevisions.php
    trunk/extensions/EducationProgram/includes/EPRoleObject.php
    trunk/extensions/EducationProgram/includes/EPStudent.php
    trunk/extensions/EducationProgram/includes/EPUtils.php

Added Paths:
-----------
    trunk/extensions/EducationProgram/includes/EPCAs.php
    trunk/extensions/EducationProgram/includes/EPCourses.php
    trunk/extensions/EducationProgram/includes/EPInstructors.php
    trunk/extensions/EducationProgram/includes/EPOAs.php
    trunk/extensions/EducationProgram/includes/EPOrgs.php
    trunk/extensions/EducationProgram/includes/EPStudents.php

Modified: trunk/extensions/EducationProgram/EducationProgram.php
===================================================================
--- trunk/extensions/EducationProgram/EducationProgram.php      2012-02-14 
18:11:52 UTC (rev 111468)
+++ trunk/extensions/EducationProgram/EducationProgram.php      2012-02-14 
18:12:22 UTC (rev 111469)
@@ -100,6 +100,13 @@
 $wgAutoloadClasses['EPArticlePager']                           = dirname( 
__FILE__ ) . '/includes/EPArticlePager.php';
 $wgAutoloadClasses['EPArticleTable']                           = dirname( 
__FILE__ ) . '/includes/EPArticleTable.php';
 $wgAutoloadClasses['EPRevisionAction']                                 = 
dirname( __FILE__ ) . '/includes/EPRevisionAction.php';
+$wgAutoloadClasses['EPOrgs']                                           = 
dirname( __FILE__ ) . '/includes/EPOrgs.php';
+$wgAutoloadClasses['EPCourses']                                        = 
dirname( __FILE__ ) . '/includes/EPCourses.php';
+$wgAutoloadClasses['EPStudents']                                       = 
dirname( __FILE__ ) . '/includes/EPStudents.php';
+$wgAutoloadClasses['EPOAs']                                            = 
dirname( __FILE__ ) . '/includes/EPOAs.php';
+$wgAutoloadClasses['EPCAs']                                            = 
dirname( __FILE__ ) . '/includes/EPCAs.php';
+$wgAutoloadClasses['EPInstructors']                            = dirname( 
__FILE__ ) . '/includes/EPInstructors.php';
+$wgAutoloadClasses['EPRevisions']                                      = 
dirname( __FILE__ ) . '/includes/EPRevisions.php';
 
 $wgAutoloadClasses['CoursePage']                                       = 
dirname( __FILE__ ) . '/pages/CoursePage.php';
 $wgAutoloadClasses['EPPage']                                           = 
dirname( __FILE__ ) . '/pages/EPPage.php';

Modified: trunk/extensions/EducationProgram/includes/EPCA.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPCA.php 2012-02-14 18:11:52 UTC 
(rev 111468)
+++ trunk/extensions/EducationProgram/includes/EPCA.php 2012-02-14 18:12:22 UTC 
(rev 111469)
@@ -14,50 +14,6 @@
 class EPCA extends EPRoleObject implements EPIRole {
 
        /**
-        * (non-PHPdoc)
-        * @see DBDataObject::getDBTable()
-        */
-       public static function getDBTable() {
-               return 'ep_cas';
-       }
-       
-       /**
-        * (non-PHPdoc)
-        * @see DBDataObject::getFieldPrefix()
-        */
-       public static function getFieldPrefix() {
-               return 'ca_';
-       }
-       
-       /**
-        * @see parent::getFieldTypes
-        *
-        * @since 0.1
-        *
-        * @return array
-        */
-       protected static function getFieldTypes() {
-               return array(
-                       'id' => 'id',
-
-                       'user_id' => 'int',
-                       'bio' => 'str',
-                       'photo' => 'str',
-               );
-       }
-       
-       /**
-        * (non-PHPdoc)
-        * @see DBDataObject::getDefaults()
-        */
-       public static function getDefaults() {
-               return array(
-                       'bio' => '',
-                       'photo' => '',
-               );
-       }
-
-       /**
         * Display a pager with campus ambassadors.
         *
         * @since 0.1

Added: trunk/extensions/EducationProgram/includes/EPCAs.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPCAs.php                        
        (rev 0)
+++ trunk/extensions/EducationProgram/includes/EPCAs.php        2012-02-14 
18:12:22 UTC (rev 111469)
@@ -0,0 +1,75 @@
+<?php
+
+/**
+ * Class representing the ep_cas table.
+ *
+ * @since 0.1
+ *
+ * @file EPCAs.php
+ * @ingroup EducationProgram
+ *
+ * @licence GNU GPL v3 or later
+ * @author Jeroen De Dauw < jeroended...@gmail.com >
+ */
+class EPCAs extends DBTable {
+
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getDBTable()
+        * @since 0.1
+        * @return string
+        */
+       public function getDBTable() {
+               return 'ep_cas';
+       }
+       
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getFieldPrefix()
+        * @since 0.1
+        * @return string
+        */
+       public function getFieldPrefix() {
+               return 'ca_';
+       }
+       
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getDataObjectClass()
+        * @since 0.1
+        * @return string
+        */
+       public function getDataObjectClass() {
+               return 'EPCA';
+       }
+       
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getFieldTypes()
+        * @since 0.1
+        * @return array
+        */
+       public function getFieldTypes() {
+               return array(
+                       'id' => 'id',
+
+                       'user_id' => 'int',
+                       'bio' => 'str',
+                       'photo' => 'str',
+               );
+       }
+       
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getDefaults()
+        * @since 0.1
+        * @return array
+        */
+       public function getDefaults() {
+               return array(
+                       'bio' => '',
+                       'photo' => '',
+               );
+       }
+
+}


Property changes on: trunk/extensions/EducationProgram/includes/EPCAs.php
___________________________________________________________________
Added: svn:eol-style
   + native

Modified: trunk/extensions/EducationProgram/includes/EPCourse.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPCourse.php     2012-02-14 
18:11:52 UTC (rev 111468)
+++ trunk/extensions/EducationProgram/includes/EPCourse.php     2012-02-14 
18:12:22 UTC (rev 111469)
@@ -88,97 +88,6 @@
                return $map[$status];
        }
 
-       /**
-        * (non-PHPdoc)
-        * @see DBDataObject::getDBTable()
-        */
-       public static function getDBTable() {
-               return 'ep_courses';
-       }
-       
-       /**
-        * (non-PHPdoc)
-        * @see DBDataObject::getFieldPrefix()
-        */
-       public static function getFieldPrefix() {
-               return 'course_';
-       }
-       
-       /**
-        * @see parent::getFieldTypes
-        *
-        * @since 0.1
-        *
-        * @return array
-        */
-       protected static function getFieldTypes() {
-               return array(
-                       'id' => 'id',
-
-                       'org_id' => 'int',
-                       'name' => 'str',
-                       'start' => 'str', // TS_MW
-                       'end' => 'str', // TS_MW
-                       'description' => 'str',
-                       'token' => 'str',
-                       'students' => 'array',
-                       'instructors' => 'array',
-                       'online_ambs' => 'array',
-                       'campus_ambs' => 'array',
-                       'field' => 'str',
-                       'level' => 'str',
-                       'term' => 'str',
-                       'lang' => 'str',
-                       'mc' => 'str',
-
-                       'student_count' => 'int',
-                       'instructor_count' => 'int',
-                       'oa_count' => 'int',
-                       'ca_count' => 'int',
-               );
-       }
-
-       /**
-        * (non-PHPdoc)
-        * @see DBDataObject::getDefaults()
-        */
-       public static function getDefaults() {
-               return array(
-                       'name' => '',
-                       'start' => wfTimestamp( TS_MW ),
-                       'end' => wfTimestamp( TS_MW ),
-                       'description' => '',
-                       'token' => '',
-                       'students' => array(),
-                       'instructors' => array(),
-                       'online_ambs' => array(),
-                       'campus_ambs' => array(),
-                       'field' => '',
-                       'level' => '',
-                       'term' => '',
-                       'lang' => '',
-                       'mc' => '',
-
-                       'student_count' => 0,
-                       'instructor_count' => 0,
-                       'oa_count' => 0,
-                       'ca_count' => 0,
-               );
-       }
-       
-       /**
-        * (non-PHPdoc)
-        * @see DBDataObject::getSummaryFields()
-        */
-       public static function getSummaryFields() {
-               return array(
-                       'student_count',
-                       'instructor_count',
-                       'oa_count',
-                       'ca_count',
-               );
-       }
-
        protected static $countMap = array(
                'student_count' => 'students',
                'instructor_count' => 'instructors',

Added: trunk/extensions/EducationProgram/includes/EPCourses.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPCourses.php                    
        (rev 0)
+++ trunk/extensions/EducationProgram/includes/EPCourses.php    2012-02-14 
18:12:22 UTC (rev 111469)
@@ -0,0 +1,124 @@
+<?php
+
+/**
+ * Class representing the ep_courses table.
+ *
+ * @since 0.1
+ *
+ * @file EPCourses.php
+ * @ingroup EducationProgram
+ *
+ * @licence GNU GPL v3 or later
+ * @author Jeroen De Dauw < jeroended...@gmail.com >
+ */
+class EPCourses extends DBTable {
+
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getDBTable()
+        * @since 0.1
+        * @return string
+        */
+       public function getDBTable() {
+               return 'ep_courses';
+       }
+       
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getFieldPrefix()
+        * @since 0.1
+        * @return string
+        */
+       public function getFieldPrefix() {
+               return 'course_';
+       }
+       
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getDataObjectClass()
+        * @since 0.1
+        * @return string
+        */
+       public function getDataObjectClass() {
+               return 'EPCourse';
+       }
+       
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getFieldTypes()
+        * @since 0.1
+        * @return array
+        */
+       public function getFieldTypes() {
+               return array(
+                       'id' => 'id',
+
+                       'org_id' => 'int',
+                       'name' => 'str',
+                       'start' => 'str', // TS_MW
+                       'end' => 'str', // TS_MW
+                       'description' => 'str',
+                       'token' => 'str',
+                       'students' => 'array',
+                       'instructors' => 'array',
+                       'online_ambs' => 'array',
+                       'campus_ambs' => 'array',
+                       'field' => 'str',
+                       'level' => 'str',
+                       'term' => 'str',
+                       'lang' => 'str',
+                       'mc' => 'str',
+
+                       'student_count' => 'int',
+                       'instructor_count' => 'int',
+                       'oa_count' => 'int',
+                       'ca_count' => 'int',
+               );
+       }
+
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getDefaults()
+        * @since 0.1
+        * @return array
+        */
+       public function getDefaults() {
+               return array(
+                       'name' => '',
+                       'start' => wfTimestamp( TS_MW ),
+                       'end' => wfTimestamp( TS_MW ),
+                       'description' => '',
+                       'token' => '',
+                       'students' => array(),
+                       'instructors' => array(),
+                       'online_ambs' => array(),
+                       'campus_ambs' => array(),
+                       'field' => '',
+                       'level' => '',
+                       'term' => '',
+                       'lang' => '',
+                       'mc' => '',
+
+                       'student_count' => 0,
+                       'instructor_count' => 0,
+                       'oa_count' => 0,
+                       'ca_count' => 0,
+               );
+       }
+       
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getSummaryFields()
+        * @since 0.1
+        * @return array
+        */
+       public function getSummaryFields() {
+               return array(
+                       'student_count',
+                       'instructor_count',
+                       'oa_count',
+                       'ca_count',
+               );
+       }
+       
+}


Property changes on: trunk/extensions/EducationProgram/includes/EPCourses.php
___________________________________________________________________
Added: svn:eol-style
   + native

Modified: trunk/extensions/EducationProgram/includes/EPInstructor.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPInstructor.php 2012-02-14 
18:11:52 UTC (rev 111468)
+++ trunk/extensions/EducationProgram/includes/EPInstructor.php 2012-02-14 
18:12:22 UTC (rev 111469)
@@ -14,38 +14,7 @@
 class EPInstructor extends EPRoleObject implements EPIRole {
 
        /**
-        * (non-PHPdoc)
-        * @see DBDataObject::getDBTable()
-        */
-       public static function getDBTable() {
-               return 'ep_instructors';
-       }
-       
-       /**
-        * (non-PHPdoc)
-        * @see DBDataObject::getFieldPrefix()
-        */
-       public static function getFieldPrefix() {
-               return 'instructor_';
-       }
-       
-       /**
-        * @see parent::getFieldTypes
-        *
         * @since 0.1
-        *
-        * @return array
-        */
-       protected static function getFieldTypes() {
-               return array(
-                       'id' => 'id',
-
-                       'user_id' => 'int',
-               );
-       }
-       
-       /**
-        * @since 0.1
         * @see EPIRole::getRoleName
         */
        public function getRoleName() {

Added: trunk/extensions/EducationProgram/includes/EPInstructors.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPInstructors.php                
                (rev 0)
+++ trunk/extensions/EducationProgram/includes/EPInstructors.php        
2012-02-14 18:12:22 UTC (rev 111469)
@@ -0,0 +1,60 @@
+<?php
+
+/**
+ * Class representing the ep_instructors table.
+ *
+ * @since 0.1
+ *
+ * @file EPInstructors.php
+ * @ingroup EducationProgram
+ *
+ * @licence GNU GPL v3 or later
+ * @author Jeroen De Dauw < jeroended...@gmail.com >
+ */
+class EPInstructors extends DBTable {
+
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getDBTable()
+        * @since 0.1
+        * @return string
+        */
+       public function getDBTable() {
+               return 'ep_instructors';
+       }
+       
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getFieldPrefix()
+        * @since 0.1
+        * @return string
+        */
+       public function getFieldPrefix() {
+               return 'instructor_';
+       }
+       
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getDataObjectClass()
+        * @since 0.1
+        * @return string
+        */
+       public function getDataObjectClass() {
+               return 'EPInstructor';
+       }
+       
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getFieldTypes()
+        * @since 0.1
+        * @return array
+        */
+       public function getFieldTypes() {
+               return array(
+                       'id' => 'id',
+
+                       'user_id' => 'int',
+               );
+       }
+
+}


Property changes on: 
trunk/extensions/EducationProgram/includes/EPInstructors.php
___________________________________________________________________
Added: svn:eol-style
   + native

Modified: trunk/extensions/EducationProgram/includes/EPOA.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPOA.php 2012-02-14 18:11:52 UTC 
(rev 111468)
+++ trunk/extensions/EducationProgram/includes/EPOA.php 2012-02-14 18:12:22 UTC 
(rev 111469)
@@ -14,50 +14,6 @@
 class EPOA extends EPRoleObject implements EPIRole {
        
        /**
-        * (non-PHPdoc)
-        * @see DBDataObject::getDBTable()
-        */
-       public static function getDBTable() {
-               return 'ep_oas';
-       }
-       
-       /**
-        * (non-PHPdoc)
-        * @see DBDataObject::getFieldPrefix()
-        */
-       public static function getFieldPrefix() {
-               return 'oa_';
-       }
-       
-       /**
-        * @see parent::getFieldTypes
-        *
-        * @since 0.1
-        *
-        * @return array
-        */
-       protected static function getFieldTypes() {
-               return array(
-                       'id' => 'id',
-
-                       'user_id' => 'int',
-                       'bio' => 'str',
-                       'photo' => 'str',
-               );
-       }
-       
-       /**
-        * (non-PHPdoc)
-        * @see DBDataObject::getDefaults()
-        */
-       public static function getDefaults() {
-               return array(
-                       'bio' => '',
-                       'photo' => '',
-               );
-       }
-       
-       /**
         * Display a pager with online ambassadors.
         *
         * @since 0.1

Added: trunk/extensions/EducationProgram/includes/EPOAs.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPOAs.php                        
        (rev 0)
+++ trunk/extensions/EducationProgram/includes/EPOAs.php        2012-02-14 
18:12:22 UTC (rev 111469)
@@ -0,0 +1,75 @@
+<?php
+
+/**
+ * Class representing the ep_oas table.
+ *
+ * @since 0.1
+ *
+ * @file EPOAs.php
+ * @ingroup EducationProgram
+ *
+ * @licence GNU GPL v3 or later
+ * @author Jeroen De Dauw < jeroended...@gmail.com >
+ */
+class EPOAs extends DBTable {
+
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getDBTable()
+        * @since 0.1
+        * @return string
+        */
+       public function getDBTable() {
+               return 'ep_oas';
+       }
+       
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getFieldPrefix()
+        * @since 0.1
+        * @return string
+        */
+       public function getFieldPrefix() {
+               return 'oa_';
+       }
+       
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getDataObjectClass()
+        * @since 0.1
+        * @return string
+        */
+       public function getDataObjectClass() {
+               return 'EPOA';
+       }
+       
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getFieldTypes()
+        * @since 0.1
+        * @return array
+        */
+       public function getFieldTypes() {
+               return array(
+                       'id' => 'id',
+
+                       'user_id' => 'int',
+                       'bio' => 'str',
+                       'photo' => 'str',
+               );
+       }
+       
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getDefaults()
+        * @since 0.1
+        * @return array
+        */
+       public function getDefaults() {
+               return array(
+                       'bio' => '',
+                       'photo' => '',
+               );
+       }
+
+}


Property changes on: trunk/extensions/EducationProgram/includes/EPOAs.php
___________________________________________________________________
Added: svn:eol-style
   + native

Modified: trunk/extensions/EducationProgram/includes/EPOrg.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPOrg.php        2012-02-14 
18:11:52 UTC (rev 111468)
+++ trunk/extensions/EducationProgram/includes/EPOrg.php        2012-02-14 
18:12:22 UTC (rev 111469)
@@ -23,80 +23,6 @@
 
        /**
         * (non-PHPdoc)
-        * @see DBDataObject::getDBTable()
-        */
-       public static function getDBTable() {
-               return 'ep_orgs';
-       }
-       
-       /**
-        * (non-PHPdoc)
-        * @see DBDataObject::getFieldPrefix()
-        */
-       public static function getFieldPrefix() {
-               return 'org_';
-       }
-       
-       /**
-        * @see parent::getFieldTypes
-        *
-        * @since 0.1
-        *
-        * @return array
-        */
-       protected static function getFieldTypes() {
-               return array(
-                       'id' => 'id',
-
-                       'name' => 'str',
-                       'city' => 'str',
-                       'country' => 'str',
-
-                       'active' => 'bool',
-                       'course_count' => 'int',
-                       'student_count' => 'int',
-                       'instructor_count' => 'int',
-                       'ca_count' => 'int',
-                       'oa_count' => 'int',
-               );
-       }
-
-       /**
-        * (non-PHPdoc)
-        * @see DBDataObject::getDefaults()
-        */
-       public static function getDefaults() {
-               return array(
-                       'name' => '',
-                       'city' => '',
-                       'country' => '',
-
-                       'active' => false,
-                       'course_count' => 0,
-                       'student_count' => 0,
-                       'instructor_count' => 0,
-                       'ca_count' => 0,
-                       'oa_count' => 0,
-               );
-       }
-       
-       /**
-        * (non-PHPdoc)
-        * @see DBDataObject::getSummaryFields()
-        */
-       public static function getSummaryFields() {
-               return array(
-                       'active',
-                       'course_count',
-                       'student_count',
-                       'instructor_count',
-                       'ca_count',
-                       'oa_count',
-               );
-       }
-
-       /**
-        * (non-PHPdoc)
         * @see DBDataObject::loadSummaryFields()
         */
        public function loadSummaryFields( $summaryFields = null ) {

Modified: trunk/extensions/EducationProgram/includes/EPOrgPager.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPOrgPager.php   2012-02-14 
18:11:52 UTC (rev 111468)
+++ trunk/extensions/EducationProgram/includes/EPOrgPager.php   2012-02-14 
18:12:22 UTC (rev 111469)
@@ -106,8 +106,7 @@
        }
 
        function getDefaultSort() {
-               $c = $this->className; // Yeah, this is needed in PHP 5.3 >_>
-               return $c::getPrefixedField( 'name' );
+               return EPOrgs::singleton()->getPrefixedField( 'name' );
        }
 
        /**

Added: trunk/extensions/EducationProgram/includes/EPOrgs.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPOrgs.php                       
        (rev 0)
+++ trunk/extensions/EducationProgram/includes/EPOrgs.php       2012-02-14 
18:12:22 UTC (rev 111469)
@@ -0,0 +1,107 @@
+<?php
+
+/**
+ * Class representing the ep_orgs table.
+ *
+ * @since 0.1
+ *
+ * @file EPOrgs.php
+ * @ingroup EducationProgram
+ *
+ * @licence GNU GPL v3 or later
+ * @author Jeroen De Dauw < jeroended...@gmail.com >
+ */
+class EPOrgs extends DBTable {
+
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getDBTable()
+        * @since 0.1
+        * @return string
+        */
+       public function getDBTable() {
+               return 'ep_orgs';
+       }
+       
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getFieldPrefix()
+        * @since 0.1
+        * @return string
+        */
+       public function getFieldPrefix() {
+               return 'org_';
+       }
+       
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getDataObjectClass()
+        * @since 0.1
+        * @return string
+        */
+       public function getDataObjectClass() {
+               return 'EPOrg';
+       }
+       
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getFieldTypes()
+        * @since 0.1
+        * @return array
+        */
+       public function getFieldTypes() {
+               return array(
+                       'id' => 'id',
+
+                       'name' => 'str',
+                       'city' => 'str',
+                       'country' => 'str',
+
+                       'active' => 'bool',
+                       'course_count' => 'int',
+                       'student_count' => 'int',
+                       'instructor_count' => 'int',
+                       'ca_count' => 'int',
+                       'oa_count' => 'int',
+               );
+       }
+
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getDefaults()
+        * @since 0.1
+        * @return array
+        */
+       public function getDefaults() {
+               return array(
+                       'name' => '',
+                       'city' => '',
+                       'country' => '',
+
+                       'active' => false,
+                       'course_count' => 0,
+                       'student_count' => 0,
+                       'instructor_count' => 0,
+                       'ca_count' => 0,
+                       'oa_count' => 0,
+               );
+       }
+       
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getSummaryFields()
+        * @since 0.1
+        * @return array
+        */
+       public function getSummaryFields() {
+               return array(
+                       'active',
+                       'course_count',
+                       'student_count',
+                       'instructor_count',
+                       'ca_count',
+                       'oa_count',
+               );
+       }
+       
+}


Property changes on: trunk/extensions/EducationProgram/includes/EPOrgs.php
___________________________________________________________________
Added: svn:eol-style
   + native

Modified: trunk/extensions/EducationProgram/includes/EPPager.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPPager.php      2012-02-14 
18:11:52 UTC (rev 111468)
+++ trunk/extensions/EducationProgram/includes/EPPager.php      2012-02-14 
18:12:22 UTC (rev 111469)
@@ -22,11 +22,11 @@
        protected $conds;
 
        /**
-        * Name of the class deriving from DBDataObject.
+        * Name of the class deriving from DBTable.
         * @since 0.1
         * @var string
         */
-       protected $className;
+       protected $tableClass;
 
        /**
         * DBDataObject object constructed from $this->currentRow.
@@ -47,11 +47,11 @@
         *
         * @param IContextSource $context
         * @param array $conds
-        * @param string $className
+        * @param string $tableClass
         */
-       public function __construct( IContextSource $context, array $conds, 
$className ) {
+       public function __construct( IContextSource $context, array $conds, 
$tableClass ) {
                $this->conds = $conds;
-               $this->className = $className;
+               $this->tableClass = $tableClass;
                $this->context = $context;
 
                $this->mDefaultDirection = true;

Modified: trunk/extensions/EducationProgram/includes/EPRevision.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPRevision.php   2012-02-14 
18:11:52 UTC (rev 111468)
+++ trunk/extensions/EducationProgram/includes/EPRevision.php   2012-02-14 
18:12:22 UTC (rev 111469)
@@ -35,46 +35,6 @@
        }
 
        /**
-        * (non-PHPdoc)
-        * @see DBDataObject::getDBTable()
-        */
-       public static function getDBTable() {
-               return 'ep_revisions';
-       }
-       
-       /**
-        * (non-PHPdoc)
-        * @see DBDataObject::getFieldPrefix()
-        */
-       public static function getFieldPrefix() {
-               return 'rev_';
-       }
-       
-       /**
-        * @see parent::getFieldTypes
-        *
-        * @since 0.1
-        *
-        * @return array
-        */
-       protected static function getFieldTypes() {
-               return array(
-                       'id' => 'id',
-
-                       'object_id' => 'int',
-                       'object_identifier' => 'str',
-                       'user_id' => 'int',
-                       'type' => 'str',
-                       'comment' => 'str',
-                       'user_text' => 'str',
-                       'minor_edit' => 'bool',
-                       'time' => 'str', // TS_MW
-                       'deleted' => 'bool',
-                       'data' => 'blob',
-               );
-       }
-
-       /**
         * Create a new revision object for the provided EPRevisionedObject.
         * The EPRevisionedObject should have all it's fields loaded.
         *

Modified: trunk/extensions/EducationProgram/includes/EPRevisions.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPRevisions.php  2012-02-14 
18:11:52 UTC (rev 111468)
+++ trunk/extensions/EducationProgram/includes/EPRevisions.php  2012-02-14 
18:12:22 UTC (rev 111469)
@@ -1,7 +1,7 @@
 <?php
 
 /**
- * Static class for storing and retrieving revisions of DBDataObjects.
+ * Class representing the ep_revisions table.
  *
  * @since 0.1
  *
@@ -11,14 +11,59 @@
  * @licence GNU GPL v3 or later
  * @author Jeroen De Dauw < jeroended...@gmail.com >
  */
-final class EPRevisions {
+class EPRevisions extends DBTable {
 
-       public static function storeRevision() {
-
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getDBTable()
+        * @since 0.1
+        * @return string
+        */
+       public function getDBTable() {
+               return 'ep_revisions';
        }
+       
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getFieldPrefix()
+        * @since 0.1
+        * @return string
+        */
+       public function getFieldPrefix() {
+               return 'rev_';
+       }
+       
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getDataObjectClass()
+        * @since 0.1
+        * @return string
+        */
+       public function getDataObjectClass() {
+               return 'EPRevision';
+       }
+       
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getFieldTypes()
+        * @since 0.1
+        * @return array
+        */
+       public function getFieldTypes() {
+               return array(
+                       'id' => 'id',
 
-       public static function getRevision() {
-
+                       'object_id' => 'int',
+                       'object_identifier' => 'str',
+                       'user_id' => 'int',
+                       'type' => 'str',
+                       'comment' => 'str',
+                       'user_text' => 'str',
+                       'minor_edit' => 'bool',
+                       'time' => 'str', // TS_MW
+                       'deleted' => 'bool',
+                       'data' => 'blob',
+               );
        }
-
+       
 }

Modified: trunk/extensions/EducationProgram/includes/EPRoleObject.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPRoleObject.php 2012-02-14 
18:11:52 UTC (rev 111468)
+++ trunk/extensions/EducationProgram/includes/EPRoleObject.php 2012-02-14 
18:12:22 UTC (rev 111469)
@@ -41,8 +41,19 @@
         */
        public static function newFromUserId( $userId, $fields = null ) {
                $data = array( 'user_id' => $userId );
-               $userRole = static::selectRow( null, $data );
-               return $userRole === false ? new static( $data, true ) : 
$userRole;
+               
+               $map = array(
+                       'EPOA' => 'EPOAs',
+                       'EPCA' => 'EPCAs',
+                       'EPStudent' => 'EPStudents',
+                       'EPInstructor' => 'EPInstructors',
+               ); // TODO: this is lame
+               
+               $class = $map[get_called_class()];
+               $table = $class::singleton();
+               
+               $userRole = $table->selectRow( null, $data );
+               return $userRole === false ? new static( $table, $data, true ) 
: $userRole;
        }
        
        /**
@@ -234,9 +245,11 @@
         * @return array of EPCourse
         */
        protected function doGetCourses( $fields, array $conditions ) {
+               $courseTable = EPCourses::singleton();
+               
                $result = wfGetDB( DB_SLAVE )->select(
                        array( 'ep_courses', 'ep_users_per_course' ),
-                       EPCourse::getPrefixedFields( is_null( $fields ) ? 
EPCourse::getFieldNames() : (array)$fields ),
+                       $courseTable->getPrefixedFields( is_null( $fields ) ? 
$courseTable->getFieldNames() : (array)$fields ),
                        array(
                                'upc_role' => $this->getRoleId(),
                                'upc_user_id' => $this->getField( 'user_id' ),

Modified: trunk/extensions/EducationProgram/includes/EPStudent.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPStudent.php    2012-02-14 
18:11:52 UTC (rev 111468)
+++ trunk/extensions/EducationProgram/includes/EPStudent.php    2012-02-14 
18:12:22 UTC (rev 111469)
@@ -14,41 +14,6 @@
 class EPStudent extends EPRoleObject {
 
        /**
-        * (non-PHPdoc)
-        * @see DBDataObject::getDBTable()
-        */
-       public static function getDBTable() {
-               return 'ep_students';
-       }
-       
-       /**
-        * (non-PHPdoc)
-        * @see DBDataObject::getFieldPrefix()
-        */
-       public static function getFieldPrefix() {
-               return 'student_';
-       }
-       
-       /**
-        * @see parent::getFieldTypes
-        *
-        * @since 0.1
-        *
-        * @return array
-        */
-       protected static function getFieldTypes() {
-               return array(
-                       'id' => 'id',
-
-                       'user_id' => 'int',
-                       'first_enroll' => 'str', // TS_MW
-
-                       'last_active' => 'str', // TS_MW
-                       'active_enroll' => 'bool',
-               );
-       }
-
-       /**
         * Display a pager with students.
         *
         * @since 0.1

Added: trunk/extensions/EducationProgram/includes/EPStudents.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPStudents.php                   
        (rev 0)
+++ trunk/extensions/EducationProgram/includes/EPStudents.php   2012-02-14 
18:12:22 UTC (rev 111469)
@@ -0,0 +1,64 @@
+<?php
+
+/**
+ * Class representing the ep_students table.
+ *
+ * @since 0.1
+ *
+ * @file EPStudents.php
+ * @ingroup EducationProgram
+ *
+ * @licence GNU GPL v3 or later
+ * @author Jeroen De Dauw < jeroended...@gmail.com >
+ */
+class EPStudents extends DBTable {
+
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getDBTable()
+        * @since 0.1
+        * @return string
+        */
+       public function getDBTable() {
+               return 'ep_students';
+       }
+       
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getFieldPrefix()
+        * @since 0.1
+        * @return string
+        */
+       public function getFieldPrefix() {
+               return 'student_';
+       }
+       
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getDataObjectClass()
+        * @since 0.1
+        * @return string
+        */
+       public function getDataObjectClass() {
+               return 'EPStudent';
+       }
+       
+       /**
+        * (non-PHPdoc)
+        * @see DBTable::getFieldTypes()
+        * @since 0.1
+        * @return array
+        */
+       public function getFieldTypes() {
+               return array(
+                       'id' => 'id',
+
+                       'user_id' => 'int',
+                       'first_enroll' => 'str', // TS_MW
+
+                       'last_active' => 'str', // TS_MW
+                       'active_enroll' => 'bool',
+               );
+       }
+
+}


Property changes on: trunk/extensions/EducationProgram/includes/EPStudents.php
___________________________________________________________________
Added: svn:eol-style
   + native

Modified: trunk/extensions/EducationProgram/includes/EPUtils.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPUtils.php      2012-02-14 
18:11:52 UTC (rev 111468)
+++ trunk/extensions/EducationProgram/includes/EPUtils.php      2012-02-14 
18:12:22 UTC (rev 111469)
@@ -194,7 +194,7 @@
 
                $user = $context->getUser();
                
-               if ( EPStudent::has( array( 'user_id' => $user->getId() ) ) ) {
+               if ( EPStudents::singleton()->has( array( 'user_id' => 
$user->getId() ) ) ) {
                        $items[wfMsg( 'ep-nav-mycourses' )] = 
SpecialPage::getTitleFor( 'MyCourses' );
                }
                


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to