예제 #1
0
 /**
  * Any additional uri segments are used as the redirect address after
  *	successful login.
  */
 function office()
 {
     if (!CheckPermissions('student', FALSE, TRUE)) {
         return;
     }
     LoginHandler('office', GetUriTail(2));
 }
/**
 * @param @$PreSegments int Number of uri segments to skip.
 */
function RedirectUriTail($PreSegments)
{
    redirect(GetUriTail($PreSegments));
}
 function GetEvent($SourceId = NULL, $EventId = NULL, $OccurrenceId = NULL)
 {
     if (is_numeric($SourceId)) {
         $SourceId = (int) $SourceId;
         $CI =& get_instance();
         // Get the specific event
         $CI->load->helper('uri_tail');
         $CI->load->library('calendar_backend');
         $CI->load->library('calendar_source_my_calendar');
         $sources = new CalendarSourceMyCalendar();
         $calendar_data = new CalendarData();
         $sources->FetchEvent($calendar_data, $SourceId, $EventId);
         $events = $calendar_data->GetEvents();
         if (array_key_exists(0, $events)) {
             $event = $events[0];
             // Find the occurrence
             $found_occurrence = NULL;
             foreach ($event->Occurrences as $key => $occurrence) {
                 if ($occurrence->SourceOccurrenceId == $OccurrenceId) {
                     $found_occurrence =& $event->Occurrences[$key];
                     break;
                 }
             }
             if (NULL === $found_occurrence) {
                 return show_404();
             }
             if ($CI->input->post('evview_return')) {
                 // REDIRECT
                 $CI->load->helper('uri_tail');
                 RedirectUriTail(5);
             } else {
                 $data = array('Event' => &$event, 'Occurrence' => &$found_occurrence, 'ReadOnly' => $this->mReadOnly, 'Attendees' => $sources->GetOccurrenceAttendanceList($SourceId, $OccurrenceId), 'FailRedirect' => '/' . GetUriTail(5), 'Path' => $this->mPaths);
                 $CI->main_frame->SetTitleParameters(array('event' => $event->Name));
                 $this->SetupTabs('', $found_occurrence->StartTime);
                 return new FramesView('calendar/event', $data);
             }
         } else {
             $CI->messages->AddMessage('error', 'The event coud not be found');
             RedirectUriTail(5);
         }
     } else {
         show_404();
     }
 }