More date sorting

Author Message

Pål Messenlien

Tuesday 15 November 2005 1:47:14 pm

Im working on a agenda list and got some problems sorting and listing the right stuff.
The agenda class consists of name, date and content.
This is the code ive got together listing it

{def $timestamp=currentdate()}
{def $idag=fetch('content','list', hash('parent_node_id', 308,
							attribute_filter, array( and, array( 296, '>=', $timestamp ) ),
							 'sort_by',array( 'attribute',true(),296 ) 
				))}			
{foreach $idag as $dagens}
	{node_view_gui content_node=$dagens view='agenda'}
{/foreach}

This functions for listing... but it skips the today agenda and jumps to the next day instead.
My next problem is that i want the list to list the items like this:
Todays agenda:
- Agenda 1
- Agenda 2
Wednesday 16. November
- Agenda 1
- Agenda 2
etc...
The code i use today for showing are this.

<b>{$node.object.data_map.dato.data_int|l10n( 'date' )}</b>
<a href={$node.url_alias|ezurl}>{$node.object.data_map.hendelse.content|wash}</a

Any suggestions?

--------------------------------------------
Høgskolen i Lillehammer
Lillehammer University College
http://www.hil.no
--------------------------------------------
Messenlien IT
http://messenlien.com
-------------------------------------------

Kristof Coomans

Wednesday 16 November 2005 12:42:00 am

I believe the problem is that the currentdate template operator returns a unix timestamp, including the current time.

You can use the following code to make a right timestamp to compare with:

{def $currentDate=currentdate()
     $current=gettime($currentDate)
     $timestamp = maketime( 0, 0, 0, $current.month, $current.day, $current.year )}

Related post: http://ez.no/community/forum/general/show_events_for_the_next_x_days

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Pål Messenlien

Sunday 20 November 2005 5:13:39 am

Thanks this worked great!

--------------------------------------------
Høgskolen i Lillehammer
Lillehammer University College
http://www.hil.no
--------------------------------------------
Messenlien IT
http://messenlien.com
-------------------------------------------

K259

Sunday 20 November 2005 7:40:52 am

Hi Pål!
What kind of agenda are you working on? What functionality? Like the agenda in the contributions?

Do you have an url to the calendar?

Pål Messenlien

Sunday 20 November 2005 9:17:50 am

Im not fully done with the code yet. The agenda in contributions might do the trick, but im not looking for a callendar. I just need a list wich groups the happenings in days then shows it under the specific date. Will post the full code when im done.

--------------------------------------------
Høgskolen i Lillehammer
Lillehammer University College
http://www.hil.no
--------------------------------------------
Messenlien IT
http://messenlien.com
-------------------------------------------

K259

Sunday 20 November 2005 10:34:19 am

Great!
I wonder how to list arrangements in a list..and over these arrangements show which month they belong to. As you say:
month: june
-arrangement
-arrangement
month: july
-arrangement
-arrangement

Would be great to get a code on this.

André R.

Monday 30 January 2006 6:16:29 am

You can modify Agenda 2 into doing this really simple
You already have the list pr month.

http://ez.no/community/contribs/applications/agenda_2_based_on_the_work_of_stefano_guandalini_and_per_espen_kindblad

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

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 22:17:52
Script start
Timing: Jan 18 2025 22:17:52
Module start 'layout'
Timing: Jan 18 2025 22:17:53
Module start 'content'
Timing: Jan 18 2025 22:17:53
Module end 'content'
Timing: Jan 18 2025 22:17:53
Script end

Main resources:

Total runtime0.7599 sec
Peak memory usage4,096.0000 KB
Database Queries73

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0055 592.2266152.6094
Module start 'layout' 0.00550.0029 744.835939.4297
Module start 'content' 0.00850.7499 784.2656663.0625
Module end 'content' 0.75840.0014 1,447.328116.1875
Script end 0.7599  1,463.5156 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.4392160.0002
Check MTime0.00140.1850160.0001
Mysql Total
Database connection0.00090.115610.0009
Mysqli_queries0.694491.3831730.0095
Looping result0.00080.1057710.0000
Template Total0.724195.320.3621
Template load0.00230.306120.0012
Template processing0.721894.988420.3609
Template load and register function0.00010.018710.0001
states
state_id_array0.00170.222910.0017
state_identifier_array0.00330.438320.0017
Override
Cache load0.00200.2680480.0000
Sytem overhead
Fetch class attribute can translate value0.00050.060540.0001
Fetch class attribute name0.00160.206590.0002
XML
Image XML parsing0.00130.170840.0003
class_abstraction
Instantiating content class attribute0.00000.002490.0000
General
dbfile0.00100.1293230.0000
String conversion0.00000.000940.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
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 29
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs