本文整理匯總了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;
}