Page 1 of 1

CGCalendar not displaying all events

Posted: Tue May 12, 2015 8:14 pm
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?

Re: CGCalendar not displaying all events

Posted: Sun May 31, 2015 11:53 pm
by paulbaker
Have you upgraded CGCalendar recently? It has gone through some major changes in the last few months. And post your system information.

Re: CGCalendar not displaying all events

Posted: Mon Jun 01, 2015 6:55 am
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

Re: CGCalendar not displaying all events

Posted: Mon Jun 01, 2015 2:49 pm
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.

Re: CGCalendar not displaying all events

Posted: Mon Jun 01, 2015 5:20 pm
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?

Re: CGCalendar not displaying all events

Posted: Mon Jun 01, 2015 11:03 pm
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.