2011-04-20 22:50:13 +02:00
|
|
|
<?php
|
2011-08-19 02:32:31 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @package cms
|
|
|
|
*/
|
2011-04-20 22:50:13 +02:00
|
|
|
class CMSPagesController extends CMSMain {
|
|
|
|
|
2013-03-18 11:47:15 +01:00
|
|
|
private static $url_segment = 'pages';
|
|
|
|
private static $url_rule = '/$Action/$ID/$OtherID';
|
|
|
|
private static $url_priority = 40;
|
|
|
|
private static $menu_title = 'Pages';
|
|
|
|
private static $required_permission_codes = 'CMS_ACCESS_CMSMain';
|
|
|
|
private static $session_namespace = 'CMSMain';
|
2012-04-17 22:27:47 +02:00
|
|
|
|
2012-09-19 12:07:46 +02:00
|
|
|
public function LinkPreview() {
|
2011-10-29 19:13:19 +02:00
|
|
|
return false;
|
|
|
|
}
|
2012-02-14 16:00:48 +01:00
|
|
|
|
2012-05-30 16:04:51 +02:00
|
|
|
/**
|
|
|
|
* @return String
|
|
|
|
*/
|
|
|
|
public function ViewState() {
|
|
|
|
return $this->request->getVar('view');
|
|
|
|
}
|
|
|
|
|
2012-04-17 22:27:47 +02:00
|
|
|
public function isCurrentPage(DataObject $record) {
|
|
|
|
return false;
|
|
|
|
}
|
2012-04-18 21:14:14 +02:00
|
|
|
|
|
|
|
public function Breadcrumbs($unlinked = false) {
|
|
|
|
$items = parent::Breadcrumbs($unlinked);
|
|
|
|
|
|
|
|
//special case for building the breadcrumbs when calling the listchildren Pages ListView action
|
|
|
|
if($parentID = $this->request->getVar('ParentID')) {
|
|
|
|
$page = DataObject::get_by_id('SiteTree', $parentID);
|
|
|
|
|
|
|
|
//build a reversed list of the parent tree
|
|
|
|
$pages = array();
|
|
|
|
while($page) {
|
|
|
|
array_unshift($pages, $page); //add to start of array so that array is in reverse order
|
|
|
|
$page = $page->Parent;
|
|
|
|
}
|
|
|
|
|
|
|
|
//turns the title and link of the breadcrumbs into template-friendly variables
|
|
|
|
$params = array_filter(array(
|
|
|
|
'view' => $this->request->getVar('view'),
|
|
|
|
'q' => $this->request->getVar('q')
|
|
|
|
));
|
|
|
|
foreach($pages as $page) {
|
|
|
|
$params['ParentID'] = $page->ID;
|
|
|
|
$item = new StdClass();
|
|
|
|
$item->Title = $page->Title;
|
|
|
|
$item->Link = Controller::join_links($this->Link(), '?' . http_build_query($params));
|
|
|
|
$items->push(new ArrayData($item));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $items;
|
|
|
|
|
|
|
|
}
|
2012-04-12 09:23:20 +02:00
|
|
|
}
|