owner->class}.currentPage");
}
// Update current subsite in session
Subsite::changeSubsite($_GET['SubsiteID']);
//Redirect to clear the current page
return $this->owner->redirect('admin/');
}
// Set subsite ID based on currently shown record
$req = $this->owner->getRequest();
$id = $req->param('ID');
if($id && is_numeric($id)) {
$record = DataObject::get_by_id($this->owner->stat('tree_class'), $id);
if($record) Session::set('SubsiteID', $record->SubsiteID);
}
}
/**
* Set the title of the CMS tree
*/
function getCMSTreeTitle() {
$subsite = Subsite::currentSubSite();
return $subsite ? Convert::raw2xml($subsite->Title) : _t('LeftAndMain.SITECONTENTLEFT');
}
function updatePageOptions(&$fields) {
$fields->push(new HiddenField('SubsiteID', 'SubsiteID', Subsite::currentSubsiteID()));
}
public function Subsites() {
$accessPerm = 'CMS_ACCESS_'. $this->owner->class;
switch($this->owner->class) {
case "AssetAdmin":
$subsites = Subsite::accessible_sites($accessPerm, true, "Shared files & images");
break;
case "SecurityAdmin":
$subsites = Subsite::accessible_sites($accessPerm, true, "Groups accessing all sites");
if($subsites->find('ID',0)) {
$subsites->push(new ArrayData(array('Title' => 'All groups', 'ID' => -1)));
}
break;
case "CMSMain":
// If there's a default site then main site has no meaning
$showMainSite = !DataObject::get_one('Subsite',"\"DefaultSite\"=1");
$subsites = Subsite::accessible_sites($accessPerm, $showMainSite);
break;
case "SubsiteAdmin":
$subsites = Subsite::accessible_sites('ADMIN', true);
break;
default:
$subsites = Subsite::accessible_sites($accessPerm);
break;
}
return $subsites;
}
public function SubsiteList() {
$list = $this->Subsites();
$currentSubsiteID = Subsite::currentSubsiteID();
if($list->Count() > 1) {
$output = '