CGCalendar not displaying all events

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
freakstar

CGCalendar not displaying all events

Post by freakstar »

Placed {cms_module module="CGCalendar"} in a page but only one day of the displayed month is "enabled" as an day with an event.

Slightly modified the default template so only de day of week becomes a link to the summary page:

Code: Select all

{if !isset($smarty.get.nojs)}
<__script__ type="text/javascript">{jsmin}
// the jsmin plugin is included with CGExtensions.
if( typeof jQuery != 'undefined' ) {
  $(document).ready(function(){
    $(document).on('click','a.calendar-nav',function(ev){
      // allow paginating through months via ajax.
      var url = $(this).attr('href').replace(/amp;/g,'')+'nojs=1&showtemplate=false';
      $('#cal-calendar').load(url);
      ev.preventDefault();
    });

    if( jQuery().dialog ) {
      $(document).on('click','a.calendar-daylist',function(ev){
        // demonstrate viewing a day list in a popup dialog
        // and mixing smarty and javascript code.
        // uses jquery ui dialog... but could just as easily use fancybox etc.
        // you could add parameters here for changing the template from the default, etc, or even filter by category.
        ev.preventDefault();
        var day = new Date( $(this).data('day') * 1000 );
        var m = day.getMonth()+1;
        var d = day.getDate();
        var y = day.getFullYear();
        var url = '{module_action_link module=CGCalendar display=list day=DDDD  month=MMMM year=YYYY jsfriendly=1}&showtemplate=false';
        url = url.replace('MMMM',m).replace('DDDD',d).replace('YYYY',y);
        $('#cal-dayview').load(url,function(data){
          $('#cal-dayview').dialog({
            title: '{$mod->Lang('dayview')}'
          })
        });
      });
    }
  })
} // jquery test
{/jsmin}</__script>
{/if}

{strip}
<div style="display: none;">{* a simple wrapper *}
  <div id="cal-dayview"></div>
</div>
<table class="calendar" id="cal-calendar">
<caption class="calendar-month">
   <span class="calendar-prev"><a class="calendar-nav" href="{$navigation.prev}">&laquo;</a></span>
     {$date|date_format:'%b %Y'}
   <span class="calendar-next"><a class="calendar-nav" href="{$navigation.next}">&raquo;</a></span>
</caption>
<tbody><tr>
{foreach from=$day_names item=day key=key}
<th class="cal-dayhdr" abbr="{$day}">{$day_short_names[$key]}</th>
{/foreach}</tr>

<tr>
{* initial empty days *}
{if $first_of_month_weekday_number > 0}
<td colspan="{$first_of_month_weekday_number}">&nbsp;</td>
{/if}

{* iterate over the days of this month *}
{assign var=weekday value=$first_of_month_weekday_number}
{foreach from=$days item=day key=key}
{if $weekday == 7}
  {assign var=weekday value=0}
</tr>
<tr>
{/if}
<td {if isset($day.class)}class="{$day.class} cal-day"{/if}>
{if isset($day.events.0)}<a class="calendar-daylist" data-day="{$day.date}" href="{$day.ni_url}"><b>{$key}</b></a>{* by default use the non inline (replace content tag) version of the URL *}

{else}{$key}{/if}
</td>
{math assign=weekday equation="x + 1" x=$weekday}
{/foreach}

{* remaining empty days *}
{if $weekday != 7}
<td colspan="{math equation="7-x" x=$weekday}">&nbsp;</td>
{/if}


</tr>
</tbody></table>

{/strip}
But also with the default template the issue occurs.

When I use {cms_module module="CGCalendar" display="list"} I can see the selected month has 10+ events in it.

Any thoughts?
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Contact:

Re: CGCalendar not displaying all events

Post by paulbaker »

Have you upgraded CGCalendar recently? It has gone through some major changes in the last few months. And post your system information.
To copy System Information to the forum:
https://docs.cmsmadesimple.org/troubles ... nformation

CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016
freakstar

Re: CGCalendar not displaying all events

Post by freakstar »

It is a recent installation, only deviation is that I imported most of the events via a MySQL restore. Did some tweaking to get that working. But tried also creating new events, still only one event per month is displayed.

(relevant) version information:
CMSMS 1.12
CGSimpleSmarty 1.9
CGExtensions 1.48
CGCalendar 1.14.7
PHP 5.6.6
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Contact:

Re: CGCalendar not displaying all events

Post by paulbaker »

freakstar wrote:It is a recent installation, only deviation is that I imported most of the events via a MySQL restore.
My guess is that the error is to do with your restore.

I wonder if it is that table cms_module_cgcalendar_events_seq is not populated with the id of the latest calendar entry? If so, strangely similar to this recent thread about another CG module.
To copy System Information to the forum:
https://docs.cmsmadesimple.org/troubles ... nformation

CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016
freakstar

Re: CGCalendar not displaying all events

Post by freakstar »

Looks like that is fixing something, raised the id to the current id and now new items are displayed. Except existing items, but I can't find any relation to those?
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Contact:

Re: CGCalendar not displaying all events

Post by paulbaker »

Perhaps the id of the category in the events table doesn't match up with the categories available, something like that? I would be carefully comparing the new and existing rows in the events table and seeing what the differences are.
To copy System Information to the forum:
https://docs.cmsmadesimple.org/troubles ... nformation

CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016
Post Reply

Return to “Modules/Add-Ons”