Пример #1
0
 public function __construct(Category $category)
 {
     parent::__construct($category);
     $p = new \Permissions($category);
     if ($p->canAddCategoryTreeNode()) {
         $this->addItem(new AddCategoryItem($category));
     }
     if ($p->canAddTopicTreeNode()) {
         $this->addItem(new AddTopicItem($category));
     }
     if ($p->canEditTreeNode()) {
         $this->addItem(new EditCategoryItem($category));
     }
     if ($p->canDuplicateTreeNode()) {
         $this->addItem(new CloneItem($category));
     }
     if ($p->canEditTreeNodePermissions() || $p->canDeleteTreeNode()) {
         $this->addItem(new DividerItem());
     }
     if ($p->canEditTreeNodePermissions()) {
         $this->addItem(new EditPermissionsItem($category));
     }
     if ($p->canDeleteTreeNode()) {
         $this->addItem(new DeleteItem($category));
     }
 }
Пример #2
0
 public function __construct(Topic $topic)
 {
     parent::__construct($topic);
     $p = new \Permissions($topic);
     if ($p->canEditTreeNode()) {
         $this->addItem(new EditTopicItem($topic));
     }
     if ($p->canDuplicateTreeNode()) {
         $this->addItem(new CloneItem($topic));
     }
     if ($p->canEditTreeNodePermissions() || $p->canDeleteTreeNode()) {
         $this->addItem(new DividerItem());
     }
     if ($p->canEditTreeNodePermissions()) {
         $this->addItem(new EditPermissionsItem($topic));
     }
     if ($p->canDeleteTreeNode()) {
         $this->addItem(new DeleteItem($topic));
     }
 }
Пример #3
0
 protected function canAccess()
 {
     $node = $this->getNode();
     $np = new \Permissions($node);
     return $np->canDuplicateTreeNode();
 }
Пример #4
0
<?php

defined('C5_EXECUTE') or die("Access Denied.");
$form = Loader::helper('form');
$node = \Concrete\Core\Tree\Node\Node::getByID(Loader::helper('security')->sanitizeInt($_REQUEST['treeNodeID']));
$np = new Permissions($node);
$tree = $node->getTreeObject();
$parent = $node->getTreeNodeParentObject();
$pp = new Permissions($parent);
if (is_object($node) && $pp->canDuplicateTreeNode()) {
    $newnode = $node->duplicate($parent);
    $r = new stdClass();
    $r->treeNodeParentID = $parent->getTreeNodeID();
    Loader::helper("ajax")->sendResult($r);
}