/** * 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); }
$the_city->add_url_params('wp=1'); // Set group nickname to pull plaza items for. // http://helpdesk.onthecity.org/entries/422776-group-nickname $the_city->set_group_nickname('@v21west'); // Load Topics $array_of_topic_titles = $the_city->topics()->titles(); // by default will grab 10 topics. $topics = $the_city->topics(); // limit the amount of topics fetched from The City. $topics = $the_city->topics(3); // 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
function shcaa_list_events($eventtag = '', $groupname = '') { // attempt to get cached request if (isset($groupname) && !empty($groupname)) { $transient_key = "_shcaa_events_feed_" . $groupname; } else { $transient_key = "_shcaa_events_feed_all"; } // If cached (transient) data are used, output an HTML // comment indicating such $cached = get_transient($transient_key); if (false !== $cached) { $myevents = $cached; } else { // create array of the events filtered by the args and include the tags $args = array(); //$args['group_types'] = 'Hope'; //$args['include_addresses'] = 'true'; $the_city = new TheCity('theCityUsername'); if (isset($groupname) && !empty($groupname)) { $the_city->set_group_nickname($groupname); } $events = $the_city->events(50); $event_titles = $events->titles(); $myevents = array(); $i = 0; foreach ($event_titles as $indx => $eve) { // get the object $rawevent = $events->select($indx); // get the body $event = accessProtected($rawevent, 'data'); //print_r('<pre style="padding: 10px; border: 1px solid #000; font-size: 11px; margin: 10px">'); print_r( $event ); print_r('</pre>'); // unique id $myevents[$i]['eve_id'] = $event->euid; // starting $myevents[$i]['starting_at'] = $event->starting_at; // ending $myevents[$i]['ending_at'] = $event->ending_at; // title $myevents[$i]['title'] = $event->title; // event_items $myevents[$i]['event_items'] = $event->event_items; // array //body $myevents[$i]['body'] = $event->body; // shorturl $myevents[$i]['short_url'] = $event->short_url; $i++; } // end foreach //print_r('<pre style="padding: 10px; border: 1px solid #000; font-size: 12px; margin: 10px">'); print_r( $event ); print_r('</pre>'); set_transient($transient_key, $myevents, 60 * 60 * 1); } // end if not cached // events output if (!isset($myevents) || empty($myevents)) { return; } // find equipping classess and add extra date modifications $myevents = add_event_date_info($myevents); $output = '<ul class="eventlist">'; $cnt = 0; //print_r('<pre style="padding: 10px; border: 1px solid #000; font-size: 11px; margin: 10px">'); print_r( $myevents ); print_r('</pre>'); $dupcheck = array(); foreach ($myevents as $myeve) { $eve_id = $myeve['eve_id']; //$image = $myeve['image']; $title = trim($myeve['title']); // set a virtual event category by detecting substring in the title $tag = 'General'; if (strpos($title, 'Equipping Class') !== false) { $tag = 'Equipping Class'; } if (strpos($title, 'Sunday Morning Worship') !== false) { $tag = 'Sunday Morning Worship'; } if (!isset($eventtag) || empty($eventtag) || isset($eventtag) && $eventtag == $tag) { // if(!in_array($title,$dupcheck)) { // turned off the dupcheck feature for all events $starting_at = $myeve['starting_at']; $ending_at = $myeve['ending_at']; $dateinfo = isset($myeve['dateinfo']) && !empty($myeve['dateinfo']) ? $myeve['dateinfo'] : ''; $event_items = $myeve['event_items']; // array - may contain images?? $body = $myeve['body']; $short_url = $myeve['short_url']; // dates if (isset($starting_at) && !empty($starting_at)) { if ($tag == 'Equipping Class' || $tag == 'Sunday Morning Worship') { $dates = datetransmog($starting_at, $ending_at, $dateinfo, true); } else { $dates = datetransmog($starting_at, $ending_at); } } // if this is a class if ($tag == 'Equipping Class') { if (!in_array($title, $dupcheck)) { $stitle = str_replace('| Equipping Class', '', $title); $output .= '<li class="event eclass">'; $output .= '<table class="blanktable">'; $output .= '<tr>'; $output .= '<td class="month">' . $dates['month'] . '</td>'; $output .= '<td class="title"><h3 class="eve-title">' . $stitle . '</h3></td>'; $output .= '</tr>'; $output .= '<tr>'; $output .= '<td class="datelabel">Dates:</td>'; $output .= '<td class="dates"><div class="eve-days">' . $dates['days'] . '</div></td>'; $output .= '</tr>'; $output .= '<tr>'; $output .= '<td class="timelabel">Time:</td>'; $output .= '<td class="time"><div class="eve-time">' . $dates['time'] . '</div></td>'; $output .= '</tr>'; $output .= '</table>'; // description if (isset($body) && !empty($body)) { $output .= '<div class="eve-description">' . $body . '</div>'; } // link if (isset($short_url) && !empty($short_url)) { $output .= '<a href="' . $short_url . '" target="_blank" class="eve-link button">Learn More and Register</a>'; } $output .= '</li>'; } } else { $output .= '<li class="event">'; // name if (isset($title) && !empty($title)) { $output .= '<h3 class="eve-title">' . $title . '</h3>'; } // dates if (isset($dates['month']) && !empty($dates['month'])) { $output .= '<div class="eve-month">' . $dates['month'] . '</div>'; } if (isset($dates['days']) && !empty($dates['days'])) { $output .= '<div class="eve-days">' . $dates['days'] . '</div>'; } if (isset($dates['time']) && !empty($dates['time'])) { $output .= '<div class="eve-dates">' . $dates['time'] . '</div>'; } // description if (isset($body) && !empty($body)) { $output .= '<div class="eve-description">' . $body . '</div>'; } // link if (isset($short_url) && !empty($short_url)) { $output .= '<a href="' . $short_url . '" target="_blank" class="eve-link button">Learn More</a>'; } $output .= '</li>'; } // end if // } // end if dupcheck } // end if in tag $dupcheck[] = $title; } // end foreach $output .= '</ul>'; return $output; }
$subdomain_key = $_GET['subdomain_key']; $plaza_choice = $_GET['plaza_display']; $items_to_display = $_GET['items_to_display']; $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();