Exemple #1
0
 /**
  * Build admin panel
  */
 protected function adminPanel()
 {
     $user = User::getUser();
     $page = $this->getPage();
     $commands = array();
     $url = url('admin.php?module=Curry_Backend_Page', array("view" => "PageProperties", "page_id" => $this->pageRevision->getPageId()));
     if ($user->hasPagePermission($page, PageAccessPeer::PERM_PROPERTIES)) {
         $commands[] = array('Name' => 'Page properties', 'Url' => $url, 'Class' => 'iframe');
     }
     $url = url('admin.php?module=Curry_Backend_Page', array('module' => 'Curry_Backend_Page', 'view' => 'NewPage', 'page_id' => $this->pageRevision->getPageId()));
     if ($user->hasPagePermission($page, PageAccessPeer::PERM_CREATE_PAGE)) {
         $commands[] = array('Name' => 'New page', 'Url' => $url, 'Class' => 'iframe');
     }
     $url = url('admin.php?module=Curry_Backend_Page', array('module' => 'Curry_Backend_Page', 'view' => 'PageRevisions', "page_id" => $this->pageRevision->getPageId()));
     if ($user->hasPagePermission($page, PageAccessPeer::PERM_REVISIONS)) {
         $commands[] = array('Name' => 'Page revisions', 'Url' => $url, 'Class' => 'iframe');
     }
     if ($this->pageRevision->allowEdit()) {
         $commands[] = array('Name' => 'Show all modules', 'Url' => '#', 'Class' => 'toggle-show-all-modules');
     } else {
         $url = '';
         $commands[] = array('Name' => 'Create working revision (TODO)', 'Url' => $url, 'Class' => 'iframe');
     }
     $view = Curry_Backend_Page::getPageView($page);
     $url = url('admin.php?module=Curry_Backend_Page', array('view' => $view, 'page_id' => $this->pageRevision->getPageId()));
     $commands[] = array('Name' => 'Backend', 'Url' => $url, 'Class' => 'curry-admin-backend');
     $url = (string) url('', $_GET)->add(array('curry_inline_admin' => 0));
     $commands[] = array('Name' => 'Exit Live Edit', 'Url' => $url, 'Class' => 'curry-admin-logout');
     $tpl = Curry_Twig_Template::loadTemplateString(Curry_InlineAdmin::getAdminPanelTpl());
     $content = $tpl->render(array('commands' => $commands));
     $htmlHead = $this->getHtmlHead();
     $htmlHead->addScript(Curry_Backend::JQUERY_JS);
     $htmlHead->addInlineScript('window.inlineAdminContent = ' . json_encode($content) . ';');
     $htmlHead->addScript("shared/backend/common/js/inline-admin.js");
     $htmlHead->addStyleSheet("shared/backend/" . Curry_Core::$config->curry->backend->theme . "/css/inline-admin.css");
 }
Exemple #2
0
 /**
  * Build admin panel
  */
 protected function adminPanel()
 {
     $user = \User::getUser();
     $page = $this->app->page;
     $pageRevision = $this->app->pageRevision;
     $commands = array();
     $url = url('/admin/curry_backend_page/', array('view' => 'PageProperties', 'page_id' => $pageRevision->getPageId()));
     if ($user->hasPagePermission($page, \PageAccessPeer::PERM_PROPERTIES)) {
         $commands[] = array('Name' => 'Page properties', 'Url' => $url, 'Class' => 'iframe');
     }
     $url = url('/admin/curry_backend_page/', array('view' => 'NewPage', 'page_id' => $pageRevision->getPageId()));
     if ($user->hasPagePermission($page, \PageAccessPeer::PERM_CREATE_PAGE)) {
         $commands[] = array('Name' => 'New page', 'Url' => $url, 'Class' => 'iframe');
     }
     $url = url('/admin/curry_backend_page/', array('view' => 'PageRevisions', 'page_id' => $pageRevision->getPageId()));
     if ($user->hasPagePermission($page, \PageAccessPeer::PERM_REVISIONS)) {
         $commands[] = array('Name' => 'Page revisions', 'Url' => $url, 'Class' => 'iframe');
     }
     if ($pageRevision->allowEdit()) {
         $commands[] = array('Name' => 'Show all modules', 'Url' => '#', 'Class' => 'toggle-show-all-modules');
     } else {
         $url = '';
         $commands[] = array('Name' => 'Create working revision (TODO)', 'Url' => $url, 'Class' => 'iframe');
     }
     $view = \Curry_Backend_Page::getPageView($page);
     $url = url('admin.php?module=Curry_Backend_Page', array('view' => $view, 'page_id' => $pageRevision->getPageId()));
     $commands[] = array('Name' => 'Backend', 'Url' => $url, 'Class' => 'curry-admin-backend');
     $url = url('', $_GET);
     $commands[] = array('Name' => 'Exit Live Edit', 'Url' => $url, 'Class' => 'curry-admin-logout');
     $tpl = $this->app->loadTemplateString($this->getAdminPanelTpl());
     $content = $tpl->render(array('commands' => $commands));
     $htmlHead = $this->app->generator->getHtmlHead();
     $htmlHead->addScript(self::JQUERY_JS);
     $htmlHead->addInlineScript('window.inlineAdminContent = ' . json_encode($content) . ';');
     $htmlHead->addScript('shared/backend/common/js/inline-admin.js');
     $htmlHead->addStyleSheet('shared/backend/' . $this->app['backend.theme'] . '/css/inline-admin.css');
 }