本文整理汇总了PHP中Preferences::singleton方法的典型用法代码示例。如果您正苦于以下问题:PHP Preferences::singleton方法的具体用法?PHP Preferences::singleton怎么用?PHP Preferences::singleton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Preferences
的用法示例。
在下文中一共展示了Preferences::singleton方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
parent::__construct();
$this->prefs = Preferences::singleton($this->session->userdata('prefs'));
$this->load->library('caldav');
$this->output->set_content_type('application/json');
}
示例2: __construct
function __construct()
{
parent::__construct();
// Force authentication
$this->auth->force_auth();
// Preferences
$this->prefs = Preferences::singleton($this->session->userdata('prefs'));
}
示例3: __construct
function __construct()
{
parent::__construct();
if (!$this->auth->is_authenticated()) {
$this->extended_logs->message('INFO', 'Anonymous access attempt to ' . uri_string());
$this->output->set_status_header('401');
$this->output->_display();
die;
}
$this->calendar_colors = $this->config->item('calendar_colors');
$this->prefs = Preferences::singleton($this->session->userdata('prefs'));
$this->load->library('caldav');
$this->output->set_content_type('application/json');
}
示例4: __construct
function __construct()
{
parent::__construct();
if (!$this->auth->is_authenticated()) {
$this->extended_logs->message('INFO', 'Anonymous access attempt to ' . uri_string());
$this->output->set_status_header('401');
$this->output->_display();
die;
}
$this->date_format = $this->dates->date_format_string('date');
$this->time_format = $this->dates->time_format_string('date');
$this->tz = $this->timezonemanager->getTz($this->config->item('default_timezone'));
$this->tz_utc = $this->timezonemanager->getTz('UTC');
$this->prefs = Preferences::singleton($this->session->userdata('prefs'));
$this->load->library('caldav');
$this->output->set_content_type('application/json');
}
示例5: create_event
/**
* Generates a view to add an event
*/
function create_event()
{
// Start/end date passed?
$start = $this->input->post('start');
$end = $this->input->post('end');
if (FALSE === $start) {
$start = time();
}
// All day?
$allday = $this->input->post('allday');
if ($allday === FALSE || $allday == 'false') {
$allday = FALSE;
} else {
$allday = TRUE;
}
// View
$view = $this->input->post('view');
$dstart = null;
$dend = null;
// Base DateTime start
$dstart = $this->dates->fullcalendar2datetime($start, $this->tz_utc);
// TODO make default duration configurable
if ($view == 'month') {
// Calculate times
$now = $this->dates->approx_by_factor(null, $this->tz);
$dstart->setTime($now->format('H'), $now->format('i'));
if ($end === FALSE || $start == $end) {
$dend = clone $dstart;
$dend->add(new DateInterval('PT60M'));
} else {
$dend = $this->dates->fullcalendar2datetime($end, $this->tz_utc);
$dend->setTime($dstart->format('H'), $dstart->format('i'));
}
} elseif ($allday === FALSE) {
if ($end === FALSE || $start == $end) {
$dend = clone $dstart;
$dend->add(new DateInterval('PT60M'));
// 1h
} else {
$dend = $this->dates->fullcalendar2datetime($end, $this->tz_utc);
}
} else {
$dstart->setTime(0, 0);
if ($end === FALSE) {
$dend = clone $dstart;
} else {
$dend = $this->dates->fullcalendar2datetime($end, $this->tz_utc);
}
}
// Calendars
$tmp_cals = $this->session->userdata('available_calendars');
$calendars = array();
if ($tmp_cals === FALSE) {
$this->extended_logs->message('ERROR', 'Call to create_or_modify_event() with no calendars stored in session');
} else {
foreach ($tmp_cals as $id => $data) {
if (!$data->shared || $data->write_access == '1') {
$calendars[$id] = $data->displayname;
}
}
}
// Currently selected calendar (or calendar on which
// this event is placed on)
$calendar = $this->input->post('current_calendar');
if ($calendar === FALSE) {
// Use the calendar specified in preferences
$prefs = Preferences::singleton($this->session->userdata('prefs'));
$calendar = $prefs->default_calendar;
if ($calendar === FALSE) {
$calendar = array_shift(array_keys($calendars));
}
}
$data = array('start_date' => $dstart->format($this->date_format), 'start_time' => $dstart->format($this->time_format), 'end_date' => $dend->format($this->date_format), 'end_time' => $dend->format($this->time_format), 'allday' => $allday, 'calendars' => $calendars, 'calendar' => $calendar);
$this->load->view('dialogs/create_or_modify_event', $data);
}