Forums / Developer / Attend a event

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

eZ debug

Timing: Jan 18 2025 11:39:08
Script start
Timing: Jan 18 2025 11:39:08
Module start 'content'
Timing: Jan 18 2025 11:39:09
Module end 'content'
Timing: Jan 18 2025 11:39:09
Script end

Main resources:

Total runtime0.8262 sec
Peak memory usage4,096.0000 KB
Database Queries197

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0065 588.6953180.8516
Module start 'content' 0.00650.6391 769.5469547.4375
Module end 'content' 0.64560.1806 1,316.9844332.7734
Script end 0.8262  1,649.7578 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00440.5277210.0002
Check MTime0.00170.2037210.0001
Mysql Total
Database connection0.00130.158410.0013
Mysqli_queries0.730088.35291970.0037
Looping result0.00230.28191950.0000
Template Total0.797496.520.3987
Template load0.00190.234020.0010
Template processing0.795596.277820.3977
Template load and register function0.00020.020010.0002
states
state_id_array0.00070.085310.0007
state_identifier_array0.00110.129820.0005
Override
Cache load0.00160.1955210.0001
Sytem overhead
Fetch class attribute can translate value0.00150.176830.0005
Fetch class attribute name0.00110.137450.0002
XML
Image XML parsing0.00080.099030.0003
class_abstraction
Instantiating content class attribute0.00000.001250.0000
General
dbfile0.01672.0272270.0006
String conversion0.00000.000630.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
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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 15
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs