{strip} {** @var array $data @var array $calendars @var array $users @var string $period_start *} {$_is_profile = ( !empty($context) && $context == "profile" )} {$_user_id = $wa->user("id")} {$_is_admin = $wa->user()->isAdmin($wa->app())} {$_limit = 2} {* CALENDAR *} {if $selected_calendar_id && !empty($calendars[$selected_calendar_id])} {$selected_calendar = $calendars[$selected_calendar_id]} {else} {$selected_calendar = $calendars["all"]} {/if} {* USER *} {if $selected_user_id && !empty($users[$selected_user_id])} {$selected_user = $users[$selected_user_id]} {else} {$selected_user = $users["all"]} {/if} {if !empty($data)}
{if empty($hide_labels)}
[`Mon`] [`Tue`] [`Wed`] [`Thu`] [`Fri`] [`Sat`] [`Sun`]
{/if}
{* displays consecutive weeks *} {$_now = waDateTime::format('Y-m-d')} {foreach $data as $_week}
{* background *} {foreach $_week.days_data as $_day} {$_current_month = date('Y-m')} {if !empty($period_start)} {$_current_month = date('Y-m', strtotime($period_start))} {/if} {$_is_current_month = ( $_current_month === date('Y-m', strtotime($_day.date) ) )} {$_day_classes = []} {if ( $_day.date == "`$_now` 00:00:00" )} {$_day_classes[] = "is-active"} {elseif !$_is_profile && !$_is_current_month} {$_day_classes[] = "is-unactive"} {/if} {/foreach}
{* content *} {foreach $_week.days_data as $_day} {/foreach} {$_event_groups = ifempty($_week.events, array())} {$_count = count($_event_groups)} {$_events_in_week = [ "view" => [[],[],[],[],[],[],[]], "all" => [[],[],[],[],[],[],[]] ]} {foreach $_event_groups as $_event_group} {foreach $_event_group as $_event} {$_is_my_event = ( !empty($_event.contact_id) && $_event.contact_id == $_user_id )} {$_can_edit = !empty($_event.can_edit)} {$_calendar = [ "id" => null, "bg_color" => "#f00", "font_color" => "#fff" ]} {if !empty($_event.calendar_id) && !empty($calendars[$_event.calendar_id])} {$_calendar = $calendars[$_event.calendar_id]} {/if} {if $_event_group@iteration <= $_limit} {* if event *} {if isset($_event.colspan)} {if $_event.colspan > 0} {$_is_birthday = ( $_event.calendar_id == "birthday" )} {$_is_part_of_day = ( !$_event.is_allday && $_event.colspan == 1 )} {$_styles = []} {if $_event.is_status} {if $_calendar.status_bg_color} {$_styles[] = "color: `$_calendar.status_font_color`;"} {$_styles[] = "background: `$_calendar.status_bg_color`;"} {else} {$_styles[] = "color: `$_calendar.font_color`;"} {$_styles[] = "background: `$_calendar.bg_color`;"} {/if} {else} {if !empty($_calendar.status_bg_color)} {$_styles[] = "color: `$_calendar.font_color`;"} {$_styles[] = "background: `$_calendar.bg_color`;"} {else} {$_styles[] = "color: `$_calendar.bg_color`;"} {$_styles[] = "background: transparent;"} {$_styles[] = "box-shadow: inset 0 0 0 1px currentColor;"} {/if} {/if} {$_classes = []} {if !empty($_event.id) && !empty($_calendar.id)} {$_classes[] = "js-view-event"} {/if} {if $_event.colspan == 1} {$_classes[] = "is-single"} {/if} {if $_event.is_status} {$_classes[] = "is-status"} {else} {$_classes[] = "is-event"} {/if} {/if} {$_events_in_week["view"][$_event@index][] = $_event.id} {* if empty *} {else} {/if} {/if} {if isset($_event.colspan)} {$_events_in_week["all"][$_event@index][] = $_event.id} {/if} {/foreach} {/foreach} {* show "more" button *} {foreach $_week.days_data as $_day} {$_view_count = count($_events_in_week["view"][$_day@index])} {$_full_count = count($_events_in_week["all"][$_day@index])} {/foreach}
{waDateTime::date('j', $_day.date)}
1}data-day-count="{$_event.day_count}" data-move-hint="{_w('%d day', '%d days', $_event.day_count)}"{/if}> {$_user = null} {if !empty($users[$_event.contact_id])} {$_user = $users[$_event.contact_id]} {/if}
{if !empty($_event.icon)} {elseif $_is_birthday && $_user} {$title = sprintf(_w("%s's birthday — %s"), $_user.name|escape, $_event.birthday_str)} {/if} {if $_user} {if $_is_birthday} {elseif !empty($_user.photo_url_16)} {/if} {/if} {if !$_is_birthday && $_is_part_of_day && $_event.start} {$_styles2 = []} {*{$_styles2[] = "background: `$_calendar.bg_color`;"}*} {*{$_styles2[] = "color: `$_calendar.font_color`;"}*} {wa_date("H:i", strtotime($_event.start))} {/if} {if !$_is_birthday} {$_event.summary|escape} {/if}
 
{if $_full_count > $_view_count}
+ [`more`] {$_full_count - $_view_count}
{/if}
{/foreach}
{else}
[`Data is broken`]
{/if} {/strip}