Index: trunk/extensions/ArticleAssessmentPilot/api/ApiListArticleAssessment.php |
— | — | @@ -5,8 +5,10 @@ |
6 | 6 | * @file |
7 | 7 | * @ingroup API |
8 | 8 | */ |
9 | | - |
10 | 9 | class ApiListArticleAssessment extends ApiBase { |
| 10 | + public function __construct( $query, $moduleName ) { |
| 11 | + parent::__construct( $query, $moduleName, 'aa' ); |
| 12 | + } |
11 | 13 | |
12 | 14 | /** |
13 | 15 | * runs when the API is called with "articleasessment" |
— | — | @@ -14,70 +16,35 @@ |
15 | 17 | */ |
16 | 18 | public function execute() { |
17 | 19 | $params = $this->extractRequestParams(); |
18 | | - $this->validateParams( $params ); |
19 | | - |
20 | | - if( isset( $params['getCumulativeResults'] ) ){ |
21 | | - //get cumulative results |
22 | | - |
23 | | - //query to add 'n' reviews together |
24 | | - |
25 | | - } |
26 | | - else if ( isset( $params['setUserVals'] ) ){ |
27 | | - //set user values |
28 | | - |
29 | | - //validate authid |
30 | | - |
31 | | - //insert |
32 | | - } |
33 | | - |
| 20 | + |
34 | 21 | } |
35 | 22 | |
36 | | - /** |
37 | | - * Required parameter check |
38 | | - * @param $params params extracted from the POST |
39 | | - */ |
40 | | - protected function validateParams( $params ) { |
41 | | - |
42 | | - if( isset( $params['getCumulativeResults'] ) ){ |
43 | | - //get cumulative results |
44 | | - $required = array('pageId', 'revId'); |
45 | | - foreach ( $required as $arg ) { |
46 | | - if ( !isset( $params[$arg] ) ) { |
47 | | - $this->dieUsageMsg( array( 'missingparam', $arg ) ); |
48 | | - } |
49 | | - } |
50 | | - } |
51 | | - else if ( isset( $params['setUserVals'] ) ){ |
52 | | - //set user values |
53 | | - $required = array('userId', 'authId', 'pageId', 'revId', 'review'); |
54 | | - foreach ( $required as $arg ) { |
55 | | - if ( !isset( $params[$arg] ) ) { |
56 | | - $this->dieUsageMsg( array( 'missingparam', $arg ) ); |
57 | | - } |
58 | | - } |
59 | | - } |
60 | | - else{ |
61 | | - //FIXME: better usage message |
62 | | - $this->dieUsageMsg( array('missingparam', "mode") ); |
63 | | - } |
| 23 | + public function getAllowedParams() { |
| 24 | + return array( |
| 25 | + 'pageid' => null, |
| 26 | + 'revid' => null, |
| 27 | + ); |
64 | 28 | } |
65 | 29 | |
66 | | - /* |
67 | 30 | public function getParamDescription() { |
68 | 31 | return array( |
69 | | - 'getResults' => 'set if you want to get results', |
| 32 | + 'pageid' => '', |
| 33 | + 'revid' => '', |
70 | 34 | ); |
71 | | - }*/ |
| 35 | + } |
72 | 36 | |
73 | 37 | public function getDescription() { |
74 | 38 | return array( |
75 | | - 'get and set article assessment data' |
| 39 | + 'List all article assessments' |
76 | 40 | ); |
77 | 41 | } |
78 | 42 | |
| 43 | + public function getPossibleErrors() { |
| 44 | + return array_merge( parent::getPossibleErrors(), array( |
| 45 | + ) ); |
| 46 | + } |
79 | 47 | |
80 | 48 | public function getVersion() { |
81 | | - return __CLASS__ . ':0'; |
| 49 | + return __CLASS__ . ': $Id$'; |
82 | 50 | } |
83 | | - |
84 | 51 | } |
\ No newline at end of file |