Forums / Developer / Agenda..howto start calendar with Monday instead of Sunday??

Agenda..howto start calendar with Monday instead of Sunday??

Author Message

K259

Tuesday 06 September 2005 3:17:47 pm

I'm not sure how to achieve this with the agenda-code from contribution..

 <tr>
{* display day names *}
{section loop=$dayarray}
     <th id="{concat("d", $index)}">{$item}</th>
{/section}
    </tr>
  {*</thead>*}
  {*<tbody>*}
{* main loop - loops days *}
{section loop=$days}
  {let dayofweek=makedate( $month, $number, $year )|datetime( custom, '%w' )}
    {section show=or( eq( $number, 1 ), eq( $dayofweek, 0 ) )}
    <tr>
    {/section}
    {section show=and( $span1|gt( 0 ), eq( $number, 1 ) )}
      <td colspan="{$span1}" class="agenda"></td>
    {/section}
        {let    my_ts=makedate( $month, $number, $year )
                events=fetch( 'content', 'list_count', hash('parent_node_id',2469,depth,4,
                        'attribute_filter',
                        array( 'and',
                                array( 'agenda/fra_dato', '<=', $my_ts ),
                                array( 'agenda/til_dato', '>=', $my_ts )
) ) ) }
    {section show=eq( $number, $today )}
      <td headers="{concat( "d", $dayofweek)}" style="background-color:#ffffff;" class="agenda" width=7>
    {section-else}
      <td headers="{concat( "d", $dayofweek)}" class="agenda">
    {/section}
    {section show=$events|gt( 0 )}
        <span style="font-weight: bold;"><a href={concat("/content/view/line/2469/day/", $item, "/month/", $month, "/year/", $year)|ezurl}>
    {/section}
{$number}
    {section show=$events|gt( 0 )}
        </a></span>
    {/section}
      {/let}{* fetch *}
      </td>
    {section show=and( eq( $number, $days ), $span2|gt( 0 ))}
      <td colspan="{$span2}" class="agenda"></td>
    {/section}
    {section show=or( eq( $dayofweek, 6 ), eq( $number, $days ) )}
    </tr>
    {/section}
  {/let}{* dayofweek *}

Eivind Marienborg

Wednesday 07 September 2005 12:38:09 am

    <tr>
{* display day names *}
{section loop=$dayarray}
      <th id="{concat("d", $index)}">{$item}</th>
{/section}
    </tr>
  </thead>
  <tbody>
{* main loop - loops days *}
{section loop=$days}
  {let dayofweek=makedate( $month, $number, $year )|datetime( custom, '%w' )}
    {section show=or( eq( $number, 1 ), eq( $dayofweek, 1 ) )}
    <tr>
    {/section}
    {section show=and( $span1|gt( 0 ), eq( $number, 1 ) )}
      <td colspan="{sub($span1,1)}" class="agenda"></td>
    {/section}
        {let    my_ts=makedate( $month, $number, $year )
                events=fetch( 'content', 'list_count', hash(
                        'parent_node_id', 126,
                        depth, 2,
                        'attribute_filter',
                        array( 'and',
                                array( 'aktiv/from_date', '<=', $my_ts ),
                                array( 'aktiv/to_date', '>=', $my_ts )
) ) ) }
    {section show=eq( $number, $today )}
      <td headers="{concat( "d", $dayofweek)}" class="activeagenda">
    {section-else}
      <td headers="{concat( "d", $dayofweek)}" class="agenda">
    {/section}
    {section show=$events|gt( 0 )}
        <span style="font-weight: bold;"><a href={concat("/content/view/full/29198/(day)/", $item, "/(month)/", $month, "/(year)/", $year)|ezurl}
title="Aktiviteter: {$events}">
    {/section}
{$number}
    {section show=$events|gt( 0 )}
        </a></span>
    {/section}
      {/let}{* fetch *}
      </td>
    {section show=and( eq( $number, $days ), $span2|gt( 0 ))}
      <td colspan="{$span2}" class="agenda"></td>
    {/section}
    {section show=or( eq( $dayofweek, 7 ), eq( $number, $days ) )}
    </tr>
    {/section}
  {/let}{* dayofweek *}

This is my hack for starting the calendar on Monday. I know it has some bugs, it messed up August, but I haven't had time to check it out..

Of course it also need adapting to your links etc :)