Skip to content

Commit

Permalink
add randomized query
Browse files Browse the repository at this point in the history
  • Loading branch information
crossan007 committed Sep 9, 2017
1 parent f592b2f commit df8124c
Showing 1 changed file with 3 additions and 4 deletions.
Expand Up @@ -15,19 +15,18 @@
global $crmc_sc_output;

$atts = $this->churchcrm_calendar_list_shortcode_atts;

$events = json_decode(file_get_contents(get_option('_curchcrm_server_url')."/external/calendar/events"));

$events_count_max = $this->churchcrm_calendar_list_shortcode_atts['max'];
$request_string = get_option('_curchcrm_server_url')."/external/calendar/events?start=".date('Y-m-d')."&max=".$events_count_max."&r=".mt_rand();
$events = json_decode(file_get_contents($request_string));

/*
TODO: Render the events on the page.
*/
$crmc_sc_output = "<div class=\"events-list\">";

$events_count_current = 0;
foreach ($events as $Event)
{
if ($events_count_current >= $events_count_max) { break; }
$crmc_sc_output .= "<div class=\"event-div\">";
$crmc_sc_output .= "<div class=\"event-div-header\"><h1>$Event->Title</h1><h2>".date("M/j/y g:i A",strtotime($Event->Start))."</h2></div>";
$crmc_sc_output .= "<div class=\"event-div-body\"><p>$Event->Desc</p></div>";
Expand Down

0 comments on commit df8124c

Please sign in to comment.