本文整理汇总了PHP中PageManager类的典型用法代码示例。如果您正苦于以下问题:PHP PageManager类的具体用法?PHP PageManager怎么用?PHP PageManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PageManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getModule
public static function getModule($module)
{
$auth = new Auth();
$mod = new Module();
$url = new URL();
$config = new Config();
$pm = new PageManager();
if ($url->getRequestedFunction() == 'angular') {
if (!isset($mod->moduleRegister[$module]) && !is_file(realpath(root . DS . "views" . DS) . "/" . $module . ".php") && !$pm->isPage($module)) {
return 'error';
} else {
if (!$auth->isAdmin() && (isset($mod->moduleRegister[$module][1]) && $mod->moduleRegister[$module][1] == 'admin')) {
return 'login';
} else {
if (is_file(realpath(root . DS . "views" . DS) . "/" . $module . ".php")) {
return $module;
} else {
if ($pm->isPage($module)) {
return $pm->deaultPage;
}
}
}
}
} else {
if (!isset($mod->moduleRegister[$module]) && !is_file(realpath(root . DS . "views" . DS) . "/" . $module . ".php")) {
return 'index';
} else {
if (isset($mod->moduleRegister[$module]) && !isset($mod->moduleRegister[$module][1])) {
return 'index';
} else {
if (!$auth->isAdmin() && isset($mod->moduleRegister[$module][1]) && $mod->moduleRegister[$module][1] == 'admin') {
if ($auth->isItAuthUser()) {
return 'error';
} else {
header("Location:" . $config->site_address . "login");
return 'login';
}
} else {
if ($auth->isItAuthUser() && (isset($mod->moduleRegister[$module][1]) && ($mod->moduleRegister[$module][1] == 'auth' || $mod->moduleRegister[$module][1] == 'admin'))) {
return 'dashboard';
} else {
if (is_file(realpath(root . DS . "views" . DS) . "/" . $module . ".php")) {
return $module;
}
}
}
}
}
}
return $mod->moduleRegister[$module][0];
}
示例2: view
public function view()
{
$params = array('{$today}', '{$current-time}', '{$this-year}', '{$this-month}', '{$this-day}', '{$timezone}', '{$website-name}', '{$page-title}', '{$root}', '{$workspace}', '{$root-page}', '{$current-page}', '{$current-page-id}', '{$current-path}', '{$current-query-string}', '{$current-url}', '{$cookie-username}', '{$cookie-pass}', '{$page-types}', '{$upload-limit}');
// Get page parameters
$pages = PageManager::fetch(true, array('params'));
foreach ($pages as $key => $pageparams) {
if (empty($pageparams['params'])) {
continue;
}
$pageparams = explode('/', $pageparams['params']);
foreach ($pageparams as $pageparam) {
$param = '{$' . $pageparam . '}';
if (!in_array($param, $params)) {
$params[] = $param;
}
}
}
// Get Data Sources output parameters
$datasources = DatasourceManager::listAll();
foreach ($datasources as $datasource) {
$current = DatasourceManager::create($datasource['handle'], array(), false);
$prefix = '{$ds-' . Lang::createHandle($datasource['name']) . '.';
$suffix = '}';
// Get parameters
if (is_array($current->dsParamPARAMOUTPUT)) {
foreach ($current->dsParamPARAMOUTPUT as $id => $param) {
$params[] = $prefix . $param . $suffix;
}
}
}
sort($params);
$this->_Result = json_encode($params);
}
示例3: execute
public function execute(&$param_pool)
{
$result = new XMLElement($this->dsParamROOTELEMENT);
$type_sql = $parent_sql = null;
if (trim($this->dsParamFILTERS['type']) != '') {
$type_sql = $this->__processNavigationTypeFilter($this->dsParamFILTERS['type'], $this->__determineFilterType($this->dsParamFILTERS['type']));
}
if (trim($this->dsParamFILTERS['parent']) != '') {
$parent_sql = $this->__processNavigationParentFilter($this->dsParamFILTERS['parent']);
}
// Build the Query appending the Parent and/or Type WHERE clauses
$pages = Symphony::Database()->fetch(sprintf("\n\t\t\t\t\tSELECT DISTINCT p.id, p.title, p.handle, (SELECT COUNT(id) FROM `tbl_pages` WHERE parent = p.id) AS children\n\t\t\t\t\tFROM `tbl_pages` AS p\n\t\t\t\t\tLEFT JOIN `tbl_pages_types` AS pt ON (p.id = pt.page_id)\n\t\t\t\t\tWHERE 1 = 1\n\t\t\t\t\t%s\n\t\t\t\t\t%s\n\t\t\t\t\tORDER BY p.`sortorder` ASC\n\t\t\t\t", !is_null($parent_sql) ? $parent_sql : " AND p.parent IS NULL ", !is_null($type_sql) ? $type_sql : ""));
if (!is_array($pages) || empty($pages)) {
if ($this->dsParamREDIRECTONEMPTY == 'yes') {
throw new FrontendPageNotFoundException();
}
$result->appendChild($this->__noRecordsFound());
} else {
// Build an array of all the types so that the page's don't have to do
// individual lookups.
$page_types = PageManager::fetchAllPagesPageTypes();
foreach ($pages as $page) {
$result->appendChild($this->__buildPageXML($page, $page_types));
}
}
return $result;
}
示例4: get_events
public function get_events()
{
$pages = PageManager::get();
foreach ($pages as $page) {
if ($page['is_event'] == TRUE) {
$this->add(new Page($page["title"], $page["content"], $page["date"], $page["id"], $page["author"], $page['is_event']));
}
}
}
示例5: showIndex
function showIndex()
{
$pager = new fvPager(PageManager::getInstance());
$this->__assign('Pages', $pager->paginate(null, "IF (page_parent_id = 0, id*100000, page_parent_id*100000 + id)"));
$request = fvRequest::getInstance();
if (!($Page = PageManager::getInstance()->getByPk($request->getRequestParameter('id')))) {
$Page = new Page();
}
$this->__assign(array('Page' => $Page, 'PageManager' => PageManager::getInstance(), 'metaManager' => MetaManager::getInstance()));
return $this->__display('page_list.tpl');
}
示例6: delete
public function delete()
{
if ($this->image) {
@unlink($this->getImageRealPath());
}
$childPages = PageManager::getInstance()->getByPageParentId($this->getPk());
foreach ($childPages as $childPage) {
$childPage->page_parent_id = 0;
$childPage->save();
}
return parent::delete();
}
示例7: view
public function view()
{
if (!($prototype_id = (int) $_GET['prototype_id'])) {
$this->_status = self::STATUS_BAD;
$this->_Result = json_encode(array('status' => __('Missing or wrong parameter.')));
return;
}
$fields = PageManager::fetchPageByID($prototype_id);
// return datasources and events as arrays
$fields['data_sources'] = explode(',', $fields['data_sources']);
$fields['events'] = explode(',', $fields['events']);
// remove "prototype" from the type array and reorder
$fields['type'] = array_values(array_diff($fields['type'], array('prototype')));
$this->_Result = json_encode($fields);
}
示例8: grab
public function grab(&$param_pool = null)
{
$result = new XMLElement('plh-page');
$langs = FLang::getLangs();
$fields = array('id', 'handle', 'parent');
foreach ($langs as $lc) {
$fields[] = "`plh_t-{$lc}`";
$fields[] = "`plh_h-{$lc}`";
}
$pages = array();
foreach (PageManager::fetch(null, $fields) as $page) {
$pages[$page['id']] = $page;
}
$this->appendPage($pages, $this->_env['param']['current-page-id'], $langs, $result);
return $result;
}
示例9: __construct
function __construct()
{
$currentUrl = fvRoute::getInstance()->getModuleName();
list($p) = (array) PageManager::getInstance()->getByPageUrl($currentUrl);
if (is_object($p)) {
$this->_pageInstance = $p;
} else {
fvDispatcher::redirect(fvSite::$fvConfig->get('page_404', 0, 404));
}
$this->_domInstance = new DOMDocument();
if (!$this->_domInstance->loadXML($this->_pageInstance->getPageContent())) {
fvDispatcher::redirect(fvSite::$fvConfig->get('page_error', 0, 302));
}
$this->setMeta($this->_pageInstance->getMeta());
fvSite::$Template->assign("Lang", fvLang::getInstance());
parent::__construct("main.tpl");
}
示例10: executeDelete
function executeDelete()
{
$request = fvRequest::getInstance();
if (!($Page = PageManager::getInstance()->getByPk($request->getRequestParameter('id')))) {
$this->setFlash("Ошибка при удалении.", self::$FLASH_ERROR);
} else {
$Page->getMeta()->delete();
$Page->delete();
$this->setFlash("Данные успешно удалены", self::$FLASH_SUCCESS);
}
fvResponce::getInstance()->setHeader('redirect', fvSite::$fvConfig->get('dir_web_root') . $request->getRequestParameter('module') . "/");
if (fvRequest::getInstance()->isXmlHttpRequest()) {
return self::$FV_NO_LAYOULT;
} else {
return self::$FV_OK;
}
}
示例11: __getPageParams
private function __getPageParams()
{
$params = array();
$pages = PageManager::fetch(true, array('params'));
foreach ($pages as $key => $pageparams) {
if (empty($pageparams['params'])) {
continue;
}
$pageparams = explode('/', $pageparams['params']);
foreach ($pageparams as $pageparam) {
$param = sprintf($this->template, $pageparam);
if (!in_array($param, $params)) {
$params[] = $param;
}
}
}
return $params;
}
示例12: view
public function view()
{
$items = $_REQUEST['items'];
if (!is_array($items) || empty($items)) {
return;
}
$destination = self::kREORDER_UNKNOWN;
if ($this->_context[0] == 'blueprints' && $this->_context[1] == 'pages') {
$destination = self::kREORDER_PAGES;
} elseif ($this->_context[0] == 'blueprints' && $this->_context[1] == 'sections') {
$destination = self::kREORDER_SECTIONS;
} elseif ($this->_context[0] == 'extensions') {
$destination = self::kREORDER_EXTENSION;
}
switch ($destination) {
case self::kREORDER_PAGES:
foreach ($items as $id => $position) {
if (!PageManager::edit($id, array('sortorder' => $position))) {
$this->setHttpStatus(self::HTTP_STATUS_ERROR);
$this->_Result->setValue(__('A database error occurred while attempting to reorder.'));
break;
}
}
break;
case self::kREORDER_SECTIONS:
foreach ($items as $id => $position) {
if (!SectionManager::edit($id, array('sortorder' => $position))) {
$this->setHttpStatus(self::HTTP_STATUS_ERROR);
$this->_Result->setValue(__('A database error occurred while attempting to reorder.'));
break;
}
}
break;
case self::kREORDER_EXTENSION:
// TODO
break;
case self::kREORDER_UNKNOWN:
default:
$this->setHttpStatus(self::HTTP_STATUS_BAD_REQUEST);
break;
}
}
示例13: route
public function route(Zend_Controller_Request_Abstract $request)
{
// Let the Rewrite router route the request first
$request = parent::route($request);
logFire("ROUTE", $request->getParam('controller'));
if ($request->getParam('controller') == '') {
// If the page param isn't set, route to default page and controller
$defaultPage = PageManager::getInstance()->getDefaultPage();
$request->setControllerName($defaultPage->pageType->controller);
$request->setParam('controller', $defaultPage->page);
$request->setParam('action', 'index');
} else {
// Route to current page's controller
$controller = PageManager::getInstance()->getPage($request->getParam('controller'));
$request->setControllerName($controller->pageType->controller);
$request->setActionName('index');
}
$request->setParam('controller', 'search');
$request->setParam('action', 'search');
return $request;
}
示例14: grab
/**
*
* Method called by Symphony in order to build the
* @param $param_pool
* @return XMLElement
*/
public function grab(&$param_pool)
{
// get the current page id
$current_page_id = (int) $this->_env['param']['current-page-id'];
// prepare output
$result = new XMLElement($this->dsParamROOTELEMENT);
// if multilangual extensions are enabled
if ($this->isMultiLangual) {
// current language
$lang = LanguageRedirect::instance()->getLanguageCode();
}
// get current page title including all parents
$titles = PageManager::resolvePage($current_page_id, isset($lang) ? 'page_lhandles_t_' . $lang : 'title');
// get current page path including all parents
$handles = PageManager::resolvePage($current_page_id, isset($lang) ? 'page_lhandles_h_' . $lang : 'handle');
// generate the output
foreach ($titles as $key => $title) {
$path = implode('/', array_slice($handles, 0, $key + 1));
$result->appendChild(new XMLElement('page', $title, array('path' => $path)));
}
// return xml result set
return $result;
}
示例15: buildTree
private function buildTree($parent = null, $indent = 0)
{
if ($parent == null) {
$results = PageManager::fetch(true, array(), array('`parent` IS NULL'), '`sortorder` ASC');
} else {
$results = PageManager::fetch(true, array(), array('`parent` = ' . $parent), '`sortorder` ASC');
}
$tree = array();
foreach ($results as $result) {
// Check if the page should be shown:
if (!in_array('ck_hide', $result['type'])) {
$prefix = '';
$info = array('handle' => $result['handle'], 'path' => $result['path']);
if ($result['path'] == null) {
$info['url'] = '/' . $result['handle'] . '/';
$info['title'] = $result['title'];
} else {
$info['url'] = '/' . $result['path'] . '/' . $result['handle'] . '/';
for ($i = 0; $i < $indent; $i++) {
$prefix .= ' ';
// Please note: this might look like an empty space (nbsp) but it's an em space (emsp).
// This was necessary because kept showing as plain text in the dropdown.
}
$info['title'] = $prefix . ' › ' . General::sanitize($result['title']);
}
$tree[] = $info;
// Check if there are templates for this page:
$tree = array_merge($tree, $this->checkTemplates($result['id'], $prefix . ' '));
// also an emsp
// Get the children:
$children = $this->buildTree($result['id'], $indent + 1);
// Join arrays:
$tree = array_merge($tree, $children);
}
}
return $tree;
}