Index: trunk/extensions/Contest/Contest.php |
— | — | @@ -51,6 +51,7 @@ |
52 | 52 | |
53 | 53 | $wgAutoloadClasses['ApiContestQuery'] = dirname( __FILE__ ) . '/api/ApiContestQuery.php'; |
54 | 54 | $wgAutoloadClasses['ApiDeleteContest'] = dirname( __FILE__ ) . '/api/ApiDeleteContest.php'; |
| 55 | +$wgAutoloadClasses['ApiQueryContestants'] = dirname( __FILE__ ) . '/api/ApiQueryContestants.php'; |
55 | 56 | $wgAutoloadClasses['ApiQueryContests'] = dirname( __FILE__ ) . '/api/ApiQueryContests.php'; |
56 | 57 | |
57 | 58 | $wgAutoloadClasses['Contest'] = dirname( __FILE__ ) . '/includes/Contest.class.php'; |
— | — | @@ -89,6 +90,7 @@ |
90 | 91 | |
91 | 92 | // API |
92 | 93 | $wgAPIModules['deletecontest'] = 'ApiDeleteContest'; |
| 94 | +$wgAPIListModules['contestants'] = 'ApiQueryContestants'; |
93 | 95 | $wgAPIListModules['contests'] = 'ApiQueryContests'; |
94 | 96 | |
95 | 97 | // Hooks |
Index: trunk/extensions/Contest/api/ApiQueryContests.php |
— | — | @@ -50,11 +50,15 @@ |
51 | 51 | */ |
52 | 52 | protected function getExamples() { |
53 | 53 | return array ( |
54 | | - 'api.php?action=query&list=contests&props=id|name', |
| 54 | + 'api.php?action=query&list=contests&coprops=id|name', |
55 | 55 | 'api.php?action=query&list=contests&costatus=1', |
56 | 56 | ); |
57 | 57 | } |
58 | 58 | |
| 59 | + /** |
| 60 | + * (non-PHPdoc) |
| 61 | + * @see includes/api/ApiBase#getVersion() |
| 62 | + */ |
59 | 63 | public function getVersion() { |
60 | 64 | return __CLASS__ . ': $Id$'; |
61 | 65 | } |
Index: trunk/extensions/Contest/api/ApiQueryContestants.php |
— | — | @@ -0,0 +1,66 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * API module to get a list of contestants. |
| 6 | + * |
| 7 | + * @since 0.1 |
| 8 | + * |
| 9 | + * @file ApiQueryContestants.php |
| 10 | + * @ingroup Contest |
| 11 | + * @ingroup API |
| 12 | + * |
| 13 | + * @licence GNU GPL v3+ |
| 14 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 15 | + */ |
| 16 | +class ApiQueryContestants extends ApiContestQuery { |
| 17 | + |
| 18 | + protected function getClassName() { |
| 19 | + return 'ContestContestant'; |
| 20 | + } |
| 21 | + |
| 22 | + public function __construct( $main, $action ) { |
| 23 | + parent::__construct( $main, $action, 'ct' ); |
| 24 | + } |
| 25 | + |
| 26 | + /** |
| 27 | + * Handle the API request. |
| 28 | + * Checks for access rights and then let's the parent method do the actual work. |
| 29 | + */ |
| 30 | + public function execute() { |
| 31 | + global $wgUser; |
| 32 | + |
| 33 | + if ( !$wgUser->isAllowed( 'contestadmin' ) || $wgUser->isBlocked() ) { |
| 34 | + $this->dieUsageMsg( array( 'badaccess-groups' ) ); |
| 35 | + } |
| 36 | + |
| 37 | + parent::execute(); |
| 38 | + } |
| 39 | + |
| 40 | + /** |
| 41 | + * (non-PHPdoc) |
| 42 | + * @see includes/api/ApiBase#getDescription() |
| 43 | + */ |
| 44 | + public function getDescription() { |
| 45 | + return 'API module for querying contestants'; |
| 46 | + } |
| 47 | + |
| 48 | + /** |
| 49 | + * (non-PHPdoc) |
| 50 | + * @see includes/api/ApiBase#getExamples() |
| 51 | + */ |
| 52 | + protected function getExamples() { |
| 53 | + return array ( |
| 54 | + 'api.php?action=query&list=contestants&ctprops=id|user_id|contest_id|rating', |
| 55 | + 'api.php?action=query&list=contestants&ctprops=id|rating&ctcontestid=42', |
| 56 | + ); |
| 57 | + } |
| 58 | + |
| 59 | + /** |
| 60 | + * (non-PHPdoc) |
| 61 | + * @see includes/api/ApiBase#getVersion() |
| 62 | + */ |
| 63 | + public function getVersion() { |
| 64 | + return __CLASS__ . ': $Id$'; |
| 65 | + } |
| 66 | + |
| 67 | +} |
Property changes on: trunk/extensions/Contest/api/ApiQueryContestants.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 68 | + native |
Added: svn:keywords |
2 | 69 | + Id |