Example #1
0
 /** @see WP_Widget::widget */
 function widget($args, $instance)
 {
     $instance = array_merge($this->defaults, $instance);
     $instance = $this->fix_scope($instance);
     // depcreciate
     echo $args['before_widget'];
     echo $args['before_title'];
     echo $instance['title'];
     echo $args['after_title'];
     if (is_numeric($instance['time_limit']) && $instance['time_limit'] > 0) {
         $instance['scope'] = date('Y-m-d') . "," . date('Y-m-t', strtotime('+' . ($instance['time_limit'] - 1) . ' month'));
     }
     $instance['owner'] = false;
     $events = EM_Events::get($instance);
     echo "<ul>";
     $li_wrap = !preg_match('/^<li>/i', trim($instance['format']));
     if (count($events) > 0) {
         foreach ($events as $event) {
             if ($li_wrap) {
                 echo '<li>' . $event->output($instance['format']) . '</li>';
             } else {
                 echo $event->output($instance['format']);
             }
         }
     } else {
         echo '<li>' . __('No events', 'dbem') . '</li>';
     }
     if (!empty($instance['all_events'])) {
         $events_link = !empty($instance['all_events_text']) ? em_get_link($instance['all_events_text']) : em_get_link(__('all events', 'dbem'));
         echo '<li>' . $events_link . '</li>';
     }
     echo "</ul>";
     echo $args['after_widget'];
 }
Example #2
0
function bp_em_events_content()
{
    global $bp, $EM_Notices;
    echo $EM_Notices;
    ?>
		<h4><?php 
    _e('My Events', 'dbem');
    ?>
</h4>
		<?php 
    $events = EM_Events::get(array('owner' => $bp->displayed_user->id));
    if (count($events) > 0) {
        $args = array('format_header' => get_option('dbem_bp_events_list_format_header'), 'format' => get_option('dbem_bp_events_list_format'), 'format_footer' => get_option('dbem_bp_events_list_format_footer'), 'owner' => $bp->displayed_user->id);
        echo EM_Events::output($events, $args);
    } else {
        ?>
			<p><?php 
        _e('No Events', 'dbem');
        ?>
</p>
			<?php 
    }
    ?>
		<h4><?php 
    _e("Events I'm Attending", 'dbem');
    ?>
</h4>
		<?php 
    bp_em_attending_content();
}
function mob_shortcode_countdown($atts)
{
    $defaults = array('id' => 'countdown_' . uniqid(), 'day' => 0, 'month' => 0, 'year' => 0, 'hour' => 0, 'minutes' => 0, 'seconds' => 0, 'nextevent' => false, 'labels' => "['Years', 'Months', 'Weeks', 'Days', 'Hours', 'Minutes', 'Seconds']", 'labels1' => "['Year', 'Month', 'Week', 'Day', 'Hour', 'Minute', 'Second']", 'compactLabels' => "['y', 'm', 'w', 'd']", 'whichLabels' => null, 'digits' => "['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']", 'timeSeparator' => ':', 'isRTL' => false, 'since' => null, 'timezone' => null, 'serverSync' => null, 'format' => 'dHMS', 'layout' => '', 'compact' => false, 'padZeroes' => false, 'significant' => 0, 'description' => '', 'expiryUrl' => null, 'alwaysExpire' => false, 'onExpiry' => null, 'onTick' => null, 'tickInterval' => 1);
    $a = shortcode_atts($defaults, $atts);
    if ($a['nextevent'] && class_exists('EM_Events')) {
        if ($events = EM_Events::get(array('limit' => 1))) {
            $datetime = strtotime($events[0]->event_start_date . ' ' . $events[0]->event_start_time);
            $a['day'] = date('j', $datetime);
            $a['month'] = date('n', $datetime);
            $a['year'] = date('Y', $datetime);
            $a['hour'] = date('G', $datetime);
            $a['minutes'] = intval(date('i', $datetime));
            $a['seconds'] = intval(date('s', $datetime));
        }
    }
    $return = '<div id="' . $a['id'] . '"></div><script type="text/javascript">jQuery(document).ready(function(){
		jQuery(\'#' . $a['id'] . '\').countdown({';
    foreach (array_diff_key($a, array('id' => '', 'day' => '', 'month' => '', 'year' => '', 'hour' => '', 'minutes' => '', 'seconds' => '')) as $k => $v) {
        if ($v != $defaults[$k] && $v != null && $v != false && !empty($v)) {
            $return .= $k . ':' . (substr($defaults[$k], 0, 1) == '[' || $defaults[$k] == null || is_numeric($defaults[$k]) || is_bool($defaults[$k]) ? $v : '"' . $v . '"') . ',';
        }
    }
    $return .= '
			until: new Date(' . intval($a['year']) . ',' . intval($a['month'] - 1) . ',' . intval($a['day']) . ',' . intval($a['hour']) . ',' . intval($a['minutes']) . ',' . intval($a['seconds']) . '),
		});
	});</script>';
    if (isset($events[0]->event_slug)) {
        $return = '<a href="' . $events[0]->event_slug . '">' . $return . '</a>';
    }
    return $return;
}
function em_rss()
{
    global $post, $wp_query;
    if (!empty($_REQUEST['dbem_rss']) || is_object($post) && $post->ID == get_option('dbem_events_page') && $wp_query->get('rss')) {
        header("Content-type: text/xml");
        ob_start();
        echo "<?xml version='1.0'?>\n";
        ?>
<rss version="2.0">
	<channel>
		<title><?php 
        echo get_option('dbem_rss_main_title');
        ?>
</title>
		<link><?php 
        echo get_permalink(get_option('dbem_events_page'));
        ?>
</link>
		<description><?php 
        echo get_option('dbem_rss_main_description');
        ?>
</description>
		<docs>http://blogs.law.harvard.edu/tech/rss</docs>
		<generator>Weblog Editor 2.0</generator>
				
		<?php 
        $description_format = str_replace(">", "&gt;", str_replace("<", "&lt;", get_option('dbem_rss_description_format')));
        $events = EM_Events::get(array('limit' => 5, 'owner' => false));
        foreach ($events as $event) {
            $description = $event->output(get_option('dbem_rss_description_format'), "rss");
            $description = ent2ncr(convert_chars(strip_tags($description)));
            //Some RSS filtering
            ?>
			<item>
				<title><?php 
            echo $event->output(get_option('dbem_rss_title_format'), "rss");
            ?>
</title>
				<link><?php 
            echo $event->output('#_EVENTURL');
            ?>
</link>
				<description><?php 
            echo $description;
            ?>
</description>
			</item>
			<?php 
        }
        ?>
		
	</channel>
</rss>
		<?php 
        echo apply_filters('em_rss', ob_get_clean());
        die;
    }
}
Example #5
0
 /**
  * Run on cron and prep emails to go out
  */
 public static function queue_emails()
 {
     global $EM_Event, $wpdb;
     //save old event in case already set
     $old_EM_Event = !empty($EM_Event) ? clone $EM_Event : null;
     //disable the current events are past rule
     add_filter('option_pre_dbem_events_current_are_past', 'em_emails_return_false', create_function('$a', 'return false;'));
     //For each event x days on
     $days = get_option('dbem_emp_emails_reminder_days', 1);
     $scope = $days > 0 ? date('Y-m-d', current_time('timestamp') + 86400 * $days) : date('Y-m-d', current_time('timestamp') + 86400);
     //make sure we don't get past events, only events starting that specific date
     $events_are_past = get_option('dbem_events_current_are_past');
     update_option('dbem_events_current_are_past', true);
     $output_type = get_option('dbem_smtp_html') ? 'html' : 'email';
     foreach (EM_Events::get(array('scope' => $scope, 'private' => 1, 'blog' => get_current_blog_id())) as $EM_Event) {
         /* @var $EM_Event EM_Event */
         $emails = array();
         //get ppl attending
         foreach ($EM_Event->get_bookings()->get_bookings()->bookings as $EM_Booking) {
             //get confirmed bookings
             /* @var $EM_Booking EM_Booking */
             if (is_email($EM_Booking->get_person()->user_email)) {
                 $subject = $EM_Booking->output(get_option('dbem_emp_emails_reminder_subject'), 'raw');
                 $message = $EM_Booking->output(get_option('dbem_emp_emails_reminder_body'), $output_type);
                 $emails[] = array($EM_Booking->get_person()->user_email, $subject, $message, $EM_Booking->booking_id);
             }
         }
         if (count($emails) > 0) {
             $attachments = serialize(array());
             if (get_option('dbem_emp_emails_reminder_ical')) {
                 //create invite ical
                 $upload_dir = wp_upload_dir();
                 if (file_exists(trailingslashit($upload_dir['basedir']) . "em-cache") || mkdir(trailingslashit($upload_dir['basedir']) . "em-cache")) {
                     $icalfilename = trailingslashit($upload_dir['basedir']) . "em-cache/invite_" . $EM_Event->event_id . ".ics";
                     $icalfile = fopen($icalfilename, 'w+');
                     if ($icalfile) {
                         ob_start();
                         em_locate_template('templates/ical.php', true, array('args' => array('event' => $EM_Event->event_id)));
                         $icalcontent = preg_replace("/([^\r])\n/", "\$1\r\n", ob_get_clean());
                         fwrite($icalfile, $icalcontent);
                         fclose($icalfile);
                         $ical_file_array = array('name' => 'invite.ics', 'type' => 'text/calendar', 'path' => $icalfilename);
                         $attachments = serialize(array($ical_file_array));
                     }
                 }
             }
             foreach ($emails as $email) {
                 $wpdb->insert(EM_EMAIL_QUEUE_TABLE, array('email' => $email[0], 'subject' => $email[1], 'body' => $email[2], 'attachment' => $attachments, 'event_id' => $EM_Event->event_id, 'booking_id' => $email[3]));
             }
         }
     }
     //cleanup
     update_option('dbem_events_current_are_past', $events_are_past);
     //reset previous current events are past setting
     $EM_Event = $old_EM_Event;
     //reset global
     remove_filter('option_pre_dbem_events_current_are_past', 'em_emails_return_false');
 }
Example #6
0
 /**
  * Get past events
  * @return string HTML
  */
 public static function getPastEvents()
 {
     return \EM_Events::output(array('format_header' => '<ul>', 'format' => '<li>
                 <div>#_{j M Y}</div>
                 <h3>#_EVENTNAME</h3>
                 <div>#_EVENTNOTES</div>
                 <a href="#_EVENTURL">En savoir plus</a>
             </li>', 'format_footer' => '</ul>', 'scope' => 'past', 'order' => 'DESC', 'limit' => 3, 'pagination' => true));
 }
Example #7
0
 /**
  * Get past events.
  *
  * @return string HTML
  */
 public static function getPastEvents()
 {
     return \EM_Events::output(['format_header' => '<ul class="eventList grid-3-medium-2-small-2-tiny-1">', 'format' => '<li class="eventItem">
                 <div class="eventDate">#_{j M Y}</div>
                 <div class="eventImg"><a href="#_EVENTURL">#_EVENTIMAGE{372,372}</a></div>
                 <h3 class="eventTitle"><a href="#_EVENTURL">#_EVENTNAME</a></h3>
                 <div class="eventDesc">#_EVENTNOTES</div>
             </li>', 'format_footer' => '</ul>', 'scope' => 'past', 'order' => 'DESC', 'limit' => 3, 'pagination' => true]);
 }
Example #8
0
/**
 * Shows a list of events according to given specifications. Accepts any event query attribute.
 * @param array $atts
 * @return string
 */
function em_get_events_list_shortcode($atts, $format = '')
{
    $atts = (array) $atts;
    $atts['format'] = $format != '' || empty($atts['format']) ? $format : $atts['format'];
    $atts['format'] = html_entity_decode($atts['format']);
    //shorcode doesn't accept html
    $atts['page'] = !empty($atts['page']) && is_numeric($atts['page']) ? $atts['page'] : 1;
    $atts['page'] = !empty($_GET['pno']) && is_numeric($_GET['pno']) ? $_GET['pno'] : $atts['page'];
    return EM_Events::output($atts);
}
 public function find($params)
 {
     $events = EM_Events::get(array('limit' => 0, 'offset' => 100));
     $events = self::filter_events($events, $params);
     $events = array_slice($events, $params['offset']);
     $remaped_events = array();
     foreach ($events as $event) {
         $remaped_events[] = $this->convert_to_se_event($event);
     }
     return $paged_posts = $this->add_paging_info($remaped_events, $params);
 }
Example #10
0
    /** @see WP_Widget::widget */
    function widget($args, $instance) {
    	$instance = array_merge($this->defaults, $instance);
    	$instance = $this->fix_scope($instance); // depcreciate	

    	echo $args['before_widget'];
    	if( !empty($instance['title']) ){
		    echo $args['before_title'];
		    echo apply_filters('widget_title',$instance['title'], $instance, $this->id_base);
		    echo $args['after_title'];
    	}
    	//remove owner searches
		$instance['owner'] = false;
		
		//legacy stuff
		//add li tags to old widgets that have no forced li wrappers
		if ( !preg_match('/^<li/i', trim($instance['format'])) ) $instance['format'] = '<li>'. $instance['format'] .'</li>';
		if (!preg_match('/^<li/i', trim($instance['no_events_text'])) ) $instance['no_events_text'] = '<li>'.$instance['no_events_text'].'</li>';
		//orderby fix for previous versions with old orderby values
		if( !array_key_exists($instance['orderby'], $this->em_orderby_options) ){
			//replace old values
			$old_vals = array(
				'name' => 'event_name',
				'end_date' => 'event_end_date',
				'start_date' => 'event_start_date',
				'end_time' => 'event_end_time',
				'start_time' => 'event_start_time'
			);
			foreach($old_vals as $old_val => $new_val){
				$instance['orderby'] = str_replace($old_val, $new_val, $instance['orderby']);
			}
		}
		
		//get events
		$events = EM_Events::get(apply_filters('em_widget_events_get_args',$instance));
		
		//output events
		echo "<ul>";
		if ( count($events) > 0 ){
			foreach($events as $event){				
				echo $event->output( $instance['format'] );
			}
		}else{
		    echo $instance['no_events_text'];
		}
		if ( !empty($instance['all_events']) ){
			$events_link = (!empty($instance['all_events_text'])) ? em_get_link($instance['all_events_text']) : em_get_link(__('all events','charity'));
			echo '<li class="all-events-link">'.$events_link.'</li>';
		}
		echo "</ul>";
		
	    echo $args['after_widget'];
    }
Example #11
0
 function EM_Events($args = array())
 {
     if (is_array($args)) {
         if (is_object(current($args)) && get_class(current($args)) == 'EM_Event') {
             $this->events = $args;
         } else {
             $this->events = EM_Events::get($args);
         }
     } else {
         $this->events = EM_Events::get();
     }
     do_action('em_events', $this);
 }
 /**
  * Hooks in after EM_Tag_Taxonomy::template() and makes sure WPML doesn't reset $wp_query and wipe the work EM just did.  
  */
 public static function tag_taxonomy_workaround()
 {
     global $EM_Tag;
     if (defined('EM_WPML_TAXONOMIES_TWEAKED') && EM_WPML_TAXONOMIES_TWEAKED) {
         return;
     }
     //prevent endless loop
     if (EM_Events::count(array('tag' => $EM_Tag->term_id)) == 0) {
         self::preset_query($EM_Tag->output(get_option('dbem_tag_page_title_format')));
     }
     define('EM_WPML_TAXONOMIES_TWEAKED', true);
     wp_reset_query();
     add_filter('the_post', 'EM_Tag_Taxonomy::template', 1);
 }
/**
 * TOTALLY DEPRECIATED (NOT ALTERNATIVE TAG) - Just use EM_Events::output, see below
 * @param unknown_type $limit
 * @param unknown_type $scope
 * @param unknown_type $order
 * @param unknown_type $format
 * @param unknown_type $echo
 * @param unknown_type $category
 * @return unknown_type
 */
function dbem_get_events_list($limit = "10", $scope = "future", $order = "ASC", $format = '', $echo = 1, $category = '')
{
    if (strpos($limit, "=")) {
        // allows the use of arguments without breaking the legacy code
        $defaults = EM_Events::get_default_search();
        $r = wp_parse_args($limit, $defaults);
        extract($r, EXTR_OVERWRITE);
    }
    $return = EM_Events::output(array('limit' => $limit, 'scope' => $scope, 'order' => $order, 'format' => $format, 'category' => $category));
    if ($echo) {
        echo $return;
    }
    return $return;
}
 /**
  * export the data in selected format
  */
 public function export()
 {
     $EM_Events = EM_Events::get();
     $format = isset($_POST['exp_format']) ? wp_unslash($_POST['exp_format']) : '';
     switch ($format) {
         case 'xCal':
             $this->exportXCal($EM_Events);
             break;
         case 'iCal':
             $this->exportICal($EM_Events);
             break;
         case 'Event Espresso':
             $this->exportEventEspresso($EM_Events);
             break;
     }
 }
 /** @see WP_Widget::widget */
 function widget($args, $instance)
 {
     $instance = array_merge($this->defaults, $instance);
     $instance = $this->fix_scope($instance);
     // depcreciate
     echo $args['before_widget'];
     if (!empty($instance['title'])) {
         echo $args['before_title'];
         echo apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
         echo $args['after_title'];
     }
     $instance['owner'] = false;
     //orderby fix for previous versions with old orderby values
     if (!array_key_exists($instance['orderby'], $this->em_orderby_options)) {
         //replace old values
         $old_vals = array('name' => 'event_name', 'end_date' => 'event_end_date', 'start_date' => 'event_start_date', 'end_time' => 'event_end_time', 'start_time' => 'event_start_time');
         foreach ($old_vals as $old_val => $new_val) {
             $instance['orderby'] = str_replace($old_val, $new_val, $instance['orderby']);
         }
     }
     $events = EM_Events::get(apply_filters('em_widget_events_get_args', $instance));
     echo "<div id='events'>";
     $li_wrap = !preg_match('/^<div class="item">/i', trim($instance['format']));
     if (count($events) > 0) {
         foreach ($events as $event) {
             if ($li_wrap) {
                 echo '<div class="item">' . $event->output($instance['format']) . '</div>';
             } else {
                 echo $event->output($instance['format']);
             }
         }
     } else {
         echo '<div class="item"><h4>' . $instance['no_events_text'] . '</h4></div>';
     }
     if (!empty($instance['all_events'])) {
         $events_link = !empty($instance['all_events_text']) ? em_get_link($instance['all_events_text']) : em_get_link(__('all events', 'dbem'));
         echo '<div class="all-events-link">&raquo; ' . $events_link . '</div>';
     }
     echo "</div>";
     echo $args['after_widget'];
 }
Example #16
0
function em_get_events_list_shortcode_all($atts, $format = '')
{
    $atts = (array) $atts;
    $atts['format'] = $format != '' || empty($atts['format']) ? $format : $atts['format'];
    $atts['format'] = html_entity_decode($atts['format']);
    //shorcode doesn't accept html
    $atts['page'] = !empty($atts['page']) && is_numeric($atts['page']) ? $atts['page'] : 1;
    $atts['page'] = !empty($_GET['page']) && is_numeric($_GET['page']) ? $_GET['page'] : $atts['page'];
    // get recurrence events
    $atts['recurring'] = 1;
    $evts_recurring = EM_Events::get($atts);
    // get non-recurrence events
    $atts['recurring'] = 0;
    $evts = EM_Events::get($atts);
    // filter out the events that are instances of recurring events
    $non_recurrence_evts = array_filter($evts, 'is_no_recurrence');
    // merge recurrence and non-recurring events
    $evts_all = array_merge($non_recurrence_evts, $evts_recurring);
    // sort them by start==start date+time
    usort($evts_all, 'evt_start_sort');
    //
    return EM_Events::output($evts_all, $atts);
}
Example #17
0
echo esc_html(get_option('dbem_rss_main_description'));
?>
</description>
		<docs>http://blogs.law.harvard.edu/tech/rss</docs>
		<pubDate><?php 
echo get_option('em_rss_pubdate', date('D, d M Y H:i:s T'));
?>
</pubDate>
		<atom:link href="<?php 
echo esc_attr(EM_RSS_URI);
?>
" rel="self" type="application/rss+xml" />
		<?php 
$description_format = str_replace(">", "&gt;", str_replace("<", "&lt;", get_option('dbem_rss_description_format')));
//$EM_Events = new EM_Events( array('limit'=>5, 'owner'=>false) );
$EM_Events = EM_Events::get(array('scope' => 'future', 'owner' => false));
foreach ($EM_Events as $EM_Event) {
    /* @var $EM_Event EM_Event */
    $description = $EM_Event->output(get_option('dbem_rss_description_format'), "rss");
    $description = ent2ncr(convert_chars($description));
    //Some RSS filtering
    $event_url = $EM_Event->output('#_EVENTURL');
    ?>
			<item>
				<title><?php 
    echo $EM_Event->output(get_option('dbem_rss_title_format'), "rss");
    ?>
</title>
				<link><?php 
    echo $event_url;
    ?>
Example #18
0
 public static function get_default_search($array_or_defaults = array(), $array = array())
 {
     self::$context = EM_POST_TYPE_EVENT;
     $defaults = array('orderby' => get_option('dbem_events_default_orderby'), 'order' => get_option('dbem_events_default_order'), 'bookings' => false, 'status' => 1, 'format_header' => '', 'format_footer' => '', 'town' => false, 'state' => false, 'country' => false, 'region' => false, 'blog' => get_current_blog_id(), 'private' => current_user_can('read_private_events'), 'private_only' => false, 'post_id' => false);
     //sort out whether defaults were supplied or just the array of search values
     if (empty($array)) {
         $array = $array_or_defaults;
     } else {
         $defaults = array_merge($defaults, $array_or_defaults);
     }
     //specific functionality
     if (EM_MS_GLOBAL && (!is_admin() || defined('DOING_AJAX'))) {
         if (empty($array['blog']) && is_main_site() && get_site_option('dbem_ms_global_events')) {
             $array['blog'] = false;
         }
     }
     if (is_admin()) {
         //figure out default owning permissions
         $defaults['owner'] = !current_user_can('edit_others_events') ? get_current_user_id() : false;
         if (!array_key_exists('status', $array) && current_user_can('edit_others_events')) {
             $defaults['status'] = false;
             //by default, admins see pending and live events
         }
     }
     return apply_filters('em_events_get_default_search', parent::get_default_search($defaults, $array), $array, $defaults);
 }
Example #19
0
/**
 * Generates a "widget" table of confirmed bookings for a specific event.
 * 
 * @param int $event_id
 */
function em_bookings_person_table()
{
    global $wpdb, $current_user, $EM_Person;
    if (!is_object($EM_Person)) {
        return false;
    }
    $action_scope = !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_confirmed_table';
    $action = $action_scope && !empty($_GET['action']) ? $_GET['action'] : '';
    $order = $action_scope && !empty($_GET['order']) ? $_GET['order'] : 'ASC';
    $limit = $action_scope && !empty($_GET['limit']) ? $_GET['limit'] : 20;
    //Default limit
    $page = $action_scope && !empty($_GET['pno']) ? $_GET['pno'] : 1;
    $offset = $action_scope && $page > 1 ? ($page - 1) * $limit : 0;
    $bookings = $EM_Person->get_bookings();
    $bookings_count = count($bookings);
    if ($bookings_count > 0) {
        //Get events here in one query to speed things up
        foreach ($bookings as $EM_Booking) {
            $event_ids[] = $EM_Booking->event_id;
        }
        $events = EM_Events::get($event_ids);
    }
    ?>
		<div class='wrap em_bookings_pending_table em_obj'>
			<form id='bookings-filter' method='get' action='<?php 
    bloginfo('wpurl');
    ?>
/wp-admin/edit.php'>
				<input type="hidden" name="em_obj" value="em_bookings_pending_table" />
				<!--
				<ul class="subsubsub">
					<li>
						<a href='edit.php?post_type=post' class="current">All <span class="count">(1)</span></a> |
					</li>
				</ul>
				<p class="search-box">
					<label class="screen-reader-text" for="post-search-input"><?php 
    _e('Search');
    ?>
:</label>
					<input type="text" id="post-search-input" name="em_search" value="<?php 
    echo !empty($_GET['em_search']) ? $_GET['em_search'] : '';
    ?>
" />
					<input type="submit" value="<?php 
    _e('Search');
    ?>
" class="button" />
				</p>
				-->
				<?php 
    if ($bookings_count >= $limit) {
        ?>
				<div class='tablenav'>
					<!--
					<div class="alignleft actions">
						<select name="action">
							<option value="-1" selected="selected">
								<?php 
        _e('Bulk Actions');
        ?>
							</option>
							<option value="approve">
								<?php 
        _e('Approve', 'dbem');
        ?>
							</option>
							<option value="decline">
								<?php 
        _e('Decline', 'dbem');
        ?>
							</option>
						</select> 
						<input type="submit" id="post-query-submit" value="Filter" class="button-secondary" />
					</div>
					-->
					<!--
					<div class="view-switch">
						<a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
					</div>
					-->
					<?php 
        if ($bookings_count >= $limit) {
            $bookings_nav = em_admin_paginate($bookings_count, $limit, $page, array('em_ajax' => 0, 'em_obj' => 'em_bookings_confirmed_table'));
            echo $bookings_nav;
        }
        ?>
					<div class="clear"></div>
				</div>
				<?php 
    }
    ?>
				<div class="clear"></div>
				<?php 
    if ($bookings_count > 0) {
        ?>
				<div class='table-wrap'>
				<table id='dbem-bookings-table' class='widefat post '>
					<thead>
						<tr>
							<th class='manage-column column-cb check-column' scope='col'>
								<input class='select-all' type="checkbox" value='1' />
							</th>
							<th class='manage-column' scope='col'>Event</th>
							<th class='manage-column' scope='col'>Spaces</th>
							<th class='manage-column' scope='col'>Status</th>
							<th class='manage-column' scope='col'>&nbsp;</th>
						</tr>
					</thead>
					<tbody>
						<?php 
        $rowno = 0;
        $event_count = 0;
        foreach ($bookings as $EM_Booking) {
            $EM_Event = $events[$EM_Booking->event_id];
            if ($EM_Event->can_manage('edit_events', 'edit_others_events') && ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0)) {
                $rowno++;
                ?>
								<tr>
									<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php 
                echo $EM_Booking->id;
                ?>
' name='bookings[]'/></th>
									<td><a class="row-title" href="<?php 
                bloginfo('wpurl');
                ?>
/wp-admin/admin.php?page=events-manager-bookings&amp;event_id=<?php 
                echo $EM_Event->id;
                ?>
"><?php 
                echo $EM_Event->name;
                ?>
</a></td>
									<td><?php 
                echo $EM_Booking->get_spaces();
                ?>
</td>
									<td><?php 
                echo $EM_Booking->status_array[$EM_Booking->status];
                ?>
									</td>
									<td>
										<?php 
                $unapprove_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action' => 'bookings_unapprove', 'bookings' => $EM_Booking->id));
                $approve_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action' => 'bookings_approve', 'bookings' => $EM_Booking->id));
                $reject_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action' => 'bookings_reject', 'bookings' => $EM_Booking->id));
                $delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action' => 'bookings_delete', 'bookings' => $EM_Booking->id));
                ?>
										<?php 
                if (get_option('dbem_bookings_approval') && $EM_Booking->status == 0) {
                    ?>
										<a class="em-bookings-approve" href="<?php 
                    echo $approve_url;
                    ?>
"><?php 
                    _e('Approve', 'dbem');
                    ?>
</a> |
										<?php 
                }
                ?>
										<?php 
                if (get_option('dbem_bookings_approval') && $EM_Booking->status == 1) {
                    ?>
										<a class="em-bookings-unapprove" href="<?php 
                    echo $unapprove_url;
                    ?>
"><?php 
                    _e('Unapprove', 'dbem');
                    ?>
</a> |
										<?php 
                }
                ?>
										<?php 
                if ($EM_Booking->status == 2) {
                    ?>
										<a class="em-bookings-approve" href="<?php 
                    echo $approve_url;
                    ?>
"><?php 
                    _e('Restore', 'dbem');
                    ?>
</a> |
										<?php 
                }
                ?>
										<?php 
                if ($EM_Booking->status == 0 || $EM_Booking->status == 1) {
                    ?>
										<a class="em-bookings-reject" href="<?php 
                    echo $reject_url;
                    ?>
"><?php 
                    _e('Reject', 'dbem');
                    ?>
</a> |
										<?php 
                }
                ?>
										<a class="em-bookings-edit" href="<?php 
                bloginfo('wpurl');
                ?>
/wp-admin/admin.php?page=events-manager-bookings&amp;booking_id=<?php 
                echo $EM_Booking->id;
                ?>
"><?php 
                _e('Edit/View', 'dbem');
                ?>
</a> |
										<span class="trash"><a class="em-bookings-delete" href="<?php 
                echo $delete_url;
                ?>
"><?php 
                _e('Delete', 'dbem');
                ?>
</a></span>
									</td>
								</tr>
								<?php 
            }
            $event_count++;
        }
        ?>
					</tbody>
				</table>
				</div>
				<?php 
    } else {
        ?>
					<?php 
        _e('No confirmed bookings.', 'dbem');
        ?>
				<?php 
    }
    ?>
			</form>
			<?php 
    if (!empty($bookings_nav) && $bookings >= $limit) {
        ?>
			<div class='tablenav'>
				<?php 
        echo $bookings_nav;
        ?>
				<div class="clear"></div>
			</div>
			<?php 
    }
    ?>
		</div>	
	<?php 
}
Example #20
0
">
					<?php 
    if (!empty($cell_data['events']) && count($cell_data['events']) > 0) {
        ?>
					<a href="<?php 
        echo $cell_data['link'];
        ?>
" title="<?php 
        echo $cell_data['link_title'];
        ?>
"><?php 
        echo date('j', $cell_data['date']);
        ?>
</a>
					<ul><?php 
        echo EM_Events::output($cell_data['events'], array('format' => get_option('dbem_full_calendar_event_format')));
        ?>
</ul>
					<?php 
    } else {
        ?>
					<?php 
        echo date('j', $cell_data['date']);
        ?>
					<?php 
    }
    ?>
				</td>
				<?php 
    //create a new row once we reach the end of a table collumn
    $col_count = $col_count == $col_max ? 1 : $col_count + 1;
Example #21
0
<?php

do_action('em_template_my_bookings_header');
global $wpdb, $current_user, $EM_Notices, $EM_Person;
if (is_user_logged_in()) {
    $EM_Person = new EM_Person(get_current_user_id());
    $EM_Bookings = $EM_Person->get_bookings();
    $bookings_count = count($EM_Bookings->bookings);
    if ($bookings_count > 0) {
        //Get events here in one query to speed things up
        $event_ids = array();
        foreach ($EM_Bookings as $EM_Booking) {
            $event_ids[] = $EM_Booking->event_id;
        }
        $EM_Events = EM_Events::get($event_ids);
    }
    $limit = !empty($_GET['limit']) ? $_GET['limit'] : 20;
    //Default limit
    $page = !empty($_GET['pno']) ? $_GET['pno'] : 1;
    $offset = $page > 1 ? ($page - 1) * $limit : 0;
    echo $EM_Notices;
    ?>
		<div class='em-my-bookings'>
				<!--
				<ul class="subsubsub">
					<li>
						<a href='edit.php?post_type=post' class="current">All <span class="count">(1)</span></a> |
					</li>
				</ul>
				-->
				<?php 
Example #22
0
        $args['pagination'] = false;
        if (get_option('dbem_event_list_groupby')) {
            $args['mode'] = get_option('dbem_event_list_groupby');
            $args['date_format'] = get_option('dbem_event_list_groupby_format');
            echo em_events_list_grouped($args);
        } else {
            echo EM_Events::output($args);
        }
        //do some custom pagination (if needed/requested)
        if (!empty($args['limit']) && $events_count > $args['limit']) {
            //Show the pagination links (unless there's less than $limit events), note that we set em_search instead of search to prevent conflicts
            $search_args = array_merge(EM_Events::get_post_search(), array('pno' => '%PAGE%', 'action' => 'search_events', 'search' => null, 'em_search' => $args['search']));
            $page_link_template = em_add_get_params($_SERVER['REQUEST_URI'], $search_args, false);
            //don't html encode, so em_paginate does its thing
            echo apply_filters('em_events_output_pagination', em_paginate($page_link_template, $events_count, $args['limit'], $args['pno']), $page_link_template, $events_count, $args['limit'], $args['pno']);
        }
    } else {
        if (get_option('dbem_event_list_groupby')) {
            $args['mode'] = get_option('dbem_event_list_groupby');
            $args['date_format'] = get_option('dbem_event_list_groupby_format');
            echo em_events_list_grouped($args);
        } else {
            echo EM_Events::output($args);
        }
    }
} else {
    echo get_option('dbem_no_events_message');
}
if (get_option('dbem_events_page_ajax', defined('EM_AJAX_SEARCH'))) {
    echo "</div>";
}
Example #23
0
</link>
					<guid><?php 
        echo $event_url;
        ?>
</guid>
					<pubDate><?php 
        echo get_gmt_from_date(date('Y-m-d H:i:s', $EM_Event->start), 'D, d M Y H:i:s +0000');
        ?>
</pubDate>
					<description><![CDATA[<?php 
        echo $description;
        ?>
]]></description>
				</item>
				<?php 
        $count++;
    }
    if ($rss_limit != 0 && $count >= $rss_limit) {
        //we've reached our limit, or showing one event only
        break;
    } else {
        //get next page of results
        $args['page']++;
        $EM_Events = EM_Events::get($args);
    }
}
?>

		
	</channel>
</rss>
<?php

/*
 * Default Events List Template
 * This page displays a list of events, called during the em_content() if this is an events list page.
 * You can override the default display settings pages by copying this file to yourthemefolder/plugins/events-manager/templates/ and modifying it however you need.
 * You can display events however you wish, there are a few variables made available to you:
 * 
 * $args - the args passed onto EM_Events::output()
 * 
 */
$args = apply_filters('em_content_events_args', $args);
if (get_option('dbem_css_evlist')) {
    echo "<div class='css-events-list'>";
}
echo EM_Events::output_grouped($args);
//note we're grabbing the content, not em_get_events_list_grouped function
if (get_option('dbem_css_evlist')) {
    echo "</div>";
}
Example #25
0
 /**
  * If event is recurring, set recurrences to same status as template
  * @param $status
  */
 function set_status_events($status)
 {
     //give sub events same status
     $events_array = EM_Events::get(array('recurrence_id' => $this->post_id, 'scope' => 'all', 'status' => false));
     foreach ($events_array as $EM_Event) {
         /* @var $EM_Event EM_Event */
         if ($EM_Event->recurrence_id == $this->event_id) {
             $EM_Event->set_status($status);
         }
     }
 }
Example #26
0
</a>
		<?php 
        }
        ?>
		</p>
		<?php 
    }
}
?>
<h4><?php 
_e("Events I'm Attending", 'events-manager');
?>
</h4>
<?php 
$EM_Person = new EM_Person($bp->displayed_user->id);
$EM_Bookings = $EM_Person->get_bookings(false, apply_filters('em_bp_attending_status', 1));
if (count($EM_Bookings->bookings) > 0) {
    //Get events here in one query to speed things up
    $event_ids = array();
    foreach ($EM_Bookings as $EM_Booking) {
        $event_ids[] = $EM_Booking->event_id;
    }
    echo EM_Events::output(array('event' => $event_ids));
} else {
    ?>
	<p><?php 
    _e('Not attending any events yet.', 'events-manager');
    ?>
</p>
	<?php 
}
 public static function untrash_post($post_id)
 {
     if (get_post_type($post_id) == 'event-recurring') {
         global $wpdb;
         //set a constant so we know this event doesn't need 'saving'
         if (!defined('UNTRASHING_' . $post_id)) {
             define('UNTRASHING_' . $post_id, true);
         }
         $EM_Event = em_get_event($post_id, 'post_id');
         $events_array = EM_Events::get(array('recurrence_id' => $EM_Event->event_id, 'scope' => 'all', 'status' => 'all'));
         foreach ($events_array as $event) {
             /* @var $event EM_Event */
             if ($EM_Event->event_id == $event->recurrence_id) {
                 wp_untrash_post($event->post_id);
             }
         }
     }
 }
Example #28
0
/**
 * Returns true if there are any events that exist in the given scope (default is future events).
 * @param string $scope
 * @return boolean
 */
function em_are_events_available($scope = "future")
{
    $scope = $scope == "" ? "future" : $scope;
    $events = EM_Events::get(array('limit' => 1, 'scope' => $scope));
    return count($events) > 0;
}
Example #29
0
/**
 * Filter for titles when on event pages
 * @param $data
 * @return string
 */
function em_content_page_title($original_content, $id = null)
{
    global $EM_Event, $EM_Location, $EM_Category, $wp_query, $post;
    if (empty($post)) {
        return $original_content;
    }
    //fix for any other plugins calling the_content outside the loop
    if ($id && $id !== $post->ID) {
        return $original_content;
    }
    $events_page_id = get_option('dbem_events_page');
    $locations_page_id = get_option('dbem_locations_page');
    $edit_events_page_id = get_option('dbem_edit_events_page');
    $edit_locations_page_id = get_option('dbem_edit_locations_page');
    $edit_bookings_page_id = get_option('dbem_edit_bookings_page');
    if (!empty($post->ID) && in_array($post->ID, array($events_page_id, $locations_page_id, $edit_events_page_id, $edit_locations_page_id, $edit_bookings_page_id))) {
        //override the titles with this filter if needed, preventing the following code from being run
        $content = apply_filters('em_content_page_title_pre', '', $original_content);
        if (empty($content)) {
            $content = $original_content;
            //leave untouched by default
            if ($post->ID == $events_page_id) {
                if (!empty($_REQUEST['calendar_day'])) {
                    $events = EM_Events::get(array('limit' => 2, 'scope' => $_REQUEST['calendar_day'], 'owner' => false));
                    if (count($events) != 1 || get_option('dbem_display_calendar_day_single') == 1) {
                        //We only support dates for the calendar day list title, so we do a simple filter for the supplied calendar_day
                        $content = get_option('dbem_list_date_title');
                        preg_match_all("/#[A-Za-z0-9]+/", $content, $placeholders);
                        foreach ($placeholders[0] as $placeholder) {
                            // matches all PHP date and time placeholders
                            if (preg_match('/^#[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]$/', $placeholder)) {
                                $content = str_replace($placeholder, mysql2date(ltrim($placeholder, "#"), $_REQUEST['calendar_day']), $content);
                            }
                        }
                    } else {
                        $event = array_shift($events);
                        $content = $event->output(get_option('dbem_event_page_title_format'));
                    }
                } elseif (EM_MS_GLOBAL && is_object($EM_Event) && !get_option('dbem_ms_global_events_links')) {
                    // single event page
                    $content = $EM_Event->output(get_option('dbem_event_page_title_format'));
                }
            } elseif ($post->ID == $locations_page_id) {
                if (EM_MS_GLOBAL && is_object($EM_Location) && get_option('dbem_ms_global_locations_links')) {
                    $content = $EM_Location->output(get_option('dbem_location_page_title_format'));
                }
            } elseif ($post->ID == $edit_events_page_id) {
                if (!empty($_REQUEST['action']) && ($_REQUEST['action'] = 'edit')) {
                    if (is_object($EM_Event) && $EM_Event->event_id) {
                        if ($EM_Event->is_recurring()) {
                            $content = __("Reschedule Events", 'dbem') . " '{$EM_Event->event_name}'";
                        } else {
                            $content = __("Edit Event", 'dbem') . " '" . $EM_Event->event_name . "'";
                        }
                    } else {
                        $content = __('Add Event', 'dbem');
                    }
                }
            } elseif ($post->ID == $edit_locations_page_id) {
                if (!empty($_REQUEST['action']) && ($_REQUEST['action'] = 'edit')) {
                    if (empty($EM_Location) || !is_object($EM_Location)) {
                        $content = __('Add Location', 'dbem');
                    } else {
                        $content = __('Edit Location', 'dbem');
                    }
                }
            } elseif ($post->ID == $edit_bookings_page_id) {
                if (is_object($EM_Event)) {
                    $content = $EM_Event->name . ' - ' . $original_content;
                }
            }
            return apply_filters('em_content_page_title', $content);
        }
    }
    return $original_content;
}
Example #30
0
/**
 * Creates a grouped list of events by year, month, week or day
 * @since 4.213
 * @param array $args
 * @param string $format
 * @return string
 */
function em_get_events_list_grouped_shortcode($args = array(), $format = '')
{
    $args = (array) $args;
    $args['ajax'] = isset($args['ajax']) ? $args['ajax'] : !defined('EM_AJAX') || EM_AJAX;
    $args['format'] = $format != '' || empty($args['format']) ? $format : $args['format'];
    $args['format'] = html_entity_decode($args['format']);
    //shortcode doesn't accept html
    if (empty($args['format']) && empty($args['format_header']) && empty($args['format_footer'])) {
        ob_start();
        if (!empty($args['ajax'])) {
            echo '<div class="em-search-ajax">';
        }
        //open AJAX wrapper
        em_locate_template('templates/events-list-grouped.php', true, array('args' => $args));
        if (!empty($args['ajax'])) {
            echo "</div>";
        }
        //close AJAX wrapper
        $return = ob_get_clean();
    } else {
        $args['ajax'] = false;
        $pno = !empty($_GET['pno']) && is_numeric($_GET['pno']) ? $_GET['pno'] : 1;
        $args['page'] = !empty($args['page']) && is_numeric($args['page']) ? $args['page'] : $pno;
        $return = EM_Events::output_grouped($args);
    }
    return $return;
}