Forums / General / How create a agenda

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}

eZ debug

Timing: Jan 18 2025 11:09:40
Script start
Timing: Jan 18 2025 11:09:40
Module start 'content'
Timing: Jan 18 2025 11:09:41
Module end 'content'
Timing: Jan 18 2025 11:09:41
Script end

Main resources:

Total runtime0.2375 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0107 587.6016180.8516
Module start 'content' 0.01070.0078 768.453193.8203
Module end 'content' 0.01850.2190 862.2734521.8594
Script end 0.2374  1,384.1328 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00421.7675200.0002
Check MTime0.00140.6086200.0001
Mysql Total
Database connection0.00060.257310.0006
Mysqli_queries0.179575.59101410.0013
Looping result0.00160.69261390.0000
Template Total0.218592.010.2185
Template load0.00110.444610.0011
Template processing0.217491.539810.2174
Override
Cache load0.00070.279010.0007
Sytem overhead
Fetch class attribute can translate value0.00050.229510.0005
XML
Image XML parsing0.00030.106510.0003
General
dbfile0.00271.1550200.0001
String conversion0.00000.003330.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs