eZ Community » Forums » Developer » calendar duplicate weeks to january...
expandshrink

calendar duplicate weeks to january and february

calendar duplicate weeks to january and february

Wednesday 25 April 2012 12:10:10 pm - 8 replies

Hello

something really strange is happening at my calender.

I use the month_overview operator to create a calendar using the defalut monthview.tpl it works well to all month except january and february. at those months the weeks are duplicated as you can see at this picture:

 

my site has ezwebin installed so when I create a event it doesn use the month view.tpl.

so I dont know how can i test this template in other situation, to see if it is the normal behaviour of this template. but this doesnt make sense, that's why I guess the problem is at my code but I cant find it.

somenone has any idea?

 

My code is :

 {def $anivers=fetch( 'content', 'list', hash('parent_node_id', $node.node_id,'sort_by', array( 'attribute', true(), 'contact/birthdate'),
                'class_filter_type',  'include','class_filter_array', array( 'contact' ),'main_node_only', true() ) ) }
 
                {def $d=$view_parameters.day
                 $counter=0
                 $m=$view_parameters.month
                 $y=$view_parameters.year
                 $has_aniver=0}
 
                {if eq($view_parameters.month, '')}
                    {set $m=currentdate()|datetime( custom, '%n')}
                {/if}
 
                {if eq($view_parameters.day, '')}
                    {set $d=currentdate()|datetime( custom, '%j')}
                {/if}
 
                {if eq($view_parameters.year, '')}
                    {set $y=currentdate()|datetime( custom, '%Y')}
                {/if}
 
                {*Navigation variable FINISH*}
 
 
                {let show_week=true()
                month=null
                month_list=array()}
 
                {for 1 to 31 as $day}{*number of day*}
                    {set $month_list = $month_list|append( hash('birthdate', maketime( 0, 0, 0, $m, $day, $y)))}
                {/for}
 
 
                {set $month=$month_list|month_overview( 'birthdate', 
                maketime( 0, 0, 0, $m, $d, $y),
                hash( current, maketime( 0, 0, 0, $m, $d, $y),
                current_class, 'selected',
                link, concat( '/content/view/text_linked/', $node.node_id ),
                next, hash( link, concat('/content/view/text_linked/', $node.node_id)),
                previous, hash( link, concat('/content/view/text_linked/', $node.node_id)) ) )} 
 
                {include uri="design:navigator/monthview.tpl"} 
 
                {/let}

Modified on Wednesday 25 April 2012 12:10:38 pm by M. Raja

Wednesday 25 April 2012 12:54:14 pm

Hi Raja

First, If I were you I would trysomething like:

 {def $last_day_time =  maketime( 0, 0, 0, $m|sum(1), 0, $y)}
{def $last_day = $last_day_time|datetime( custom, '%j')}{*that Normally gives the real last day of a month: eg 28/29 for february*}
{*EDIT or simply**}
{def $last_day = maketime( 0, 0, 0, $m|sum(1), 0, $y)|datetime( custom, '%j')}{*that Normally gives the real last day of a month: eg 28/29 for february*}
{for 1 to $last_day as $day}{*number of day*}
    {** stufs **}
{/for}

But wy don't you simply use

 {fetch('content', 'calendar', hash(....))}

Modified on Wednesday 25 April 2012 12:56:14 pm by Ousmane KANTE

Wednesday 25 April 2012 2:23:33 pm

I not using the :

 $month_list=fetch('contect', 'calendar',hash)

because I read at documentation that This function fetches the date time list when objects were published, but I doont need the published date I need the birthdate of my concat class ( the class that I create) and when i try to use it my days are not links that's my code tryingo to use it:

 

{set $month_list=fetch( 'content', 'calendar',hash( 'parent_node_id',234,   
                  'class_filter_type','include',
                'class_filter_array','contact'))    
                }

the 234 is the node_id of a folder where I keep my contact objects.

Maybe Im wryting my fetch incorrectly.

 

<span style="color: #66cc66;">{</span><a href="http://doc.ez.no/fetch" target="ez_no_documentation"><span style="color: #0600ff;">fetch</span></a><span style="color: #66cc66;">(</span><span style="color: #dd0000;">'content'</span>, <span style="color: #dd0000;">'calendar'</span>, <a href="http://doc.ez.no/hash" target="ez_no_documentation"><span style="color: #0600ff;">hash</span></a><span style="color: #66cc66;">(</span>....<span style="color: #66cc66;">)</span><span style="color: #66cc66;">)</span><span style="color: #66cc66;">}</span>

 

$month_list=fetch( 'content', 'calendar',hash

Modified on Wednesday 25 April 2012 2:26:53 pm by M. Raja

Wednesday 25 April 2012 2:30:53 pm

Ok. understood blunk.gif Emoticon

What about the given code Above?

Wednesday 25 April 2012 2:54:09 pm

I tried it now but the problem persists I have tried {foreach 1 to 10}, just to test and the problem still persists the only diference is that 1 to 1o is linkable and the rest are not but the calendar is still unconfigured.I guess the problem are not the limit of days.

Wednesday 25 April 2012 4:56:54 pm

Quote from M. Raja :

I tried it now but the problem persists I have tried {foreach 1 to 10}, just to test and the problem still persists the only diference is that 1 to 1o is linkable and the rest are not but the calendar is still unconfigured.I guess the problem are not the limit of days.

OK, I will have a quick look at it when I have 1min

Wednesday 25 April 2012 5:04:04 pm

Can You upload your resultfile (I mean tpl output) somewhere? my output is OK.

Thursday 26 April 2012 10:24:57 am

really strange your output works well.

 

my output:

 

 

 

I copied my image from paint and paste it at forum editor but when i save it disappears

I cant show my output.

 

by the week column is like this:

05

6

06

7

07

8

08

9

09

Modified on Thursday 26 April 2012 10:31:33 am by M. Raja

Friday 11 May 2012 10:46:40 am

I didnt find a solution for my calendar problem. Ousmane KANTE you said that your output is ok, please can you send me your code I want to test it at my site to see if it works well here.

 

and I would like to know if instead of using monthview.tpl I can use a ez publish extension to generate a navigator calendar?

 

Someone know which php files manage the monthview.tpl maybve if i see the source code I would understand what's going on at my calendar.

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu