本文整理汇总了PHP中Permissions::canAddPageType方法的典型用法代码示例。如果您正苦于以下问题:PHP Permissions::canAddPageType方法的具体用法?PHP Permissions::canAddPageType怎么用?PHP Permissions::canAddPageType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Permissions
的用法示例。
在下文中一共展示了Permissions::canAddPageType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_post
public function action_post() {
// happens through ajax
$pagetype = PageType::getByID($this->ptID);
if (is_object($pagetype) && $this->enableNewTopics) {
$ccp = new Permissions($pagetype);
if ($ccp->canAddPageType()) {
$pagetypes = $pagetype->getPageTypeComposerPageTypeObjects();
$ctTopic = $pagetypes[0];
$c = Page::getCurrentPage();
$e = $pagetype->validatePublishRequest($ctTopic, $c);
$r = new PageTypePublishResponse($e);
if (!$e->has()) {
$d = $pagetype->createDraft($ctTopic);
$d->setPageDraftTargetParentPageID($c->getCollectionID());
$d->saveForm();
$d->publish();
$nc = Page::getByID($d->getCollectionID(), 'RECENT');
$link = Loader::helper('navigation')->getLinkToCollection($nc, true);
$r->setRedirectURL($link);
}
$r->outputJSON();
}
}
exit;
}
示例2: create_new
public function create_new()
{
$pr = new PageEditResponse();
$ms = Section::getByID($this->request->request->get('section'));
// we get the related parent id
if ($this->page->isPageDraft()) {
$cParentID = $this->page->getPageDraftTargetParentPageID();
} else {
$cParentID = $this->page->getCollectionParentID();
}
$cParent = \Page::getByID($cParentID);
$cParentRelatedID = $ms->getTranslatedPageID($cParent);
if ($cParentRelatedID > 0) {
// we copy the page underneath it and store it
$ct = \PageType::getByID($this->page->getPageTypeID());
if ($this->page->isPageDraft()) {
$ptp = new \Permissions($ct);
if (!$ptp->canAddPageType()) {
throw new \Exception(t('You do not have permission to add a page of this type.'));
}
}
$newParent = \Page::getByID($cParentRelatedID);
$cp = new \Permissions($newParent);
if ($cp->canAddSubCollection($ct)) {
if ($this->page->isPageDraft()) {
$targetParent = \Page::getByPath(\Config::get('concrete.paths.drafts'));
} else {
$targetParent = $newParent;
}
$newPage = $this->page->duplicate($targetParent);
if (is_object($newPage)) {
if ($this->page->isPageDraft()) {
$newPage->setPageDraftTargetParentPageID($newParent->getCollectionID());
Section::relatePage($this->page, $newPage, $ms->getLocale());
$pr->setMessage(t('New draft created.'));
} else {
// grab the approved version and unapprove it
$v = Version::get($newPage, 'ACTIVE');
if (is_object($v)) {
$v->deny();
}
$pr->setMessage(t('Unapproved page created. You must publish this page before it is live.'));
}
$ih = Core::make('multilingual/interface/flag');
$icon = (string) $ih->getSectionFlagIcon($ms);
$pr->setAdditionalDataAttribute('name', $newPage->getCollectionName());
$pr->setAdditionalDataAttribute('link', $newPage->getCollectionLink());
$pr->setAdditionalDataAttribute('icon', $icon);
}
} else {
throw new \Exception(t('You do not have permission to add this page to this section of the tree.'));
}
}
$pr->outputJSON();
}
示例3: add_composer
public function add_composer($ptComposerFormLayoutSetControlID, $action)
{
$setControl = FormLayoutSetControl::getByID($ptComposerFormLayoutSetControlID);
if (is_object($setControl)) {
$formControl = $setControl->getPageTypeComposerControlObject();
if ($formControl instanceof BlockControl) {
$set = $setControl->getPageTypeComposerFormLayoutSetObject();
$type = $set->getPageTypeObject();
$pp = new \Permissions($type);
if ($pp->canAddPageType()) {
$controller = $formControl->getBlockTypeObject()->getController();
return $this->deliverResponse($controller, $action);
}
}
}
$response = new Response(t('Access Denied'));
return $response;
}
示例4: loadblogSections
protected function loadblogSections()
{
$blogSectionList = new ProBlogList();
$blogSectionList->filterByBlogSection(1);
$blogSectionList->sortBy('cvName', 'asc');
$tmpSections = $blogSectionList->get();
$sections = array();
foreach ($tmpSections as $_c) {
$pt = CollectionType::getByID($_c->getCollectionTypeID());
$cmp = new \Permissions($pt);
$pp = $cmp->canAddPageType();
if ($pp) {
$this->pt = $pt;
$sections[$_c->getCollectionID()] = $_c->getCollectionName();
}
}
$this->sections = $sections;
$this->set('sections', $this->sections);
}
示例5: validateComposerAddBlockPassThruAction
public function validateComposerAddBlockPassThruAction(Type $type)
{
$pp = new \Permissions($type);
return $pp->canAddPageType();
}
示例6: render
/**
* render Add Blog dialog
*/
public function render()
{
$this->requireAsset('redactor');
$this->requireAsset('core/file-manager');
$blogify = Loader::helper('blogify');
$settings = $blogify->getBlogSettings();
$blogSectionList = new PageList();
$blogSectionList->filter(false, "ak_blog_section = 1");
$blogSectionList->sortBy('cvName', 'asc');
$tmpSections = $blogSectionList->get();
$sections = array();
foreach ($tmpSections as $_c) {
$pt = CollectionType::getByID($_c->getCollectionTypeID());
$cmp = new \Permissions($pt);
$pp = $cmp->canAddPageType();
if ($pp) {
$sections[$_c->getCollectionID()] = $_c->getCollectionName();
}
}
$ctArray = PageTemplate::getList('');
$pageTemplates = array();
foreach ($ctArray as $ct) {
$pms = new AddSubpagePageKey($ct);
$pp = $pms->validate();
if ($pp) {
$pageTemplates[$ct->getPageTemplateID()] = $ct->getPageTemplateName();
}
}
if ($_REQUEST['postID']) {
$keys = array_keys($sections);
$keys[] = -1;
$current_page = Page::getByID($_REQUEST['postID']);
$date = $current_page->getCollectionDatePublic();
$canonical_parent_id = $blogify->getCanonicalParent($date, $current_page);
$cParentID = $canonical_parent_id;
if (in_array($canonical_parent_id, $keys)) {
$this->blog = $current_page;
}
}
if (is_object($this->blog)) {
$blogTitle = $this->blog->getCollectionName();
$blogDescription = $this->blog->getCollectionDescription();
$blogDate = $this->blog->getCollectionDatePublic();
$ptID = $this->blog->getPageTemplateID();
$blogBody = '';
$eb = $this->blog->getBlocks('Main');
foreach ($eb as $b) {
if ($b->getBlockTypeHandle() == 'content' || $b->getBlockTypeHandle() == 'core_page_type_composer_control_output') {
$blogBody = $b->getInstance()->getContent();
}
}
echo "<div class=\"alert alert-success\"><span class=\"tooltip icon edit\"></span> " . t('You are now editing') . " <b><u>{$blogTitle}</u></b></div>";
$task = 'editthis';
$buttonText = t('Update Blog Entry');
$title = 'Update';
} else {
$task = 'addthis';
$buttonText = t('Add Blog Entry');
$title = 'Add';
}
Loader::PackageElement('tools/add_blog', 'problog', array('blog' => $this->blog, 'blogTitle' => $blogTitle, 'blogDescription' => $blogDescription, 'blogBody' => $blogBody, 'sections' => $sections, 'pageTemplates' => $pageTemplates, 'buttonText' => $buttonText, 'ptID' => $ptID, 'settings' => $settings));
}