Ejemplo n.º 1
0
 private function getSectionDataByAttachObject(array $attachObject)
 {
     if (empty($attachObject['type'])) {
         throw new \Bitrix\Main\ArgumentException('type', 'attachObject');
     }
     if (!isset($attachObject['id'])) {
         throw new \Bitrix\Main\ArgumentException('id', 'attachObject');
     }
     if ($attachObject['type'] == \CWebDavSymlinkHelper::ENTITY_TYPE_GROUP) {
         $data = \CWebDavIblock::getRootSectionDataForGroup((int) $attachObject['id']);
         $data['SOCNET_GROUP_ID'] = $attachObject['id'];
         return $data;
     }
     if ($attachObject['type'] == \CWebDavSymlinkHelper::ENTITY_TYPE_USER) {
         $sectionId = (int) $attachObject['id'];
         $sectionData = \CIBlockSection::getList(array(), array('ID' => $sectionId, 'CHECK_PERMISSIONS' => 'Y'), false, array('SOCNET_GROUP_ID', 'IBLOCK_ID', 'CREATED_BY', 'NAME'));
         if (!$sectionData || !($sectionData = $sectionData->fetch())) {
             return array();
         }
         $allowableIblock = false;
         $iblockType = false;
         foreach (array('user_files', 'group_files', 'shared_files') as $type) {
             $wdIblockOptions = \CWebDavIblock::libOptions($type, false, SITE_ID);
             if (is_set($wdIblockOptions, 'id') && intval($wdIblockOptions['id']) > 0) {
                 if ($sectionData['IBLOCK_ID'] == $wdIblockOptions['id']) {
                     $allowableIblock = true;
                     $iblockType = $type;
                 }
             }
         }
         if (!$allowableIblock) {
             return array();
         }
         \CWebDavSymlinkHelper::setIblockIdForSectionId($sectionId, $sectionData['IBLOCK_ID']);
         return array('NAME' => $sectionData['NAME'], 'IBLOCK_ID' => $sectionData['IBLOCK_ID'], 'IBLOCK_TYPE' => $iblockType, 'SECTION_ID' => $sectionId, 'CREATED_BY' => $sectionData['CREATED_BY'], 'SOCNET_GROUP_ID' => isset($sectionData['SOCNET_GROUP_ID']) ? $sectionData['SOCNET_GROUP_ID'] : null);
     }
     throw new \Bitrix\Main\ArgumentException('Wrong type', 'attachObject');
 }
Ejemplo n.º 2
0
$arResult["URL"]["ELEMENT"]["BP_VIEW"] = CComponentEngine::MakePathFromTemplate($arParams["WEBDAV_BIZPROC_VIEW_URL"], array("ELEMENT_ID" => $arParams["ELEMENT_ID"]));
$arResult["URL"]["HELP"] = CComponentEngine::MakePathFromTemplate($arParams["HELP_URL"], array());
$arResult["URL"]["CONNECTOR"] = CComponentEngine::MakePathFromTemplate($arParams["CONNECTOR_URL"], array());
$arResult["URL"]["SUBSCRIBE"] = CComponentEngine::MakePathFromTemplate($arParams["SECTIONS_URL"], array("PATH" => $path, "SECTION_ID" => $arParams["SECTION_ID"]));
$arResult["URL"]["UNSUBSCRIBE"] = WDAddPageParams($arResult["URL"]["SUBSCRIBE"], array("subscribe_forum" => "N", "sessid" => bitrix_sessid()));
$arResult["URL"]["SUBSCRIBE"] = WDAddPageParams($arResult["URL"]["SUBSCRIBE"], array("subscribe_forum" => "Y", "sessid" => bitrix_sessid()));
/*************** For Custom components *****************************/
$arParams["USE_BIZPROC"] = $ob->workflow == "bizproc" ? "Y" : "N";
$arParams["USE_WORKFLOW"] = $ob->workflow == "workflow" ? "Y" : "N";
$arResult["URL"]["CHAIN"] = array(array("URL" => CComponentEngine::MakePathFromTemplate($arParams["SECTIONS_URL"], array("PATH" => "", "SECTION_ID" => 0)), "TITLE" => empty($arParams["STR_TITLE"]) ? GetMessage("WD_TITLE") : $arParams["STR_TITLE"]));
$arResult['BP_PARAM_REQUIRED'] = 'N';
if ($ob->Type == 'iblock') {
    $arResult['BP_PARAM_REQUIRED'] = $ob->BPParameterRequired() ? 'Y' : 'N';
}
/********************************************************************
				/Data
********************************************************************/
$arResult['GROUP_DISK'] = array();
if ($ob->attributes['group_id'] && $ob->e_rights && $ob->GetPermission('SECTION', $ob->arParams['item_id'], 'section_edit') && CWebDavTools::isIntranetUser($USER->getId())) {
    $rootSectionDataForGroup = CWebDavIblock::getRootSectionDataForGroup($ob->attributes['group_id']);
    $arResult['GROUP_DISK']['CONNECTED'] = !\Bitrix\Webdav\FolderInviteTable::getRow(array('filter' => array('=INVITE_USER_ID' => $USER->getId(), '=USER_ID' => $USER->getId(), '=IS_APPROVED' => true, '=IBLOCK_ID' => $rootSectionDataForGroup['IBLOCK_ID'], '=SECTION_ID' => $rootSectionDataForGroup['SECTION_ID'])));
    $arResult['GROUP_DISK']['CONNECT_URL'] = $APPLICATION->GetCurUri(http_build_query(array('toWDController' => 1, 'wdaction' => 'connect', 'group' => $ob->attributes['group_id'])));
    $arResult['GROUP_DISK']['DISCONNECT_URL'] = $APPLICATION->GetCurUri(http_build_query(array('toWDController' => 1, 'wdaction' => 'disconnect', 'group' => $ob->attributes['group_id'])));
    $arResult['GROUP_DISK']['DETAIL_URL'] = $APPLICATION->GetCurUri(http_build_query(array('toWDController' => 1, 'wdaction' => 'detail_group_connect', 'group' => $ob->attributes['group_id'])));
}
$this->IncludeComponentTemplate();
if (!$ob->e_rights && $ob->CheckRight($arParams["PERMISSION"], "section_read") < "R") {
    ShowError(GetMessage("WD_ACCESS_DENIED"));
    return 0;
}
return array("PERMISSION" => $arParams["PERMISSION"]);