Beispiel #1
0
 protected function processActionGetListStorage()
 {
     $this->checkRequiredPostParams(array('proxyType'));
     if ($this->errorCollection->hasErrors()) {
         $this->sendJsonErrorResponse();
     }
     $proxyTypePost = $this->request->getPost('proxyType');
     $diskSecurityContext = $this->getSecurityContextByUser($this->getUser());
     $siteId = null;
     $siteDir = null;
     if ($this->request->getPost('siteId')) {
         $siteId = $this->request->getPost('siteId');
     }
     if ($this->request->getPost('siteDir')) {
         $siteDir = rtrim($this->request->getPost('siteDir'), '/');
     }
     $result = array();
     $filterReadableList = array();
     $checkSiteId = false;
     if ($proxyTypePost == 'user') {
         $result['TITLE'] = Loc::getMessage('DISK_AGGREGATOR_USER_TITLE');
         $filterReadableList = array('STORAGE.ENTITY_TYPE' => ProxyType\User::className());
     } elseif ($proxyTypePost == 'group') {
         $checkSiteId = true;
         $result['TITLE'] = Loc::getMessage('DISK_AGGREGATOR_GROUP_TITLE');
         $filterReadableList = array('STORAGE.ENTITY_TYPE' => ProxyType\Group::className());
     }
     foreach (Storage::getReadableList($diskSecurityContext, array('filter' => $filterReadableList)) as $storage) {
         if ($checkSiteId) {
             $groupObject = CSocNetGroup::getList(array(), array('ID' => $storage->getEntityId()), false, false, array('SITE_ID'));
             $group = $groupObject->fetch();
             if (!empty($group) && $group['SITE_ID'] != $siteId) {
                 continue;
             }
         }
         $proxyType = $storage->getProxyType();
         $result['DATA'][] = array("TITLE" => $proxyType->getEntityTitle(), "URL" => $siteDir . $proxyType->getBaseUrlFolderList(), "ICON" => $proxyType->getEntityImageSrc(64, 64));
     }
     if (!empty($result['DATA'])) {
         Collection::sortByColumn($result['DATA'], array('TITLE' => SORT_ASC));
         $this->sendJsonSuccessResponse(array('listStorage' => $result['DATA'], 'title' => $result['TITLE']));
     } else {
         $this->errorCollection->add(array(new Error(Loc::getMessage('DISK_AGGREGATOR_ERROR_COULD_NOT_FIND_DATA'))));
         $this->sendJsonErrorResponse();
     }
 }
Beispiel #2
0
 protected function processActionDefault()
 {
     $diskSecurityContext = $this->getSecurityContextByUser($this->getUser());
     $this->arResult["COMMON_DISK"] = array();
     $filterReadableList = array('STORAGE.ENTITY_TYPE' => ProxyType\Common::className());
     foreach (Storage::getReadableList($diskSecurityContext, array('filter' => $filterReadableList)) as $storage) {
         $proxyType = $storage->getProxyType();
         if ($storage->getSiteId() != SITE_ID) {
             continue;
         }
         $this->arResult["COMMON_DISK"][$storage->getEntityId()] = array("TITLE" => $proxyType->getEntityTitle(), "URL" => $proxyType->getBaseUrlFolderList(), "ICON" => $proxyType->getEntityImageSrc(64, 64));
     }
     $userId = $this->getUser()->getId();
     $storage = Driver::getInstance()->getStorageByUserId($userId);
     $proxyType = $storage->getProxyType();
     $this->arResult["COMMON_DISK"][$storage->getEntityId()] = array("TITLE" => $proxyType->getTitleForCurrentUser(), "URL" => $proxyType->getBaseUrlFolderList(), "ICON" => $proxyType->getEntityImageSrc(64, 64));
     $this->arResult["COMMON_DISK"]["GROUP"] = array("TITLE" => Loc::getMessage('DISK_AGGREGATOR_GROUP_TITLE'), "ID" => "bx-disk-aggregator-group-link");
     $this->arResult["COMMON_DISK"]["USER"] = array("TITLE" => Loc::getMessage('DISK_AGGREGATOR_USER_TITLE'), "ID" => "bx-disk-aggregator-user-link");
     $this->arResult["NETWORK_DRIVE_LINK"] = Driver::getInstance()->getUrlManager()->getHostUrl() . $this->getApplication()->GetCurPage();
     $this->includeComponentTemplate();
 }
Beispiel #3
0
 protected function getCommonStorages()
 {
     return Storage::getReadableList($this->getSecurityContextByUser($this->getUser()), array('filter' => array('STORAGE.ENTITY_TYPE' => ProxyType\Common::className(), 'STORAGE.SITE_ID' => SITE_ID)));
 }