Ejemplo n.º 1
0
 /**
  * @return array(Todays events view, Todo view).
  */
 private function _GetMiniCalendars()
 {
     $this->load->library('academic_calendar');
     $this->load->library('calendar_backend');
     $this->load->library('calendar_source_my_calendar');
     $this->load->library('calendar_frontend');
     $this->load->library('calendar_view_upcoming');
     $this->load->library('calendar_view_todo_list');
     $now = new Academic_time(time());
     $start = $now;
     $end = $now->Midnight()->Adjust('+2day');
     $sources = new CalendarSourceMyCalendar();
     // lets be explicit just in case:
     $sources->EnableGroup('owned');
     $sources->EnableGroup('subscribed');
     $sources->EnableGroup('private');
     $sources->EnableGroup('active');
     $sources->DisableGroup('inactive');
     $sources->SetRange($start->Timestamp(), $end->Timestamp());
     $sources->SetTodoRange(time(), time());
     $calendar_data = new CalendarData();
     $this->messages->AddMessages($calendar_data->FetchEventsFromSources($sources));
     // Display data
     $this->load->library('calendar_view_days');
     $EventsView = new CalendarViewUpcoming();
     $EventsView->SetMiniMode();
     $EventsView->SetCalendarData($calendar_data);
     //$EventsView->SetStartEnd($start->Timestamp(), $end->Timestamp());
     $TodoView = NULL;
     // 		$TodoView = new CalendarViewTodoList();
     // 		$TodoView->SetCalendarData($calendar_data);
     return array($EventsView, $TodoView);
 }
Ejemplo n.º 2
0
 function eventsearch($search = '')
 {
     if (!CheckPermissions('public')) {
         return;
     }
     if (array_key_exists('search', $_GET)) {
         redirect('test/james/eventsearch/' . urlencode($_GET['search']));
     }
     // Load the libraries
     $this->load->library('calendar_backend');
     $this->load->library('calendar_source_my_calendar');
     $this->load->library('facebook');
     $data = array('target' => $this->uri->uri_string(), 'search' => $search);
     if (!empty($search)) {
         $source = new CalendarSourceMyCalendar();
         // Use the search phrase
         $source->SetSearchPhrase($search);
         // Set the groups to get events from
         /*
         	groups:
         	'owned'      => TRUE,
         	'subscribed' => TRUE,
         	'all'        => FALSE,
         	
         	'private'    => TRUE,
         	'active'     => TRUE,
         	'inactive'   => TRUE,
         	
         	'hide'       => FALSE,
         	'show'       => TRUE,
         	'rsvp'       => TRUE,
         	
         	'event'      => TRUE,
         	'todo'       => FALSE,
         */
         $source->EnableGroup('all');
         $source->DisableGroup('subscribed');
         // (subset of all)
         $source->DisableGroup('owned');
         // (subset of all)
         $source->EnableGroup('hide');
         // Show events hidden by user
         $source->EnableGroup('todo');
         // Enable todo items
         // Set the date range if applicable
         //$source->SetRange(strtotime('-1month'), NULL))
         //$source->SetTodoRange(strtotime('-1month'), NULL))
         // Get the actual events from the sources
         $calendar_data = new CalendarData();
         $source->FetchEvents($calendar_data);
         // Do whatever with the data
         // $calendar_data->GetEvents() are the events
         // theres a couple of others for occurrences + organisations
         $data['results'] = $calendar_data->GetEvents();
     }
     $this->main_frame->SetContentSimple('test/james-eventsearch', $data);
     $this->main_frame->Load();
 }