Ejemplo n.º 1
0
    public static function GetAccessHTML($binging = 'calendar_section', $id = false)
    {
        if ($id === false) {
            $id = 'bxec-' . $binging;
        }
        $arTasks = CCalendar::GetAccessTasks($binging);
        ?>
		<span style="display:none;">
		<select id="<?php 
        echo $id;
        ?>
" class="bxec-task-select">
			<?php 
        foreach ($arTasks as $taskId => $task) {
            ?>
				<option value="<?php 
            echo $taskId;
            ?>
"><?php 
            echo htmlspecialcharsex($task['title']);
            ?>
</option>
			<?php 
        }
        ?>
		</select>
		</span>
		<?php 
    }
Ejemplo n.º 2
0
 public static function GetAccessTasksByName($binging = 'calendar_section', $name = 'calendar_denied')
 {
     $arTasks = CCalendar::GetAccessTasks($binging);
     foreach ($arTasks as $id => $task) {
         if ($task['name'] == $name) {
             return $id;
         }
     }
     return false;
 }
Ejemplo n.º 3
0
 public static function DoConvertStep()
 {
     $types = CCalendarConvert::GetOption('__convert');
     $start_time = microtime(true);
     $time_limit = 2;
     $stage = 'stop';
     $finished = false;
     self::$accessTasks = CCalendar::GetAccessTasks('calendar_section');
     self::$userIblockId = $types['user']['iblockId'];
     foreach ($types as $key => $type) {
         $iblockId = $type['iblockId'];
         if ($iblockId < 0) {
             continue;
         }
         // Fetch type
         if ($key == 'user') {
             $arFilter = array('IBLOCK_ID' => $iblockId, "ACTIVE" => "Y", "CHECK_PERMISSIONS" => 'N', "DEPTH_LEVEL" => 1, "UF_CAL_CONVERTED" => false);
             $dbSections = CIBlockSection::GetList(array('ID' => 'ASC'), $arFilter);
             // For each user:
             while ($arSection = $dbSections->Fetch()) {
                 $ownerId = $arSection["CREATED_BY"];
                 CCalendar::SetUserSettings(false, $ownerId);
                 $res = CCalendarConvert::ConvertEntity('user', $ownerId, $arSection["ID"], $iblockId, $arSection["CREATED_BY"]);
                 if ($res['sectCount'] > 0 || $res['eventsCount'] > 0) {
                     CCalendarConvert::Log(GetMessage("CAL_CONVERT_STAGE_USER_CALS", array('#USER_NAME#' => $arSection['NAME'], '#SECT_COUNT#' => $res['sectCount'], '#EVENTS_COUNT#' => $res['eventsCount'])));
                 }
                 if ($res && ($res['sectCount'] > 0 || $res['eventsCount'] > 0) && microtime(true) - $start_time > $time_limit) {
                     $stage = 'go';
                     break;
                 }
             }
         } elseif ($key == 'group') {
             $arFilter = array('IBLOCK_ID' => $iblockId, "ACTIVE" => "Y", "CHECK_PERMISSIONS" => 'N', "DEPTH_LEVEL" => 1, "UF_CAL_CONVERTED" => false);
             $dbSections = CIBlockSection::GetList(array('ID' => 'ASC'), $arFilter);
             // For each group:
             while ($arSection = $dbSections->Fetch()) {
                 $ownerId = $arSection["SOCNET_GROUP_ID"];
                 $res = CCalendarConvert::ConvertEntity('group', $ownerId, $arSection["ID"], $iblockId, $arSection["CREATED_BY"]);
                 if ($res['sectCount'] > 0 || $res['eventsCount'] > 0) {
                     CCalendarConvert::Log(GetMessage("CAL_CONVERT_STAGE_GROUP_CALS", array('#GROUP_NAME#' => $arSection['NAME'], '#SECT_COUNT#' => $res['sectCount'], '#EVENTS_COUNT#' => $res['eventsCount'])));
                 }
                 if ($res && ($res['sectCount'] > 0 || $res['eventsCount'] > 0) && microtime(true) - $start_time > $time_limit) {
                     $stage = 'go';
                     break;
                 }
             }
         } else {
             $res = CCalendarConvert::ConvertEntity($key, 0, 0, $iblockId, 1);
             if ($res['sectCount'] > 0 || $res['eventsCount'] > 0) {
                 CCalendarConvert::Log(GetMessage("CAL_CONVERT_STAGE_TYPE", array('#TYPE_NAME#' => $type['name'], '#SECT_COUNT#' => $res['sectCount'], '#EVENTS_COUNT#' => $res['eventsCount'])));
             }
             if ($res && ($res['sectCount'] > 0 || $res['eventsCount'] > 0) && microtime(true) - $start_time > $time_limit) {
                 $stage = 'go';
                 break;
             }
         }
         if ($stage == 'go') {
             break;
         }
     }
     return $stage;
 }