本文整理汇总了PHP中OC_Calendar_Calendar::addDefaultCalendars方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Calendar_Calendar::addDefaultCalendars方法的具体用法?PHP OC_Calendar_Calendar::addDefaultCalendars怎么用?PHP OC_Calendar_Calendar::addDefaultCalendars使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_Calendar_Calendar
的用法示例。
在下文中一共展示了OC_Calendar_Calendar::addDefaultCalendars方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
/**
* Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
OCP\User::checkLoggedIn();
OCP\App::checkAppEnabled('calendar');
// Create default calendar ...
$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser(), false);
if (count($calendars) == 0) {
OC_Calendar_Calendar::addDefaultCalendars(OCP\USER::getUser());
$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser(), true);
}
//Fix currentview for fullcalendar
if (OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "oneweekview") {
OCP\Config::setUserValue(OCP\USER::getUser(), "calendar", "currentview", "agendaWeek");
}
if (OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "onemonthview") {
OCP\Config::setUserValue(OCP\USER::getUser(), "calendar", "currentview", "month");
}
if (OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "listview") {
OCP\Config::setUserValue(OCP\USER::getUser(), "calendar", "currentview", "list");
}
OCP\Util::addscript('calendar/3rdparty/fullcalendar', 'fullcalendar');
OCP\Util::addStyle('calendar/3rdparty/fullcalendar', 'fullcalendar');
OCP\Util::addscript('3rdparty/timepicker', 'jquery.ui.timepicker');
OCP\Util::addStyle('3rdparty/timepicker', 'jquery.ui.timepicker');
if (OCP\Config::getUserValue(OCP\USER::getUser(), "calendar", "timezone") == null || OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezonedetection') == 'true') {
示例2: createUser
/**
* @brief Creates default calendar for a user
* @param paramters parameters from postCreateUser-Hook
* @return array
*/
public static function createUser($parameters)
{
OC_Calendar_Calendar::addDefaultCalendars($parameters['uid']);
return true;
}