Exemplo n.º 1
0
 protected function loadDataProcesses()
 {
     $this->arResult['SYSTEM_PROCESSES'] = array();
     $this->arResult['USER_PROCESSES'] = array();
     try {
         $defaultSiteId = CSite::getDefSite();
         $iterator = CSite::getByID($defaultSiteId);
         $site = $iterator->fetch();
         $defaultLang = $site ? $site['LANGUAGE_ID'] : 'en';
         if ($defaultLang == 'ua') {
             $defaultLang = 'ru';
         }
         \Bitrix\Lists\Importer::loadDataProcesses($defaultLang, true, $this->arResult['SYSTEM_PROCESSES']);
         \Bitrix\Lists\Importer::loadDataProcesses($defaultLang, false, $this->arResult['USER_PROCESSES']);
         $this->checkForIblock($this->arResult['SYSTEM_PROCESSES']);
         $this->checkForIblock($this->arResult['USER_PROCESSES']);
     } catch (Exception $e) {
         $this->errors[] = $e->getMessage();
     }
     if (empty($this->arResult['SYSTEM_PROCESSES']) && empty($this->arResult['USER_PROCESSES'])) {
         $this->errors[] = Loc::getMessage('CC_LCP_NOT_PROCESSES');
     }
 }
Exemplo n.º 2
0
 /**
  * @return array
  * @throws Exception
  */
 protected function getUserStorageId()
 {
     if ($this->enableDiskModule) {
         $storage = \Bitrix\Disk\Driver::getInstance()->getStorageByUserId($this->getUser()->getId());
         if (!$storage) {
             $storage = \Bitrix\Disk\Driver::getInstance()->addUserStorage($this->getUser()->getId());
         }
         if ($storage) {
             return array('IBLOCK_ID' => $storage->getId(), 'IBLOCK_SECTION_ID' => $storage->getRootObjectId());
         }
     }
     $userFilesOptions = COption::getOptionString('webdav', 'user_files', null);
     if ($userFilesOptions == null) {
         throw new Exception('Where are options "user_files"?');
     }
     $userFilesOptions = unserialize($userFilesOptions);
     $iblockId = $userFilesOptions[CSite::getDefSite()]['id'];
     $userSectionId = CWebDavIblock::getRootSectionIdForUser($iblockId, $this->getUser()->getId());
     if (!$userSectionId) {
         throw new Exception('Wrong section for user ' . $this->getUser()->getLastName());
     }
     return array('IBLOCK_ID' => $iblockId, 'IBLOCK_SECTION_ID' => $userSectionId);
 }