Index: trunk/extensions/EducationProgram/EducationProgram.php |
— | — | @@ -98,14 +98,9 @@ |
99 | 99 | $wgAutoloadClasses['EPPage'] = dirname( __FILE__ ) . '/pages/EPPage.php'; |
100 | 100 | $wgAutoloadClasses['OrgPage'] = dirname( __FILE__ ) . '/pages/OrgPage.php'; |
101 | 101 | |
102 | | -$wgAutoloadClasses['SpecialCourse'] = dirname( __FILE__ ) . '/specials/SpecialCourse.php'; |
103 | 102 | $wgAutoloadClasses['SpecialCourses'] = dirname( __FILE__ ) . '/specials/SpecialCourses.php'; |
104 | | -$wgAutoloadClasses['SpecialEditCourse'] = dirname( __FILE__ ) . '/specials/SpecialEditCourse.php'; |
105 | | -$wgAutoloadClasses['SpecialEditInstitution'] = dirname( __FILE__ ) . '/specials/SpecialEditInstitution.php'; |
106 | 103 | $wgAutoloadClasses['SpecialEducationProgram'] = dirname( __FILE__ ) . '/specials/SpecialEducationProgram.php'; |
107 | | -$wgAutoloadClasses['SpecialEPFormPage'] = dirname( __FILE__ ) . '/specials/SpecialEPFormPage.php'; |
108 | 104 | $wgAutoloadClasses['SpecialEPPage'] = dirname( __FILE__ ) . '/specials/SpecialEPPage.php'; |
109 | | -$wgAutoloadClasses['SpecialInstitution'] = dirname( __FILE__ ) . '/specials/SpecialInstitution.php'; |
110 | 105 | $wgAutoloadClasses['SpecialInstitutions'] = dirname( __FILE__ ) . '/specials/SpecialInstitutions.php'; |
111 | 106 | $wgAutoloadClasses['SpecialMyCourses'] = dirname( __FILE__ ) . '/specials/SpecialMyCourses.php'; |
112 | 107 | $wgAutoloadClasses['SpecialStudent'] = dirname( __FILE__ ) . '/specials/SpecialStudent.php'; |
— | — | @@ -115,45 +110,29 @@ |
116 | 111 | $wgAutoloadClasses['SpecialOAs'] = dirname( __FILE__ ) . '/specials/SpecialOAs.php'; |
117 | 112 | $wgAutoloadClasses['SpecialCA'] = dirname( __FILE__ ) . '/specials/SpecialCA.php'; |
118 | 113 | $wgAutoloadClasses['SpecialOA'] = dirname( __FILE__ ) . '/specials/SpecialOA.php'; |
119 | | -$wgAutoloadClasses['SpecialEPHistory'] = dirname( __FILE__ ) . '/specials/SpecialEPHistory.php'; |
120 | | -$wgAutoloadClasses['SpecialCourseHistory'] = dirname( __FILE__ ) . '/specials/SpecialCourseHistory.php'; |
121 | | -$wgAutoloadClasses['SpecialInstitutionHistory'] = dirname( __FILE__ ) . '/specials/SpecialInstitutionHistory.php'; |
122 | 114 | |
123 | 115 | // Special pages |
124 | 116 | $wgSpecialPages['MyCourses'] = 'SpecialMyCourses'; |
125 | | -$wgSpecialPages['Institution'] = 'SpecialInstitution'; |
126 | 117 | $wgSpecialPages['Institutions'] = 'SpecialInstitutions'; |
127 | 118 | $wgSpecialPages['Student'] = 'SpecialStudent'; |
128 | 119 | $wgSpecialPages['Students'] = 'SpecialStudents'; |
129 | | -$wgSpecialPages['Course'] = 'SpecialCourse'; |
130 | 120 | $wgSpecialPages['Courses'] = 'SpecialCourses'; |
131 | 121 | $wgSpecialPages['EducationProgram'] = 'SpecialEducationProgram'; |
132 | | -$wgSpecialPages['EditCourse'] = 'SpecialEditCourse'; |
133 | | -$wgSpecialPages['EditInstitution'] = 'SpecialEditInstitution'; |
134 | 122 | $wgSpecialPages['Enroll'] = 'SpecialEnroll'; |
135 | 123 | $wgSpecialPages['CampusAmbassadors'] = 'SpecialCAs'; |
136 | 124 | $wgSpecialPages['OnlineAmbassadors'] = 'SpecialOAs'; |
137 | 125 | $wgSpecialPages['CampusAmbassador'] = 'SpecialCA'; |
138 | 126 | $wgSpecialPages['OnlineAmbassador'] = 'SpecialOA'; |
139 | | -$wgSpecialPages['CourseHistory'] = 'SpecialCourseHistory'; |
140 | | -$wgSpecialPages['InstitutionHistory'] = 'SpecialInstitutionHistory'; |
141 | 127 | |
142 | 128 | $wgSpecialPageGroups['MyCourses'] = 'education'; |
143 | | -$wgSpecialPageGroups['Institution'] = 'education'; |
144 | 129 | $wgSpecialPageGroups['Institutions'] = 'education'; |
145 | 130 | $wgSpecialPageGroups['Student'] = 'education'; |
146 | 131 | $wgSpecialPageGroups['Students'] = 'education'; |
147 | | -$wgSpecialPageGroups['Course'] = 'education'; |
148 | 132 | $wgSpecialPageGroups['Courses'] = 'education'; |
149 | 133 | $wgSpecialPageGroups['EducationProgram'] = 'education'; |
150 | | -$wgSpecialPageGroups['EditCourse'] = 'education'; |
151 | | -$wgSpecialPageGroups['EditInstitution'] = 'education'; |
152 | 134 | $wgSpecialPageGroups['CampusAmbassadors'] = 'education'; |
153 | 135 | $wgSpecialPageGroups['OnlineAmbassadors'] = 'education'; |
154 | 136 | $wgSpecialPageGroups['CampusAmbassador'] = 'education'; |
155 | | -$wgSpecialPageGroups['OnlineAmbassador'] = 'education'; |
156 | | -$wgSpecialPageGroups['CourseHistory'] = 'education'; |
157 | | -$wgSpecialPageGroups['InstitutionHistory'] = 'education'; |
158 | 137 | |
159 | 138 | // DB object classes |
160 | 139 | $egEPDBObjects = array(); |
Index: trunk/extensions/EducationProgram/pages/CoursePage.php |
— | — | @@ -9,7 +9,6 @@ |
10 | 10 | 'view' => 'ViewCourseAction', |
11 | 11 | 'edit' => 'EditCourseAction', |
12 | 12 | 'history' => 'CourseHistoryAction', |
13 | | - 'enroll' => 'CourseEnrollAction', |
14 | 13 | ); |
15 | 14 | } |
16 | 15 | |
Index: trunk/extensions/EducationProgram/specials/SpecialInstitution.php |
— | — | @@ -1,114 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -/** |
5 | | - * Shows the info for a single institution, with management and |
6 | | - * enrollment controls depending on the user and his rights. |
7 | | - * |
8 | | - * @since 0.1 |
9 | | - * |
10 | | - * @file SpecialInstitution.php |
11 | | - * @ingroup EducationProgram |
12 | | - * |
13 | | - * @licence GNU GPL v3 or later |
14 | | - * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
15 | | - */ |
16 | | -class SpecialInstitution extends SpecialEPPage { |
17 | | - |
18 | | - /** |
19 | | - * Constructor. |
20 | | - * |
21 | | - * @since 0.1 |
22 | | - */ |
23 | | - public function __construct() { |
24 | | - parent::__construct( 'Institution', '', false ); |
25 | | - } |
26 | | - |
27 | | - /** |
28 | | - * Main method. |
29 | | - * |
30 | | - * @since 0.1 |
31 | | - * |
32 | | - * @param string $subPage |
33 | | - */ |
34 | | - public function execute( $subPage ) { |
35 | | - parent::execute( $subPage ); |
36 | | - |
37 | | - $out = $this->getOutput(); |
38 | | - |
39 | | - if ( trim( $subPage ) === '' ) { |
40 | | - $this->getOutput()->redirect( SpecialPage::getTitleFor( 'Institutions' )->getLocalURL() ); |
41 | | - } |
42 | | - else { |
43 | | - $out->setPageTitle( wfMsgExt( 'ep-institution-title', 'parsemag', $this->subPage ) ); |
44 | | - |
45 | | - $org = EPOrg::selectRow( null, array( 'name' => $this->subPage ) ); |
46 | | - |
47 | | - if ( $org === false ) { |
48 | | - $this->displayNavigation(); |
49 | | - |
50 | | - if ( $this->getUser()->isAllowed( 'ep-org' ) ) { |
51 | | - $out->addWikiMsg( 'ep-institution-create', $this->subPage ); |
52 | | - EPOrg::displayAddNewControl( $this->getContext(), array( 'name' => $this->subPage ) ); |
53 | | - } |
54 | | - else { |
55 | | - $out->addWikiMsg( 'ep-institution-none', $this->subPage ); |
56 | | - } |
57 | | - } |
58 | | - else { |
59 | | - $this->displayNavigation(); |
60 | | - |
61 | | - $this->displaySummary( $org ); |
62 | | - |
63 | | - $out->addHTML( Html::element( 'h2', array(), wfMsg( 'ep-institution-courses' ) ) ); |
64 | | - |
65 | | - EPCourse::displayPager( $this->getContext(), array( 'org_id' => $org->getId() ) ); |
66 | | - |
67 | | - if ( $this->getUser()->isAllowed( 'ep-course' ) ) { |
68 | | - $out->addHTML( Html::element( 'h2', array(), wfMsg( 'ep-institution-add-course' ) ) ); |
69 | | - |
70 | | - EPCourse::displayAddNewControl( $this->getContext(), array( 'org' => $org->getId() ) ); |
71 | | - } |
72 | | - } |
73 | | - } |
74 | | - } |
75 | | - |
76 | | - /** |
77 | | - * Gets the summary data. |
78 | | - * |
79 | | - * @since 0.1 |
80 | | - * |
81 | | - * @param EPOrg $org |
82 | | - * |
83 | | - * @return array |
84 | | - */ |
85 | | - protected function getSummaryData( EPDBObject $org ) { |
86 | | - $stats = array(); |
87 | | - |
88 | | - $stats['name'] = $org->getField( 'name' ); |
89 | | - $stats['city'] = $org->getField( 'city' ); |
90 | | - |
91 | | - $countries = CountryNames::getNames( $this->getLanguage()->getCode() ); |
92 | | - $stats['country'] = $countries[$org->getField( 'country' )]; |
93 | | - |
94 | | - $stats['status'] = wfMsgHtml( $org->getField( 'active' ) ? 'ep-institution-active' : 'ep-institution-inactive' ); |
95 | | - |
96 | | - $stats['courses'] = $this->getLanguage()->formatNum( $org->getField( 'courses' ) ); |
97 | | - $stats['students'] = $this->getLanguage()->formatNum( $org->getField( 'students' ) ); |
98 | | - |
99 | | - foreach ( $stats as &$stat ) { |
100 | | - $stat = htmlspecialchars( $stat ); |
101 | | - } |
102 | | - |
103 | | - if ( $org->getField( 'courses' ) > 0 ) { |
104 | | - $stats['courses'] = Linker::linkKnown( |
105 | | - SpecialPage::getTitleFor( 'Courses' ), |
106 | | - $stats['courses'], |
107 | | - array(), |
108 | | - array( 'org_id' => $org->getId() ) |
109 | | - ); |
110 | | - } |
111 | | - |
112 | | - return $stats; |
113 | | - } |
114 | | - |
115 | | -} |
Index: trunk/extensions/EducationProgram/specials/SpecialEditInstitution.php |
— | — | @@ -1,84 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -/** |
5 | | - * Adittion and modification interface for insitutions. |
6 | | - * |
7 | | - * @since 0.1 |
8 | | - * |
9 | | - * @file SpecialEditInstitution.php |
10 | | - * @ingroup EducationProgram |
11 | | - * |
12 | | - * @licence GNU GPL v3 or later |
13 | | - * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
14 | | - */ |
15 | | -class SpecialEditInstitution extends SpecialEPFormPage { |
16 | | - |
17 | | - /** |
18 | | - * Constructor. |
19 | | - * |
20 | | - * @since 0.1 |
21 | | - */ |
22 | | - public function __construct() { |
23 | | - parent::__construct( 'EditInstitution', 'ep-org', 'EPOrg', 'Institutions', 'Institution' ); |
24 | | - } |
25 | | - |
26 | | - /** |
27 | | - * (non-PHPdoc) |
28 | | - * @see SpecialEPFormPage::getFormFields() |
29 | | - * @return array |
30 | | - */ |
31 | | - protected function getFormFields() { |
32 | | - $fields = parent::getFormFields(); |
33 | | - |
34 | | - $fields['name'] = array ( |
35 | | - 'type' => 'text', |
36 | | - 'label-message' => 'educationprogram-org-edit-name', |
37 | | - 'maxlength' => 255, |
38 | | - 'required' => true, |
39 | | - 'validation-callback' => function ( $value, array $alldata = null ) { |
40 | | - return strlen( $value ) < 2 ? wfMsg( 'educationprogram-org-invalid-name' ) : true; |
41 | | - } , |
42 | | - ); |
43 | | - |
44 | | - $fields['city'] = array ( |
45 | | - 'type' => 'text', |
46 | | - 'label-message' => 'educationprogram-org-edit-city', |
47 | | - 'required' => true, |
48 | | - 'validation-callback' => function ( $value, array $alldata = null ) { |
49 | | - return strlen( $value ) < 2 ? wfMsg( 'educationprogram-org-invalid-city' ) : true; |
50 | | - } , |
51 | | - ); |
52 | | - |
53 | | - $fields['country'] = array ( |
54 | | - 'type' => 'select', |
55 | | - 'label-message' => 'educationprogram-org-edit-country', |
56 | | - 'maxlength' => 255, |
57 | | - 'required' => true, |
58 | | - 'options' => EPUtils::getCountryOptions( $this->getLanguage()->getCode() ), |
59 | | - 'validation-callback' => array( $this, 'countryIsValid' ), |
60 | | - ); |
61 | | - |
62 | | - return $this->processFormFields( $fields ); |
63 | | - } |
64 | | - |
65 | | - /** |
66 | | - * Returns true if the country value is valid or an error message if it's not. |
67 | | - * |
68 | | - * @since 0.1 |
69 | | - * |
70 | | - * @param string $value |
71 | | - * @param array $alldata |
72 | | - * |
73 | | - * @return string|true |
74 | | - */ |
75 | | - public function countryIsValid( $value, array $alldata = null ) { |
76 | | - $countries = array_keys( CountryNames::getNames( $this->getLanguage()->getCode() ) ); |
77 | | - |
78 | | -// if ( $this->isNew() ) { |
79 | | -// array_unshift( $countries, '' ); |
80 | | -// } |
81 | | - |
82 | | - return in_array( $value, $countries ) ? true : wfMsg( 'educationprogram-org-invalid-country' ); |
83 | | - } |
84 | | - |
85 | | -} |
Index: trunk/extensions/EducationProgram/specials/SpecialCourse.php |
— | — | @@ -1,123 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -/** |
5 | | - * Shows the info for a single course, with management and |
6 | | - * enrollment controls depending on the user and his rights. |
7 | | - * |
8 | | - * @since 0.1 |
9 | | - * |
10 | | - * @file SpecialCourse.php |
11 | | - * @ingroup EducationProgram |
12 | | - * |
13 | | - * @licence GNU GPL v3 or later |
14 | | - * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
15 | | - */ |
16 | | -class SpecialCourse extends SpecialEPPage { |
17 | | - |
18 | | - /** |
19 | | - * Constructor. |
20 | | - * |
21 | | - * @since 0.1 |
22 | | - */ |
23 | | - public function __construct() { |
24 | | - parent::__construct( 'Course', '', false ); |
25 | | - } |
26 | | - |
27 | | - /** |
28 | | - * Main method. |
29 | | - * |
30 | | - * @since 0.1 |
31 | | - * |
32 | | - * @param string $subPage |
33 | | - */ |
34 | | - public function execute( $subPage ) { |
35 | | - parent::execute( $subPage ); |
36 | | - |
37 | | - $out = $this->getOutput(); |
38 | | - |
39 | | - if ( trim( $subPage ) === '' ) { |
40 | | - $this->getOutput()->redirect( SpecialPage::getTitleFor( 'Courses' )->getLocalURL() ); |
41 | | - } |
42 | | - else { |
43 | | - $out->setPageTitle( wfMsgExt( 'ep-course-title', 'parsemag', $this->subPage ) ); |
44 | | - |
45 | | - $course = EPCourse::selectRow( null, array( 'name' => $this->subPage ) ); |
46 | | - |
47 | | - if ( $course === false ) { |
48 | | - $this->displayNavigation(); |
49 | | - |
50 | | - if ( $this->getUser()->isAllowed( 'ep-term' ) ) { |
51 | | - $out->addWikiMsg( 'ep-course-create', $this->subPage ); |
52 | | - EPCourse::displayAddNewRegion( $this->getContext(), array( 'name' => $this->subPage ) ); |
53 | | - } |
54 | | - else { |
55 | | - $out->addWikiMsg( 'ep-course-none', $this->subPage ); |
56 | | - } |
57 | | - } |
58 | | - else { |
59 | | - $this->displayNavigation(); |
60 | | - |
61 | | - $this->displaySummary( $course ); |
62 | | - |
63 | | - $out->addHTML( Html::element( 'h2', array(), wfMsg( 'ep-course-description' ) ) ); |
64 | | - |
65 | | - $out->addHTML( $this->getOutput()->parse( $course->getField( 'description' ) ) ); |
66 | | - |
67 | | - $studentIds = array_map( |
68 | | - function( EPStudent $student ) { |
69 | | - return $student->getId(); |
70 | | - }, |
71 | | - $course->getStudents( 'id' ) |
72 | | - ); |
73 | | - |
74 | | - if ( count( $studentIds ) > 0 ) { |
75 | | - $out->addHTML( Html::element( 'h2', array(), wfMsg( 'ep-course-students' ) ) ); |
76 | | - EPStudent::displayPager( $this->getContext(), array( 'id' => $studentIds ) ); |
77 | | - } |
78 | | - else { |
79 | | - // TODO |
80 | | - } |
81 | | - } |
82 | | - } |
83 | | - } |
84 | | - |
85 | | - /** |
86 | | - * Gets the summary data. |
87 | | - * |
88 | | - * @since 0.1 |
89 | | - * |
90 | | - * @param EPCourse $course |
91 | | - * |
92 | | - * @return array |
93 | | - */ |
94 | | - protected function getSummaryData( EPDBObject $course ) { |
95 | | - $stats = array(); |
96 | | - |
97 | | - $org = EPOrg::selectFieldsRow( 'name', array( 'id' => $course->getField( 'org_id' ) ) ); |
98 | | - |
99 | | - $stats['org'] = Linker::linkKnown( |
100 | | - SpecialPage::getTitleFor( 'Institution', $org ), |
101 | | - htmlspecialchars( $org ) |
102 | | - ); |
103 | | - |
104 | | - $lang = $this->getLanguage(); |
105 | | - |
106 | | - $stats['term'] = htmlspecialchars( $course->getField( 'term' ) ); |
107 | | - $stats['start'] = htmlspecialchars( $lang->timeanddate( $course->getField( 'start' ), true ) ); |
108 | | - $stats['end'] = htmlspecialchars( $lang->timeanddate( $course->getField( 'end' ), true ) ); |
109 | | - |
110 | | - $stats['students'] = htmlspecialchars( $lang->formatNum( $course->getField( 'students' ) ) ); |
111 | | - |
112 | | - $stats['status'] = htmlspecialchars( EPCourse::getStatusMessage( $course->getStatus() ) ); |
113 | | - |
114 | | - if ( $this->getUser()->isAllowed( 'ep-token' ) ) { |
115 | | - $stats['token'] = Linker::linkKnown( |
116 | | - SpecialPage::getTitleFor( 'Enroll', $course->getId() . '/' . $course->getField( 'token' ) ), |
117 | | - htmlspecialchars( $course->getField( 'token' ) ) |
118 | | - ); |
119 | | - } |
120 | | - |
121 | | - return $stats; |
122 | | - } |
123 | | - |
124 | | -} |
Index: trunk/extensions/EducationProgram/specials/SpecialEditCourse.php |
— | — | @@ -1,165 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -/** |
5 | | - * Addition and modification interface for courses. |
6 | | - * |
7 | | - * @since 0.1 |
8 | | - * |
9 | | - * @file SpecialEditCourse.php |
10 | | - * @ingroup EducationProgram |
11 | | - * |
12 | | - * @licence GNU GPL v3 or later |
13 | | - * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
14 | | - */ |
15 | | -class SpecialEditCourse extends SpecialEPFormPage { |
16 | | - |
17 | | - /** |
18 | | - * Constructor. |
19 | | - * |
20 | | - * @since 0.1 |
21 | | - */ |
22 | | - public function __construct() { |
23 | | - parent::__construct( 'EditCourse', 'ep-course', 'EPCourse', 'Courses', 'Course' ); |
24 | | - |
25 | | - $this->getOutput()->addModules( array( 'ep.datepicker', 'ep.combobox' ) ); |
26 | | - } |
27 | | - |
28 | | - /** |
29 | | - * (non-PHPdoc) |
30 | | - * @see SpecialEPFormPage::getFormFields() |
31 | | - * @return array |
32 | | - */ |
33 | | - protected function getFormFields() { |
34 | | - $fields = parent::getFormFields(); |
35 | | - |
36 | | - $orgOptions = EPOrg::getOrgOptions(); |
37 | | - |
38 | | - $fields['name'] = array ( |
39 | | - 'type' => 'text', |
40 | | - 'label-message' => 'ep-course-edit-name', |
41 | | - 'required' => true, |
42 | | - ); |
43 | | - |
44 | | - $fields['org_id'] = array ( |
45 | | - 'type' => 'select', |
46 | | - 'label-message' => 'ep-course-edit-org', |
47 | | - 'required' => true, |
48 | | - 'options' => $orgOptions, |
49 | | - 'validation-callback' => function ( $value, array $alldata = null ) use ( $orgOptions ) { |
50 | | - return in_array( (int)$value, array_values( $orgOptions ) ) ? true : wfMsg( 'ep-course-invalid-org' ); |
51 | | - }, |
52 | | - ); |
53 | | - |
54 | | - $fields['token'] = array ( |
55 | | - 'type' => 'text', |
56 | | - 'label-message' => 'ep-course-edit-token', |
57 | | - 'maxlength' => 255, |
58 | | - 'size' => 20, |
59 | | - 'validation-callback' => function ( $value, array $alldata = null ) { |
60 | | - $strLen = strlen( $value ); |
61 | | - return ( $strLen !== 0 && $strLen < 2 ) ? wfMsgExt( 'ep-course-invalid-token', 'parsemag', 2 ) : true; |
62 | | - } , |
63 | | - ); |
64 | | - |
65 | | - $fields['term'] = array ( |
66 | | - 'type' => 'text', |
67 | | - 'label-message' => 'ep-course-edit-term', |
68 | | - 'required' => true, |
69 | | - ); |
70 | | - |
71 | | - $fields['start'] = array ( |
72 | | - 'class' => 'EPHTMLDateField', |
73 | | - 'label-message' => 'ep-course-edit-start', |
74 | | - 'required' => true, |
75 | | - ); |
76 | | - |
77 | | - $fields['end'] = array ( |
78 | | - 'class' => 'EPHTMLDateField', |
79 | | - 'label-message' => 'ep-course-edit-end', |
80 | | - 'required' => true, |
81 | | - ); |
82 | | - |
83 | | - $fieldFields = EPCourse::selectFields( 'field', array(), array( 'DISTINCT' ) ); |
84 | | - $fieldFields = array_merge( array( '' => '' ), $fieldFields ); |
85 | | - $fields['field'] = array ( |
86 | | - 'class' => 'EPHTMLCombobox', |
87 | | - 'label-message' => 'ep-course-edit-field', |
88 | | - 'required' => true, |
89 | | - 'options' => array_combine( $fieldFields, $fieldFields ), |
90 | | - ); |
91 | | - |
92 | | - $levels = EPCourse::selectFields( 'level', array(), array( 'DISTINCT' ) ); |
93 | | - $levels = array_merge( array( '' => '' ), $levels ); |
94 | | - $fields['level'] = array ( |
95 | | - 'class' => 'EPHTMLCombobox', |
96 | | - 'label-message' => 'ep-course-edit-level', |
97 | | - 'required' => true, |
98 | | - 'options' => array_combine( $levels, $levels ), |
99 | | - ); |
100 | | - |
101 | | - $langOptions = EPUtils::getLanguageOptions( $this->getLanguage()->getCode() ); |
102 | | - $fields['lang'] = array ( |
103 | | - 'type' => 'select', |
104 | | - 'label-message' => 'ep-course-edit-lang', |
105 | | - 'maxlength' => 255, |
106 | | - 'required' => true, |
107 | | - 'options' => $langOptions, |
108 | | - 'validation-callback' => function ( $value, array $alldata = null ) use ( $langOptions ) { |
109 | | - return in_array( $value, $langOptions ) ? true : wfMsg( 'ep-course-invalid-lang' ); |
110 | | - } |
111 | | - ); |
112 | | - |
113 | | - $mcs = EPCourse::selectFields( 'mc', array(), array( 'DISTINCT' ) ); |
114 | | - $mcs = array_merge( array( '' => '' ), $mcs ); |
115 | | - $fields['mc'] = array ( |
116 | | - 'class' => 'EPHTMLCombobox', |
117 | | - 'label-message' => 'ep-course-edit-mc', |
118 | | - 'required' => true, |
119 | | - 'options' => array_combine( $mcs, $mcs ), |
120 | | - ); |
121 | | - |
122 | | - $fields['description'] = array ( |
123 | | - 'type' => 'textarea', |
124 | | - 'label-message' => 'ep-course-edit-description', |
125 | | - 'required' => true, |
126 | | - 'validation-callback' => function ( $value, array $alldata = null ) { |
127 | | - return strlen( $value ) < 10 ? wfMsgExt( 'ep-course-invalid-description', 'parsemag', 10 ) : true; |
128 | | - } , |
129 | | - 'rows' => 10, |
130 | | - 'id' => 'wpTextbox1', |
131 | | - ); |
132 | | - |
133 | | - return $this->processFormFields( $fields ); |
134 | | - } |
135 | | - |
136 | | - /** |
137 | | - * (non-PHPdoc) |
138 | | - * @see SpecialEPFormPage::getNewData() |
139 | | - */ |
140 | | - protected function getNewData() { |
141 | | - return array( |
142 | | - 'org_id' => $this->getRequest()->getVal( 'neworg' ), |
143 | | - 'name' => wfMsgExt( |
144 | | - 'ep-course-edit-name-format', |
145 | | - 'parsemag', |
146 | | - $this->getRequest()->getVal( 'newname' ), |
147 | | - $this->getRequest()->getVal( 'newterm' ) |
148 | | - ), |
149 | | - 'term' => $this->getRequest()->getVal( 'newterm' ), |
150 | | - 'mc' => $this->getRequest()->getVal( 'newname' ), |
151 | | - ); |
152 | | - } |
153 | | - |
154 | | - /** |
155 | | - * (non-PHPdoc) |
156 | | - * @see SpecialEPFormPage::handleKnownField() |
157 | | - */ |
158 | | - protected function handleKnownField( $name, $value ) { |
159 | | - if ( in_array( $name, array( 'end', 'start' ) ) ) { |
160 | | - $value = wfTimestamp( TS_MW, strtotime( $value ) ); |
161 | | - } |
162 | | - |
163 | | - return $value; |
164 | | - } |
165 | | - |
166 | | -} |
Index: trunk/extensions/EducationProgram/specials/SpecialInstitutionHistory.php |
— | — | @@ -1,25 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -/** |
5 | | - * Special page for listing the history of an institution. |
6 | | - * |
7 | | - * @since 0.1 |
8 | | - * |
9 | | - * @file SpecialInstitutionHistory.php |
10 | | - * @ingroup EducationProgram |
11 | | - * |
12 | | - * @licence GNU GPL v3 or later |
13 | | - * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
14 | | - */ |
15 | | -class SpecialInstitutionHistory extends SpecialEPHistory { |
16 | | - |
17 | | - /** |
18 | | - * Constructor. |
19 | | - * |
20 | | - * @since 0.1 |
21 | | - */ |
22 | | - public function __construct() { |
23 | | - parent::__construct( 'InstitutionHistory', 'EPOrg', 'name', 'Institution' ); |
24 | | - } |
25 | | - |
26 | | -} |
Index: trunk/extensions/EducationProgram/specials/SpecialCourseHistory.php |
— | — | @@ -1,25 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -/** |
5 | | - * Special page for listing the history of a course. |
6 | | - * |
7 | | - * @since 0.1 |
8 | | - * |
9 | | - * @file SpecialCourseHistory.php |
10 | | - * @ingroup EducationProgram |
11 | | - * |
12 | | - * @licence GNU GPL v3 or later |
13 | | - * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
14 | | - */ |
15 | | -class SpecialCourseHistory extends SpecialEPHistory { |
16 | | - |
17 | | - /** |
18 | | - * Constructor. |
19 | | - * |
20 | | - * @since 0.1 |
21 | | - */ |
22 | | - public function __construct() { |
23 | | - parent::__construct( 'CourseHistory', 'EPCourse', 'id', 'Course' ); |
24 | | - } |
25 | | - |
26 | | -} |
Index: trunk/extensions/EducationProgram/specials/SpecialEPFormPage.php |
— | — | @@ -1,432 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -/** |
5 | | - * FormSpecialPage equivalent but deriving from SpecialEPPage. |
6 | | - * |
7 | | - * @since 0.1 |
8 | | - * |
9 | | - * @file SpecialEPFormPage.php |
10 | | - * @ingroup EducationProgram |
11 | | - * |
12 | | - * @licence GNU GPL v3 or later |
13 | | - * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
14 | | - */ |
15 | | -abstract class SpecialEPFormPage extends SpecialEPPage { |
16 | | - |
17 | | - /** |
18 | | - * Instance of the object being edited or created. |
19 | | - * |
20 | | - * @since 0.1 |
21 | | - * @var EPDBObject|false |
22 | | - */ |
23 | | - protected $item = false; |
24 | | - |
25 | | - /** |
26 | | - * Name of the class of the object being edited or created. |
27 | | - * |
28 | | - * @since 0.1 |
29 | | - * @var string |
30 | | - */ |
31 | | - protected $itemClass; |
32 | | - |
33 | | - /** |
34 | | - * Name of the special page listing the items. |
35 | | - * For example, for "EditLolcat", it could be "Lolcats". |
36 | | - * |
37 | | - * @since 0.1 |
38 | | - * @var string |
39 | | - */ |
40 | | - protected $listPage; |
41 | | - |
42 | | - /** |
43 | | - * Name of the special page displaying individual items. |
44 | | - * For example, for "EditLolcat", it could be "Lolcat". |
45 | | - * |
46 | | - * @since 0.1 |
47 | | - * @var string |
48 | | - */ |
49 | | - protected $itemPage; |
50 | | - |
51 | | - /** |
52 | | - * Constructor. |
53 | | - * |
54 | | - * @since 0.1 |
55 | | - * |
56 | | - * @param string $name Name of the page |
57 | | - * @param string $right Right needed to access the page |
58 | | - * @param string $itemClass Name of the item class |
59 | | - * @param string $listPage Name of the page listing the items |
60 | | - * @param string $itemPage Name of the page displaying individual items |
61 | | - */ |
62 | | - public function __construct( $name, $right, $itemClass, $listPage, $itemPage ) { |
63 | | - $this->itemClass = $itemClass; |
64 | | - $this->listPage = $listPage; |
65 | | - $this->itemPage = $itemPage; |
66 | | - |
67 | | - parent::__construct( $name, $right, false ); |
68 | | - |
69 | | - $this->getOutput()->addModules( 'ep.formpage' ); |
70 | | - } |
71 | | - |
72 | | - /** |
73 | | - * @see SpecialPage::getDescription |
74 | | - * |
75 | | - * @since 0.1 |
76 | | - * |
77 | | - * @return string |
78 | | - */ |
79 | | - public function getDescription() { |
80 | | - $action = $this->isNew() ? 'add' : 'edit'; |
81 | | - return wfMsg( 'special-' . strtolower( $this->getName() ) . '-' . $action ); |
82 | | - } |
83 | | - |
84 | | - /** |
85 | | - * Sets headers - this should be called from the execute() method of all derived classes! |
86 | | - * |
87 | | - * @since 0.1 |
88 | | - */ |
89 | | - public function setHeaders() { |
90 | | - $out = $this->getOutput(); |
91 | | - $out->setArticleRelated( false ); |
92 | | - $out->setRobotPolicy( 'noindex,nofollow' ); |
93 | | - $out->setPageTitle( $this->getDescription() ); |
94 | | - } |
95 | | - |
96 | | - /** |
97 | | - * Main method. |
98 | | - * |
99 | | - * @since 0.1 |
100 | | - * |
101 | | - * @param string $subPage |
102 | | - */ |
103 | | - public function execute( $subPage ) { |
104 | | - parent::execute( $subPage ); |
105 | | - |
106 | | - if ( $this->getRequest()->wasPosted() && $this->getUser()->matchEditToken( $this->getRequest()->getVal( 'wpEditToken' ) ) ) { |
107 | | - $this->showForm(); |
108 | | - } |
109 | | - else { |
110 | | - $this->showContent(); |
111 | | - } |
112 | | - } |
113 | | - |
114 | | - /** |
115 | | - * Display the form and set the item field, or redirect the user. |
116 | | - * |
117 | | - * @since 0.1 |
118 | | - */ |
119 | | - protected function showContent() { |
120 | | - $c = $this->itemClass; // Yeah, this is needed in PHP 5.3 >_> |
121 | | - |
122 | | - if ( $this->isNew() ) { |
123 | | - $data = $this->getNewData(); |
124 | | - |
125 | | - $object = $c::selectRow( null, $data ); |
126 | | - |
127 | | - if ( $object === false ) { |
128 | | - $object = new $c( $data, true ); |
129 | | - } |
130 | | - else { |
131 | | - $this->showWarning( wfMessage( 'educationprogram-' . strtolower( $this->getName() ) . '-exists-already' ) ); |
132 | | - } |
133 | | - } |
134 | | - else { |
135 | | - $object = $c::selectRow( null, $this->getTitleConditions() ); |
136 | | - } |
137 | | - |
138 | | - if ( $object === false ) { |
139 | | - $this->getOutput()->redirect( SpecialPage::getTitleFor( $this->listPage )->getLocalURL() ); |
140 | | - } |
141 | | - else { |
142 | | -// if ( !$this->isNew() ) { |
143 | | -// $this->getOutput()->addHTML( |
144 | | -// SpecialContestPage::getNavigation( $contest->getField( 'name' ), $this->getUser(), $this->getLanguage(), $this->getName() ) |
145 | | -// ); |
146 | | -// } |
147 | | - |
148 | | - $this->item = $object; |
149 | | - $this->showForm(); |
150 | | - } |
151 | | - } |
152 | | - |
153 | | - /** |
154 | | - * Returns if the page should work in insertion mode rather then modification mode. |
155 | | - * |
156 | | - * @since 0.1 |
157 | | - * |
158 | | - * @return boolean |
159 | | - */ |
160 | | - protected function isNew() { |
161 | | - static $isNew = null; |
162 | | - |
163 | | - if ( is_null( $isNew ) ) { |
164 | | - $isNew = $this->getRequest()->wasPosted() && |
165 | | - ( $this->getRequest()->getCheck( 'isnew' ) || $this->getRequest()->getCheck( 'wpisnew' ) ); |
166 | | - } |
167 | | - |
168 | | - return $isNew; |
169 | | - } |
170 | | - |
171 | | - /** |
172 | | - * Show the form. |
173 | | - * |
174 | | - * @since 0.1 |
175 | | - */ |
176 | | - protected function showForm() { |
177 | | - $form = $this->getForm(); |
178 | | - |
179 | | - if ( $this->getRequest()->wasPosted() && $this->getRequest()->getCheck( 'isnew' ) ) { |
180 | | - $form->prepareForm(); |
181 | | - $form->displayForm( Status::newGood() ); |
182 | | - } |
183 | | - else { |
184 | | - if ( $form->show() ) { |
185 | | - $this->onSuccess(); |
186 | | - } |
187 | | - } |
188 | | - } |
189 | | - |
190 | | - /** |
191 | | - * Returns the data to use as condition for selecting the object, |
192 | | - * or in case nothing matches the selection, the data to initialize |
193 | | - * it with. This is typically an identifier such as name or id. |
194 | | - * |
195 | | - * @since 0.1 |
196 | | - * |
197 | | - * @return array |
198 | | - */ |
199 | | - protected function getNewData() { |
200 | | - return array( 'name' => $this->getRequest()->getVal( 'newname' ) ); |
201 | | - } |
202 | | - |
203 | | - /** |
204 | | - * Get the query conditions to obtain the item based on the page title. |
205 | | - * |
206 | | - * @since 0.1 |
207 | | - * |
208 | | - * @return array |
209 | | - */ |
210 | | - protected function getTitleConditions() { |
211 | | - return array( 'name' => $this->subPage ); |
212 | | - } |
213 | | - |
214 | | - /** |
215 | | - * (non-PHPdoc) |
216 | | - * @see FormSpecialPage::getForm() |
217 | | - * @return HTMLForm|null |
218 | | - */ |
219 | | - protected function getForm() { |
220 | | - $fields = $this->getFormFields(); |
221 | | - |
222 | | - if ( $this->isNew() ) { |
223 | | - $fields['isnew'] = array( |
224 | | - 'type' => 'hidden', |
225 | | - 'default' => 1, |
226 | | - ); |
227 | | - } |
228 | | - |
229 | | - if ( $this->getRequest()->getCheck( 'wpreturnto' ) ) { |
230 | | - $fields['returnto'] = array( |
231 | | - 'type' => 'hidden', |
232 | | - 'default' => $this->getRequest()->getText( 'wpreturnto' ), |
233 | | - ); |
234 | | - } |
235 | | - |
236 | | - $form = new HTMLForm( $fields, $this->getContext() ); |
237 | | - |
238 | | - $form->setSubmitCallback( array( $this, 'handleSubmission' ) ); |
239 | | - $form->setSubmitText( wfMsg( 'educationprogram-org-submit' ) ); |
240 | | - $form->setSubmitTooltip( 'ep-form-save' ); |
241 | | - |
242 | | - $action = $this->isNew() ? 'add' : 'edit'; |
243 | | - $form->setWrapperLegend( $this->msg( strtolower( $this->getName() ) . '-' . $action . '-legend' ) ); |
244 | | - |
245 | | - $form->addButton( |
246 | | - 'cancelEdit', |
247 | | - wfMsg( 'cancel' ), |
248 | | - 'cancelEdit', |
249 | | - array( |
250 | | - 'target-url' => SpecialPage::getTitleFor( $this->listPage )->getFullURL(), |
251 | | - ) |
252 | | - ); |
253 | | - |
254 | | -// $form->addButton( |
255 | | -// 'deleteEdit', |
256 | | -// wfMsg( 'delete' ), |
257 | | -// 'deleteEdit' |
258 | | -// ); |
259 | | - |
260 | | - return $form; |
261 | | - } |
262 | | - |
263 | | - /** |
264 | | - * (non-PHPdoc) |
265 | | - * @see FormSpecialPage::getFormFields() |
266 | | - * @return array |
267 | | - */ |
268 | | - protected function getFormFields() { |
269 | | - $fields = array(); |
270 | | - |
271 | | - $fields['id'] = array( 'type' => 'hidden' ); |
272 | | - |
273 | | - $req = $this->getRequest(); |
274 | | - |
275 | | - // This sort of sucks as well. Meh, HTMLForm is odd. |
276 | | - if ( $req->wasPosted() |
277 | | - && $this->getUser()->matchEditToken( $req->getVal( 'wpEditToken' ) ) |
278 | | - && $req->getCheck( 'wpitem-id' ) ) { |
279 | | - $fields['id']['default'] = $req->getInt( 'wpitem-id' ); |
280 | | - } |
281 | | - |
282 | | - return $fields; |
283 | | - } |
284 | | - |
285 | | - /** |
286 | | - * Populates the form fields with the data of the item |
287 | | - * and prefixes their names. |
288 | | - * |
289 | | - * @since 0.1 |
290 | | - * |
291 | | - * @param array $fields |
292 | | - * |
293 | | - * @return array |
294 | | - */ |
295 | | - protected function processFormFields( array $fields ) { |
296 | | - if ( $this->item !== false ) { |
297 | | - foreach ( $fields as $name => &$data ) { |
298 | | - if ( !array_key_exists( 'default', $data ) ) { |
299 | | - $data['default'] = $this->getDefaultFromItem( $this->item, $name ); |
300 | | - } |
301 | | - } |
302 | | - } |
303 | | - |
304 | | - $mappedFields = array(); |
305 | | - |
306 | | - foreach ( $fields as $name => $field ) { |
307 | | - if ( $this->getRequest()->getCheck( 'isnew' ) ) { |
308 | | - // HTML form is being a huge pain in running the validation on post, |
309 | | - // so just remove it if when not appropriate. |
310 | | - unset( $field['validation-callback'] ); |
311 | | - unset( $field['required'] ); |
312 | | - } |
313 | | - |
314 | | - $mappedFields['item-' . $name] = $field; |
315 | | - } |
316 | | - |
317 | | - return $mappedFields; |
318 | | - } |
319 | | - |
320 | | - /** |
321 | | - * Gets the default value for a field from the item. |
322 | | - * |
323 | | - * @since 0.1 |
324 | | - * |
325 | | - * @param EPDBObject $item |
326 | | - * @param string $name |
327 | | - * |
328 | | - * @return mixed |
329 | | - */ |
330 | | - protected function getDefaultFromItem( EPDBObject $item, $name ) { |
331 | | - return $item->getField( $name ); |
332 | | - } |
333 | | - |
334 | | - /** |
335 | | - * Gets called after the form is saved. |
336 | | - * |
337 | | - * @since 0.1 |
338 | | - */ |
339 | | - public function onSuccess() { |
340 | | - if ( $this->getRequest()->getCheck( 'wpreturnto' ) ) { |
341 | | - $parts = explode( '/', $this->getRequest()->getText( 'wpreturnto' ), 2 ); |
342 | | - $title = SpecialPage::getTitleFor( $parts[0], count( $parts ) === 2 ? $parts[1] : false ); |
343 | | - } |
344 | | - elseif ( $this->isNew() ) { |
345 | | - $c = $this->itemClass; // Yeah, this is needed in PHP 5.3 >_> |
346 | | - $title = $c::getTitleFor( $this->getRequest()->getText( 'wpitem-' . $c::getIdentifierField() ) ); |
347 | | - } |
348 | | - else { |
349 | | - $title = SpecialPage::getTitleFor( $this->itemPage, $this->subPage ); |
350 | | - } |
351 | | - |
352 | | - $this->getOutput()->redirect( $title->getLocalURL() ); |
353 | | - } |
354 | | - |
355 | | - /** |
356 | | - * Process the form. At this point we know that the user passes all the criteria in |
357 | | - * userCanExecute(). |
358 | | - * |
359 | | - * @param array $data |
360 | | - * |
361 | | - * @return Bool|Array |
362 | | - */ |
363 | | - public function handleSubmission( array $data ) { |
364 | | - $fields = array(); |
365 | | - $unknownValues = array(); |
366 | | - |
367 | | - $c = $this->itemClass; // Yeah, this is needed in PHP 5.3 >_> |
368 | | - |
369 | | - foreach ( $data as $name => $value ) { |
370 | | - $matches = array(); |
371 | | - |
372 | | - if ( preg_match( '/item-(.+)/', $name, $matches ) ) { |
373 | | - if ( $matches[1] === 'id' && ( $value === '' || $value === '0' ) ) { |
374 | | - $value = null; |
375 | | - } |
376 | | - |
377 | | - if ( $c::canHasField( $matches[1] ) ) { |
378 | | - $fields[$matches[1]] = $value; |
379 | | - } |
380 | | - else { |
381 | | - $unknownValues[$matches[1]] = $value; |
382 | | - } |
383 | | - } |
384 | | - } |
385 | | - |
386 | | - $keys = array_keys( $fields ); |
387 | | - $fields = array_combine( $keys, array_map( array( $this, 'handleKnownField' ), $keys, $fields ) ); |
388 | | - |
389 | | - /* EPDBObject */ $item = new $c( $fields, is_null( $fields['id'] ) ); |
390 | | - |
391 | | - foreach ( $unknownValues as $name => $value ) { |
392 | | - $this->handleUnknownField( $item, $name, $value ); |
393 | | - } |
394 | | - |
395 | | - $success = $item->writeToDB(); |
396 | | - |
397 | | - if ( $success ) { |
398 | | - return true; |
399 | | - } |
400 | | - else { |
401 | | - return array(); // TODO |
402 | | - } |
403 | | - } |
404 | | - |
405 | | - /** |
406 | | - * Gets called for evey unknown submitted value, so they can be dealt with if needed. |
407 | | - *$title = SpecialPage::getTitleFor( $this->itemPage, $this->subPage )->getLocalURL(); |
408 | | - * @since 0.1 |
409 | | - * |
410 | | - * @param EPDBObject $item |
411 | | - * @param string $name |
412 | | - * @param string $value This is a string, since it comes from request data, but might be a number or other type. |
413 | | - */ |
414 | | - protected function handleUnknownField( EPDBObject $item, $name, $value ) { |
415 | | - // Override to use. |
416 | | - } |
417 | | - |
418 | | - /** |
419 | | - * Gets called for evey known submitted value, so they can be dealt with if needed. |
420 | | - * |
421 | | - * @since 0.1 |
422 | | - * |
423 | | - * @param string $name |
424 | | - * @param string $value This is a string, since it comes from request data, but might be a number or other type. |
425 | | - * |
426 | | - * @return mixed The new value |
427 | | - */ |
428 | | - protected function handleKnownField( $name, $value ) { |
429 | | - // Override to use. |
430 | | - return $value; |
431 | | - } |
432 | | - |
433 | | -} |
Index: trunk/extensions/EducationProgram/specials/SpecialEPHistory.php |
— | — | @@ -1,178 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -/** |
5 | | - * Base class for history special pages. |
6 | | - * |
7 | | - * @since 0.1 |
8 | | - * |
9 | | - * @file SpecialEPHistory.php |
10 | | - * @ingroup EducationProgram |
11 | | - * |
12 | | - * @licence GNU GPL v3 or later |
13 | | - * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
14 | | - */ |
15 | | -abstract class SpecialEPHistory extends SpecialEPPage { |
16 | | - |
17 | | - /** |
18 | | - * @since 0.1 |
19 | | - * @var string |
20 | | - */ |
21 | | - protected $identifier; |
22 | | - |
23 | | - /** |
24 | | - * @since 0.1 |
25 | | - * @var string |
26 | | - */ |
27 | | - protected $className; |
28 | | - |
29 | | - /** |
30 | | - * @since 0.1 |
31 | | - * @var string |
32 | | - */ |
33 | | - protected $itemPage; |
34 | | - |
35 | | - /** |
36 | | - * @see parent::__construct |
37 | | - * |
38 | | - * @since 0.1 |
39 | | - * |
40 | | - * @param string $name |
41 | | - * @param string $className |
42 | | - * @param string $identifierField |
43 | | - * @param string $restriction |
44 | | - */ |
45 | | - public function __construct( $name, $className, $identifierField, $itemPage, $restriction = '' ) { |
46 | | - $this->identifier = $identifierField; |
47 | | - $this->className = $className; |
48 | | - $this->itemPage = $itemPage; |
49 | | - |
50 | | - parent::__construct( $name, $restriction, false ); |
51 | | - } |
52 | | - |
53 | | - /** |
54 | | - * Main method. |
55 | | - * |
56 | | - * @since 0.1 |
57 | | - * |
58 | | - * @param string $subPage |
59 | | - */ |
60 | | - public function execute( $subPage ) { |
61 | | - parent::execute( $subPage ); |
62 | | - |
63 | | - $c = $this->className; // Yeah, this is needed in PHP 5.3 >_> |
64 | | - $object = $c::selectRow( null, array( $this->identifier => $subPage ) ); |
65 | | - |
66 | | - if ( $object === false ) { |
67 | | - // TODO |
68 | | - } |
69 | | - else { |
70 | | - $this->displayRevisions( $object ); |
71 | | - } |
72 | | - } |
73 | | - |
74 | | - /** |
75 | | - * @see SpecialPage::getDescription |
76 | | - * |
77 | | - * @since 0.1 |
78 | | - * |
79 | | - * @return string |
80 | | - */ |
81 | | - public function getDescription() { |
82 | | - return wfMsgExt( 'special-' . strtolower( $this->getName() ), 'parsemag', $this->subPage ); |
83 | | - } |
84 | | - |
85 | | - /** |
86 | | - * Display a list with the passed revisions. |
87 | | - * |
88 | | - * @since 0.1 |
89 | | - * |
90 | | - * @param EPDBObject $object |
91 | | - */ |
92 | | - protected function displayRevisions( EPDBObject $object ) { |
93 | | - $conditions = array( |
94 | | - 'type' => get_class( $object ), |
95 | | - ); |
96 | | - |
97 | | - if ( $object->hasIdField() ) { |
98 | | - $conditions['object_id'] = $object->getId(); |
99 | | - } |
100 | | - |
101 | | - $action = htmlspecialchars( $GLOBALS['wgScript'] ); |
102 | | - |
103 | | - $request = $this->getRequest(); |
104 | | - $out = $this->getOutput(); |
105 | | - |
106 | | - /** |
107 | | - * Add date selector to quickly get to a certain time |
108 | | - */ |
109 | | - $year = $request->getInt( 'year' ); |
110 | | - $month = $request->getInt( 'month' ); |
111 | | - $tagFilter = $request->getVal( 'tagfilter' ); |
112 | | - $tagSelector = ChangeTags::buildTagFilterSelector( $tagFilter ); |
113 | | - |
114 | | - /** |
115 | | - * Option to show only revisions that have been (partially) hidden via RevisionDelete |
116 | | - */ |
117 | | - if ( $request->getBool( 'deleted' ) ) { |
118 | | - $conditions['deleted'] = true; |
119 | | - } |
120 | | - |
121 | | - $checkDeleted = Xml::checkLabel( $this->msg( 'history-show-deleted' )->text(), |
122 | | - 'deleted', 'mw-show-deleted-only', $request->getBool( 'deleted' ) ) . "\n"; |
123 | | - |
124 | | - $out->addHTML( |
125 | | - "<form action=\"$action\" method=\"get\" id=\"mw-history-searchform\">" . |
126 | | - Xml::fieldset( |
127 | | - $this->msg( 'history-fieldset-title' )->text(), |
128 | | - false, |
129 | | - array( 'id' => 'mw-history-search' ) |
130 | | - ) . |
131 | | - Html::hidden( 'title', $this->getTitle()->getPrefixedDBKey() ) . "\n" . |
132 | | - Html::hidden( 'action', 'history' ) . "\n" . |
133 | | - Xml::dateMenu( $year, $month ) . ' ' . |
134 | | - ( $tagSelector ? ( implode( ' ', $tagSelector ) . ' ' ) : '' ) . |
135 | | - $checkDeleted . |
136 | | - Xml::submitButton( $this->msg( 'allpagessubmit' )->text() ) . "\n" . |
137 | | - '</fieldset></form>' |
138 | | - ); |
139 | | - |
140 | | - $pager = new EPRevisionPager( $this->getContext(), $this->className, $this->itemPage, $conditions ); |
141 | | - |
142 | | - if ( $pager->getNumRows() ) { |
143 | | - $out->addHTML( |
144 | | - $pager->getNavigationBar() . |
145 | | - $pager->getBody() . |
146 | | - $pager->getNavigationBar() |
147 | | - ); |
148 | | - } |
149 | | - else { |
150 | | - // TODO |
151 | | - } |
152 | | - |
153 | | -// $revisions = EPRevision::select( |
154 | | -// null, |
155 | | -// $conditions |
156 | | -// ); |
157 | | -// |
158 | | -// if ( count( $revisions ) > 0 ) { |
159 | | -// array_unshift( $revisions, EPRevision::newFromObject( $object ) ); |
160 | | -// $this->displayRevisionList( $revisions ); |
161 | | -// } |
162 | | -// else { |
163 | | -// // TODO |
164 | | -// } |
165 | | - } |
166 | | - |
167 | | - protected function displayRevisionList( array /* of EPRevision */ $revisions ) { |
168 | | - foreach ( $revisions as &$revision ) { |
169 | | - $revision = '<li>' . $this->getRevisionItem( $revision ) . '</li>'; |
170 | | - } |
171 | | - |
172 | | - $this->getOutput()->addHTML( '<ul>' . implode( '', $revisions ) . '</ul>' ); |
173 | | - } |
174 | | - |
175 | | - protected function getRevisionItem( EPRevision $revision ) { |
176 | | - return $revision->getField( 'time' ) . json_encode( $revision->getField( 'data' ) ); // TODO |
177 | | - } |
178 | | - |
179 | | -} |
Index: trunk/extensions/EducationProgram/EducationProgram.hooks.php |
— | — | @@ -233,7 +233,6 @@ |
234 | 234 | ); |
235 | 235 | |
236 | 236 | if ( array_key_exists( $title->getNamespace(), $classes ) ) { |
237 | | - // array_intersect_key( $links['views'], array_flip( array( 'view', 'edit', 'history' ) ) ); |
238 | 237 | $links['views'] = array(); |
239 | 238 | $links['actions'] = array(); |
240 | 239 | |