2008-11-13 22:39:53 +01:00
|
|
|
<?php
|
|
|
|
|
2010-02-01 22:34:17 +01:00
|
|
|
/**
|
|
|
|
* Test a subtree-admin that only shows the children of a FTPageHolder
|
|
|
|
*/
|
2008-11-13 22:39:53 +01:00
|
|
|
class CMSSubTreeAdmin extends CMSMain {
|
|
|
|
// These variables are 2.3-specific; in 2.2.x you will need to edit _config.php
|
|
|
|
static $url_segment = 'subtree';
|
2010-02-01 22:34:17 +01:00
|
|
|
static $menu_title = 'FT Pages';
|
2008-11-13 22:39:53 +01:00
|
|
|
|
|
|
|
function SiteTreeAsUL() {
|
|
|
|
// This piece of code just gets us a root ID to use
|
2010-02-01 22:34:17 +01:00
|
|
|
$ftRoot = DataObject::get_one("FTPageHolder");
|
|
|
|
if(!$ftRoot) {
|
|
|
|
$ftRoot = new FTPageHolder();
|
|
|
|
$ftRoot->write();
|
2008-11-13 22:39:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// This code is what you will need to do to make a subtree version of CMSMain
|
|
|
|
$this->generateDataTreeHints();
|
|
|
|
$this->generateTreeStylingJS();
|
|
|
|
|
2010-02-01 22:34:17 +01:00
|
|
|
// ftRoot->ID is your root node
|
|
|
|
$siteTree = $this->getSiteTreeFor("SiteTree", $ftRoot->ID);
|
2008-11-13 22:39:53 +01:00
|
|
|
|
|
|
|
// This code is copied from getSiteTreeFor(), because getSiteTreeFor has it hard-coded to only generate if rootID = 0
|
|
|
|
$rootLink = $this->Link() . '0';
|
|
|
|
if($this->hasMethod('getCMSTreeTitle')) $treeTitle = $this->getCMSTreeTitle();
|
|
|
|
else $treeTitle = _t('LeftAndMain.SITECONTENTLEFT',"Site Content",PR_HIGH,'Root node on left');
|
|
|
|
$siteTree = "<ul id=\"sitetree\" class=\"tree unformatted\"><li id=\"record-0\" class=\"Root nodelete\"><a href=\"$rootLink\"><strong>$treeTitle</strong></a>"
|
|
|
|
. $siteTree . "</li></ul>";
|
|
|
|
|
|
|
|
return $siteTree;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|