Forums / Developer / fetch('collaboration', 'item_list', hash(...))

fetch('collaboration', 'item_list', hash(...))

Author Message

Fabien Audin

Monday 12 April 2010 12:30:03 am

Hi,

I have this line : fetch('collaboration', 'item_list', hash(...)).

But this line returns only content that current user have created. I want to have all content waiting for approval. Where is the script which get these information?

Thank you in advance

Fabien Audin

Wednesday 14 April 2010 5:58:09 am

Do you have any idea about the script location?

(the script which get the pending objects)

Thank you

Nicolas Pastorino

Friday 16 April 2010 12:50:40 am

"

Do you have any idea about the script location?

(the script which get the pending objects)

"

Hello Fabien,

The fetch function used is provided by the 'collaboration' module. This means the fetch function definition will be found in the module's directory, under kernel/collaboration, in a file called 'function_definition.php' (this is the standard structure, which you can obviously apply to your custom modules). The definition of the fetch function is as follows (eZ Publish 4.2) :

$FunctionList['item_list'] = array( 'name' => 'item_list',
                                    'operation_types' => array( 'read' ),
                                    'call_method' => array( 'class' => 'eZCollaborationFunctionCollection',
                                                            'method' => 'fetchItemList' ),
                                    'parameter_type' => 'standard',
                                    'parameters' => array( array( 'name' => 'sort_by',
                                                                  'required' => false,
                                                                  'default' => false ),
                                                           array( 'name' => 'offset',
                                                                  'required' => false,
                                                                  'default' => false ),
                                                           array( 'name' => 'limit',
                                                                  'required' => false,
                                                                  'default' => false ),
                                                           array( 'name' => 'status',
                                                                  'required' => false,
                                                                  'default' => false ),
                                                           array( 'name' => 'is_read',
                                                                  'required' => false,
                                                                  'default' => null ),
                                                           array( 'name' => 'is_active',
                                                                  'required' => false,
                                                                  'default' => null ),
                                                           array( 'name' => 'parent_group_id',
                                                                  'required' => false,
                                                                  'default' => null ) ) );

This tells you that the class involved is 'eZCollaborationFunctionCollection' and the method 'fetchItemList', found in the 'kernel/collaboration/ezcollaborationfunctioncollection.php' file. You mat want to have a look there!

Cheers, and let us know how you are progressing,

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Fabien Audin

Monday 19 April 2010 1:49:54 am

Thank you very much Nicolas,

For my first problem, I had to write this line :

{def $latest_item_list=fetch("collaboration","item_list", hash("is_active",true(), "status", array(1)))}

to get only objects with status = 1.

My second problem is that this function get objects which are created by the current logged in user. But I want objects created by everyone. I'll have a look on files you told me. I'll reply when I have found.

Thanks a lot

Fabien Audin

Monday 19 April 2010 6:20:12 am

I have found the solution for my second problem. I have changed one thing in the file ezcollaborationitem.php line 459 :

$userID = eZUser::currentUserID();

by

$userID = the administrator's node_id

because each created object is linked to the administrator user in the ezpublish's database.

eZ debug

Timing: Jan 18 2025 01:55:56
Script start
Timing: Jan 18 2025 01:55:56
Module start 'content'
Timing: Jan 18 2025 01:55:57
Module end 'content'
Timing: Jan 18 2025 01:55:57
Script end

Main resources:

Total runtime1.0640 sec
Peak memory usage4,096.0000 KB
Database Queries200

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 588.8516180.8281
Module start 'content' 0.00630.9388 769.6797576.5000
Module end 'content' 0.94500.1189 1,346.1797341.3828
Script end 1.0639  1,687.5625 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00390.3677210.0002
Check MTime0.00150.1381210.0001
Mysql Total
Database connection0.00130.123310.0013
Mysqli_queries0.982292.31532000.0049
Looping result0.00190.17771980.0000
Template Total1.030396.820.5152
Template load0.00220.204920.0011
Template processing1.028196.632020.5141
Template load and register function0.00020.021810.0002
states
state_id_array0.00080.075710.0008
state_identifier_array0.00140.128320.0007
Override
Cache load0.00190.1759370.0001
Sytem overhead
Fetch class attribute can translate value0.00150.139930.0005
Fetch class attribute name0.00140.132460.0002
XML
Image XML parsing0.00080.071230.0003
class_abstraction
Instantiating content class attribute0.00000.001060.0000
General
dbfile0.00680.6370270.0003
String conversion0.00000.000430.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
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/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
1content/datatype/view/ezxmltags/quote.tpldatatype/ezxmltext/quote.tplextension/ezwebin/design/ezwebin/override/templates/datatype/ezxmltext/quote.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
3content/datatype/view/ezxmltags/strong.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/strong.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 23
 Number of unique templates used: 8

Time used to render debug report: 0.0002 secs