Exemplo n.º 1
0
 /**
  * 
  * @param ITag $tag
  */
 public function removeTag(ITag $tag)
 {
     TagManager::getInstance()->removeTag($this, $tag);
 }
Exemplo n.º 2
0
 /**
  * Unassign tags from a file.
  *
  * @param array $params (
  * 		path => string,
  * 		tagIds => array(
  *			tagId1, tagId2, ...
  *		)
  * )
  */
 public function removeAllTags($params)
 {
     if ($params === null) {
         throw new EyeInvalidArgumentException('Missing $params');
     }
     if (!isset($params['path']) || !is_string($params['path'])) {
         throw new EyeInvalidArgumentException('Missing or invalid $params[\'path\']');
     }
     if (!isset($params['tagIds']) || !is_array($params['tagIds'])) {
         throw new EyeInvalidArgumentException('Missing or invalid $params[\'tagIds\']');
     }
     $file = FSI::getFile($params['path']);
     $TM = TagManager::getInstance();
     $tags = array();
     foreach ($params['tagIds'] as $tagId) {
         $tag = new BasicTag();
         $tag->setId($tagId);
         $TM->getTag($tag);
         $tags[] = $tag;
     }
     $TM->removeAllTags($file, $tags);
 }
Exemplo n.º 3
0
 /**
  * Update a system tag for this user
  * @param array(
  * 		oldTag => array(
  *			label => String,
  *			color => String,
  *		),
  *		newTag => array(
  *			label => String,
  *			color => String
  *		)
  * )
  */
 public function updateTag($params)
 {
     if ($params === null) {
         throw new EyeInvalidArgumentException('Missing $params');
     }
     if (!isset($params['oldTag']) || !is_array($params['oldTag'])) {
         throw new EyeInvalidArgumentException('Missing or invalid $params[\'oldTag\']');
     }
     if (!isset($params['newTag']) || !is_array($params['newTag'])) {
         throw new EyeInvalidArgumentException('Missing or invalid $params[\'newTag\']');
     }
     $oldTag = $params['oldTag'];
     $newTag = $params['newTag'];
     if (!isset($oldTag['label']) || !is_string($oldTag['label'])) {
         throw new EyeInvalidArgumentException('Missing or invalid $oldTag[\'label\']');
     }
     if (!isset($newTag['label']) || !is_string($newTag['label'])) {
         throw new EyeInvalidArgumentException('Missing or invalid $newTag[\'label\']');
     }
     if (!isset($oldTag['color']) || !is_string($oldTag['color'])) {
         throw new EyeInvalidArgumentException('Missing or invalid $oldTag[\'color\']');
     }
     if (!isset($newTag['color']) || !is_string($newTag['color'])) {
         throw new EyeInvalidArgumentException('Missing or invalid $newTag[\'color\']');
     }
     $oldTag = new BasicTag($oldTag['label'], $oldTag['color']);
     $newTag = new BasicTag($newTag['label'], $newTag['color']);
     $currentUser = ProcManager::getInstance()->getCurrentProcess()->getLoginContext()->getEyeosUser();
     TagManager::getInstance()->updateTag($currentUser, $oldTag, $newTag);
 }