Source for file basic_model_createcopy.php

Documentation is available at basic_model_createcopy.php


1 <?php
2 /**
3 * @author Jan H. Andersen <jha@ipwsystems.dk>
4 * @author Martin R. Larsen <mrl@ipwsystems.dk>
5 * @copyright {@link http://www.ipwsystems.dk/ IPW Systems a.s}
6 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
7 * @package METAjour
8 * @subpackage model
9 * $Id: basic_model_createcopy.php,v 1.2 2004/10/17 19:10:14 jan Exp $
10 */
11
12 require_once('basic_model.php');
13
14 class basic_model_createcopy extends basic_model {
15
16 function model() {
17 foreach($this->objectid as $curid) {
18 $oldobject = owRead($curid);
19 $oldobject->elements[0]['name'] = "Copy of ".$oldobject->elements[0]['name'];
20
21 $obj = owNew($oldobject->gettype());
22 $obj->createobject($oldobject->elements[0],$oldobject->getparentid());
23 $id = $obj->getobjectid();
24
25 if ($oldobject->haschild()) {
26 $arr = $oldobject->getchilds();
27 foreach ($arr as $order) {
28 $oldsectionobj = owNew($oldobject->getsubtype());
29 $oldsectionobj->readobject($order);
30 $newsectionobj = owNew($oldobject->getsubtype());
31 $newsectionobj->createobject($oldsectionobj->elements[0],$id);
32 }
33 }
34 }
35 }
36
37 }
38
39 ?>

Documentation generated on Thu, 9 Jun 2005 06:51:08 +0200 by phpDocumentor 1.2.3