本文整理汇总了PHP中Pages::findById方法的典型用法代码示例。如果您正苦于以下问题:PHP Pages::findById方法的具体用法?PHP Pages::findById怎么用?PHP Pages::findById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pages
的用法示例。
在下文中一共展示了Pages::findById方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPage
/**
* Return page ID
*
* @param void
* @return Page
*/
function getPage()
{
return Pages::findById($this->getPageId());
}
示例2: __construct
/**
* Constructor
*
* @param Request $request
* @return PagesController
*/
function __construct($request)
{
parent::__construct($request);
//echo $this->logged_user->getProjectPermission('page', $this->active_project);
if ($this->logged_user->getProjectPermission('page', $this->active_project) < PROJECT_PERMISSION_ACCESS) {
$this->httpError(HTTP_ERR_FORBIDDEN);
}
// if
$section_url = pages_module_url($this->active_project);
$this->wireframe->addBreadCrumb(lang('Pages'), $section_url);
if ($this->active_category->isLoaded()) {
$this->wireframe->addBreadCrumb($this->active_category->getName(), assemble_url('project_pages', array('project_id' => $this->active_project->getId(), 'category_id' => $this->active_category->getId())));
}
// if
$page_id = $this->request->get('page_id');
if ($page_id) {
$this->active_page = Pages::findById($page_id);
}
// if
if (instance_of($this->active_page, 'Page')) {
$parents = array();
$parent = $this->active_page->getParent();
while (instance_of($parent, 'ProjectObject')) {
if (instance_of($parent, 'Page')) {
if (array_key_exists($parent->getId(), $parents)) {
break;
// avoid dead loops
}
// if
$parents[$parent->getId()] = $parent;
$parent = $parent->getParent();
} elseif (instance_of($parent, 'Category')) {
$parents[$parent->getId()] = $parent;
break;
} else {
break;
}
// if
}
// while
$parents = array_reverse($parents);
foreach ($parents as $parent) {
if (instance_of($parent, 'Page')) {
$this->wireframe->addBreadCrumb($parent->getName(), $parent->getViewUrl());
} elseif (instance_of($parent, 'Category')) {
$this->wireframe->addBreadCrumb($parent->getName(), assemble_url('project_pages', array('project_id' => $this->active_project->getId(), 'category_id' => $parent->getId())));
}
// if
}
// foreach
$this->wireframe->addBreadCrumb($this->active_page->getName(), $this->active_page->getViewUrl());
} else {
$this->active_page = new Page();
}
// if
if (Page::canAdd($this->logged_user, $this->active_project)) {
if ($this->active_page->isLoaded()) {
$add_page_url = pages_module_add_page_url($this->active_project, array('parent' => $this->active_page));
} elseif ($this->active_category->isLoaded()) {
$add_page_url = pages_module_add_page_url($this->active_project, array('parent' => $this->active_category));
} else {
$add_page_url = pages_module_add_page_url($this->active_project);
}
// if
$this->wireframe->addPageAction(lang('New Page'), $add_page_url);
}
// if
$this->smarty->assign(array('active_page' => $this->active_page, 'pages_url' => $section_url, 'add_page_url' => $add_page_url, 'page_tab' => 'pages'));
}