/** * 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 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 $need = $needs->select(2); // Get count. $need_count = $needs->size(); // Albums $array_of_album_titles = $the_city->albums()->titles(); // by default will grab 10 albums $albums = $the_city->albums(); // limit the amount of albums fetched from The City $albums = $the_city->albums(3); // Get event $album = $albums->select(2); // Get count.
$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"; } else { foreach ($plaza_titles as $indx => $title) { $item = $plaza_display->select($indx);