28 if (Loader::includeModule(
"calendar")
29 && Option::get(
'calendar',
'needChangeColor',
'Y') ===
'N')
34 $status = $this->loadCurrentStatus();
36 if ($status[
'finished'])
38 \CCalendar::ClearCache([
'section_list',
'event_list']);
44 'count' => $status[
'count'],
45 'steps' => $status[
'steps'],
46 'sectionFinished' => $status[
'sectionFinished'],
47 'finished' => $status[
'finished']
51 if (!$status[
'sectionFinished'])
53 $sections = SectionTable::getList([
55 '>ID' => $status[
'sectionLastId'],
57 'limit' => self::PORTION,
63 foreach ($sections as $section)
67 if (strtolower($color) != strtolower($section[
'COLOR']))
69 \CCalendarSect::Edit(array(
71 'ID' => $section[
'ID'],
76 $newStatus[
'sectionLastId'] = $section[
'ID'];
77 $newStatus[
'steps']++;
81 if (!empty($newStatus[
'sectionLastId']))
83 Option::set(
'calendar',
'changecolor', serialize($newStatus));
88 $newStatus[
'sectionFinished'] =
true;
89 Option::set(
'calendar',
'eventindex', serialize($newStatus));
93 $events = EventTable::getList([
95 '>ID' =>$status[
'eventLastId'] ??
null,
101 'limit' => self::PORTION,
105 foreach ($events as $event)
109 if (strtolower($color) != strtolower($event[
'COLOR']))
111 \CCalendarEvent::updateColor($event[
'ID'], $color);
114 $newStatus[
'eventLastId'] = $event[
'ID'];
115 $newStatus[
'steps']++;
118 if (!empty($newStatus[
'eventLastId']))
120 Option::set(
'calendar',
'changecolor', serialize($newStatus));
125 Option::set(
'calendar',
'needChangeColor',
'N');
126 Option::delete(
'calendar', array(
'name' =>
'changecolor'));