/** * @param TopicTreeNode $node */ public function setPermissionObject($node) { $this->permissionObject = $node; if ($node->overrideParentTreeNodePermissions()) { $this->permissionObjectToCheck = $node; } else { $parent = Node::getByID($node->getTreeNodePermissionsNodeID()); $this->permissionObjectToCheck = $parent; } }
public function action_topic($treeNodeID = false, $topic = false) { if ($treeNodeID) { $topicObj = Topic::getByID(intval($treeNodeID)); $this->set('currentTopic', $topicObj); } $this->view(); }
public function add_topic_node() { $token = \Core::make('token'); $error = \Core::make('error'); $parent = $this->getNode(); if (!$token->validate('add_topic_node')) { $error->add($token->getErrorMessage()); } $title = $_POST['treeNodeTopicName']; if (!$title) { $error->add(t('Invalid title for topic.')); } if (!is_object($parent)) { $error->add(t('Invalid parent category')); } if (!$error->has()) { $topic = Topic::add($title, $parent); $r = $topic->getTreeNodeJSON(); return new JsonResponse($r); } else { return new JsonResponse($error); } }
public function action_filter_by_topic($treeNodeID = false, $topic = false) { if ($treeNodeID) { $this->list->filterByTopic(intval($treeNodeID)); $topicObj = Topic::getByID(intval($treeNodeID)); if (is_object($topicObj)) { $seo = Core::make('helper/seo'); $seo->addTitleSegment($topicObj->getTreeNodeDisplayName()); } } $this->view(); }
public function add_topic_node($treeNodeParentID) { if ($this->token->validate('add_topic_node')) { $parent = TreeNode::getByID($treeNodeParentID); $tree = $parent->getTreeObject(); $title = $_POST['treeNodeTopicName']; if (!$title) { $this->error->add(t('Invalid title for topic')); } if (!is_object($parent)) { $this->error->add(t('Invalid parent category')); } $np = new Permissions($parent); if (!$np->canAddTopicTreeNode()) { $this->error->add(t('You may not add a topic here.')); } if (!$this->error->has()) { $category = TopicTreeNode::add($title, $parent); $r = $category->getTreeNodeJSON(); Loader::helper('ajax')->sendResult($r); } } else { $this->error->add($this->token->getErrorMessage()); } if ($this->error->has()) { Loader::helper('ajax')->sendError($this->error); } }