public function getTreeObject() { if (!isset($this->tree)) { $this->tree = Tree::getByID($this->treeID); } return $this->tree; }
protected function getTree() { if (!isset($this->tree)) { $treeID = $this->app->make('helper/security')->sanitizeInt($this->request->request('treeID')); $this->tree = \Concrete\Core\Tree\Tree::getByID($treeID); } return $this->tree; }
public function import(\SimpleXMLElement $sx) { if (isset($sx->trees)) { foreach ($sx->trees->tree as $t) { Tree::import($t); } } }
public static function add() { // copy permissions from the other node. $rootNode = GroupTreeNode::add(); $treeID = parent::create($rootNode); $tree = self::getByID($treeID); return $tree; }
public function remove_tree() { if ($this->token->validate('remove_tree')) { $tree = Tree::getByID(Loader::helper('security')->sanitizeInt($_REQUEST['treeID'])); $treeType = $tree->getTreeTypeObject(); if (is_object($treeType)) { $treeTypeHandle = $treeType->getTreeTypeHandle(); } if (is_object($tree) && $treeTypeHandle == 'topic') { if (\PermissionKey::getByHandle('remove_topic_tree')->validate()) { $tree->delete(); $this->redirect('/dashboard/system/attributes/topics', 'tree_deleted'); } } } }
public static function add($name) { // copy permissions from the other node. $rootNode = TopicCategoryTreeNode::add(); $treeID = parent::add($rootNode); $tree = self::getByID($treeID); $tree->setTopicTreeName($name); // by default, topic trees are viewable by all $guestGroupEntity = GroupPermissionAccessEntity::getOrCreate(UserGroup::getByID(GUEST_GROUP_ID)); $pk = TopicCategoryTreeNodePermissionKey::getByHandle('view_topic_category_tree_node'); $pk->setPermissionObject($rootNode); $pa = PermissionAccess::create($pk); $pa->addListItem($guestGroupEntity); $pt = $pk->getPermissionAssignmentObject(); $pt->assignPermissionAccess($pa); return $tree; }
public static function add() { // copy permissions from the other node. $rootNode = ExpressEntryCategory::add(); $treeID = parent::create($rootNode); $tree = self::getByID($treeID); $adminGroupEntity = GroupEntity::getOrCreate(ConcreteGroup::getByID(ADMIN_GROUP_ID)); $permissions = ['view_express_entries', 'add_express_entries', 'edit_express_entries', 'delete_express_entries']; foreach ($permissions as $handle) { $pk = ExpressTreeNodeKey::getByHandle($handle); $pk->setPermissionObject($rootNode); $pa = Access::create($pk); $pa->addListItem($adminGroupEntity); $pt = $pk->getPermissionAssignmentObject(); $pt->assignPermissionAccess($pa); } return $tree; }
public function exportKey($key) { $this->load(); $tree = Tree::getByID($this->akTopicTreeID); $node = Node::getByID($this->akTopicParentNodeID); $path = $node->getTreeNodeDisplayPath(); $treeNode = $key->addChild('tree'); $treeNode->addAttribute('name', $tree->getTreeName()); $treeNode->addAttribute('path', $path); return $key; }
public function getTreeObject() { return Tree::getByID($this->treeID); }
public function run() { $this->x = new SimpleXMLElement("<concrete5-cif></concrete5-cif>"); $this->x->addAttribute('version', '1.0'); // First, attribute categories AttributeKeyCategory::exportList($this->x); // Features Feature::exportList($this->x); FeatureCategory::exportList($this->x); ConversationEditor::exportList($this->x); ConversationRatingType::exportList($this->x); // composer PageTypePublishTargetType::exportList($this->x); PageTypeComposerControlType::exportList($this->x); PageType::exportList($this->x); // attribute types AttributeType::exportList($this->x); // then block types BlockTypeList::exportList($this->x); // now block type sets (including user) BlockTypeSet::exportList($this->x); // gathering GatheringDataSource::exportList($this->x); GatheringItemTemplate::exportList($this->x); // now attribute keys (including user) AttributeKey::exportList($this->x); // now attribute keys (including user) AttributeSet::exportList($this->x); PageTemplate::exportList($this->x); // now theme PageTheme::exportList($this->x); // now packages PackageList::export($this->x); // permission access entity types PermissionAccessEntityType::exportList($this->x); // now task permissions PermissionKey::exportList($this->x); // workflow types WorkflowType::exportList($this->x); // now jobs Job::exportList($this->x); // now single pages $singlepages = $this->x->addChild("singlepages"); $db = Loader::db(); $r = $db->Execute('select cID from Pages where cFilename is not null and cFilename <> "" and cID not in (select cID from Stacks) order by cID asc'); while ($row = $r->FetchRow()) { $pc = Page::getByID($row['cID'], 'RECENT'); $pc->export($singlepages); } // now stacks/global areas StackList::export($this->x); // now content pages $pages = $this->x->addChild("pages"); $db = Loader::db(); $r = $db->Execute('select Pages.cID from Pages where cIsTemplate = 0 and cFilename is null or cFilename = "" order by cID asc'); while ($row = $r->FetchRow()) { $pc = Page::getByID($row['cID'], 'RECENT'); if ($pc->getPageTypeHandle() == STACKS_PAGE_TYPE) { continue; } $pc->export($pages); } SystemCaptchaLibrary::exportList($this->x); \Concrete\Core\Sharing\SocialNetwork\Link::exportList($this->x); \Concrete\Core\Page\Feed::exportList($this->x); \Concrete\Core\File\Image\Thumbnail\Type\Type::exportList($this->x); Config::exportList($this->x); Tree::exportList($this->x); }
public function export(\SimpleXMLElement $blockNode) { $tree = Tree::getByID($this->topicTreeID); $data = $blockNode->addChild('data'); $data->addChild('mode', $this->mode); $data->addChild("title", $this->title); $data->addChild('topicAttributeKeyHandle', $this->topicAttributeKeyHandle); if (is_object($tree)) { $data->addChild('tree', $tree->getTreeName()); } $path = null; if ($this->cParentID) { $parent = \Page::getByID($this->cParentID); $path = '{ccm:export:page:' . $parent->getCollectionPath() . '}'; } $data->addChild('cParentID', $path); }
<?php defined('C5_EXECUTE') or die("Access Denied."); use Concrete\Core\Tree\Tree; use Concrete\Core\Tree\Node\Node as TreeNode; $form = Loader::helper('form'); $treeID = Loader::helper('security')->sanitizeInt($_REQUEST['treeID']); $tree = Tree::getByID($treeID); if (!is_object($tree)) { exit; } if (is_array($_REQUEST['treeNodeSelectedIDs'])) { $selectedIDs = array(); foreach ($_REQUEST['treeNodeSelectedIDs'] as $nID) { $node = TreeNode::getByID($nID); if (is_object($node) && $node->getTreeID() == $tree->getTreeID()) { $selectedIDs[] = $node->getTreeNodeID(); } } $tree->setSelectedTreeNodeIDs($selectedIDs); } $tree->setRequest($_REQUEST); $result = $tree->getJSON(); print Loader::helper('ajax')->sendResult($result);