show username of the body who shares in the summary

This commit is contained in:
Georg Ehrke 2012-06-13 22:06:22 +02:00
parent 12b34d2dda
commit 6bd80d6457
2 changed files with 9 additions and 7 deletions

View File

@ -27,7 +27,6 @@ else {
$start = (version_compare(PHP_VERSION, '5.3.0', '>='))?DateTime::createFromFormat('U', $_GET['start']):new DateTime('@' . $_GET['start']); $start = (version_compare(PHP_VERSION, '5.3.0', '>='))?DateTime::createFromFormat('U', $_GET['start']):new DateTime('@' . $_GET['start']);
$end = (version_compare(PHP_VERSION, '5.3.0', '>='))?DateTime::createFromFormat('U', $_GET['end']):new DateTime('@' . $_GET['end']); $end = (version_compare(PHP_VERSION, '5.3.0', '>='))?DateTime::createFromFormat('U', $_GET['end']):new DateTime('@' . $_GET['end']);
$events = OC_Calendar_App::getrequestedEvents($calendar_id, $start, $end); $events = OC_Calendar_App::getrequestedEvents($calendar_id, $start, $end);
$output = array(); $output = array();
foreach($events as $event){ foreach($events as $event){
$output = array_merge($output, OC_Calendar_App::generateEventOutput($event, $start, $end)); $output = array_merge($output, OC_Calendar_App::generateEventOutput($event, $start, $end));

View File

@ -331,26 +331,29 @@ class OC_Calendar_App{
*/ */
public static function getrequestedEvents($calendarid, $start, $end){ public static function getrequestedEvents($calendarid, $start, $end){
$events = array(); $events = array();
if($calendarid == 'shared_rw' || $_GET['calendar_id'] == 'shared_r'){ if($calendarid == 'shared_rw' || $calendarid == 'shared_r'){
$calendars = OC_Calendar_Share::allSharedwithuser(OCP\USER::getUser(), OC_Calendar_Share::CALENDAR, 1, ($_GET['calendar_id'] == 'shared_rw')?'rw':'r'); $calendars = OC_Calendar_Share::allSharedwithuser(OCP\USER::getUser(), OC_Calendar_Share::CALENDAR, 1, ($_GET['calendar_id'] == 'shared_rw')?'rw':'r');
foreach($calendars as $calendar){ foreach($calendars as $calendar){
$calendarevents = OC_Calendar_Object::allInPeriod($calendar['calendarid'], $start, $end); $calendarevents = OC_Calendar_Object::allInPeriod($calendar['calendarid'], $start, $end);
foreach($calendarevents as $event){
$event['summary'] .= ' (' . self::$l10n->t('by') . ' ' . OC_Calendar_Object::getowner($event['id']) . ')';
}
$events = array_merge($events, $calendarevents); $events = array_merge($events, $calendarevents);
} }
$singleevents = OC_Calendar_Share::allSharedwithuser(OCP\USER::getUser(), OC_Calendar_Share::EVENT, 1, ($_GET['calendar_id'] == 'shared_rw')?'rw':'r'); $singleevents = OC_Calendar_Share::allSharedwithuser(OCP\USER::getUser(), OC_Calendar_Share::EVENT, 1, ($_GET['calendar_id'] == 'shared_rw')?'rw':'r');
foreach($singleevents as $singleevent){ foreach($singleevents as $singleevent){
$event = OC_Calendar_Object::find($singleevent['eventid']); $event = OC_Calendar_Object::find($singleevent['eventid']);
$event['summary'] .= ' (' . self::$l10n->t('by') . ' ' . OC_Calendar_Object::getowner($event['id']) . ')';
$events[] = $event; $events[] = $event;
} }
}else{ }else{
$calendar_id = $_GET['calendar_id']; if (is_numeric($calendarid)) {
if (is_numeric($calendar_id)) { $calendar = self::getCalendar($calendarid);
$calendar = self::getCalendar($calendar_id);
OCP\Response::enableCaching(0); OCP\Response::enableCaching(0);
OCP\Response::setETagHeader($calendar['ctag']); OCP\Response::setETagHeader($calendar['ctag']);
$events = OC_Calendar_Object::allInPeriod($calendar_id, $start, $end); $events = OC_Calendar_Object::allInPeriod($calendarid, $start, $end);
} else { } else {
OCP\Util::emitHook('OC_Calendar', 'getEvents', array('calendar_id' => $calendar_id, 'events' => &$events)); OCP\Util::emitHook('OC_Calendar', 'getEvents', array('calendar_id' => $calendarid, 'events' => &$events));
} }
} }
return $events; return $events;