Exemplo n.º 1
0
 /**
  * Constructor.
  *
  * @param TagMapper $mapper Instance of the TagMapper abstraction layer.
  * @param string $user The user whose data the object will operate on.
  * @param string $type The type of items for which tags will be loaded.
  * @param array $defaultTags Tags that should be created at construction.
  * @param boolean $includeShared Whether to include tags for items shared with this user by others.
  */
 public function __construct(TagMapper $mapper, $user, $type, $defaultTags = array(), $includeShared = false)
 {
     $this->mapper = $mapper;
     $this->user = $user;
     $this->type = $type;
     $this->includeShared = $includeShared;
     $this->owners = array($this->user);
     if ($this->includeShared) {
         $this->owners = array_merge($this->owners, \OC\Share\Share::getSharedItemsOwners($this->user, $this->type, true));
         $this->backend = \OC\Share\Share::getBackend($this->type);
     }
     $this->tags = $this->mapper->loadTags($this->owners, $this->type);
     if (count($defaultTags) > 0 && count($this->tags) === 0) {
         $this->addMultiple($defaultTags, true);
     }
     \OCP\Util::writeLog('core', __METHOD__ . ', tags: ' . print_r($this->tags, true), \OCP\Util::DEBUG);
 }
Exemplo n.º 2
0
 /**
  * Constructor.
  *
  * @param TagMapper $mapper Instance of the TagMapper abstraction layer.
  * @param string $user The user whose data the object will operate on.
  * @param string $type The type of items for which tags will be loaded.
  * @param array $defaultTags Tags that should be created at construction.
  * @param boolean $includeShared Whether to include tags for items shared with this user by others.
  */
 public function __construct(TagMapper $mapper, $user, $type, $defaultTags = array(), $includeShared = false)
 {
     $this->mapper = $mapper;
     $this->user = $user;
     $this->type = $type;
     $this->includeShared = $includeShared;
     $this->owners = array($this->user);
     if ($this->includeShared) {
         $this->owners = array_merge($this->owners, \OC\Share\Share::getSharedItemsOwners($this->user, $this->type, true));
         $this->backend = \OC\Share\Share::getBackend($this->type);
     }
     $this->tags = $this->mapper->loadTags($this->owners, $this->type);
     if (count($defaultTags) > 0 && count($this->tags) === 0) {
         $this->addMultiple($defaultTags, true);
     }
 }