コード例 #1
0
ファイル: component.php プロジェクト: mrdeadmouse/u136006
$arParams['MEETING_ID'] = intval($arParams['MEETING_ID']);
$arParams['COPY'] = $arParams['COPY'] == 'Y';
$arParams['GROUP_ID'] = intval($arParams['GROUP_ID']);
$arParams['NAME_TEMPLATE'] = empty($arParams['NAME_TEMPLATE']) ? CSite::GetNameFormat(false) : str_replace(array("#NOBR#", "#/NOBR#"), array("", ""), $arParams["NAME_TEMPLATE"]);
if ($arParams['MEETING_ID'] && !$arParams['COPY']) {
    $arParams['ITEM_URL'] .= '?from=' . $arParams['MEETING_ID'];
}
//$arParams['CALENDAR_ID'] = intval($arParams['CALENDAR_ID']);
$arParams['EDIT'] = $arParams['EDIT'] == 'Y' || $arParams['MEETING_ID'] <= 0 || $arParams['COPY'];
$arResult['IS_NEW_CALENDAR'] = CMeeting::IsNewCalendar();
$arResult['START_INDEX'] = 0;
if ($arParams['MEETING_ID'] > 0) {
    $arResult['ACCESS'] = CMeeting::GetUserRole($arParams['MEETING_ID']);
    if ($arResult['ACCESS']) {
        if ($_REQUEST['DELETE'] == 'Y' && $arResult['ACCESS'] == CMeeting::ROLE_OWNER && check_bitrix_sessid()) {
            CMeeting::Delete($arParams['MEETING_ID']);
            $APPLICATION->RestartBuffer();
            die;
        }
        $dbRes = CMeeting::GetList(array(), array('ID' => $arParams['MEETING_ID']), false, false, array('*'));
        if (!($arResult['MEETING'] = $dbRes->GetNext())) {
            return ShowError(GetMessage("ME_MEETING_NOT_FOUND"));
        }
        if (CMeeting::CheckPlace($arResult["MEETING"]["PLACE"])) {
            $arResult["MEETING"]["PLACE_ID"] = $arResult["MEETING"]["PLACE"];
        }
        $arResult['MEETING']['USERS'] = CMeeting::GetUsers($arParams['MEETING_ID']);
        $arResult['MEETING']['CURRENT_RIGHTS'] = $arResult['ACCESS'];
        //$arResult['MEETING']['USERS'][$USER->GetID()]; // not arParams[USER_ID]!
        if (!$arResult['MEETING']['CURRENT_RIGHTS']) {
            return ShowError(GetMessage("ME_MEETING_ACCESS_DENIED"));
コード例 #2
0
ファイル: wizard.php プロジェクト: mrdeadmouse/u136006
 function InstallService($serviceID, $serviceStage)
 {
     $wizard =& $this->GetWizard();
     if (CModule::IncludeModule("iblock")) {
         $type = substr($serviceID, 0, -1);
         if ($type == "iblockElement") {
             $dbItem = CIBlockElement::GetList(array(), array("=IBLOCK_CODE" => $serviceStage), false, false, array("ID"));
             while ($arItem = $dbItem->Fetch()) {
                 CIBlockElement::Delete($arItem["ID"]);
             }
         } elseif ($type == "iblockSectionElement") {
             $dbItem = CIBlockElement::GetList(array(), array("=IBLOCK_CODE" => $serviceStage), false, false, array("ID"));
             while ($arItem = $dbItem->Fetch()) {
                 CIBlockElement::Delete($arItem["ID"]);
             }
             $dbItem = CIBlockSection::GetList(array(), array("=IBLOCK_CODE" => $serviceStage), false, array("ID"));
             while ($arItem = $dbItem->Fetch()) {
                 CIBlockSection::Delete($arItem["ID"]);
             }
         } elseif ($serviceID == "iblockDepartmentsElement") {
             $dbItem = CIBlockSection::GetList(array(), array("=IBLOCK_CODE" => "departments"));
             while ($arItem = $dbItem->Fetch()) {
                 if ($arItem["DEPTH_LEVEL"] > 2) {
                     CIBlockSection::Delete($arItem["ID"]);
                 }
             }
         } elseif ($serviceID == "tasks") {
             if (CModule::IncludeModule("tasks")) {
                 $dbItem = CTasks::GetList(array(), array("SITE_ID" => $wizard->GetVar("siteID")));
                 while ($arItem = $dbItem->Fetch()) {
                     CTasks::Delete($arItem["ID"]);
                 }
             }
         } elseif ($serviceID == "calendar") {
             if (CModule::IncludeModule("calendar")) {
                 $dbItem = CCalendarEvent::GetList();
                 foreach ($dbItem as $arItem) {
                     CCalendarEvent::Delete(array("id" => $arItem["ID"]));
                 }
             }
         } elseif ($serviceID == "meeting") {
             if (CModule::IncludeModule("meeting")) {
                 $dbItem = CMeeting::GetList(array(), array());
                 while ($arItem = $dbItem->Fetch()) {
                     if ($arItem["ID"]) {
                         CMeeting::Delete($arItem["ID"]);
                     }
                 }
             }
         } elseif ($serviceID == "user") {
             if ($serviceStage == "user") {
                 $dbUser = CUser::GetList($by = "ID", $order = "DESC", array(">ID" => 1));
                 while ($arUser = $dbUser->Fetch()) {
                     CUser::Delete($arUser["ID"]);
                 }
             }
         } elseif ($serviceID == "crm") {
             if ($serviceStage == "crm") {
                 if (CModule::IncludeModule('crm')) {
                     $CCrmLead = new CCrmLead();
                     $resLead = CCrmLead::GetList(array(), array(), array(), false);
                     while ($rowLead = $resLead->Fetch()) {
                         $CCrmLead->Delete($rowLead["ID"]);
                     }
                     $CCrmContact = new CCrmContact();
                     $resContact = CCrmContact::GetList(array(), array(), array(), false);
                     while ($rowContact = $resContact->Fetch()) {
                         $CCrmContact->Delete($rowContact["ID"]);
                     }
                     $CCrmCompany = new CCrmCompany();
                     $resCompany = CCrmCompany::GetList(array(), array(), array(), false);
                     while ($rowCompany = $resCompany->Fetch()) {
                         $CCrmCompany->Delete($rowCompany["ID"]);
                     }
                     $CCrmDeal = new CCrmDeal();
                     $resDeal = CCrmDeal::GetList(array(), array(), array(), false);
                     while ($rowDeal = $resDeal->Fetch()) {
                         $CCrmDeal->Delete($rowDeal["ID"]);
                     }
                 }
             }
         } elseif ($serviceID == "cache") {
             require_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/classes/general/cache_html.php";
             if ($serviceStage == "cache1") {
                 BXClearCache(true);
             } elseif ($serviceStage == "cache2") {
                 $GLOBALS["CACHE_MANAGER"]->CleanAll();
             } elseif ($serviceStage == "cache3") {
                 $GLOBALS["stackCacheManager"]->CleanAll();
             } elseif ($serviceStage == "cache4") {
                 CHTMLPagesCache::CleanAll();
             }
             COption::SetOptionString("main", "wizard_clear_exec", "Y", false, $wizard->GetVar("siteID"));
         }
     }
 }