/** * Constructor. * * @param TheCity $the_city An initialized TheCity object. */ public function __construct($the_city, $items_to_display) { $topics = $the_city->topics($items_to_display); $events = $the_city->events($items_to_display); $prayers = $the_city->prayers($items_to_display); $needs = $the_city->needs($items_to_display); $albums = $the_city->albums($items_to_display); $temp = array(); $i = 0; while (($topic = $topics->select($i)) != NULL) { $key = $this->_build_time_key($topic->created_at()); $temp[$key] = $topic; $i++; } $i = 0; while (($event = $events->select($i)) != NULL) { $key = $this->_build_time_key($event->starting_at()); $temp[$key] = $event; $i++; } $i = 0; while (($prayer = $prayers->select($i)) != NULL) { $key = $this->_build_time_key($prayer->created_at()); $temp[$key] = $prayer; $i++; } $i = 0; while (($need = $needs->select($i)) != NULL) { $key = $this->_build_time_key($need->created_at()); $temp[$key] = $need; $i++; } $i = 0; while (($album = $albums->select($i)) != NULL) { $key = $this->_build_time_key($album->created_at()); $temp[$key] = $album; $i++; } krsort($temp); // Sort by keys from high to low $this->plaza_data = array_slice($temp, 0, $items_to_display); }
// Get topic. $topic = $topics->select(2); // Get count. $topic_count = $topics->size(); // Load Events $array_of_event_titles = $the_city->events()->titles(); // by default will grab 10 events. $events = $the_city->events(); // limit the amount of events fetched from The City $events = $the_city->events(3); // Get event. $event = $events->select(2); // Get count. $event_count = $events->size(); // Load Prayers $array_of_prayer_titles = $the_city->prayers()->titles(); // by default will grab 10 prayers. $prayers = $the_city->prayers(); // limit the amount of prayers fetched from The City $rayers = $the_city->prayers(3); // Get prayer $prayer = $prayers->select(2); // Get count. $prayer_count = $prayers->size(); // Load Needs $array_of_need_titles = $the_city->prayers()->titles(); // by default will grab 10 needs $needs = $the_city->needs(); // limit the amount of needs fetched from The City $needs = $the_city->needs(3); // Get needs
$show_dates = isset($_GET['show_dates']) ? $_GET['show_dates'] : ''; $show_type = isset($_GET['show_type']) ? $_GET['show_type'] : ''; $plaza_choice_key = ''; $plaza_display = ''; switch ($_GET['plaza_display']) { case 'all': $plaza_display = new PlazaCollection($the_city, $items_to_display); break; case 'topics': $plaza_display = $the_city->topics($items_to_display); break; case 'events': $plaza_display = $the_city->events($items_to_display); break; case 'prayers': $plaza_display = $the_city->prayers($items_to_display); break; case 'needs': $plaza_display = $the_city->needs($items_to_display); break; case 'albums': $plaza_display = $the_city->albums($items_to_display); break; default: $plaza_choice = 'topics'; $plaza_display = $the_city->topics($items_to_display); } $html = array(); $plaza_titles = $plaza_display->titles(); if (empty($plaza_titles)) { $html[] = "No {$plaza_choice} found";