Attend a event

Author Message

Steffen Amundsen

Friday 30 January 2009 5:14:27 am

I have a eventcalender. And I would like users to attend a event. I have created a new class called "attend". I thougt it would be a good idea just to let users create this class under the appropiate event, and then use a fetch to see who is attending.

Now my problem is how to make sure users only can create this class ONCE under each event, and how to let them delete it (if startdate is not passed).

So, how can I test if the current user have already created a child under the current node?

Steffen

Kristof Coomans

Friday 30 January 2009 6:17:03 am

Hi Steffen

You can do this in the template, by fetching the "attend" objects that have the current user as owner. If the count of the results is 0, you can show the create button, otherwise you can show the current object together with an "edit" button or link.

See http://ez.no/doc/ez_publish/technical_manual/4_0/reference/modules/content/fetch_functions/list#eztoc87605_0_0_1, under "Filtering on a non-attribute". The current user you can fetch with the user/current_user fetch function, see http://ez.no/doc/ez_publish/technical_manual/4_0/reference/modules/user/fetch_functions/current_user.

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

Steffen Amundsen

Friday 30 January 2009 6:50:44 am

Thanks.

I am kind a new to Ez, but I try this so far:

 {def $count=fetch( 'content', 'list_count', hash( 'parent_node_id', $node.node_id ) )}

{section show=$count|gt(0)}
 some form here..
{/section}

Now how to test for which user?

Steffen Amundsen

Friday 30 January 2009 7:21:02 am

I think I got it:

{def $user=fetch( 'user', 'current_user' )}
{def $count=fetch( 'content', 'list_count', hash( 
			'parent_node_id', $node.node_id,
			'attribute_filter',$user,
			depth,2,
            class_filter_type, include,
            class_filter_array, array( 'attend' )) )}

{section show=$count|gt(0)}
har meldt på
{section-else}
har ikke
{/section}

Thanks

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 16:11:56
Script start
Timing: Jan 18 2025 16:11:56
Module start 'layout'
Timing: Jan 18 2025 16:11:56
Module start 'content'
Timing: Jan 18 2025 16:11:56
Module end 'content'
Timing: Jan 18 2025 16:11:56
Script end

Main resources:

Total runtime0.6540 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0062 588.9063152.6094
Module start 'layout' 0.00620.0027 741.515639.4063
Module start 'content' 0.00890.6439 780.9219542.3750
Module end 'content' 0.65280.0013 1,323.296912.2031
Script end 0.6540  1,335.5000 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.5245160.0002
Check MTime0.00140.2139160.0001
Mysql Total
Database connection0.00070.102910.0007
Mysqli_queries0.610793.3664600.0102
Looping result0.00050.0711580.0000
Template Total0.625895.720.3129
Template load0.00170.265020.0009
Template processing0.624195.416920.3120
Template load and register function0.00010.016010.0001
states
state_id_array0.00090.135110.0009
state_identifier_array0.00100.153220.0005
Override
Cache load0.00140.2151210.0001
Sytem overhead
Fetch class attribute can translate value0.00060.099320.0003
Fetch class attribute name0.00100.153750.0002
XML
Image XML parsing0.00070.109220.0004
class_abstraction
Instantiating content class attribute0.00000.001550.0000
General
dbfile0.00070.1086160.0000
String conversion0.00000.001440.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
4content/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
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/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