r96766 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96765‎ | r96766 | r96767 >
Date:01:17, 11 September 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
added API modules to obtain survey submission results
Modified paths:
  • /trunk/extensions/Survey/Survey.php (modified) (history)
  • /trunk/extensions/Survey/api/ApiAddSurvey.php (modified) (history)
  • /trunk/extensions/Survey/api/ApiEditSurvey.php (modified) (history)
  • /trunk/extensions/Survey/api/ApiQuerySurveyAnswers.php (added) (history)
  • /trunk/extensions/Survey/api/ApiQuerySurveySubmissions.php (added) (history)
  • /trunk/extensions/Survey/api/ApiQuerySurveys.php (modified) (history)
  • /trunk/extensions/Survey/includes/SurveyDBClass.php (modified) (history)
  • /trunk/extensions/Survey/specials/SpecialSurveyStats.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Survey/Survey.php
@@ -41,51 +41,55 @@
4242 'descriptionmsg' => 'survey-desc'
4343 );
4444
45 -$wgExtensionMessagesFiles['Survey'] = dirname( __FILE__ ) . '/Survey.i18n.php';
46 -$wgExtensionMessagesFiles['SurveyAlias'] = dirname( __FILE__ ) . '/Survey.alias.php';
 45+$wgExtensionMessagesFiles['Survey'] = dirname( __FILE__ ) . '/Survey.i18n.php';
 46+$wgExtensionMessagesFiles['SurveyAlias'] = dirname( __FILE__ ) . '/Survey.alias.php';
4747
48 -$wgAutoloadClasses['SurveyHooks'] = dirname( __FILE__ ) . '/Survey.hooks.php';
49 -$wgAutoloadClasses['SurveySettings'] = dirname( __FILE__ ) . '/Survey.settings.php';
 48+$wgAutoloadClasses['SurveyHooks'] = dirname( __FILE__ ) . '/Survey.hooks.php';
 49+$wgAutoloadClasses['SurveySettings'] = dirname( __FILE__ ) . '/Survey.settings.php';
5050
51 -$wgAutoloadClasses['ApiAddSurvey'] = dirname( __FILE__ ) . '/api/ApiAddSurvey.php';
52 -$wgAutoloadClasses['ApiDeleteSurvey'] = dirname( __FILE__ ) . '/api/ApiDeleteSurvey.php';
53 -$wgAutoloadClasses['ApiEditSurvey'] = dirname( __FILE__ ) . '/api/ApiEditSurvey.php';
54 -$wgAutoloadClasses['ApiQuerySurveys'] = dirname( __FILE__ ) . '/api/ApiQuerySurveys.php';
55 -$wgAutoloadClasses['ApiSubmitSurvey'] = dirname( __FILE__ ) . '/api/ApiSubmitSurvey.php';
 51+$wgAutoloadClasses['ApiAddSurvey'] = dirname( __FILE__ ) . '/api/ApiAddSurvey.php';
 52+$wgAutoloadClasses['ApiDeleteSurvey'] = dirname( __FILE__ ) . '/api/ApiDeleteSurvey.php';
 53+$wgAutoloadClasses['ApiEditSurvey'] = dirname( __FILE__ ) . '/api/ApiEditSurvey.php';
 54+$wgAutoloadClasses['ApiQuerySurveyAnswers'] = dirname( __FILE__ ) . '/api/ApiQuerySurveyAnswers.php';
 55+$wgAutoloadClasses['ApiQuerySurveys'] = dirname( __FILE__ ) . '/api/ApiQuerySurveys.php';
 56+$wgAutoloadClasses['ApiQuerySurveySubmissions'] = dirname( __FILE__ ) . '/api/ApiQuerySurveySubmissions.php';
 57+$wgAutoloadClasses['ApiSubmitSurvey'] = dirname( __FILE__ ) . '/api/ApiSubmitSurvey.php';
5658
57 -$wgAutoloadClasses['Survey'] = dirname( __FILE__ ) . '/includes/Survey.class.php';
58 -$wgAutoloadClasses['SurveyAnswer'] = dirname( __FILE__ ) . '/includes/SurveyAnswer.php';
59 -$wgAutoloadClasses['SurveyCompat'] = dirname( __FILE__ ) . '/includes/SurveyCompat.php';
60 -$wgAutoloadClasses['SurveyDBClass'] = dirname( __FILE__ ) . '/includes/SurveyDBClass.php';
61 -$wgAutoloadClasses['SurveyQuestion'] = dirname( __FILE__ ) . '/includes/SurveyQuestion.php';
62 -$wgAutoloadClasses['SurveySubmission'] = dirname( __FILE__ ) . '/includes/SurveySubmission.php';
63 -$wgAutoloadClasses['SurveyTag'] = dirname( __FILE__ ) . '/includes/SurveyTag.php';
 59+$wgAutoloadClasses['Survey'] = dirname( __FILE__ ) . '/includes/Survey.class.php';
 60+$wgAutoloadClasses['SurveyAnswer'] = dirname( __FILE__ ) . '/includes/SurveyAnswer.php';
 61+$wgAutoloadClasses['SurveyCompat'] = dirname( __FILE__ ) . '/includes/SurveyCompat.php';
 62+$wgAutoloadClasses['SurveyDBClass'] = dirname( __FILE__ ) . '/includes/SurveyDBClass.php';
 63+$wgAutoloadClasses['SurveyQuestion'] = dirname( __FILE__ ) . '/includes/SurveyQuestion.php';
 64+$wgAutoloadClasses['SurveySubmission'] = dirname( __FILE__ ) . '/includes/SurveySubmission.php';
 65+$wgAutoloadClasses['SurveyTag'] = dirname( __FILE__ ) . '/includes/SurveyTag.php';
6466
65 -$wgAutoloadClasses['SpecialSurvey'] = dirname( __FILE__ ) . '/specials/SpecialSurvey.php';
66 -$wgAutoloadClasses['SpecialSurveyPage'] = dirname( __FILE__ ) . '/specials/SpecialSurveyPage.php';
67 -$wgAutoloadClasses['SpecialSurveys'] = dirname( __FILE__ ) . '/specials/SpecialSurveys.php';
68 -$wgAutoloadClasses['SpecialSurveyStats'] = dirname( __FILE__ ) . '/specials/SpecialSurveyStats.php';
69 -$wgAutoloadClasses['SpecialTakeSurvey'] = dirname( __FILE__ ) . '/specials/SpecialTakeSurvey.php';
 67+$wgAutoloadClasses['SpecialSurvey'] = dirname( __FILE__ ) . '/specials/SpecialSurvey.php';
 68+$wgAutoloadClasses['SpecialSurveyPage'] = dirname( __FILE__ ) . '/specials/SpecialSurveyPage.php';
 69+$wgAutoloadClasses['SpecialSurveys'] = dirname( __FILE__ ) . '/specials/SpecialSurveys.php';
 70+$wgAutoloadClasses['SpecialSurveyStats'] = dirname( __FILE__ ) . '/specials/SpecialSurveyStats.php';
 71+$wgAutoloadClasses['SpecialTakeSurvey'] = dirname( __FILE__ ) . '/specials/SpecialTakeSurvey.php';
7072
71 -$wgSpecialPages['Survey'] = 'SpecialSurvey';
72 -$wgSpecialPages['Surveys'] = 'SpecialSurveys';
73 -$wgSpecialPages['SurveyStats'] = 'SpecialSurveyStats';
74 -$wgSpecialPages['TakeSurvey'] = 'SpecialTakeSurvey';
 73+$wgSpecialPages['Survey'] = 'SpecialSurvey';
 74+$wgSpecialPages['Surveys'] = 'SpecialSurveys';
 75+$wgSpecialPages['SurveyStats'] = 'SpecialSurveyStats';
 76+$wgSpecialPages['TakeSurvey'] = 'SpecialTakeSurvey';
7577
76 -$wgSpecialPageGroups['Survey'] = 'other';
77 -$wgSpecialPageGroups['Surveys'] = 'other';
78 -$wgSpecialPageGroups['SurveyStats'] = 'other';
79 -$wgSpecialPageGroups['TakeSurvey'] = 'other';
 78+$wgSpecialPageGroups['Survey'] = 'other';
 79+$wgSpecialPageGroups['Surveys'] = 'other';
 80+$wgSpecialPageGroups['SurveyStats'] = 'other';
 81+$wgSpecialPageGroups['TakeSurvey'] = 'other';
8082
81 -$wgAPIModules['addsurvey'] = 'ApiAddSurvey';
82 -$wgAPIModules['deletesurvey'] = 'ApiDeleteSurvey';
83 -$wgAPIModules['editsurvey'] = 'ApiEditSurvey';
84 -$wgAPIModules['submitsurvey'] = 'ApiSubmitSurvey';
85 -$wgAPIListModules['surveys'] = 'ApiQuerySurveys';
 83+$wgAPIModules['addsurvey'] = 'ApiAddSurvey';
 84+$wgAPIModules['deletesurvey'] = 'ApiDeleteSurvey';
 85+$wgAPIModules['editsurvey'] = 'ApiEditSurvey';
 86+$wgAPIModules['submitsurvey'] = 'ApiSubmitSurvey';
 87+$wgAPIListModules['surveys'] = 'ApiQuerySurveys';
 88+$wgAPIListModules['surveyanswers'] = 'ApiQuerySurveyAnswers';
 89+$wgAPIListModules['surveysubmissions'] = 'ApiQuerySurveySubmissions';
8690
87 -$wgHooks['LoadExtensionSchemaUpdates'][] = 'SurveyHooks::onSchemaUpdate';
88 -$wgHooks['UnitTestsList'][] = 'SurveyHooks::registerUnitTests';
89 -$wgHooks['ParserFirstCallInit'][] = 'SurveyHooks::onParserFirstCallInit';
 91+$wgHooks['LoadExtensionSchemaUpdates'][] = 'SurveyHooks::onSchemaUpdate';
 92+$wgHooks['UnitTestsList'][] = 'SurveyHooks::registerUnitTests';
 93+$wgHooks['ParserFirstCallInit'][] = 'SurveyHooks::onParserFirstCallInit';
9094
9195 $wgAvailableRights[] = 'surveyadmin';
9296 $wgAvailableRights[] = 'surveysubmit';
Index: trunk/extensions/Survey/specials/SpecialSurveyStats.php
@@ -217,6 +217,15 @@
218218 $out->addHTML( '</tr>' );
219219 }
220220
 221+ /**
 222+ * Get a list of most provided answers for the question.
 223+ *
 224+ * @since 0.1
 225+ *
 226+ * @param SurveyQuestion $question
 227+ *
 228+ * @return string
 229+ */
221230 protected function getAnswerList( SurveyQuestion $question ) {
222231 if ( $question->isRestrictiveType() ) {
223232 $list = '<ul>';
Index: trunk/extensions/Survey/includes/SurveyDBClass.php
@@ -66,6 +66,19 @@
6767 }
6868
6969 /**
 70+ * Returns an array with the fields and their descriptions.
 71+ *
 72+ * field name => field description
 73+ *
 74+ * @since 0.1
 75+ *
 76+ * @return array
 77+ */
 78+ public static function getFieldDescriptions() {
 79+ return array();
 80+ }
 81+
 82+ /**
7083 * Returns the name of the database table objects of this type are stored in.
7184 *
7285 * @since 0.1
@@ -561,6 +574,19 @@
562575 }
563576
564577 /**
 578+ * Takes in a field and returns an it's prefixed version, ready for db usage.
 579+ *
 580+ * @since 0.1
 581+ *
 582+ * @param string $field
 583+ *
 584+ * @return string
 585+ */
 586+ public static function getPrefixedField( $field ) {
 587+ return static::getFieldPrefix() . $field;
 588+ }
 589+
 590+ /**
565591 * Takes in an associative array with field names as keys and
566592 * their values as value. The field names are prefixed with the
567593 * db field prefix.
@@ -628,11 +654,22 @@
629655 return array();
630656 }
631657
632 - public static function getAPIParams() {
 658+ /**
 659+ * Get API parameters for the fields supported by this object.
 660+ *
 661+ * @since 0.1
 662+ *
 663+ * @param boolean $requireParams
 664+ *
 665+ * @return array
 666+ */
 667+ public static function getAPIParams( $requireParams = true ) {
633668 $typeMap = array(
 669+ 'id' => 'integer',
634670 'int' => 'integer',
635671 'str' => 'string',
636 - 'bool' => 'integer'
 672+ 'bool' => 'integer',
 673+ 'array' => 'string'
637674 );
638675
639676 $params = array();
@@ -647,11 +684,16 @@
648685
649686 $params[$field] = array(
650687 ApiBase::PARAM_TYPE => $typeMap[$type],
651 - ApiBase::PARAM_REQUIRED => !$hasDefault
 688+ ApiBase::PARAM_REQUIRED => $requireParams && !$hasDefault
652689 );
653690
 691+ if ( $type == 'array' ) {
 692+ $params[$field][ApiBase::PARAM_ISMULTI] = true;
 693+ }
 694+
654695 if ( $hasDefault ) {
655 - $params[$field][ApiBase::PARAM_DFLT] = $defaults[$field];
 696+ $default = is_array( $defaults[$field] ) ? implode( '|', $defaults[$field] ) : $defaults[$field];
 697+ $params[$field][ApiBase::PARAM_DFLT] = $default;
656698 }
657699 }
658700
@@ -659,22 +701,24 @@
660702 }
661703
662704 /**
663 - * Create a new instance from API parameters.
 705+ * Takes an array of field name => field value and
 706+ * filters it on valid field names.
664707 *
665708 * @since 0.1
666709 *
667 - * @param array $params
 710+ * @param array $conditions
 711+ * @param false|integer $id
668712 *
669 - * @return SurveyDBClass
 713+ * @return array
670714 */
671 - public static function newFromAPIParams( array $params, $id = false ) {
672 - $validParams = array();
 715+ public static function getValidFields( array $conditions, $id = false ) {
 716+ $validFields = array();
673717
674718 $fields = static::getFieldTypes();
675719
676 - foreach ( $params as $name => $value ) {
 720+ foreach ( $conditions as $name => $value ) {
677721 if ( array_key_exists( $name, $fields ) ) {
678 - $validParams[$name] = $value;
 722+ $validFields[$name] = $value;
679723 }
680724 }
681725
@@ -682,7 +726,7 @@
683727 $validParams[static::getIDField()] = $id;
684728 }
685729
686 - return new static( $validParams );
 730+ return $validFields;
687731 }
688732
689733 }
Index: trunk/extensions/Survey/api/ApiQuerySurveySubmissions.php
@@ -0,0 +1,154 @@
 2+<?php
 3+
 4+/**
 5+ * API module to get a list of survey submissions.
 6+ *
 7+ * @since 0.1
 8+ *
 9+ * @file ApiQuerySurveySubmissions.php
 10+ * @ingroup Surveys
 11+ * @ingroup API
 12+ *
 13+ * @licence GNU GPL v3+
 14+ * @author Jeroen De Dauw < jeroendedauw@gmail.com >
 15+ */
 16+class ApiQuerySurveySubmissions extends ApiQueryBase {
 17+
 18+ public function __construct( $main, $action ) {
 19+ parent::__construct( $main, $action, 'qs' );
 20+ }
 21+
 22+ /**
 23+ * Retrieve the special words from the database.
 24+ */
 25+ public function execute() {
 26+ global $wgUser;
 27+
 28+ if ( $wgUser->isBlocked() ) {
 29+ $this->dieUsageMsg( array( 'badaccess-groups' ) );
 30+ }
 31+
 32+ // Get the requests parameters.
 33+ $params = $this->extractRequestParams();
 34+
 35+ $starPropPosition = array_search( '*', $params['props'] );
 36+
 37+ if ( $starPropPosition !== false ) {
 38+ unset( $params['props'][$starPropPosition] );
 39+ $params['props'] = array_merge( $params['props'], SurveySubmission::getFieldNames() );
 40+ }
 41+
 42+ $params = array_filter( $params, function( $param ) { return !is_null( $param ); } );
 43+
 44+ $results = SurveySubmission::select(
 45+ $params['props'],
 46+ SurveySubmission::getValidFields( $params ),
 47+ array(
 48+ 'LIMIT' => $params['limit'] + 1,
 49+ 'ORDER BY' => SurveySubmission::getPrefixedField( 'id' ) . ' ASC'
 50+ )
 51+ );
 52+
 53+ $serializedResults = array();
 54+ $count = 0;
 55+
 56+ foreach ( $results as $result ) {
 57+ if ( ++$count > $params['limit'] ) {
 58+ // We've reached the one extra which shows that
 59+ // there are additional pages to be had. Stop here...
 60+ $this->setContinueEnumParameter( 'continue', $result->getId() );
 61+ break;
 62+ }
 63+
 64+ $serializedResults[] = $result->toArray();
 65+ }
 66+
 67+ $this->getResult()->setIndexedTagName( $serializedResults, 'submission' );
 68+
 69+ $this->getResult()->addValue(
 70+ null,
 71+ 'submissions',
 72+ $serializedResults
 73+ );
 74+ }
 75+
 76+ public function needsToken() {
 77+ return true;
 78+ }
 79+
 80+ public function getTokenSalt() {
 81+ return 'querysurveysubmissions';
 82+ }
 83+
 84+ /**
 85+ * (non-PHPdoc)
 86+ * @see includes/api/ApiBase#getAllowedParams()
 87+ */
 88+ public function getAllowedParams() {
 89+ $params = array (
 90+ 'props' => array(
 91+ ApiBase::PARAM_TYPE => array_merge( SurveySubmission::getFieldNames(), array( '*' ) ),
 92+ ApiBase::PARAM_ISMULTI => true,
 93+ ApiBase::PARAM_DFLT => '*'
 94+ ),
 95+ 'limit' => array(
 96+ ApiBase::PARAM_DFLT => 20,
 97+ ApiBase::PARAM_TYPE => 'limit',
 98+ ApiBase::PARAM_MIN => 1,
 99+ ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1,
 100+ ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2
 101+ ),
 102+ 'continue' => null,
 103+ 'token' => null,
 104+ );
 105+
 106+ return array_merge( SurveySubmission::getAPIParams( false ), $params );
 107+ }
 108+
 109+ /**
 110+ * (non-PHPdoc)
 111+ * @see includes/api/ApiBase#getParamDescription()
 112+ */
 113+ public function getParamDescription() {
 114+ $descs = array (
 115+ 'props' => 'Survey data to query',
 116+ 'continue' => 'Offset number from where to continue the query',
 117+ 'limit' => 'Max amount of words to return',
 118+ 'token' => 'Edit token. You can get one of these through prop=info.',
 119+ );
 120+
 121+ return array_merge( SurveySubmission::getFieldDescriptions(), $descs );
 122+ }
 123+
 124+ /**
 125+ * (non-PHPdoc)
 126+ * @see includes/api/ApiBase#getDescription()
 127+ */
 128+ public function getDescription() {
 129+ return 'API module for obatining survey submissions';
 130+ }
 131+
 132+ /**
 133+ * (non-PHPdoc)
 134+ * @see includes/api/ApiBase#getPossibleErrors()
 135+ */
 136+ public function getPossibleErrors() {
 137+ return array_merge( parent::getPossibleErrors(), array(
 138+ ) );
 139+ }
 140+
 141+ /**
 142+ * (non-PHPdoc)
 143+ * @see includes/api/ApiBase#getExamples()
 144+ */
 145+ protected function getExamples() {
 146+ return array (
 147+ 'api.php?action=query&list=surveysubmissions&',
 148+ );
 149+ }
 150+
 151+ public function getVersion() {
 152+ return __CLASS__ . ': $Id$';
 153+ }
 154+
 155+}
Property changes on: trunk/extensions/Survey/api/ApiQuerySurveySubmissions.php
___________________________________________________________________
Added: svn:eol-style
1156 + native
Added: svn:keywords
2157 + Id
Index: trunk/extensions/Survey/api/ApiEditSurvey.php
@@ -31,7 +31,7 @@
3232 $question = SurveyQuestion::newFromUrlData( $question );
3333 }
3434
35 - $survey = Survey::newFromAPIParams( $params, $params['id'] );
 35+ $survey = new Survey( Survey::getValidFields( $params, $params['id'] ) );
3636
3737 $this->getResult()->addValue(
3838 null,
Index: trunk/extensions/Survey/api/ApiAddSurvey.php
@@ -32,7 +32,7 @@
3333 }
3434
3535 try {
36 - $survey = Survey::newFromAPIParams( $params );
 36+ $survey = new Survey( Survey::getValidFields( $params ) );
3737 $success = $survey->writeToDB();
3838 }
3939 catch ( DBQueryError $ex ) {
Index: trunk/extensions/Survey/api/ApiQuerySurveyAnswers.php
@@ -0,0 +1,154 @@
 2+<?php
 3+
 4+/**
 5+ * API module to get a list of survey answers.
 6+ *
 7+ * @since 0.1
 8+ *
 9+ * @file ApiQuerySurveyAnswers.php
 10+ * @ingroup Surveys
 11+ * @ingroup API
 12+ *
 13+ * @licence GNU GPL v3+
 14+ * @author Jeroen De Dauw < jeroendedauw@gmail.com >
 15+ */
 16+class ApiQuerySurveyAnswers extends ApiQueryBase {
 17+
 18+ public function __construct( $main, $action ) {
 19+ parent::__construct( $main, $action, 'qa' );
 20+ }
 21+
 22+ /**
 23+ * Retrieve the special words from the database.
 24+ */
 25+ public function execute() {
 26+ global $wgUser;
 27+
 28+ if ( $wgUser->isBlocked() ) {
 29+ $this->dieUsageMsg( array( 'badaccess-groups' ) );
 30+ }
 31+
 32+ // Get the requests parameters.
 33+ $params = $this->extractRequestParams();
 34+
 35+ $starPropPosition = array_search( '*', $params['props'] );
 36+
 37+ if ( $starPropPosition !== false ) {
 38+ unset( $params['props'][$starPropPosition] );
 39+ $params['props'] = array_merge( $params['props'], SurveyAnswer::getFieldNames() );
 40+ }
 41+
 42+ $params = array_filter( $params, function( $param ) { return !is_null( $param ); } );
 43+
 44+ $answers = SurveyAnswer::select(
 45+ $params['props'],
 46+ SurveyAnswer::getValidFields( $params ),
 47+ array(
 48+ 'LIMIT' => $params['limit'] + 1,
 49+ 'ORDER BY' => SurveyAnswer::getPrefixedField( 'id' ) . ' ASC'
 50+ )
 51+ );
 52+
 53+ $serializedAnswers = array();
 54+ $count = 0;
 55+
 56+ foreach ( $answers as $answer ) {
 57+ if ( ++$count > $params['limit'] ) {
 58+ // We've reached the one extra which shows that
 59+ // there are additional pages to be had. Stop here...
 60+ $this->setContinueEnumParameter( 'continue', $answer->getId() );
 61+ break;
 62+ }
 63+
 64+ $serializedAnswers[] = $answer->toArray();
 65+ }
 66+
 67+ $this->getResult()->setIndexedTagName( $serializedAnswers, 'answer' );
 68+
 69+ $this->getResult()->addValue(
 70+ null,
 71+ 'answers',
 72+ $serializedAnswers
 73+ );
 74+ }
 75+
 76+ public function needsToken() {
 77+ return true;
 78+ }
 79+
 80+ public function getTokenSalt() {
 81+ return 'querysurveyanswers';
 82+ }
 83+
 84+ /**
 85+ * (non-PHPdoc)
 86+ * @see includes/api/ApiBase#getAllowedParams()
 87+ */
 88+ public function getAllowedParams() {
 89+ $params = array (
 90+ 'props' => array(
 91+ ApiBase::PARAM_TYPE => array_merge( SurveyAnswer::getFieldNames(), array( '*' ) ),
 92+ ApiBase::PARAM_ISMULTI => true,
 93+ ApiBase::PARAM_DFLT => '*'
 94+ ),
 95+ 'limit' => array(
 96+ ApiBase::PARAM_DFLT => 20,
 97+ ApiBase::PARAM_TYPE => 'limit',
 98+ ApiBase::PARAM_MIN => 1,
 99+ ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1,
 100+ ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2
 101+ ),
 102+ 'continue' => null,
 103+ 'token' => null,
 104+ );
 105+
 106+ return array_merge( SurveyAnswer::getAPIParams( false ), $params );
 107+ }
 108+
 109+ /**
 110+ * (non-PHPdoc)
 111+ * @see includes/api/ApiBase#getParamDescription()
 112+ */
 113+ public function getParamDescription() {
 114+ $descs = array (
 115+ 'props' => 'Survey data to query',
 116+ 'continue' => 'Offset number from where to continue the query',
 117+ 'limit' => 'Max amount of words to return',
 118+ 'token' => 'Edit token. You can get one of these through prop=info.',
 119+ );
 120+
 121+ return array_merge( SurveyAnswer::getFieldDescriptions(), $descs );
 122+ }
 123+
 124+ /**
 125+ * (non-PHPdoc)
 126+ * @see includes/api/ApiBase#getDescription()
 127+ */
 128+ public function getDescription() {
 129+ return 'API module for obatining survey answers';
 130+ }
 131+
 132+ /**
 133+ * (non-PHPdoc)
 134+ * @see includes/api/ApiBase#getPossibleErrors()
 135+ */
 136+ public function getPossibleErrors() {
 137+ return array_merge( parent::getPossibleErrors(), array(
 138+ ) );
 139+ }
 140+
 141+ /**
 142+ * (non-PHPdoc)
 143+ * @see includes/api/ApiBase#getExamples()
 144+ */
 145+ protected function getExamples() {
 146+ return array (
 147+ 'api.php?action=query&list=surveyanswers&',
 148+ );
 149+ }
 150+
 151+ public function getVersion() {
 152+ return __CLASS__ . ': $Id$';
 153+ }
 154+
 155+}
Property changes on: trunk/extensions/Survey/api/ApiQuerySurveyAnswers.php
___________________________________________________________________
Added: svn:eol-style
1156 + native
Added: svn:keywords
2157 + Id
Index: trunk/extensions/Survey/api/ApiQuerySurveys.php
@@ -116,6 +116,14 @@
117117 return $survey;
118118 }
119119
 120+ public function needsToken() {
 121+ return true;
 122+ }
 123+
 124+ public function getTokenSalt() {
 125+ return 'querysurveys';
 126+ }
 127+
120128 /**
121129 * (non-PHPdoc)
122130 * @see includes/api/ApiBase#getAllowedParams()

Status & tagging log