-
Notifications
You must be signed in to change notification settings - Fork 4
/
churchcrm-calendar-list-shortcode-display.php
40 lines (30 loc) · 1.26 KB
/
churchcrm-calendar-list-shortcode-display.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/**
* Provide a public-facing view for the plugin
*
* This file is used to markup the public-facing aspects of the plugin.
*
* @link
* @since
*
* @package ChurchCRM_Calendar
* @subpackage ChurchCRM_Calendar/public/partials
*/
global $crmc_sc_output;
$atts = $this->churchcrm_calendar_list_shortcode_atts;
$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\">";
foreach ($events as $Event)
{
$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>";
$crmc_sc_output .= "</div>";
$events_count_current ++;
}
$crmc_sc_output .= "</div>";