예제 #1
0
 /**
  * Find Access level for current user for this page
  *
  * @return integer (ACCESS CONSTANT)
  */
 private function getAccessLevel(PageEntity $page)
 {
     if (SecurityUtil::checkPermission('ZikulaPagesModule::Page', "{$page->getTitle()}::{$page->getPageid()}", ACCESS_READ)) {
         $accessLevel = ACCESS_READ;
         if (SecurityUtil::checkPermission('ZikulaPagesModule::', "{$page->getTitle()}::{$page->getPageid()}", ACCESS_COMMENT)) {
             $accessLevel = ACCESS_COMMENT;
             if (SecurityUtil::checkPermission('ZikulaPagesModule::', "{$page->getTitle()}::{$page->getPageid()}", ACCESS_EDIT)) {
                 $accessLevel = ACCESS_EDIT;
             }
         }
     } else {
         $accessLevel = ACCESS_NONE;
     }
     return $accessLevel;
 }
예제 #2
0
 /**
  * create a sample page
  *
  * @throws \Doctrine\ORM\ORMException
  */
 private function createIntroPage()
 {
     $em = $this->container->get('doctrine.entitymanager');
     $content = $this->__('This is a demonstration page. You can use Pages to create simple static content pages. It is excellent ' . 'if you only need basic html for your pages. You can also utilize the Scribite module for WYSIWYG ' . 'content creation. It is well suited for informational articles, documents and other "long term" type ' . 'content items.' . '<br /><br />' . 'Pages is a hookable module which allows you to hook EZComments or other hook providers to extend the ' . 'capabilities of your module.');
     $data = array('title' => $this->__('Welcome to Pages content manager'), 'urltitle' => $this->__('welcome-to-pages-content-manager'), 'content' => $content, 'language' => ZLanguage::getLanguageCode());
     $page = new PageEntity();
     $page->merge($data);
     $em->persist($page);
     $category = CategoryUtil::getCategoryByPath('/__SYSTEM__/Modules/ZikulaPagesModule/Category1');
     $catEntity = $em->getReference('Zikula\\CategoriesModule\\Entity\\CategoryEntity', $category['id']);
     $page->setCategories(array($catEntity));
     $em->flush();
 }