Exemplo n.º 1
0
 /**
  * Return name of storage.
  * @return string
  */
 public function getTitle()
 {
     $entityId = $this->storage->getEntityId();
     if ($entityId == 'shared_files_s1' || $entityId == 'shared_files' || $entityId == 'shared') {
         return Loc::getMessage('DISK_PROXY_TYPE_COMMON_TITLE_S1');
     }
     return parent::getTitle();
 }
Exemplo n.º 2
0
 /**
  * Get name of entity (ex. user last name + first name, group name, etc)
  * By default: get title
  * @return string
  */
 public function getEntityTitle()
 {
     $group = $this->getGroup();
     return isset($group['~NAME']) ? $group['~NAME'] : parent::getEntityTitle();
 }
Exemplo n.º 3
0
 /**
  * Return name of storage.
  * May be concrete by current user context.
  * Should not use in notification, email to another person.
  * @return string
  */
 public function getTitleForCurrentUser()
 {
     global $USER;
     if (is_object($USER) && $USER->getId() == $this->entityId) {
         return Loc::getMessage('DISK_PROXY_TYPE_USER_TITLE_CURRENT_USER');
     }
     return parent::getTitle();
 }
Exemplo n.º 4
0
 public static function add(array $data, ErrorCollection $errorCollection)
 {
     if (!is_subclass_of($data['ENTITY_TYPE'], ProxyType\Base::className())) {
         throw new SystemException('Invalid class for ProxyType. Must be subclass of ProxyType\\Base');
     }
     $rootObjectData = array();
     if (!empty($data['ROOT_OBJECT'])) {
         $rootObjectData = $data['ROOT_OBJECT'];
         unset($data['ROOT_OBJECT']);
     }
     $storage = parent::add($data, $errorCollection);
     if (!$storage) {
         return null;
     }
     $folderData = array_merge(array_intersect_key($rootObjectData, array('CREATE_TIME' => true, 'UPDATE_TIME' => true, 'XML_ID' => true)), array('NAME' => Ui\Text::correctFilename($storage->getName()), 'STORAGE_ID' => $storage->getId()));
     $folder = Folder::add($folderData, $errorCollection);
     if (!$folder) {
         return null;
     }
     $success = $storage->update(array('ROOT_OBJECT_ID' => $folder->getId()));
     if (!$success) {
         return null;
     }
     $storage->rootObject = $folder;
     $event = new Event(Driver::INTERNAL_MODULE_ID, "onAfterAddStorage", array($storage));
     $event->send();
     $storage->clearByTagCommonStorages();
     return $storage;
 }