2006-08-24 18:11:35 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class CategoryTreeCategoryPage extends CategoryPage {
|
|
|
|
function closeShowCategory() {
|
|
|
|
global $wgOut, $wgRequest;
|
2010-04-20 22:00:34 +00:00
|
|
|
|
2006-08-24 18:11:35 +00:00
|
|
|
$from = $wgRequest->getVal( 'from' );
|
|
|
|
$until = $wgRequest->getVal( 'until' );
|
|
|
|
|
|
|
|
$viewer = new CategoryTreeCategoryViewer( $this->mTitle, $from, $until );
|
|
|
|
$wgOut->addHTML( $viewer->getHTML() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class CategoryTreeCategoryViewer extends CategoryViewer {
|
2008-06-30 14:09:47 +00:00
|
|
|
var $child_cats;
|
2008-02-04 09:22:12 +00:00
|
|
|
|
2008-06-28 20:13:20 +00:00
|
|
|
function getCategoryTree() {
|
2008-07-02 08:49:13 +00:00
|
|
|
global $wgOut, $wgCategoryTreeCategoryPageOptions, $wgCategoryTreeForceHeaders;
|
2008-06-28 20:13:20 +00:00
|
|
|
|
2010-04-20 22:00:34 +00:00
|
|
|
if ( ! isset( $this->categorytree ) ) {
|
2008-07-02 08:49:13 +00:00
|
|
|
if ( !$wgCategoryTreeForceHeaders ) CategoryTree::setHeaders( $wgOut );
|
2008-06-28 20:13:20 +00:00
|
|
|
|
|
|
|
$this->categorytree = new CategoryTree( $wgCategoryTreeCategoryPageOptions );
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->categorytree;
|
|
|
|
}
|
|
|
|
|
2006-09-02 12:14:12 +00:00
|
|
|
/**
|
|
|
|
* Add a subcategory to the internal lists
|
|
|
|
*/
|
2008-06-30 14:09:47 +00:00
|
|
|
function addSubcategoryObject( $cat, $sortkey, $pageLength ) {
|
2008-06-28 20:13:20 +00:00
|
|
|
global $wgContLang, $wgOut, $wgRequest;
|
2008-02-04 09:22:12 +00:00
|
|
|
|
2008-06-30 14:09:47 +00:00
|
|
|
$title = $cat->getTitle();
|
|
|
|
|
2006-09-02 12:55:29 +00:00
|
|
|
if ( $wgRequest->getCheck( 'notree' ) ) {
|
2008-06-30 14:09:47 +00:00
|
|
|
return parent::addSubcategoryObject( $cat, $sortkey, $pageLength );
|
2006-09-02 12:55:29 +00:00
|
|
|
}
|
2008-02-04 09:22:12 +00:00
|
|
|
|
2008-06-28 20:13:20 +00:00
|
|
|
$tree = $this->getCategoryTree();
|
2008-02-04 09:22:12 +00:00
|
|
|
|
2008-06-30 14:09:47 +00:00
|
|
|
$this->children[] = $tree->renderNodeInfo( $title, $cat );
|
2006-09-02 12:14:12 +00:00
|
|
|
|
|
|
|
$this->children_start_char[] = $this->getSubcategorySortChar( $title, $sortkey );
|
|
|
|
}
|
2008-02-04 09:22:12 +00:00
|
|
|
|
2006-08-24 18:11:35 +00:00
|
|
|
function clearCategoryState() {
|
2008-06-30 14:09:47 +00:00
|
|
|
$this->child_cats = array();
|
2006-08-24 18:11:35 +00:00
|
|
|
parent::clearCategoryState();
|
|
|
|
}
|
2008-02-04 09:22:12 +00:00
|
|
|
|
2006-08-24 18:11:35 +00:00
|
|
|
function finaliseCategoryState() {
|
2010-04-20 22:00:34 +00:00
|
|
|
if ( $this->flip ) {
|
2008-06-30 14:09:47 +00:00
|
|
|
$this->child_cats = array_reverse( $this->child_cats );
|
2006-08-24 18:11:35 +00:00
|
|
|
}
|
|
|
|
parent::finaliseCategoryState();
|
|
|
|
}
|
|
|
|
}
|