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.
Gold and Silver members can add posts here directly.
Re: Exporting jEvent's events iCal
by hifi » Sun Mar 22, 2009 5:14 pm
OK, finally had time to think this... how about following solution:
Still needs that frontend form/something to pick up just categories wanted to. Currently just using that directly with URL: index.php?option=com_jevents&task=modlatest.ical&format=ical&class=
- Code: Select all
function ical() {
function loadIcal() {
$database =& JFactory::getDBO();
$q = "
SELECT ved.*, ve.uid, ve.created, vr.*
FROM #__jevents_vevdetail ved, #__jevents_vevent ve
LEFT JOIN #__jevents_rrule vr ON ve.detail_id = vr.eventid
WHERE ved.evdet_id = ve.detail_id AND ve.access=0";
if (isset($_GET['class']) && $_GET['class'] != "") {
$q = $q." AND ved.class='".$_GET['class']."'";
}
if (isset($_GET['catid']) && $_GET['catid'] != "") {
$q = $q." AND ve.catid='".$_GET['catid']."'";
}
if (isset($_GET['year']) && $_GET['year'] != "") {
$q = $q." AND (ved.dtstartraw LIKE '%".$_GET['year']."%' OR ved.untilraw LIKE '%".$_GET['year']."%')";
}
$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" ?>
<?php
if($a->freq != "") echo 'RRULE:';
if($a->freq != "") echo 'FREQ='.$a->freq.";";
if($a->untilraw != "") echo 'UNTIL='.$a->untilraw.";";
if($a->count != "") echo 'COUNT='.$a->count.";";
if($a->rintelval != "") echo 'RINTELVAL='.$a->rintelval.";";
if($a->bysecond != "") echo 'BYSECOND='.$a->bysecond.";";
if($a->byminute != "") echo 'BYMINUTE='.$a->byminute.";";
if($a->byhour != "") echo 'BYHOUR='.$a->byhour.";";
if($a->byday != "") echo 'BYDAY='.$a->byday.";";
if($a->bymonthday != "") echo 'BYMONTHDAY='.$a->bymonthday.";";
if($a->byyearday != "") echo 'BYYEARDAY='.$a->byyearday.";";
if($a->byweekno != "") echo 'BYWEEKNO='.$a->byweekno.";";
if($a->bymonth != "") echo 'NYMONTH='.$a->bymonth.";";
if($a->bysetpos != "") echo 'BYSETPOS='.$a->bysetpos.";";
if($a->wkst != "") echo 'WKST='.$a->wkst.";";
?>
END:VEVENT
<?php
}
?>
END:VCALENDAR
<?php
}
Still needs that frontend form/something to pick up just categories wanted to. Currently just using that directly with URL: index.php?option=com_jevents&task=modlatest.ical&format=ical&class=
- hifi
- Contributor
- Posts: 87
- Joined: Tue Oct 28, 2008 6:29 am
Re: Exporting jEvent's events iCal
by hifi » Thu Apr 02, 2009 9:50 am
Has anyone tested this? Or do you need UI for this too?
- hifi
- Contributor
- Posts: 87
- Joined: Tue Oct 28, 2008 6:29 am
Re: Exporting jEvent's events iCal
by Geraint » Thu Apr 02, 2009 10:58 am
Looking at the code it it should work fine - I intend to take a closer look after 1.5 is released. We will ultimately need to incorporate exceptions into the extract - that will take a bit of time and thought.
Geraint
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!
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!
-

Geraint - Posts: 30529
- Joined: Fri Feb 15, 2008 6:14 pm
Re: Exporting jEvent's events iCal
by erwin » Sat Apr 25, 2009 7:15 am
Hi,
what about using an existing class like the iCalcreator class (http://www.kigkonsult.se/index.php)
I'm new here, just wondering.
-erwin
what about using an existing class like the iCalcreator class (http://www.kigkonsult.se/index.php)
I'm new here, just wondering.
-erwin
- erwin
- Posts: 1
- Joined: Sat Apr 25, 2009 7:12 am
Re: Exporting jEvent's events iCal
by ricardo.cristof » Wed Apr 29, 2009 8:08 am
hifi wrote:
- 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).
Hi,
put this code at the and of the file /components/com_jevents/controllers/modlatest.php, but in the frontend, I do not see any possibility to get an ical-file.
What did I miss?
Best regards,
Ricardo Cristof
-

ricardo.cristof - Posts: 22
- Joined: Wed Mar 25, 2009 11:04 am
- Location: Germany
Re: Exporting jEvent's events iCal
by hifi » Wed Apr 29, 2009 8:17 am
As I said:
So there's no button, that can be called only directly with that address.
Still needs that frontend form/something to pick up just categories wanted to. Currently just using that directly with URL: index.php?option=com_jevents&task=modlatest.ical&format=ical&class=
So there's no button, that can be called only directly with that address.
- hifi
- Contributor
- Posts: 87
- Joined: Tue Oct 28, 2008 6:29 am
Re: Exporting jEvent's events iCal
by ricardo.cristof » Wed Apr 29, 2009 8:47 am
Hi,
thank you for the quick reply! Yes, i missed that, sorry!
but calling http://www.aktion-freiheitstattangst.org/index.php?option=com_jevents&task=modlatest.ical&format=ical&class= leads to an error 500.
Hm... what did I screw up now?
Best regards,
Ricardo Cristof
thank you for the quick reply! Yes, i missed that, sorry!
but calling http://www.aktion-freiheitstattangst.org/index.php?option=com_jevents&task=modlatest.ical&format=ical&class= leads to an error 500.
Hm... what did I screw up now?
Best regards,
Ricardo Cristof
-

ricardo.cristof - Posts: 22
- Joined: Wed Mar 25, 2009 11:04 am
- Location: Germany
Re: Exporting jEvent's events iCal
by hifi » Mon Jun 08, 2009 9:01 am
Should this be moved to new features thread? Or should "most important parts" of this be written to new message in that thread?
- hifi
- Contributor
- Posts: 87
- Joined: Tue Oct 28, 2008 6:29 am
Re: Exporting jEvent's events iCal
by Geraint » Sun Sep 13, 2009 1:03 pm
JEvents 1.5.3 preview (available to club members) now incorporates iCal exports (thanks to HiFi for the groundwork on this!)
------------
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!
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!
-

Geraint - Posts: 30529
- Joined: Fri Feb 15, 2008 6:14 pm
19 posts
• Page 2 of 2 • 1, 2
Return to Feature Requests/Suggestions
Who is online
Users browsing this forum: No registered users

