WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Ajax Event Calendar] Display category title above the date [eventlist] (2 posts)

  1. clubfredd
    Member
    Posted 1 year ago #

    Greetings,

    Maybe someone can show me how to patch AEC so that the category title is displayed on the [eventlist] just above the date within that event box. And also change the formatting so that the event title is just after the date.

    Something like this:
    Event Category
    Event Date - Event Title

    Thanks in advance.

    [ Please do not bump, it's not permitted here. ]

  2. rbiasiutti
    Member
    Posted 1 year ago #

    Hi,
    because I wanted to do the same thing, i modified the plugin code.
    After many attempts I found the 3 functions to change.

    I insert here the functions already changed

    1) function db_query_events

    function db_query_events($start, $end, $category_id, $excluded, $limit=false) {
    	global $wpdb;
    	$excluded = ($excluded) ? 'NOT IN' : 'IN';
            $andcategory = ($category_id) ? " AND category_id {$excluded}({$category_id})" : '';
    	$limit = ($limit) ? " LIMIT {$limit}" : "";
    
    	$tabeventi = $wpdb->prefix . AEC_EVENT_TABLE;
    	$tabcategorie = $wpdb->prefix . AEC_CATEGORY_TABLE;
    
    	$result = $wpdb->get_results("SELECT "
    				. $tabeventi . ".id, "
    				. $tabeventi . ".user_id, "
    				. $tabeventi . ".title, "
    				. $tabeventi . ".start, "
    				. $tabeventi . ".end, "
    				. $tabeventi . ".allDay, "
    				. $tabeventi . ".repeat_int, "
    				. $tabeventi . ".repeat_freq, "
    				. $tabeventi . ".repeat_end, "
    				. $tabeventi . ".category_id, "
    				. $tabcategorie . ".category
    				FROM " . $tabeventi . "
    				INNER JOIN " . $tabcategorie . "
    				ON " . $tabeventi . ".category_id = " . $tabcategorie . ".ID
    				WHERE (
    				(start >= '{$start}' AND start < '{$end}')
    				OR (end >= '{$start}' AND end < '{$end}')
    				OR (start <= '{$start}' AND end >= '{$end}')
    				OR (start < '{$end}' AND (repeat_freq > 0 AND repeat_end >= '{$start}'))
    				)
    	{$andcategory} ORDER BY start{$limit};");
    	return $this->return_result($result);
    }

    2) function generate_event

    function generate_event($input, $user_id) {
    	$permissions      = new stdClass();
    	$permissions 	= $this->get_event_permissions($input, $user_id);
    	$repeats		= ($input->repeat_freq) ? ' aec-repeating' : '';
    	$output 		= array(
    		'id'	 	=> $input->id,
    		'title'  	=> $input->title,
    		'start'		=> $input->start,
    		'end'		=> $input->end,
    		'allDay' 	=> ($input->allDay) ? true : false,
    		'className'	=> "cat{$input->category_id}{$permissions->cssclass}{$repeats}",
    		'editable'	=> $permissions->editable,
    		'repeat_i'	=> $input->repeat_int,
    		'repeat_f'	=> $input->repeat_freq,
    		'repeat_e'	=> $input->repeat_end,
    		'categoryName'  => $input->category
    	);
    	return $output;
    }

    3) function render_eventlist_events
    here I show only the inserted part

    function render_eventlist_events($events, $whitelabel, $limit) {
    	...
    	// link to event
    	$class = ($whitelabel) ? '' : ' ' . $row->className;
    	$out .= '<li class="fc-event round5' . $class . '" onClick="jQuery.aecDialog({\'id\':' . $row->id . ',\'start\':\'' . $row->start . '\',\'end\':\'' . $row->end . '\'});">';
    	$out .= '<span class="fc-event-category">Categoria : ' . $row->categoryName . '</span>'
    	$out .= '<span class="fc-event-time">';
    	$out .= $row->start_date;
    ...

    I hope everything is clear.

    Bye
    Riccardo

Topic Closed

This topic has been closed to new replies.

About this Topic