Forums / Developer / Moving an object through php?

Moving an object through php?

Author Message

Clemens T

Monday 10 October 2005 8:35:25 am

Heya all,
I have a user object @ position 1, now I want to move the user to another group @ position 2, I know both node_id's.. how can I make the move?
(in my own module, and in php)
Thanks,
Clemens

Bruce Morrison

Monday 10 October 2005 4:26:36 pm

Hi Clemens

Code to accomplish this can be found in kernel/content/action.php around line 199
else if ( $module->isCurrentAction( 'MoveNode' ) )

http://pubsvn.ez.no/websvn/filedetails.php?repname=nextgen&path=%2Ftrunk%2Fkernel%2Fcontent%2Faction.php&rev=13600&sc=1

In the trunk the key line appears to be:

eZContentObjectTreeNodeOperations::move( $nodeID, $selectedNodeID )

Where $nodeID is the node you want to move and $selectedNodeID is the destination.

Much of the preceeding code is checking that the permissions are in place.

The code in 3.6.1 seems to be a bit different in that much of the moving work is actually done in action.php

HTH

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Clemens T

Wednesday 26 October 2005 2:51:19 pm

Excellent job. Thanks a lot! Worked like a charm :).

eZ debug

Timing: Jan 20 2025 17:00:53
Script start
Timing: Jan 20 2025 17:00:53
Module start 'content'
Timing: Jan 20 2025 17:00:53
Module end 'content'
Timing: Jan 20 2025 17:00:53
Script end

Main resources:

Total runtime0.0158 sec
Peak memory usage2,048.0000 KB
Database Queries4

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0051 587.7109180.8359
Module start 'content' 0.00510.0045 768.546993.9922
Module end 'content' 0.00960.0061 862.539170.7031
Script end 0.0157  933.2422 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.001912.1724120.0002
Check MTime0.00095.9133120.0001
Mysql Total
Database connection0.00074.166710.0007
Mysqli_queries0.002616.730140.0007
Looping result0.00000.089120.0000
Template Total0.005635.610.0056
Template load0.00084.843010.0008
Template processing0.004830.703510.0048
Override
Cache load0.00053.292610.0005
General
dbfile0.002314.2980100.0002
String conversion0.00000.031730.0000
Note: percentages do not add up to 100% because some accumulators overlap

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