}
                    $data = $vcalendar->serialize();
                    $oldobject = \OC_Calendar_Object::find($taskId);
                    $object = \OC_VObject::parse($data);
                    $type = 'VTODO';
                    $startdate = null;
                    $enddate = null;
                    $summary = '';
                    $repeating = 0;
                    $uid = null;
                    foreach ($object->children as $property) {
                        if ($property->name == 'VTODO') {
                            foreach ($property->children as &$element) {
                                if ($element->name == 'SUMMARY') {
                                    $summary = $element->value;
                                } elseif ($element->name == 'UID') {
                                    $uid = $element->value;
                                }
                            }
                            break;
                        }
                    }
                    $stmt = OCP\DB::prepare('UPDATE `*PREFIX*clndr_objects` SET `objecttype`=?,`startdate`=?,`enddate`=?,`repeating`=?,`summary`=?,`calendardata`=?,`lastmodified`= ? WHERE `id` = ?');
                    $stmt->execute(array($type, $startdate, $enddate, $repeating, $summary, $data, time(), $taskId));
                    \OC_Calendar_Calendar::touchCalendar($oldobject['calendarid']);
                }
            }
        }
    } catch (\Exception $e) {
    }
}
示例#2
0
 public static function moveToCalendar($id, $calendarid)
 {
     $calendar = OC_Calendar_Calendar::find($calendarid);
     if ($calendar['userid'] != OCP\User::getUser()) {
         $sharedCalendar = OCP\Share::getItemSharedWithBySource('calendar', $calendarid);
         if (!$sharedCalendar || !($sharedCalendar['permissions'] & OCP\PERMISSION_DELETE)) {
             throw new Exception(OC_Calendar_App::$l10n->t('You do not have the permissions to add events to this calendar.'));
         }
     }
     $stmt = OCP\DB::prepare('UPDATE `*PREFIX*clndr_objects` SET `calendarid`=? WHERE `id`=?');
     $stmt->execute(array($calendarid, $id));
     OC_Calendar_Calendar::touchCalendar($calendarid);
     OCP\Util::emitHook('OC_Calendar', 'moveEvent', $id);
     return true;
 }
 public static function moveToCalendar($id, $calendarid)
 {
     $stmt = OC_DB::prepare('UPDATE *PREFIX*calendar_objects SET calendarid=? WHERE id = ?');
     $result = $stmt->execute(array($calendarid, $id));
     OC_Calendar_Calendar::touchCalendar($id);
     return true;
 }