/** * Get child tag tree. * * @return array */ public function getChildTags() { return Repo_Tag::getInstance()->getChildTag($this->getId()); }
/** * Updates a tag * * @param id * @param name * @param client_id * */ public function updateTagAction() { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(TRUE); $id = $this->_request->getParam("id"); $parentId = $this->_request->getParam("parent_id") == 0 ? null : $this->_request->getParam("parent_id"); if ($id !== "" && $this->_request->isPost()) { Repo_Tag::getInstance()->updateTag(array("name" => $this->_request->getParam("name"), "client_id" => $this->_request->getParam("client_id"), "parent_id" => $parentId), "id=" . $id); } echo json_encode(array("success" => true, "name" => $this->_request->getParam("name"))); }
/** * Add a list of tags for an entity. Need to find tag id first. * * @param integer $clientId * @param string $tags * @param string $entityType * @param integer $entityId * @return boolean */ public function addEntityTags($clientId, $tags, $entityType, $entityId) { if (!is_array($tags) || empty($tags) || !$clientId || !$entityType || !$entityId) { return false; } $this->removeEntityTags($entityId, $entityType); foreach ($tags as $_tag) { $_tagId = Repo_Tag::getInstance()->getTagId($clientId, $_tag); if ($_tagId && $_tagId > 0) { $this->addNew($entityType, $entityId, $_tagId); } } return true; }