mxCalendar icon indicating copy to clipboard operation
mxCalendar copied to clipboard

Don't display repeats in list view

Open estrata opened this issue 11 years ago • 6 comments

I'd like to only display the first instance of an event in the list view, and not the repeats. Is this possible?

estrata avatar Feb 11 '14 16:02 estrata

change the Snippet mxcalendar

around line 96 after: //++ Form Chunk Filter match name $formFilter = $modx->getOption('formFilter',$scriptProperties,'form_')

insert the following lines:

//Filter against categories $categoryFilter = isset($_REQUEST['calf']) ? $_REQUEST['calf'] : $modx->getOption('categoryFilter', $scriptProperties, null); //-- Default: show all categories //Filter against reoccuring events $reoccuringFilter = isset($_REQUEST['calf']) ? $_REQUEST['calf'] : $modx->getOption('reoccuringFilter', $scriptProperties, null); //-- Default: show all reoccuring events

After that, you can use the following parameters:

Filters against categories &categoryFilter = 1,2,3

If 1 only the first event will be listed &reoccuringFilter = 1

MacConin avatar Feb 11 '14 17:02 MacConin

I'm afraid it doesn't seem to be working... still showing all reoccurances.

estrata avatar Feb 15 '14 04:02 estrata

did you modified the snippet (within the MODX backend)?

What is your snippet call ?

MacConin avatar Feb 15 '14 09:02 MacConin

This isn't working for me either. Verified update to the mxcalendar snippet and cleared the cache.

MacConin: I may be missing something, but this code sets those two variables - where's the part of the code that acts on those values to change the output of the snippet?

My call is: [[!mxcalendar? &resourceId=2162 &tplListItem=mxCalendarListItem &tplListHeading=mxCalendarListHeading &tplListWrap=mxCalendarListWrap &displayType=list &eventListlimit=999 &dir=ASC &elEndDate=+10 years &reoccuringFilter=1]]

jcdm avatar Feb 23 '14 11:02 jcdm

Ah, sry.

around line 170 //-- ADD IN THE CONTEXT AND CALENDAR PROPERTY FILTERS $whereArr['AND:context:IN'] = explode(',',$contextFilter); if(!empty($calendarFilter)) $whereArr['AND:calendar_id:IN'] = explode(',',$calendarFilter);

ADD the following: if(!empty($categoryFilter)) $whereArr['AND:CategoryId.id:IN'] = explode(',',$categoryFilter);

around line 259 - checking for the reoccuring filter and skip that loop:

//-- If we have repeating dates and repeating is enabled lets add those to

the array if($mxcArray['repeating'] && count(explode(',', $mxcArray['repeatdates']))){

    //-- If reoccuringFilter is set, skip here
    if($reoccuringFilter != 1 ) {

        if($debug) echo 'Repeating Event: '.$mxcArray['title'].'<br />';
        if($debug) echo '&nbsp;&nbsp;&nbsp;++(0)&nbsp;&nbsp;'.strftime($dateFormat.'

'.$timeFormat, $mxcArray['startdate']).'
'; $rid = 1; foreach(explode(',',$mxcArray['repeatdates']) AS $rDate){ $arrEventDates[$mxcArray['id'].'-'.$rid] = array('date'=>$rDate, 'eventId'=>$mxcArray['id'],'repeatId'=>$rid); if($debug) echo '   ++('.$rid.')  '.strftime($dateFormat.' '.$timeFormat, $rDate).'
'; $rid++; } } } //$output .= $mxcal->getChunk($tpl,$mxcArray); }

around line 321 //----- NOW GET THE DISPLAY TYPE ------// switch ($displayType){ case 'list': $output = $mxcal->makeEventList($eventListLimit, $eventsArr, array('tplElItem'=>$tplElItem, 'tplElMonthHeading'=>$tplElMonthHeading, 'tplElWrap'=>$tplElWrap)); break; case 'calendar': case 'mini': default:

change the following line to: $output = $mxcal->makeEventCalendar($eventsArr,(!empty($ajaxResourceId) && $modalView? $ajaxResourceId : $resourceId),(!empty( $ajaxMonthResourceId) ? $ajaxMonthResourceId : (!empty($ajaxResourceId) ? $ajaxResourceId : $resourceId) ),array('event'=>$tplEvent,'day'=>$tplDay,'week'=>$tplWeek,'month'=>$tplMonth,'heading'=>$tplHeading), $contextFilter, $calendarFilter, $categoryFilter, $highlightToday);

Josh schrieb uns am 23.02.14 12:16:

This isn't working for me either. Verified update to the mxcalendar snippet and cleared the cache.

MacConin: I may be missing something, but this code sets those two variables - where's the part of the code that acts on those values to change the output of the snippet?

— Reply to this email directly or view it on GitHub https://github.com/CharlesMx/mxCalendar/issues/147#issuecomment-35829292.

MacConin avatar Feb 24 '14 08:02 MacConin

Exposing a parameter that will allow disabling of the repeat dates of a given event in the list view.

CharlesMx avatar Feb 28 '14 05:02 CharlesMx