function view($organisation)
 {
     if (!CheckPermissions('public')) {
         return;
     }
     $data = $this->organisations->_GetOrgData($organisation);
     if (!empty($data)) {
         $this->pages_model->SetPageCode('directory_view');
         $this->_SetupOrganisationFrame($organisation);
         $subpageview = 'directory/directory_view';
         //Reviews
         $this->load->model('articles_model');
         $reviews = $this->articles_model->GetDirectoryOrganisationReviewsByEntryName($organisation);
         // sort into types
         $directory_reviews = array();
         $review_types = array();
         foreach ($reviews as $review) {
             if (NULL === $review['type']) {
                 $directory_reviews[] = $review;
             } else {
                 if (!array_key_exists($review['type'], $review_types)) {
                     $review_types[$review['type']] = array();
                 }
                 $review_types[$review['type']][] = $review;
             }
         }
         $data['organisation']['reviews_untyped'] = $directory_reviews;
         $data['organisation']['reviews_by_type'] = $review_types;
         if ($data['organisation']['location_lat'] !== NULL) {
             $this->load->library('maps');
             $map =& $this->maps->CreateMap('Location', 'googlemaps');
             $map->AddLocation($data['organisation']['name'], $data['organisation']['location_lat'], $data['organisation']['location_lng']);
             $this->maps->SendMapData();
         }
         // Event statistics
         $this->load->library('calendar_backend');
         $this->load->library('calendar_source_yorker');
         $yorker_source = new CalendarSourceYorker(0);
         // Only those events of the organisation
         $yorker_source->DisableGroup('subscribed');
         $yorker_source->DisableGroup('owned');
         $yorker_source->DisableGroup('private');
         $yorker_source->EnableGroup('active');
         $yorker_source->DisableGroup('inactive');
         $yorker_source->EnableGroup('hide');
         $yorker_source->EnableGroup('show');
         $yorker_source->EnableGroup('rsvp');
         $yorker_source->IncludeStream((int) $data['organisation']['id'], TRUE);
         $result = $yorker_source->MainQuery('*, COUNT(event_occurrences.event_occurrence_id)', $yorker_source->ProduceWhereClause() . ' GROUP BY organisations.organisation_entity_id');
         // 			$this->messages->AddDumpMessage('results', $result);
         // Set up the directory frame to use the directory events view
         $this->main_frame->SetPage('about', 'directory');
         $this->frame_directory->SetOrganisation($data['organisation']);
         $this->frame_directory->SetContentSimple($subpageview, $data);
         // Set up the public frame to use the directory view
         $this->main_frame->SetTitleParameters(array('organisation' => $data['organisation']['name']));
         $this->main_frame->SetContent($this->frame_directory);
     } else {
         $this->load->library('custom_pages');
         $this->main_frame->SetContent(new CustomPageView('directory_notfound', 'error'));
     }
     // Load the main frame view
     $this->main_frame->Load();
 }
Ejemplo n.º 2
0
 function GetOrganisationScoresCalender($dir_entry_name)
 {
     //get calender head
     $calendar['head']['name'] = 'Calender';
     //calender - events
     // Event statistics
     $this->CI->load->library('calendar_backend');
     $this->CI->load->library('calendar_source_yorker');
     $yorker_source = new CalendarSourceYorker(0);
     // Only those events of the organisation
     $yorker_source->DisableGroup('subscribed');
     $yorker_source->DisableGroup('owned');
     $yorker_source->DisableGroup('private');
     $yorker_source->EnableGroup('active');
     $yorker_source->DisableGroup('inactive');
     $yorker_source->EnableGroup('show');
     $yorker_source->EnableGroup('rsvp');
     $yorker_source->IncludeStream((int) $this->CI->pr_model->GetOrganisationID($dir_entry_name), TRUE);
     //times for the next 2 weeks
     $last_monday = strtotime("last Monday");
     $next_monday = strtotime("next Monday");
     $week_monday = strtotime("+1 week", $next_monday);
     //set time to this week
     $yorker_source->SetRange($last_monday, $next_monday);
     $this_result = $yorker_source->MainQuery('COUNT(*)', $yorker_source->ProduceWhereClause());
     //set time to this week
     $yorker_source->SetRange($next_monday, $week_monday);
     $next_result = $yorker_source->MainQuery('COUNT(*)', $yorker_source->ProduceWhereClause());
     //$this->CI->messages->AddDumpMessage('this_result', $this_result);
     //$this->CI->messages->AddDumpMessage('next_result', $next_result);
     //result = $yorker_source->MainQuery( 'COUNT(event_occurrences.event_occurrence_id)', $yorker_source->ProduceWhereClause().' GROUP BY organisations.organisation_entity_id' 	);
     $score_item['name'] = 'Events - This Week';
     $score_item['link'] = '#';
     $score_item['score_current'] = $this_result[0]['COUNT(*)'];
     $score_item['score_possible'] = 1;
     $calendar['body'][] = $score_item;
     $score_item['name'] = 'Events - Next Week';
     $score_item['link'] = '#';
     $score_item['score_current'] = $next_result[0]['COUNT(*)'];
     $score_item['score_possible'] = 1;
     $calendar['body'][] = $score_item;
     return $calendar;
 }