public function Render() { include_once 'libs/smartylibs/Smarty.class.php'; $smarty = new Smarty(); $smarty->template_dir = 'components/templates'; $smarty->assign_by_ref('Page', $this); $users = $this->tableBasedGrantsManager->GetAllUsersAsJson(); $smarty->assign_by_ref('Users', $users); $localizerCaptions = $this->GetLocalizerCaptions(); $smarty->assign_by_ref('Captions', $localizerCaptions); /* $roles = $this->tableBasedGrantsManager->GetAllRolesAsJson(); $smarty->assign_by_ref('Roles', $roles); */ $headerString = 'Content-Type: text/html'; if ($this->GetContentEncoding() != null) { StringUtils::AddStr($headerString, 'charset=' . $this->GetContentEncoding(), ';'); } header($headerString); $pageInfos = GetPageInfos(); $pageListViewData = array('Pages' => array(), 'CurrentPageOptions' => array()); foreach ($pageInfos as $pageInfo) { $pageListViewData['Pages'][] = array('Caption' => $this->RenderText($pageInfo['caption']), 'Hint' => $this->RenderText($pageInfo['short_caption']), 'Href' => $pageInfo['filename'], 'GroupName' => $this->RenderText($pageInfo['group_name']), 'BeginNewGroup' => $pageInfo['add_separator']); } $pageGroups = GetPageGroups(); foreach ($pageGroups as &$pageGroup) { $pageGroup = $this->RenderText($pageGroup); } $pageListViewData['Groups'] = $pageGroups; $smarty->assign_by_ref('PageList', $pageListViewData); $authenticationViewData = $this->GetAuthenticationViewData(); $smarty->assign_by_ref('Authentication', $authenticationViewData); $smarty->display('admin_panel.tpl'); }
public static function createForPage(CommonPage $page) { $currentPageFilename = $page->GetPageFileName(); $pageList = new PageList($page); $pageGroups = GetPageGroups(); foreach ($pageGroups as $group) { $pageList->AddGroup($page->RenderText($group)); } $pageInfos = GetPageInfos(); foreach ($pageInfos as $pageInfo) { if (!GetCurrentUserGrantForDataSource($pageInfo['name'])->HasViewGrant()) { continue; } $shortCaption = $page->RenderText($pageInfo['short_caption']); $pageList->AddPage(new PageLink($page->RenderText($pageInfo['caption']), $pageInfo['filename'], $shortCaption, $currentPageFilename == $pageInfo['filename'], $pageInfo['add_separator'], $page->RenderText($pageInfo['group_name']))); } return $pageList; }