Forums / Developer / Object status

Object status

Author Message

David Santiso

Saturday 19 March 2011 10:58:20 am

Hi,

I've created a new group object status. How can I check the status of an object from a template?

Thanks,

David

Damien Pobel

Sunday 20 March 2011 4:34:24 am

Hi David,

I guess you are working in a view template so you have the $node object. To get the list of object state identifiers you can write :

{$node.object.state_identifier_array}

or

{$node.object.state_id_array}

Cheers

Damien
Planet eZ Publish.fr : http://www.planet-ezpublish.fr
Certification : http://auth.ez.no/certification/verify/372448
Publications about eZ Publish : http://pwet.fr/tags/keywords/weblog/ez_publish

David Santiso

Sunday 20 March 2011 7:46:21 am

I've showed the contents of that array and are identifiers, but how do I display the name of the state?

Damien Pobel

Sunday 20 March 2011 11:09:21 am

As far as I know, there's no fetch function nor template operator to load an object state from its identifier, but you can write it on your own.

Damien
Planet eZ Publish.fr : http://www.planet-ezpublish.fr
Certification : http://auth.ez.no/certification/verify/372448
Publications about eZ Publish : http://pwet.fr/tags/keywords/weblog/ez_publish

Marko Žmak

Sunday 20 March 2011 1:10:00 pm

Logically, if the object states names are displayed in the admin interface under object details, then they should be fetchable in templates...

What you are looking for is "allowed_assign_state_list" property, try this:

{$node.object.allowed_assign_state_list|attribute(show)}

To narrow down your search through all thoose properties and arrays, here's an example of what you need:

{$node.object.allowed_assign_state_list[0].group.states[0].current_translation.name}

You'll figure out the rest...

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Marko Žmak

Sunday 20 March 2011 4:10:51 pm

P.S. I think that the documentation for ezcontentobject should be updated.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

David Santiso

Monday 21 March 2011 1:48:42 pm

Thank you very much ;)

eZ debug

Timing: Jan 18 2025 02:49:41
Script start
Timing: Jan 18 2025 02:49:41
Module start 'content'
Timing: Jan 18 2025 02:49:42
Module end 'content'
Timing: Jan 18 2025 02:49:42
Script end

Main resources:

Total runtime0.8372 sec
Peak memory usage4,096.0000 KB
Database Queries209

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0068 587.5391180.8594
Module start 'content' 0.00680.7052 768.3984634.2031
Module end 'content' 0.71210.1251 1,402.6016341.0859
Script end 0.8372  1,743.6875 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.4756210.0002
Check MTime0.00160.1869210.0001
Mysql Total
Database connection0.00060.071210.0006
Mysqli_queries0.755790.26362090.0036
Looping result0.00190.22862070.0000
Template Total0.805396.220.4027
Template load0.00210.248620.0010
Template processing0.803295.939420.4016
Template load and register function0.00020.018910.0002
states
state_id_array0.00160.185210.0016
state_identifier_array0.00120.139220.0006
Override
Cache load0.00180.2181340.0001
Sytem overhead
Fetch class attribute can translate value0.00150.173940.0004
Fetch class attribute name0.00220.259190.0002
XML
Image XML parsing0.00140.169940.0004
class_abstraction
Instantiating content class attribute0.00000.0032110.0000
General
dbfile0.00390.4693350.0001
String conversion0.00000.001030.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
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
11content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 29
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs