public function prepareEvents($events) { if (count($events)) { foreach ($events as $event) { $start = $event->start_date_time; $end = $event->end_date_time; // if (isset($event->fromCa)) { $event->start_date_time = $event->start_date_time instanceof DateTime ? $event->start_date_time : date_create($event->start_date_time); $event->end_date_time = $event->end_date_time instanceof DateTime ? $event->end_date_time : date_create($event->end_date_time); $start = $event->start_date_time->setTimeZone(new DateTimeZone(App::$instance->opt->ca_timezone)); $end = $event->end_date_time->setTimeZone(new DateTimeZone(App::$instance->opt->ca_timezone)); $mskStart = clone $start; $mskEnd = clone $end; $start->setTimezone(new DateTimeZone(App::$instance->opt->timezone)); $end->setTimezone(new DateTimeZone(App::$instance->opt->timezone)); $event->mks_start_time = $mskStart->format("H:i"); $event->mks_end_time = $mskEnd->format("H:i"); $event->mks_date = $mskStart->format("d.m.Y"); $event->mks_start = $mskStart->format("Y-m-d H:i"); $event->mks_end = $mskEnd->format("Y-m-d H:i"); } $event->start_time = $start->format("H:i"); $event->end_time = $end->format("H:i"); $event->date = $start->format("d.m.Y"); $event->start = $start->format("Y-m-d H:i"); $event->end = $end->format("Y-m-d H:i"); ST::deployColorScheme($event, App::$instance->user->colors['local_default']); if (!isset($event->fromCa)) { $event->titleCustom = "<span style='font-size: 10px;'><span class='label label-success'>#" . $event->id . "</span> "; } else { $event->titleCustom = "<span style='font-size: 10px;'><span class='label label-warning'>#" . $event->id . "</span> "; } if ($event->status == VKS_STATUS_PENDING) { $event->titleCustom = $event->titleCustom . '<span class="label label-info">Pending</span> '; ST::deployColorScheme($event, App::$instance->user->colors['local_pending']); } if (isset($event->fromCa)) { $event->titleCustom = $event->titleCustom . '<span class="label label-info" style="background-color: brown;">СA</span> '; ST::deployColorScheme($event, App::$instance->user->colors['fromca_local_linked']); if (!$event->isLinked) { if (!$event->tbFlag) { ST::deployColorScheme($event, App::$instance->user->colors['fromca_no_local_linked']); } $event->titleCustom = $event->titleCustom . '<span class="label label-info" style="background-color: #F2EE0F; color: #000;">НЗ</span> '; } if ($event->flag) { ST::deployColorScheme($event, App::$instance->user->colors['fromca_with_flag']); } if ($event->tbFlag) { ST::deployColorScheme($event, App::$instance->user->colors['local_with_flag']); } } if (Auth::isAdmin(App::$instance) && isset($event->link_ca_vks_id) && !$event->other_tb_required) { $event->titleCustom = $event->titleCustom . '<span class="label label-info">TbToCa</span>'; // $event->backgroundColor = "#B9BAB2"; // $event->borderColor = "#B9BAB2"; } if (!isset($event->fromCa) && $event->other_tb_required) { $event->titleCustom = $event->titleCustom . '<span class="label label-info">TbToTb</span> '; } if (!isset($event->fromCa) && $event->is_simple) { $event->titleCustom = $event->titleCustom . '<span class="label label-info">Simple</span> '; ST::deployColorScheme($event, App::$instance->user->colors['local_simple']); } if (Auth::isAdmin(App::$instance)) { if (!isset($event->fromCa) && $event->record_required) { $event->titleCustom = $event->titleCustom . "<span class='label label-danger'><span class='glyphicon glyphicon-facetime-video'></span></span> "; } if (!isset($event->fromCa)) { if ($event->flag) { ST::deployColorScheme($event, App::$instance->user->colors['local_with_flag']); // $event->titleCustom = $event->titleCustom.'<span class="label label-danger" style="background-color: #F730D5">Flag</span> '; } } else { } } if (Auth::isAdmin(App::$instance)) { if ($event->admin_id == App::$instance->user->id) { ST::deployColorScheme($event, App::$instance->user->colors['local_im_admin']); } } if (Auth::isLogged(App::$instance) && !Auth::isAdmin(App::$instance)) { if ($event->owner_id == App::$instance->user->id && $event->status != VKS_STATUS_PENDING) { ST::deployColorScheme($event, App::$instance->user->colors['local_im_owner']); } } $event->titleCustom .= "<span style='font-size: 9px;'>" . $event->start_time . " - " . $event->end_time . "</span>"; $event->titleCustom .= "<div class='plank-title' style='font-size: 9px; word-break: normal; word-wrap: normal; white-space: pre-wrap;'>" . $event->title . "</div></span>"; if (Auth::isAdmin(App::$instance)) { $event->codes = '-'; if (isset($event->connection_codes) && count($event->connection_codes)) { $tmp = array(); foreach ($event->connection_codes as $code) { $tmp[] = $code->value; } $event->codes = implode(", ", $tmp); } $event->titleCustom .= "<span class='' style='font-size: 9px;'>code: " . $event->codes . "</span>"; } $event->title = null; //костыль } } return $events; }