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 {
|
|
|
|
|
|
|
|
static $url_segment = 'pages';
|
|
|
|
static $url_rule = '/$Action/$ID/$OtherID';
|
2012-04-16 15:55:19 +02:00
|
|
|
static $url_priority = 40;
|
2011-04-20 22:50:13 +02:00
|
|
|
static $menu_title = 'Pages';
|
2012-03-05 16:07:53 +01:00
|
|
|
static $required_permission_codes = 'CMS_ACCESS_CMSMain';
|
2012-04-17 22:27:47 +02:00
|
|
|
|
2012-04-18 22:59:31 +02:00
|
|
|
function LinkPreview() {
|
2011-10-29 19:13:19 +02:00
|
|
|
return false;
|
|
|
|
}
|
2012-02-14 16:00:48 +01:00
|
|
|
|
2012-04-17 22:27:47 +02:00
|
|
|
/**
|
|
|
|
* Doesn't deal with a single record, and we need
|
|
|
|
* to avoid session state from previous record edits leaking in here.
|
|
|
|
*/
|
2012-02-14 16:00:48 +01:00
|
|
|
public function currentPageID() {
|
|
|
|
return false;
|
|
|
|
}
|
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
|
|
|
}
|