Sascha Carlin
|
Saturday 07 February 2004 10:21:53 am
Hi all ;-) Goal: set up a calendar for appointments. I've setup a section 'Termine' and a fitting folder Termine. All appointments should go in there. (Currently I simply use Article from Content class to create appointments, but apparently I will need to set up a decent content class.) Now what I want to do is create two differnt views on the articles in the Termine-folder: current articles (say all appointments with date from today to today+4 weeks) and a year overview (all appointments from the current year). I looked at the fetch-operator but could not figure how to do that. Any hints? cu, Sascha
|
Tore Skobba
|
Sunday 08 February 2004 2:56:41 pm
Hmm where are you storing the dates then? You say you are using the Article class, but that does not have any dates? I have also made an calendar the following way:
Class: Calendar_folder (Name, Description), only having Calendar_event as children Class: Calendar_event (Name, intro, body, image, when (datetime)) I then in my Calendar_folder template fetch all Calendar_events sorted on when. You could do something like that and use {switch}{case} to terminate the displaying of the Calendar_events, or use more advanced fetch functionality.
Cheers Tore
|
Sascha Carlin
|
Sunday 08 February 2004 3:38:46 pm
Hi Tore, thank you for your input. Would you mind sharing your template code? By now I have a content class and can set up appointments in the content folder. How can I set up two different views of the same content (the appointments)? The goal was to have two views: the next 4 weeks and the current year (from jan to dec). Thanks, Sascha
|
Tore Skobba
|
Monday 09 February 2004 2:52:20 am
Hmm again where is your date? Anyway here is my template code for my solution. I am using two view, standard full which show ALL events, and a inline view which only show the 4 upcoming ones. Docs for making an new view: http://www.ez.no/ez_publish/documentation/building_an_ez_publish_site/the_news_page/news_archive
{* Full Calendar Folder view, shows all children of type Calendar event sorted on date *}
<h1>{$node.name}</h1>
{attribute_view_gui attribute=$node.data_map.description}
{* Listing of children *}
{* Fetch all children of calendar event type (none other objects should be in the calendar class!) *}
{let cal_list=fetch('content',list,
hash(parent_node_id, $node.node_id,
class_filter_type, include,class_filter_array, array(20),
sort_by,array('attribute',true(),175)))}
{* Where attribute 175 is an Date field called when *}
<ul class="content_list">
{section loop=$cal_list max=4}
<li><h2><a href={concat("/content/view/full/",$item.node_id)|ezurl}>
{$item.name} {'on'|i18n('design/gsa/node/view')}
{attribute_view_gui attribute=$item.data_map.when}
{attribute_view_gui attribute=$item.data_map.time}</a></h2>
<p> {attribute_view_gui attribute=$item.data_map.intro}
<a href={concat("/content/view/full/",$item.node_id)|ezurl}><br />{'Read more...'|i18n('design/gsa/node/view')}</a></p>
</li>
{/section}
</ul>
<h2>{"More happenings"|i18n('design/gsa/node/view')}</h2>
<ul class="plain">
{section loop=$cal_list offset=4}
<li>{node_view_gui view=line content_node=$item}</li>
{/section}
</ul> {/let}
{* Inline Calendar folder view, show the first 4 Calendar event (for use on front page etc) *}
<div class="calendar">
{let cal_list=fetch('content',list,
hash(parent_node_id, $node.node_id,
class_filter_type, include,class_filter_array, array(20),
sort_by,array('attribute',true(),175)))}
<h2>{"Upcoming events"|i18n('design/gsa/node/view')}</h2>
<ul>
{section loop=$cal_list max=4}
<li><a href={concat("/content/view/full/",$item.node_id)|ezurl}>
{$item.name} {'on'|i18n('design/gsa/node/view')}
{attribute_view_gui attribute=$item.data_map.when}
{attribute_view_gui attribute=$item.data_map.time}</a>
</li>
{/section}
</ul>
{/let}
<a href={concat("/content/view/full/",55)|ezurl}>{"More events"|i18n('design/gsa/node/view')}</a> </div>
|
Sascha Carlin
|
Tuesday 10 February 2004 8:28:01 pm
Thank you very much for sharing your code! Actually everything worked out fine - after I set the Anonymous Role permissions to read objects of the type Termine I created. Silly me ;-) Thanks again, you have been very helpful. Regards, Sascha
|