The following theme snippet allows me to highlight the schedule per time slot, instead of per date. The attached screenshot gives an example of what I needed to achieve.

WARNING: This is for REFERENCE purposes only to demonstrate the feature that I needed to implement. It should NOT BE USED as it is FLAKY and REQUIRES PERFECTION in how the repeating events are added. If you know of a way to build a scheduling system (where people can sign up for time slots on each date/time) without using ridiculous hacks, please leave your comments and let me know how! Thanks. :)

 function THEMENAME_event_node_week($node) {
 ...
 // at the end of this function the following 'tag' is added:
$output .= "BREAKFORROWS";

And then the table is rebuilt using rows for time slots instead of just all events in one day shoved into a column.

 // Build the table for the WEEKLY view
function THEMENAME_event_calendar_week($op, $header, $rows, $attributes = array(), $caption = NULL) {
	// a whole week is stored as one row
	$wholeweek = $rows[0];
	unset($rows);
	
	// for each day, break out the time slots	
	for ($i=0; $i < count($wholeweek); $i++) {
		$event[$i]['class'] = $wholeweek[$i]['class']; 
		$event[$i]['id'] = $wholeweek[$i]['id']; 
		$day = $wholeweek[$i]['data'];

		// each day contains several time slots
		$events = explode("BREAKFORROWS", $day);
		$dropempty = array_pop($events);

		for ($j=0; $j < count($events); $j++) {
			$rows[$j]['data'][$i] = $events[$j];

			if ($i < 1) {
			$rows[$j]['class'] = $event[$i]['class'];
			$rows[$j]['id'] = "timeslot-$j";
			}
		}
	}
	
	$output = theme("table", $header, $rows, $attributes, $caption);
    return '<div class="event-calendar"><div class="week-view">'. $output ."</div></div>\n";
} 
CommentFileSizeAuthor
schedule.png33.28 KBemmajane

Comments

kenorb’s picture

I'm trying to find similar solution, did you solve it somehow?

kenorb’s picture

Version: 5.x-1.0 » 6.x-2.x-dev
japerry’s picture

Status: Active » Closed (outdated)

Event for Drupal 8 is unrelated to older versions. If an issue similar to this one exists, please open a new issue with the 8.x branch.