added function to export single events

This commit is contained in:
Georg Ehrke 2011-10-01 23:19:06 +02:00
parent f9824f6108
commit 0ebe9ad70c
2 changed files with 25 additions and 10 deletions

View file

@ -10,15 +10,29 @@ require_once ("../../lib/base.php");
OC_Util::checkLoggedIn(); OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('calendar'); OC_Util::checkAppEnabled('calendar');
$cal = $_GET["calid"]; $cal = $_GET["calid"];
$calendar = OC_Calendar_Calendar::findCalendar($cal); $event = $_GET["eventid"];
if($calendar["userid"] != OC_User::getUser()){ if(isset($cal)){
header( 'Location: '.OC_Helper::linkTo('', 'index.php')); $calendar = OC_Calendar_Calendar::findCalendar($cal);
exit; if($calendar["userid"] != OC_User::getUser()){
} OC_JSON::error();
$calobjects = OC_Calendar_Object::all($cal); exit;
header("Content-Type: text/Calendar"); }
header("Content-Disposition: inline; filename=calendar.ics"); $calobjects = OC_Calendar_Object::all($cal);
for($i = 0;$i <= count($calobjects); $i++){ header("Content-Type: text/Calendar");
echo $calobjects[$i]["calendardata"] . "\n"; header("Content-Disposition: inline; filename=calendar.ics");
for($i = 0;$i <= count($calobjects); $i++){
echo $calobjects[$i]["calendardata"] . "\n";
}
}elseif(isset($event)){
$data = OC_Calendar_Object::find($_GET["eventid"]);
$calendarid = $data["calendarid"];
$calendar = OC_Calendar_Calendar::findCalendar($calendarid);
if($calendar["userid"] != OC_User::getUser()){
OC_JSON::error();
exit;
}
header("Content-Type: text/Calendar");
header("Content-Disposition: inline; filename=" . $data["summary"] . ".ics");
echo $data["calendardata"];
} }
?> ?>

View file

@ -6,6 +6,7 @@
<span id="actions"> <span id="actions">
<input type="button" class="submit" style="float: left;" value="<?php echo $l->t("Submit");?>" onclick="Calendar.UI.validateEventForm('ajax/editevent.php');"> <input type="button" class="submit" style="float: left;" value="<?php echo $l->t("Submit");?>" onclick="Calendar.UI.validateEventForm('ajax/editevent.php');">
<input type="button" class="submit" style="float: left;" name="delete" value="<?php echo $l->t("Delete");?>" onclick="Calendar.UI.submitDeleteEventForm('ajax/deleteevent.php');"> <input type="button" class="submit" style="float: left;" name="delete" value="<?php echo $l->t("Delete");?>" onclick="Calendar.UI.submitDeleteEventForm('ajax/deleteevent.php');">
<input type="button" class="submit" style="float: right;" name="export" value="<?php echo $l->t("Export");?>" onclick="window.location='export.php?eventid=<?php echo $_['id'] ?>';">
</span> </span>
</form> </form>
</div> </div>