How create a agenda

Author Message

Francesc Febrer

Friday 23 January 2004 4:45:07 am

Hi.

I want create a agenda with eZPublish. I create a class with different item (name, place and date). But when I want show this class, I want that appaers sorted by date (display the elements more actual) and that the system removes the items expired.

Please, how can I do this?

Thanks.

Sébastien Prud'homme

Tuesday 27 January 2004 12:03:30 pm

I have a web page which display some events. Here is the code to sort by the date attribute of the events:

{let events=fetch(content,list,hash(parent_node_id,$node.node_id,sort_by,array(array
(attribute,true(),156),array(attribute,true(),157))))}

156 corresponds to the id of the class date attribute
157 correspond to the id of the class time attribute

you can use only a datetime attribute if you prefer :
{let events=fetch(content,list,hash(parent_node_id,$node.node_id,sort_by,array(array
(attribute,true(),MY_DATETIME_ID))))}

where MY_DATETIME_ID is the id of your datetime attribute

For removing expired items i don't know yet if you can fetch items with a datetime greater that the current datetime...but you can use a simple "if" statement in the items loop of your template

Anders F

Tuesday 27 January 2004 12:50:50 pm

I use this code to display class "event", sort it by attribute "date" and only display items within 1 month from the current date. Almost positive it works..

{let currentdate=currentdate()
     limitdays=31
     enddate=sum($currentdate, mul($limitdays,24,3600))
     children=fetch( content, list, hash( parent_node_id, CALENDAR_NODE,
                                          sort_by, array('attribute',true(),'event/date'),
                                          class_filter_type, include,
                                          class_filter_array, array( 'event' ) ) )}

<h2>Calendar</h2>

{section name=Child loop=$children}
{section show=and(or($Child:item.data_map.date.content.timestamp|ge($currentdate)),
or($Child:item.data_map.date.content.timestamp|le($enddate)) )}
<p><b>{$Child:item.data_map.date.content.timestamp|datetime( custom, '%D %d %M %H.%i' )}</b><br />

{attribute_view_gui attribute=$Child:item.data_map.body}</p>
{/section}
{/section}
{/let}

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 15:17:47
Script start
Timing: Jan 18 2025 15:17:47
Module start 'layout'
Timing: Jan 18 2025 15:17:47
Module start 'content'
Timing: Jan 18 2025 15:17:48
Module end 'content'
Timing: Jan 18 2025 15:17:48
Script end

Main resources:

Total runtime0.7749 sec
Peak memory usage4,096.0000 KB
Database Queries59

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0053 588.9219152.6094
Module start 'layout' 0.00540.0025 741.531339.4297
Module start 'content' 0.00790.7654 780.9609506.3750
Module end 'content' 0.77330.0016 1,287.335912.1875
Script end 0.7749  1,299.5234 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00300.3913160.0002
Check MTime0.00130.1637160.0001
Mysql Total
Database connection0.00080.104710.0008
Mysqli_queries0.732094.4520590.0124
Looping result0.00060.0763570.0000
Template Total0.743395.920.3716
Template load0.00200.253120.0010
Template processing0.741395.659520.3707
Template load and register function0.00020.027410.0002
states
state_id_array0.00080.104410.0008
state_identifier_array0.00130.170320.0007
Override
Cache load0.00170.2254210.0001
Sytem overhead
Fetch class attribute can translate value0.00070.092430.0002
Fetch class attribute name0.00080.098130.0003
XML
Image XML parsing0.00040.048030.0001
class_abstraction
Instantiating content class attribute0.00000.000830.0000
General
dbfile0.00070.0863100.0001
String conversion0.00000.001040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 15
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs