function wpfc_ue_get_the_calendar($cmonth, $cyear)
{
    global $calentries;
    $calentries = array();
    $output = '';
    wpfc_get_the_events($cmonth, $cyear);
    if ($calentries) {
        $calentries = wpfc_subval_sort($calentries, 'strdate');
        foreach ($calentries as $cal_the_entry) {
            $tmonth = date_i18n('D', $cal_the_entry['strdate'], false);
            $caltime = get_post_meta($cal_the_entry['cids'], '_wpfc_timestartentry', true);
            $output .= '<div class="calsingleentry"><div class="daydisplay"><span>' . $tmonth . '</span><h1>' . date('d', $cal_the_entry['strdate']) . ' </h1></div>';
            $output .= '<div class="shortcalentry"><a href="' . $cal_the_entry['clink'] . '">' . $cal_the_entry['ctitle'] . '</a>';
            $output .= '<span class="intdesc">';
            if ($caltime) {
                $output .= __('Time: ', 'church-pack') . '' . $caltime . '&nbsp;';
            }
            if ($caltime && $cal_the_entry['clocation']) {
                $output .= '|&nbsp;';
            }
            if ($cal_the_entry['clocation']) {
                $output .= __('Location: ', 'church-pack') . '' . $cal_the_entry['clocation'] . ' ';
            }
            $output .= '</span></div></div>';
        }
        return $output;
    } else {
        return '<p>' . __('No events currently scheduled', 'church-pack') . '</p>';
    }
}
Example #2
0
function wpfc_get_for_widget($num)
{
    global $calentries;
    $woutput = '';
    $monthset = '';
    $wmonth = date("n");
    $wyear = date("Y");
    $emptycounter = 0;
    $wcounter = 0;
    $currententry = date('U');
    $continue = 0;
    $wnum = $num - 1;
    while ($continue != 1) {
        $calentries = array();
        wpfc_get_the_events($wmonth, $wyear);
        if ($calentries) {
            $calentries = wpfc_subval_sort($calentries, 'strdate');
            foreach ($calentries as $cal_the_entry) {
                if ($cal_the_entry['strdate'] >= $currententry && $wcounter <= $wnum) {
                    $caltime = get_post_meta($cal_the_entry['cids'], '_wpfc_timestartentry', true);
                    $woutput .= '<div class="calsingleentryw"><div class="daydisplayw"><span>' . date_i18n('M', $cal_the_entry['strdate'], false) . '</span><h1>' . date_i18n('d', $cal_the_entry['strdate'], false) . '</h1></div>';
                    $woutput .= '<div class="shortcalentryw"><a href="' . $cal_the_entry['clink'] . '">' . $cal_the_entry['ctitle'] . '</a>';
                    $woutput .= '</div><div class="clear"></div></div>';
                    $wcounter = $wcounter + 1;
                }
            }
        }
        $wmonth = $wmonth + 1;
        if ($wmonth == 13) {
            $wmonth = 1;
            $wyear = $wyear + 1;
        }
        $emptycounter++;
        $monthset = '';
        if ($wcounter >= $num || $emptycounter >= 5) {
            $continue = 1;
        }
    }
    if ($woutput) {
        echo $woutput;
    } else {
        echo '<p>' . __('No events currently scheduled', 'church-pack') . '</p>';
    }
}