Calendar Module - Just show today's events? -- A UDT Solution?

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
irasanborn
Forum Members
Forum Members
Posts: 14
Joined: Tue Jun 10, 2008 4:12 pm

Calendar Module - Just show today's events? -- A UDT Solution?

Post by irasanborn »

I've searched the forum, but I couldn't find anything about this specific topic, so here is my question:

Is there a way to just show today's events for the Calendar Module? Perhaps a custom template I could add?

CMSMS ver 1.3, Calendar ver 0.8.2
Last edited by irasanborn on Tue Jun 24, 2008 1:01 pm, edited 1 time in total.
Russ
Power Poster
Power Poster
Posts: 813
Joined: Fri Nov 25, 2005 5:02 pm

Re: Calendar Module - Just show today's events?

Post by Russ »

Hi irasanborn, I felt sure you could do this with Calendar, but looking through the module help and the forum, it would appear not? You could log a request for this as a new feature, or just write yourself a user tag to get the data out of Calendar?
irasanborn
Forum Members
Forum Members
Posts: 14
Joined: Tue Jun 10, 2008 4:12 pm

Re: Calendar Module - Just show today's events?

Post by irasanborn »

Ahh well, I was afraid of that. I added it as a feature request. Hopefully the dev's can incorporate that functionality at some point.

In the meantime, since I'm just learning about UDTs, how might you suggest I go about pulling data from the Calendar Module with a UDT?

Thanks in advance.
Russ
Power Poster
Power Poster
Posts: 813
Joined: Fri Nov 25, 2005 5:02 pm

Re: Calendar Module - Just show today's events? -- A UDT Solution?

Post by Russ »

I'd have a look at one of the list templates for Calendar and see if you can use Smarty to limit the array to todays date?

As for UDT maybe something like below - you'd have to do some other stuff and format the output a bit better (which is why the Smarty template way is by far the best!) Warning this is very rough and ready and not really tested!!

Code: Select all

//CalToday UDT
global $gCms;
$config = $gCms->config;
//Get Timestamps
$sToday =  date('Y-m-d',time())." 00:00:00"; //Start of today
$eToday =  date('Y-m-d',time())." 23:59:59"; //End of of today
//Get Calendar Event Information from the database
$prefix = $config['db_prefix']; // Database Prefix
$db =&$gCms->db;
//SQL Statement
$Get_Today_Cal  = "SELECT event_id, event_title, event_summary, event_details, event_date_start, event_date_end, event_parent_id,event_recur_period, event_date_recur_end, event_created_by, event_create_date, event_modified_date FROM `" . $prefix . "module_calendar_events` WHERE `event_date_start` BETWEEN '$sToday' AND '$eToday';";

$sql = mysql_query($Get_Today_Cal) or die("Unexpected Error: Database or access problem?:   ".mysql_error());

//Get data and display

	While ($row = mysql_fetch_assoc($sql))
	{
		//Only some of the event details is shown here
		echo "<h3>".$row['event_title']."</h3>";
		echo "<p>Summary: ".$row['event_summary']."<br/>";
		echo "<p>Details: ".$row['event_details']."<br/>";
		echo "<p>Start: ".$row['event_date_start']."<br/>";
		echo "<p>End: ".$row['event_date_end']."</p>";
		echo "<hr/>";
	}
Hope this helps,
Russ
irasanborn
Forum Members
Forum Members
Posts: 14
Joined: Tue Jun 10, 2008 4:12 pm

Re: Calendar Module - Just show today's events? -- A UDT Solution?

Post by irasanborn »

Thanks very much, I appreciate your help!

I'll start playing around with this code and post later on how everything works.
Post Reply

Return to “Modules/Add-Ons”