summaryrefslogtreecommitdiffstats
path: root/apps/calendar/lib
diff options
context:
space:
mode:
authorGeorg Ehrke <dev@georgswebsite.de>2012-02-11 14:02:51 +0100
committerGeorg Ehrke <dev@georgswebsite.de>2012-02-11 14:02:51 +0100
commitdb23ec5c1c8a58d63bd81bee007994090b0bcecf (patch)
tree57e9b1285c914613194fb533f718f8d8720de24b /apps/calendar/lib
parent66ac6c232c22181a9cd7b83518f802df81aea3e9 (diff)
downloadnextcloud-server-db23ec5c1c8a58d63bd81bee007994090b0bcecf.tar.gz
nextcloud-server-db23ec5c1c8a58d63bd81bee007994090b0bcecf.zip
show shared calendars
Diffstat (limited to 'apps/calendar/lib')
-rw-r--r--apps/calendar/lib/app.php15
-rw-r--r--apps/calendar/lib/share.php10
2 files changed, 20 insertions, 5 deletions
diff --git a/apps/calendar/lib/app.php b/apps/calendar/lib/app.php
index 6e92cf67c5c..27129e77e35 100644
--- a/apps/calendar/lib/app.php
+++ b/apps/calendar/lib/app.php
@@ -114,4 +114,19 @@ class OC_Calendar_App{
public static function getWeekofMonth(){
return OC_Calendar_Object::getWeekofMonth(self::$l10n);
}
+
+ public static function prepareForOutput($event, $vevent, $return_event){
+ $return_event['id'] = (int)$event['id'];
+ $return_event['title'] = htmlspecialchars($event['summary']);
+ $return_event['description'] = isset($vevent->DESCRIPTION)?htmlspecialchars($vevent->DESCRIPTION->value):'';
+ $last_modified = $vevent->__get('LAST-MODIFIED');
+ if ($last_modified){
+ $lastmodified = $last_modified->getDateTime()->format('U');
+ }else{
+ $lastmodified = 0;
+ }
+ $return_event['lastmodified'] = (int)$lastmodified;
+ return $return_event;
+
+ }
}
diff --git a/apps/calendar/lib/share.php b/apps/calendar/lib/share.php
index bbc8770f65a..33bf50f68ad 100644
--- a/apps/calendar/lib/share.php
+++ b/apps/calendar/lib/share.php
@@ -17,21 +17,21 @@ class OC_Calendar_Share{
* @param: (string) $type - use const self::CALENDAR or self::EVENT
* @return: (array) $return - information about calendars
*/
- public static function allSharedwithuser($userid, $type){
- $group_where = 'false';
+ public static function allSharedwithuser($userid, $type, $active=null){
+ $group_where = '';
$groups = OC_Group::getUserGroups($userid);
$i = 0;
foreach($groups as $group){
if($i == 0){
- $group_where = '';
+ $group_where = 'OR (';
}else{
$group_where .= ' OR ';
}
$group_where .= ' (share = "' . $group . '" and sharetype = "group") ';
$i++;
}
- $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . $type . ' WHERE (share = ? AND sharetype = "user") OR (' . $group_where . ')');
- $result = $stmt->execute(array($userid));
+ $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*calendar_share_' . $type . ' WHERE ((share = ? AND sharetype = "user") ' . $group_where . ') AND owner <> ?' . ((!is_null($active) && $active)?' AND active = 1':''));
+ $result = $stmt->execute(array($userid, $userid));
$return = array();
while( $row = $result->fetchRow()){
$return[] = $row;