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['ApiQueryChallenges'] = dirname( __FILE__ ) . '/api/ApiQueryChallenges.php'; |
55 | 56 | $wgAutoloadClasses['ApiQueryContestants'] = dirname( __FILE__ ) . '/api/ApiQueryContestants.php'; |
56 | 57 | $wgAutoloadClasses['ApiQueryContests'] = dirname( __FILE__ ) . '/api/ApiQueryContests.php'; |
57 | 58 | |
— | — | @@ -90,6 +91,7 @@ |
91 | 92 | |
92 | 93 | // API |
93 | 94 | $wgAPIModules['deletecontest'] = 'ApiDeleteContest'; |
| 95 | +$wgAPIListModules['challenges'] = 'ApiQueryChallenges'; |
94 | 96 | $wgAPIListModules['contestants'] = 'ApiQueryContestants'; |
95 | 97 | $wgAPIListModules['contests'] = 'ApiQueryContests'; |
96 | 98 | |
Index: trunk/extensions/Contest/api/ApiQueryChallenges.php |
— | — | @@ -0,0 +1,66 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * API module to get a list of contest challenges. |
| 6 | + * |
| 7 | + * @since 0.1 |
| 8 | + * |
| 9 | + * @file ApiQueryChallenges.php |
| 10 | + * @ingroup Contest |
| 11 | + * @ingroup API |
| 12 | + * |
| 13 | + * @licence GNU GPL v3+ |
| 14 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 15 | + */ |
| 16 | +class ApiQueryChallenges extends ApiContestQuery { |
| 17 | + |
| 18 | + protected function getClassName() { |
| 19 | + return 'ContestChallenge'; |
| 20 | + } |
| 21 | + |
| 22 | + public function __construct( $main, $action ) { |
| 23 | + parent::__construct( $main, $action, 'ch' ); |
| 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 contest challanges'; |
| 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=challenges&chprops=title|text', |
| 55 | + 'api.php?action=query&list=challenges&chcontestid=42&chprops=id|contest_id|title', |
| 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/ApiQueryChallenges.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 68 | + native |
Added: svn:keywords |
2 | 69 | + Id |