Commit e5f1dfb0 authored by sampaioprimo's avatar sampaioprimo

[FIX] module calendar_new display items when in list mode

parent ddcec70f
......@@ -833,7 +833,19 @@ class CalendarLib extends TikiLib
$daysnames_abr[] = tra('Su');
}
}
function getCalendar($calIds, &$viewstart, &$viewend, $group_by = '', $item_name = 'events') {
/**
* Get calendar and its events
*
* @param $calIds
* @param $viewstart
* @param $viewend
* @param $group_by
* @param $item_name
* @param bool $listmode if set to true populate listevents key of the returned array
* @return array
*/
function getCalendar($calIds, &$viewstart, &$viewend, $group_by = '', $item_name = 'events', $listmode = false) {
global $user, $prefs, $smarty;
// Global vars used by tiki-calendar_setup.php (this has to be changed)
......@@ -968,7 +980,7 @@ $request_year, $dayend, $myurl;
}
}
if ( isset($_SESSION['CalendarViewList']) && $_SESSION['CalendarViewList'] == 'list' ) {
if ((isset($_SESSION['CalendarViewList']) && $_SESSION['CalendarViewList'] == 'list') || $listmode) {
if ( is_array($listtikievents) ) {
foreach ( $listtikievents as $le ) {
if ( is_array($le) ) {
......
......@@ -125,13 +125,12 @@ function module_calendar_new( $mod_reference, $module_params ) {
}
if ( !empty($calIds) ) {
$tc_infos = $calendarlib->getCalendar($calIds, $viewstart, $viewend, 'day');
$tc_infos = $calendarlib->getCalendar($calIds, $viewstart, $viewend, 'day', 'events', true);
if ($_REQUEST['viewlistmodule'] == 'list') {
foreach ($tc_infos['listevents'] as $i=>$e) {
$tc_infos['listevents'][$i]['head'] = '';
$tc_infos['listevents'][$i]['group_description'] ='';
}
$tc_infos['listevents'] = array_unique($tc_infos['listevents']);
}
foreach ( $tc_infos as $tc_key => $tc_val ) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment