J and Beyond 2013 | An International Joomla! Conference - May 31st - 2nd, 2013, Noordwijkerhout, The Netherlands
It is currently Sun May 19, 2013 6:26 am

Exporting jEvent's events iCal [in 1.5.3]

Proposed new features of merit and bugs to be fixed. Messages are moved here from the main forum by moderators.

Gold and Silver members can add posts here directly.

Exporting jEvent's events iCal [in 1.5.3]

Postby hifi » Mon Mar 09, 2009 8:37 am

I was just wondering, is it possible to load ical-file directly from jEvents? Or is there only possibility to include different iCals?
hifi
Contributor
Posts: 87
Joined: Tue Oct 28, 2008 6:29 am

Re: Exporting jEvent's events iCal

Postby Geraint » Mon Mar 09, 2009 8:51 am

At the moment you can import iCal data from URLs or local files. Exporting events in iCal format is currently not working - I plan to get onto this after 1.5 stable is released.
------------
JEvents club members can get priority forum support at the Support Forum. As well as access to a variety of custom JEvents addons and benefits.

Join the JEvents club today!
User avatar
Geraint
Posts: 30507
Joined: Fri Feb 15, 2008 6:14 pm

Re: Exporting jEvent's events iCal

Postby hifi » Fri Mar 13, 2009 8:21 am

Geraint wrote:At the moment you can import iCal data from URLs or local files. Exporting events in iCal format is currently not working - I plan to get onto this after 1.5 stable is released.


Have you made anything for this, or is it completely in "planned" stage? I have thought this this morning (problems with eg. categories, and how to solve that).

So, if you haven't thought this much yet, I might start move from thinking functionalities to thinking how to really code this.
hifi
Contributor
Posts: 87
Joined: Tue Oct 28, 2008 6:29 am

Re: Exporting jEvent's events iCal

Postby Geraint » Fri Mar 13, 2009 10:50 am

Any thoughts you may have on implementing this would be welcome.

We do store the RRULE and repetitions so the data is all there - what I'm missing is the time to get this done.
------------
JEvents club members can get priority forum support at the Support Forum. As well as access to a variety of custom JEvents addons and benefits.

Join the JEvents club today!
User avatar
Geraint
Posts: 30507
Joined: Fri Feb 15, 2008 6:14 pm

Re: Exporting jEvent's events iCal

Postby hifi » Sat Mar 14, 2009 2:37 pm

I encountered one problem... seems that iCal code breaks up immediately, when it hits to some HTML tags (or stops reading that parameter). Problem is, that jEvents is making HTML code. So, am I just missing some parameter/ical specification, or should the HTML code be somehow cleaned?
hifi
Contributor
Posts: 87
Joined: Tue Oct 28, 2008 6:29 am

Re: Exporting jEvent's events iCal

Postby hifi » Sat Mar 14, 2009 2:42 pm

Wrong "alert", reading stopped because of the line change... so all descriptions should be saved just one long line, so there's no problems to export those.'

EDIT: When realizing this was the problem, found quite fast how to fix this:
Code: Select all
DESCRIPTION:<?php echo preg_replace("/\n|\r\n|\r$/","", $a->description)."<br>".JText::_('JEV_EVENT_CONTACT').": ".$a->contact."<br>.".JText::_('JEV_EVENT_EXTRA').": ".$a->extra_info."\n" ?> 


If someone has better code to do this, please tell.
hifi
Contributor
Posts: 87
Joined: Tue Oct 28, 2008 6:29 am

Re: Exporting jEvent's events iCal

Postby hifi » Sun Mar 15, 2009 9:27 am

Code: Select all
function ical() {

function loadIcal() {
      $database =& JFactory::getDBO();
      $q  = "
         SELECT ved.*, ve.uid, ve.created, r.startrepeat, r.endrepeat
         FROM #__jevents_vevdetail ved, #__jevents_vevent ve, #__jevents_repetition r
         WHERE ved.evdet_id = ve.detail_id AND r.eventid = ved.evdet_id";
         if (isset($_GET['class']) && $_GET['class'] != "") {
         $class = $_GET['class'];
         $q = "
            SELECT *
            FROM #__jevents_vevdetail
            WHERE class='".$class."'";         
         }
      $database->setQuery( $q );
      $testi = $database->loadObjectList();
return $testi;
   }

$testi = loadIcal();
//echo $testi[0]->description;
//print_r($testi);

//echo '<h1>väli</h1>';

      header( 'Content-Type: text/calendar');
      header( 'Content-Disposition: inline; filename=testi.ics');
      ?>
BEGIN:VCALENDAR
VERSION:2.0
PRODID:WebCalendar
<?php
foreach($testi as $a) {
?>
BEGIN:VEVENT
UID:<?php echo $a->uid."\n";?>
CATEGORIES:<?php echo $a->categories."\n";?>
CLASS:<?php echo $a->class."\n";?>
DTSTAMP:<?php echo $a->dtstamp."\n";?>
CREATED:<?php echo $a->created."\n";?>
SUMMARY;ENCODING=QUOTED-PRINTABLE:<?php echo $a->summary."\n" ?>
LOCATION;ENCODING=QUOTED-PRINTABLE:<?php echo $a->location."\n" ?>
SEQUENCE:<?php echo $a->sequence."\n" ?>
DESCRIPTION:<?php echo preg_replace("/\n|\r\n|\r$/","", $a->description)."<br>"; if ($a->contact != "") echo JText::_('JEV_EVENT_CONTACT').": ".$a->contact."<br>."; if ($a->extra_info != "") echo JText::_('JEV_EVENT_EXTRA').": ".$a->extra_info; echo "\n"; ?>
TRANSP:OPAQUE
DTSTART:<?php echo preg_replace("/ /","T", preg_replace("/-|:/","",$a->startrepeat))."Z"."\n"; ?>
DTEND:<?php echo preg_replace("/ /","T", preg_replace("/-|:/","",$a->endrepeat))."Z"."\n" ?>
END:VEVENT
<?php
}
?>
END:VCALENDAR
<?php

}



This is what I have made, I put this code to controllert/modlatest.php (easiest way). What needs to be still done (at least):
    Times to check timezone
    Make some parameters, that allows users to create iCal file with just categories they want
hifi
Contributor
Posts: 87
Joined: Tue Oct 28, 2008 6:29 am

Re: Exporting jEvent's events iCal

Postby Geraint » Mon Mar 16, 2009 7:50 am

Cool - that should work fine.

What I was planning to do was use RRULE to define the main repetitions patterns and then specify the exclusions. If you have a lot of repetitions this would be better to management at the receiving end and save server load/bandwidth.

Geraint
------------
JEvents club members can get priority forum support at the Support Forum. As well as access to a variety of custom JEvents addons and benefits.

Join the JEvents club today!
User avatar
Geraint
Posts: 30507
Joined: Fri Feb 15, 2008 6:14 pm

Re: Exporting jEvent's events iCal

Postby hifi » Mon Mar 16, 2009 8:04 am

Ok, I'll check that maybe today. Actually made some modifications to code yesterday, that eg. empty "extra_info" or "contact" values are not added to description.

Maybe I'm able to give new code today evening, because next I have time to do something about this is thursday or friday.
hifi
Contributor
Posts: 87
Joined: Tue Oct 28, 2008 6:29 am

Re: Exporting jEvent's events iCal

Postby Geraint » Mon Mar 16, 2009 9:26 am

That would be great - if "we" can get this working we can get it into the 1.5 release :D .

Geraint
------------
JEvents club members can get priority forum support at the Support Forum. As well as access to a variety of custom JEvents addons and benefits.

Join the JEvents club today!
User avatar
Geraint
Posts: 30507
Joined: Fri Feb 15, 2008 6:14 pm

Next

Return to Feature Requests/Suggestions

Who is online

Users browsing this forum: No registered users

cron

Main Menu

User Menu

Hosted By


Who is online

In total there are 0 users online :: 0 registered and 0 hidden (based on users active over the past 5 minutes)
Most users ever online was 94 on Tue Sep 01, 2009 12:33 am

Users browsing this forum: No registered users

Login Form