コード例 #1
0
ファイル: Tag.php プロジェクト: beesheer/freehdfootage
 /**
  * Returns an instance.
  *
  * Singleton pattern implementation.
  *
  * @return Repo_Tag
  */
 public static function getInstance()
 {
     if (null === self::$_instance) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
コード例 #2
0
ファイル: Tag.php プロジェクト: beesheer/freehdfootage
 /**
  * Get child tag tree.
  *
  * @return array
  */
 public function getChildTags()
 {
     return Repo_Tag::getInstance()->getChildTag($this->getId());
 }
コード例 #3
0
 /**
  * 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")));
 }
コード例 #4
0
ファイル: TagEntity.php プロジェクト: beesheer/freehdfootage
 /**
  * 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;
 }