Index: trunk/extensions/EducationProgram/sql/AddExtraFields.sql |
— | — | @@ -5,7 +5,7 @@ |
6 | 6 | |
7 | 7 | ALTER TABLE /*_*/ep_orgs ADD COLUMN org_courses SMALLINT unsigned NOT NULL; |
8 | 8 | ALTER TABLE /*_*/ep_orgs ADD COLUMN org_mentors SMALLINT unsigned NOT NULL; |
9 | | -ALTER TABLE /*_*/ep_orgs ADD COLUMN org_terms SMALLINT unsigned NOT NULL; |
| 9 | +ALTER TABLE /*_*/ep_orgs ADD COLUMN org_terms SMALLIN1T unsigned NOT NULL; |
10 | 10 | ALTER TABLE /*_*/ep_orgs ADD COLUMN org_students INT unsigned NOT NULL; |
11 | 11 | |
12 | 12 | CREATE INDEX /*i*/ep_org_courses ON /*_*/ep_orgs (org_courses); |
Index: trunk/extensions/EducationProgram/sql/AddStatusFields.sql |
— | — | @@ -0,0 +1,12 @@ |
| 2 | +-- SQL for the Education Program extension. |
| 3 | +-- Adds additional fields. |
| 4 | +-- Licence: GNU GPL v3+ |
| 5 | +-- Author: Jeroen De Dauw < jeroendedauw@gmail.com > |
| 6 | + |
| 7 | +ALTER TABLE /*_*/ep_orgs ADD COLUMN org_active TINYINT unsigned NOT NULL default 1; |
| 8 | + |
| 9 | +CREATE INDEX /*i*/ep_org_active ON /*_*/ep_orgs (org_active); |
| 10 | + |
| 11 | +ALTER TABLE /*_*/ep_courses ADD COLUMN course_active TINYINT unsigned NOT NULL default 1; |
| 12 | + |
| 13 | +CREATE INDEX /*i*/ep_course_active ON /*_*/ep_courses (course_active); |
\ No newline at end of file |
Property changes on: trunk/extensions/EducationProgram/sql/AddStatusFields.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 14 | + native |
Index: trunk/extensions/EducationProgram/sql/EducationProgram.sql |
— | — | @@ -10,6 +10,7 @@ |
11 | 11 | org_city VARCHAR(255) NOT NULL, -- Name of the city where the org is located |
12 | 12 | org_country VARCHAR(255) NOT NULL, -- Name of the country where the org is located |
13 | 13 | |
| 14 | + org_active TINYINT unsigned NOT NULL, -- If the org has any active terms |
14 | 15 | org_courses SMALLINT unsigned NOT NULL, -- Amount of courses |
15 | 16 | org_terms SMALLINT unsigned NOT NULL, -- Amount of terms |
16 | 17 | org_mentors SMALLINT unsigned NOT NULL, -- Amount of mentors |
— | — | @@ -21,6 +22,7 @@ |
22 | 23 | CREATE INDEX /*i*/ep_org_courses ON /*_*/ep_orgs (org_courses); |
23 | 24 | CREATE INDEX /*i*/ep_org_mentors ON /*_*/ep_orgs (org_mentors); |
24 | 25 | CREATE INDEX /*i*/ep_org_students ON /*_*/ep_orgs (org_students); |
| 26 | +CREATE INDEX /*i*/ep_org_active ON /*_*/ep_orgs (org_active); |
25 | 27 | |
26 | 28 | -- Courses. These describe a specific course, time-independent. |
27 | 29 | CREATE TABLE IF NOT EXISTS /*_*/ep_courses ( |
— | — | @@ -31,6 +33,7 @@ |
32 | 34 | course_description TEXT NOT NULL, -- Description of the course |
33 | 35 | course_lang VARCHAR(10) NOT NULL, -- Language (code) |
34 | 36 | |
| 37 | + course_active TINYINT unsigned NOT NULL, -- If the course has any active terms |
35 | 38 | course_students SMALLINT unsigned NOT NULL -- Amount of students |
36 | 39 | ) /*$wgDBTableOptions*/; |
37 | 40 | |
— | — | @@ -38,6 +41,7 @@ |
39 | 42 | CREATE UNIQUE INDEX /*i*/ep_course_name ON /*_*/ep_courses (course_name); |
40 | 43 | CREATE INDEX /*i*/ep_course_lang ON /*_*/ep_courses (course_lang); |
41 | 44 | CREATE INDEX /*i*/ep_course_students ON /*_*/ep_courses (course_students); |
| 45 | +CREATE INDEX /*i*/ep_course_active ON /*_*/ep_courses (course_active); |
42 | 46 | |
43 | 47 | -- Terms. These are "instances" of a course in a certain period. |
44 | 48 | CREATE TABLE IF NOT EXISTS /*_*/ep_terms ( |
Index: trunk/extensions/EducationProgram/includes/EPOrgPager.php |
— | — | @@ -36,6 +36,7 @@ |
37 | 37 | 'terms', |
38 | 38 | 'mentors', |
39 | 39 | 'students', |
| 40 | + 'active', |
40 | 41 | ); |
41 | 42 | } |
42 | 43 | |
— | — | @@ -85,6 +86,9 @@ |
86 | 87 | } |
87 | 88 | |
88 | 89 | break; |
| 90 | + case 'active': |
| 91 | + $value = wfMsgHtml( 'eporgpager-' . ( $value == '1' ? 'yes' : 'no' ) ); |
| 92 | + break; |
89 | 93 | } |
90 | 94 | |
91 | 95 | return $value; |
— | — | @@ -103,7 +107,7 @@ |
104 | 108 | 'mentors', |
105 | 109 | 'students', |
106 | 110 | 'terms', |
107 | | - 'terms', |
| 111 | + 'active', |
108 | 112 | ); |
109 | 113 | } |
110 | 114 | |
— | — | @@ -123,6 +127,15 @@ |
124 | 128 | 'options' => efEpGetCountryOptions( $this->getLanguage()->getCode() ), |
125 | 129 | 'value' => '' |
126 | 130 | ), |
| 131 | + 'active' => array( |
| 132 | + 'type' => 'select', |
| 133 | + 'options' => array( |
| 134 | + '' => '', |
| 135 | + wfMsg( 'eporgpager-yes' ) => '1', |
| 136 | + wfMsg( 'eporgpager-no' ) => '0', |
| 137 | + ), |
| 138 | + 'value' => '1', |
| 139 | + ), |
127 | 140 | ); |
128 | 141 | } |
129 | 142 | |
Index: trunk/extensions/EducationProgram/includes/EPTermPager.php |
— | — | @@ -160,7 +160,7 @@ |
161 | 161 | array( '' => '' ), |
162 | 162 | EPTerm::getStatuses() |
163 | 163 | ), |
164 | | - 'value' => '', |
| 164 | + 'value' => 'current', |
165 | 165 | ); |
166 | 166 | |
167 | 167 | return $options; |
Index: trunk/extensions/EducationProgram/includes/EPOrg.php |
— | — | @@ -44,6 +44,7 @@ |
45 | 45 | 'city' => 'str', |
46 | 46 | 'country' => 'str', |
47 | 47 | |
| 48 | + 'active' => 'bool', |
48 | 49 | 'courses' => 'int', |
49 | 50 | 'terms' => 'int', |
50 | 51 | 'mentors' => 'int', |
— | — | @@ -61,6 +62,7 @@ |
62 | 63 | 'city' => '', |
63 | 64 | 'country' => '', |
64 | 65 | |
| 66 | + 'active' => false, |
65 | 67 | 'courses' => 0, |
66 | 68 | 'terms' => 0, |
67 | 69 | 'mentors' => 0, |
Index: trunk/extensions/EducationProgram/includes/EPCoursePager.php |
— | — | @@ -32,6 +32,7 @@ |
33 | 33 | 'name', |
34 | 34 | 'org_id', |
35 | 35 | 'students', |
| 36 | + 'active', |
36 | 37 | ); |
37 | 38 | } |
38 | 39 | |
— | — | @@ -74,6 +75,9 @@ |
75 | 76 | case 'students': |
76 | 77 | $value = htmlspecialchars( $this->getLanguage()->formatNum( $value ) ); |
77 | 78 | break; |
| 79 | + case 'active': |
| 80 | + $value = wfMsgHtml( 'epcoursepager-' . ( $value == '1' ? 'yes' : 'no' ) ); |
| 81 | + break; |
78 | 82 | } |
79 | 83 | |
80 | 84 | return $value; |
— | — | @@ -92,6 +96,7 @@ |
93 | 97 | return array( |
94 | 98 | 'name', |
95 | 99 | 'students', |
| 100 | + 'active', |
96 | 101 | ); |
97 | 102 | } |
98 | 103 | |
— | — | @@ -110,6 +115,15 @@ |
111 | 116 | 'value' => '', |
112 | 117 | 'datatype' => 'int', |
113 | 118 | ), |
| 119 | + 'active' => array( |
| 120 | + 'type' => 'select', |
| 121 | + 'options' => array( |
| 122 | + '' => '', |
| 123 | + wfMsg( 'epcoursepager-yes' ) => '1', |
| 124 | + wfMsg( 'epcoursepager-no' ) => '0', |
| 125 | + ), |
| 126 | + 'value' => '1', |
| 127 | + ), |
114 | 128 | ); |
115 | 129 | } |
116 | 130 | |
Index: trunk/extensions/EducationProgram/includes/EPCourse.php |
— | — | @@ -38,6 +38,7 @@ |
39 | 39 | 'description' => 'str', |
40 | 40 | 'lang' => 'str', |
41 | 41 | |
| 42 | + 'active' => 'bool', |
42 | 43 | 'students' => 'int', |
43 | 44 | ); |
44 | 45 | } |
— | — | @@ -49,6 +50,9 @@ |
50 | 51 | public static function getDefaults() { |
51 | 52 | return array( |
52 | 53 | 'description' => '', |
| 54 | + |
| 55 | + 'active' => false, |
| 56 | + 'students' => 0, |
53 | 57 | ); |
54 | 58 | } |
55 | 59 | |
— | — | @@ -168,7 +172,7 @@ |
169 | 173 | * |
170 | 174 | * @since 0.1 |
171 | 175 | * |
172 | | - * @param array $orgs |
| 176 | + * @param array $courses |
173 | 177 | * |
174 | 178 | * @return array |
175 | 179 | */ |
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php |
— | — | @@ -138,12 +138,20 @@ |
139 | 139 | 'eporgpager-header-mentors' => 'Ambassadors', |
140 | 140 | 'eporgpager-header-students' => 'Students', |
141 | 141 | 'eporgpager-header-terms' => 'Terms', |
| 142 | + 'eporgpager-header-active' => 'Active', |
| 143 | + 'eporgpager-filter-active' => 'Active courses', |
| 144 | + 'eporgpager-yes' => 'Yes', |
| 145 | + 'eporgpager-no' => 'No', |
142 | 146 | |
143 | 147 | // Course pager |
144 | 148 | 'epcoursepager-header-name' => 'Name', |
145 | 149 | 'epcoursepager-header-org-id' => 'Institution', |
146 | 150 | 'epcoursepager-filter-org-id' => 'Institution', |
147 | 151 | 'epcoursepager-header-students' => 'Students', |
| 152 | + 'epcoursepager-header-active' => 'Active', |
| 153 | + 'epcoursepager-filter-active' => 'Active terms', |
| 154 | + 'epcoursepager-yes' => 'Yes', |
| 155 | + 'epcoursepager-no' => 'No', |
148 | 156 | |
149 | 157 | // Term pager |
150 | 158 | 'eptermpager-header-id' => 'Id', |
Index: trunk/extensions/EducationProgram/EducationProgram.hooks.php |
— | — | @@ -37,6 +37,14 @@ |
38 | 38 | true |
39 | 39 | ) ); |
40 | 40 | |
| 41 | + $updater->addExtensionUpdate( array( |
| 42 | + 'addField', |
| 43 | + 'ep_orgs', |
| 44 | + 'org_active', |
| 45 | + dirname( __FILE__ ) . '/sql/AddStatusFields.sql', |
| 46 | + true |
| 47 | + ) ); |
| 48 | + |
41 | 49 | return true; |
42 | 50 | } |
43 | 51 | |