Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't display repeats in list view #147

Open
estrata opened this issue Feb 11, 2014 · 6 comments
Open

Don't display repeats in list view #147

estrata opened this issue Feb 11, 2014 · 6 comments

Comments

@estrata
Copy link

estrata commented Feb 11, 2014

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

@MacConin
Copy link

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

@estrata
Copy link
Author

estrata commented Feb 15, 2014

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

@MacConin
Copy link

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

What is your snippet call ?

@jcdm
Copy link

jcdm commented Feb 23, 2014

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]]

@MacConin
Copy link

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
#147 (comment).

@CharlesMx
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants