if ($params->get('defaultView', 'month') == 'week') {
    $defaultView = 'agendaWeek';
} else {
    if ($params->get('defaultView', 'month') == 'day') {
        $defaultView = 'agendaDay';
    }
}
$daysLong = "[";
$daysShort = "[";
$daysMin = "[";
$monthsLong = "[";
$monthsShort = "[";
for ($i = 0; $i < 7; $i++) {
    $daysLong .= "'" . htmlspecialchars(GCalendarUtil::dayToString($i, false), ENT_QUOTES) . "'";
    $daysShort .= "'" . htmlspecialchars(GCalendarUtil::dayToString($i, true), ENT_QUOTES) . "'";
    $daysMin .= "'" . htmlspecialchars(mb_substr(GCalendarUtil::dayToString($i, true), 0, 2), ENT_QUOTES) . "'";
    if ($i < 6) {
        $daysLong .= ",";
        $daysShort .= ",";
        $daysMin .= ",";
    }
}
for ($i = 1; $i <= 12; $i++) {
    $monthsLong .= "'" . htmlspecialchars(GCalendarUtil::monthToString($i, false), ENT_QUOTES) . "'";
    $monthsShort .= "'" . htmlspecialchars(GCalendarUtil::monthToString($i, true), ENT_QUOTES) . "'";
    if ($i < 12) {
        $monthsLong .= ",";
        $monthsShort .= ",";
    }
}
$daysLong .= "]";
    $cssClass = "gcal-event_gccal_" . $calendar->id;
    $calsSources .= "\t\t\t'" . JRoute::_('index.php?option=com_gcalendar&view=jsonfeed&format=raw&gcid=' . $calendar->id) . "',\n";
    $color = GCalendarUtil::getFadedColor($calendar->color);
    $document->addStyleDeclaration("." . $cssClass . ",.fc-agenda " . $cssClass . " .fc-event-time, ." . $cssClass . " a, ." . $cssClass . " span{background-color: " . $color . " !important; border-color: #" . $calendar->color . "; color: white;}");
}
$calsSources = trim($calsSources, ",\n");
$calsSources .= "\t\t],\n";
$daysLong = "[";
$daysShort = "[";
$daysMin = "[";
$monthsLong = "[";
$monthsShort = "[";
for ($i = 0; $i < 7; $i++) {
    $daysLong .= "'" . GCalendarUtil::dayToString($i, false) . "'";
    $daysShort .= "'" . GCalendarUtil::dayToString($i, true) . "'";
    $daysMin .= "'" . substr(GCalendarUtil::dayToString($i, true), 0, 2) . "'";
    if ($i < 6) {
        $daysLong .= ",";
        $daysShort .= ",";
        $daysMin .= ",";
    }
}
for ($i = 1; $i <= 12; $i++) {
    $monthsLong .= "'" . GCalendarUtil::monthToString($i, false) . "'";
    $monthsShort .= "'" . GCalendarUtil::monthToString($i, true) . "'";
    if ($i < 12) {
        $monthsLong .= ",";
        $monthsShort .= ",";
    }
}
$daysLong .= "]";