Forums / Developer / More date sorting

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

eZ debug

Timing: Jan 20 2025 16:57:08
Script start
Timing: Jan 20 2025 16:57:08
Module start 'content'
Timing: Jan 20 2025 16:57:08
Module end 'content'
Timing: Jan 20 2025 16:57:08
Script end

Main resources:

Total runtime0.2146 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.0063 588.6172180.8438
Module start 'content' 0.00630.0056 769.4609101.9609
Module end 'content' 0.01190.2026 871.4219531.7344
Script end 0.2145  1,403.1563 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00321.4824200.0002
Check MTime0.00130.5939200.0001
Mysql Total
Database connection0.00060.290310.0006
Mysqli_queries0.164376.53171410.0012
Looping result0.00140.65021390.0000
Template Total0.202394.210.2023
Template load0.00080.368110.0008
Template processing0.201593.878110.2015
Override
Cache load0.00050.252510.0005
Sytem overhead
Fetch class attribute can translate value0.00090.442210.0009
XML
Image XML parsing0.00040.172410.0004
General
dbfile0.00733.3815200.0004
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