/** * This method basically executes the exact same code as the parent class, though with * a hook added, to allow extensions to add additional queries. * * @param string $offset Index offset, inclusive * @param int $limit Exact query limit * @param bool $descending Query direction, false for ascending, true for descending * @return ResultWrapper */ function reallyDoQuery($offset, $limit, $descending) { $data = [parent::reallyDoQuery($offset, $limit, $descending)]; // This hook will allow extensions to add in additional queries, nearly // identical to ContribsPager::reallyDoQuery. Hooks::run('DeletedContribsPager::reallyDoQuery', [&$data, $this, $offset, $limit, $descending]); $result = []; // loop all results and collect them in an array foreach ($data as $query) { foreach ($query as $i => $row) { // use index column as key, allowing us to easily sort in PHP $result[$row->{$this->getIndexField()} . "-{$i}"] = $row; } } // sort results if ($descending) { ksort($result); } else { krsort($result); } // enforce limit $result = array_slice($result, 0, $limit); // get rid of array keys $result = array_values($result); return new FakeResultWrapper($result); }
function __construct() { global $wgRequest; $this->mSort = $wgRequest->getText('sort'); if (!array_key_exists($this->mSort, $this->getFieldNames())) { $this->mSort = $this->getDefaultSort(); } if ($wgRequest->getBool('asc')) { $this->mDefaultDirection = false; } elseif ($wgRequest->getBool('desc')) { $this->mDefaultDirection = true; } /* Else leave it at whatever the class default is */ parent::__construct(); }
public function __construct( IContextSource $context = null ) { if ( $context ) { $this->setContext( $context ); } $this->mSort = $this->getRequest()->getText( 'sort' ); if ( !array_key_exists( $this->mSort, $this->getFieldNames() ) || !$this->isFieldSortable( $this->mSort ) ) { $this->mSort = $this->getDefaultSort(); } if ( $this->getRequest()->getBool( 'asc' ) ) { $this->mDefaultDirection = false; } elseif ( $this->getRequest()->getBool( 'desc' ) ) { $this->mDefaultDirection = true; } /* Else leave it at whatever the class default is */ parent::__construct(); }
function getDefaultQuery() { $query = parent::getDefaultQuery(); $query['target'] = $this->target; return $query; }
/** * Get the formatted result list, with navigation bars. * * Calls getBody(), getNavigationBar() and getModuleStyles() and * builds a ParserOutput object. (This is a bit hacky but works well.) * * @since 1.24 * @return ParserOutput */ public function getFullOutput() { $navigation = $this->getNavigationBar(); $body = parent::getBody(); $pout = new ParserOutput(); $pout->setText($navigation . $body . $navigation); $pout->addModuleStyles($this->getModuleStyles()); return $pout; }
function __construct($article, $orderType) { $this->article = $article; $this->orderType = $orderType; parent::__construct(); $this->mLimit = $this->getPageLimit(); }
function doQuery() { # If displaying comments for a single item, save the item. # Otherwise, set query option to return items along with their # comments. if ( ( $item = $this->mQuery->getItem() ) ) { $this->mSingleItem = $item; } else { $this->mQuery->setOption( 'include-item' ); } return parent::doQuery(); }
function __construct() { parent::__construct(); $this->mLimit = $this->mDefaultLimit; }