2017-09-27 17:53:26 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class CommentListAPI extends ApiBase {
|
|
|
|
|
|
|
|
public function execute() {
|
|
|
|
$commentsPage = new CommentsPage( $this->getMain()->getVal( 'pageID' ), RequestContext::getMain() );
|
|
|
|
$commentsPage->orderBy = $this->getMain()->getVal( 'order' );
|
|
|
|
$commentsPage->currentPagerPage = $this->getMain()->getVal( 'pagerPage' );
|
|
|
|
|
|
|
|
$output = '';
|
|
|
|
if ( $this->getMain()->getVal( 'showForm' ) ) {
|
|
|
|
$output .= $commentsPage->displayOrderForm();
|
|
|
|
}
|
|
|
|
$output .= $commentsPage->display();
|
|
|
|
if ( $this->getMain()->getVal( 'showForm' ) ) {
|
|
|
|
$output .= $commentsPage->displayForm();
|
|
|
|
}
|
|
|
|
|
|
|
|
$result = $this->getResult();
|
|
|
|
$result->addValue( $this->getModuleName(), 'html', $output );
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getAllowedParams() {
|
2019-05-25 13:18:39 +02:00
|
|
|
return [
|
|
|
|
'pageID' => [
|
2017-09-27 17:53:26 +02:00
|
|
|
ApiBase::PARAM_REQUIRED => true,
|
|
|
|
ApiBase::PARAM_TYPE => 'integer'
|
2019-05-25 13:18:39 +02:00
|
|
|
],
|
|
|
|
'order' => [
|
2017-09-27 17:53:26 +02:00
|
|
|
ApiBase::PARAM_REQUIRED => true,
|
|
|
|
ApiBase::PARAM_TYPE => 'boolean'
|
2019-05-25 13:18:39 +02:00
|
|
|
],
|
|
|
|
'pagerPage' => [
|
2017-09-27 17:53:26 +02:00
|
|
|
ApiBase::PARAM_REQUIRED => true,
|
|
|
|
ApiBase::PARAM_TYPE => 'integer'
|
2019-05-25 13:18:39 +02:00
|
|
|
],
|
|
|
|
'showForm' => [
|
2017-09-27 17:53:26 +02:00
|
|
|
ApiBase::PARAM_REQUIRED => false,
|
|
|
|
ApiBase::PARAM_TYPE => 'integer'
|
2019-05-25 13:18:39 +02:00
|
|
|
]
|
|
|
|
];
|
2017-09-27 17:53:26 +02:00
|
|
|
}
|
|
|
|
}
|