Jump to content

Recommended Posts

Posted

Hi I have been working on a scrolling calendar for my xibo display

It uses simplepie and jquery.newsScroll

it works atm but not as I would like it to so that I could share it

here is the code

require 'simplepie.inc';

// Create a new class that extends an existing class
class SimplePie_Item_Extras extends SimplePie_Item {
   var $show_past_events = TRUE;

function set_show_past_events($value = FALSE){
	$this->show_past_events = $value;
}
/**
This is an example of adding a new method to an existing class
*/

function check_url($url_to_check){
	$tmp = str_replace("/basic","/full",$url_to_check);
//		if(!strpos($tmp,'?'))
//			$tmp = $this->append($tmp,"?")

//		else{
//			if(!(substr($tmp, -1) === '&'))
//				$tmp = $this->append($tmp,'&');
//		}
//		if($this->show_past_events)
//			$tmp = $this->append($tmp,'futureevents=false&');
//		else
//			$tmp = $this->append($tmp,'futureevents=true&');
//		if($this->sort_ascending)
//			$tmp = $this->append($tmp,'sortorder=ascending&');
//		else
//			$tmp = $this->append($tmp,'sortorder=descending&');
//		if($this->orderby_by_start_date)
//			$tmp = $this->append($tmp,'orderby=starttime&');
//		else
//			$tmp = $this->append($tmp,'orderby=lastmodified&');
//		if($this->expand_single_events)
//			$tmp = $this->append($tmp,'singleevents=true&');
//		else
//			$tmp = $this->append($tmp,'singleevents=false&');
//		return $tmp;
	}
// Retrieve the  value.
function get_gcal_starttime($format = false)
{
	// We want to grab the Google-namespaced  tag.
	// http://simplepie.org/wiki/tutorial/grab_custom_tags_or_attributes
	$when = $this->get_item_tags('http://schemas.google.com/g/2005', 'when');

	// Once we grab the tag, let's grab the startTime attribute
	$date = $when[0]['attribs']['']['startTime'];

	if ($format)
	{
		// Let's pass it through strtotime() and then format it with date(). This will be the date we display.
		return date($format, strtotime($date));
	}
	else
	{
		// Otherwise we'll return it as-is with no modifications.
		return $date;
	}
}
function get_gcal_endtime($format = false)
{
	// We want to grab the Google-namespaced  tag.
	// http://simplepie.org/wiki/tutorial/grab_custom_tags_or_attributes
	$when = $this->get_item_tags('http://schemas.google.com/g/2005', 'when');

	// Once we grab the tag, let's grab the startTime attribute
	$date = $when[0]['attribs']['']['endTime'];

	if ($format)
	{
		// Let's pass it through strtotime() and then format it with date(). This will be the date we display.
		return date($format, strtotime($date));
	}
	else
	{
		// Otherwise we'll return it as-is with no modifications.
		return $date;
	}
	
}
function get_gcal_where()
{
	// We want to grab the Google-namespaced  tag.
	// http://simplepie.org/wiki/tutorial/grab_custom_tags_or_attributes
	$where = $this->get_item_tags('http://schemas.google.com/g/2005','where');
	
// Once we grab the tag, let's grab the startTime attribute
	return $where[0]['attribs']['']['valueString'];
	
}
/**
This is an example of modifying an existing method of an existing class.
 */

function get_id()
{
	return $this->__toString();
}

}
$feed = new SimplePie('http://www.google.com/calendar/feeds/ford.plymouth.sch.uk_fcbr34ae6jag4pah8oogd7id50%40group.calendar.google.com/private-9b334582e4341761e0cc732328184757/full?futureevents=true');
$feed->handle_content_type();
$feed->set_item_class('SimplePie_Item_Extras');
$feed->init();
$feed->handle_content_type();
?>






Super Duper News Scroller





	
	
		get_items(0, 15) as $item) : ?>
		
			get_title(); ?>
			

				Date get_gcal_starttime('j F Y'); ?>

				Time get_gcal_starttime('h:i') =='12:00'){echo "all day";}
				else 
				{echo $item->get_gcal_starttime('H:i');echo' - ';echo $item->get_gcal_endtime('H:i');}?>

				Event get_content('j F Y H:i'); ?>

				Location get_gcal_where($string); ?>
			
		
		
	





<br />
	$('#widget').newsScroll({<br />
		speed: 2000,<br />
		delay: 5000<br />
	});<br />
	<br />
	// or just call it like:<br />
	// $('#widget').newsScroll();<br />



at the moment you need to change Parents Calander manually as a lot of the code does not work i have zipped the other files if anyone else wants a play.

I have used various of open sources to create this I just want to make it easier for other people to use.

gcalander.zip

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...