meriam santos
Moderated by: Nicolas Pastorino
|
Thursday 05 November 2009 7:16:28 pm
i have a question on your Agenda template. can you help me please on how to display only the weeks events rather that the whole months event.. really appreciate any reply. in case you need the code of agenda here it is. {* Agenda Folder override *}{set-block scope=root variable=cache_ttl}500{/set-block}{* Agenda v2.2.2 (C) 2006 by André R. Based on Agenda v1.0: (C) 2004 by Stefano Guandalini - nizan sg@nizan.net http://www.nizan.net And Agenda "v1.1":Modified 2006 by Per-Espen Kindblad This file may be distributed and/or modified under the terms of the "GNU General Public License" version 2 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. For changlog, install and other info see readme.txt in orginal package on ez.no: http://ez.no/community/contribs/applications/agenda_2_based_on_the_work_of_stefano_guandalini_and_per_espen_kindblad For discussion, problems and Contributions: http://ez.no/community/forum/developer/about_agenda_2_contribution*}{def$event_node=$node.node_id$curr_ts=currentdate()$curr_today=$curr_ts|datetime( custom, '%j')$curr_year=$curr_ts|datetime( custom, '%Y')$curr_month=$curr_ts|datetime( custom, '%n')$temp_ts=cond( and(ne($view_parameters.month, ''), ne($view_parameters.year, '')), makedate($view_parameters.month, cond(ne($view_parameters.day, ''),$view_parameters.day, eq($curr_month, $view_parameters.month), $curr_today, 1 ), $view_parameters.year), currentdate() )$datearray=gettime($temp_ts)$temp_month=$temp_ts|datetime( custom, '%n')$temp_year=$temp_ts|datetime( custom, '%Y')$temp_today=$temp_ts|datetime( custom, '%j')$days=$temp_ts|datetime( custom, '%t')$first_ts=makedate($temp_month, 1, $temp_year)$dayone=$first_ts|datetime( custom, '%w' )$last_ts=makedate($temp_month, $days, $temp_year)$daylast=$last_ts|datetime( custom, '%w' )$span1=$dayone$span2=sub( 7, $daylast )$dayofweek=0$day_array = " "$loop_dayone = 1$loop_daylast = 1$day_events = array()$loop_count = 0}{if ne($temp_month, 12)} {set $last_ts=makedate($temp_month|sum( 1 ), 1, $temp_year)}{else} {set $last_ts=makedate(1, 1, $temp_year|sum(1))}{/if}{def$events=fetch( 'content', 'list', hash('parent_node_id', $event_node,'sort_by', array( 'attribute', true(), 'event/from_time' ),'class_filter_type', 'include', 'class_filter_array', array( 'event' ),'main_node_only', true(), 'attribute_filter',array( 'or',array( 'event/from_time', 'between', array( sum($first_ts,1), sub($last_ts,1) )),array( 'event/to_time', 'between', array( sum($first_ts,1), sub($last_ts,1) )) )))$url_reload=concat("/content/view/full/", $event_node,"/day/",$temp_today,"/month/",$temp_month,"/year/",$temp_year, "/offset/2")$url_back=concat("/content/view/full/", $event_node, "/month/", sub($temp_month, 1), "/year/", $temp_year)$url_forward=concat("/content/view/full/", $event_node, "/month/", sum($temp_month, 1), "/year/", $temp_year)}{if eq($temp_month, 1)}{set $url_back=concat("/content/view/full/", $event_node,"/month/", "12", "/year/", sub($temp_year, 1))}{elseif eq($temp_month, 12)}{set $url_forward=concat("/content/view/full/", $event_node,"/month/", "1", "/year/", sum($temp_year, 1))}{/if}{foreach $events as $event}{if eq($temp_month|int(), $event.data_map.from_time.content.month|int())}{set $loop_dayone = $event.data_map.from_time.content.day}{else}{set $loop_dayone = 1}{/if}{if eq($temp_month|int(), $event.data_map.to_time.content.month|int())}{set $loop_daylast = $event.data_map.to_time.content.day}{else}{set $loop_daylast = $days}{/if}{for $loop_dayone|int() to $loop_daylast|int() as $counter}{set $day_array = concat($day_array, $counter, ', ')}{*check and add to day events while we already have the days*}{if eq($counter,$temp_today)}{set $day_events = $day_events|append($event)}{/if}{/for}{/foreach}
<<
| {$temp_ts|datetime( custom, '%F' )|upfirst()} {$temp_year}
| >>
|
Mon
| Tue
| Wed
| Thu
| Fri
| Sat
| Sun
|
|
|
{elseif eq( $number, $temp_today )} {elseif and(eq( $number, $curr_today ), eq($curr_month, $temp_month))} {else} {/if}{if $day_array|contains(concat(' ', $number, ',')) } {$number}{else} {$number}{/if} {if and( eq( $number, $days ), $span2|gt( 0 ), $span2|ne(7))} {/if}{if or( eq( $dayofweek, 0 ), eq( $number, $days ) )}
|
Selected DayToday
|
{$temp_ts|datetime( custom, '%F %Y' )|upfirst()}: {foreach $events as $event}{if and( ne($view_parameters.offset, 2), eq($loop_count, 8))}Show All Events..{/if}{if gt($curr_ts , $event.object.data_map.to_time.content.timestamp)}
{$event.name|wash}
|
{$event.data_map.category.class_content.options[$event.data_map.category.value[0]].name} {$event.object.data_map.from_time.content.timestamp|datetime(custom,"%j %M")|shorten( 6 , '')}{if and($event.object.data_map.to_time.has_content, ne( $event.object.data_map.to_time.content.timestamp|datetime(custom,"%j %M"), $event.object.data_map.from_time.content.timestamp|datetime(custom,"%j %M") ))} - {$event.object.data_map.to_time.content.timestamp|datetime(custom,"%j %M")|shorten( 6 , '')}{/if}
|
{section show=$event.object.data_map.text.has_content} {$event.object.data_map.text.content|shorten( 110 , '...' )}{/section}
|
{/if}
|
{if eq($curr_ts|datetime( custom, '%j'),$temp_ts|datetime( custom, '%j'))} Today: {else} {$temp_ts|datetime( custom, '%M %j')|upfirst()}: {/if} {foreach $day_events as $day_event}{if gt($curr_ts , $day_event.object.data_map.to_time.content.timestamp)}{else}{/if} {$day_event.name|wash}
Category: {$day_event.data_map.category.class_content.options[$day_event.data_map.category.value[0]].name} {$day_event.object.data_map.from_time.content.timestamp|datetime(custom,"%j %M %H:%i")} {if $day_event.object.data_map.to_time.has_content} - {$day_event.object.data_map.to_time.content.timestamp|datetime(custom,"%j %M %H:%i")}{/if}{/foreach}
|
{undef $events $day_events}
|