當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Preferences::singleton方法代碼示例

本文整理匯總了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');
 }
開發者ID:julien2512,項目名稱:agendav,代碼行數:7,代碼來源:caldav2json.php

示例2: __construct

 function __construct()
 {
     parent::__construct();
     // Force authentication
     $this->auth->force_auth();
     // Preferences
     $this->prefs = Preferences::singleton($this->session->userdata('prefs'));
 }
開發者ID:julien2512,項目名稱:agendav,代碼行數:8,代碼來源:prefs.php

示例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');
 }
開發者ID:julien2512,項目名稱:agendav,代碼行數:14,代碼來源:calendar.php

示例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');
 }
開發者ID:julien2512,項目名稱:agendav,代碼行數:17,代碼來源:event.php

示例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);
 }
開發者ID:julien2512,項目名稱:agendav,代碼行數:78,代碼來源:dialog_generator.php


注:本文中的Preferences::singleton方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。