Exemplo n.º 1
0
 public function getTreeObject()
 {
     if (!isset($this->tree)) {
         $this->tree = Tree::getByID($this->treeID);
     }
     return $this->tree;
 }
Exemplo n.º 2
0
 public static function get()
 {
     $db = Database::connection();
     $treeTypeID = $db->GetOne('select treeTypeID from TreeTypes where treeTypeHandle = ?', array('group'));
     $treeID = $db->GetOne('select treeID from Trees where treeTypeID = ?', array($treeTypeID));
     return Tree::getByID($treeID);
 }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
 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');
             }
         }
     }
 }
Exemplo n.º 5
0
 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;
 }
Exemplo n.º 6
0
 public function getTreeObject()
 {
     return Tree::getByID($this->treeID);
 }
Exemplo n.º 7
0
 public static function getByName($name)
 {
     $db = Loader::db();
     $treeID = $db->GetOne('select treeID from TopicTrees where topicTreeName = ?', array($name));
     return Tree::getByID($treeID);
 }
Exemplo n.º 8
0
 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);
 }
Exemplo n.º 9
0
<?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);