wCMF  3.6
 All Classes Namespaces Files Functions Variables Groups Pages
class.AbstractFormat.php
Go to the documentation of this file.
1 <?php
2 /**
3  * wCMF - wemove Content Management Framework
4  * Copyright (C) 2005-2014 wemove digital solutions GmbH
5  *
6  * Licensed under the terms of any of the following licenses
7  * at your choice:
8  *
9  * - GNU Lesser General Public License (LGPL)
10  * http://www.gnu.org/licenses/lgpl.html
11  * - Eclipse Public License (EPL)
12  * http://www.eclipse.org/org/documents/epl-v10.php
13  *
14  * See the license.txt file distributed with this work for
15  * additional information.
16  *
17  * $Id: class.AbstractFormat.php 1462 2014-02-04 23:52:27Z iherwig $
18  */
19 require_once(BASE."wcmf/lib/presentation/format/class.IFormat.php");
20 
21 /**
22  * @class AbstractFormat
23  * @ingroup Format
24  * @brief AbstractFormat maybe used as base class for specialized formats.
25  *
26  * @author ingo herwig <ingo@wemove.com>
27  */
28 class AbstractFormat extends IFormat
29 {
30  var $_deserializedNodes = null;
31 
32  /**
33  * Get a node with the given oid to deserialize values from form fields into it.
34  * The method ensures that there is only one instance per oid.
35  * @param oid The oid
36  * @return A reference to the Node instance
37  */
38  function &getNode($oid)
39  {
40  if (!is_array($this->_deserializedNodes))
41  $this->_deserializedNodes = array();
42 
43  if (!isset($this->_deserializedNodes[$oid]))
44  {
45  $persistenceFacade = &PersistenceFacade::getInstance();
46  $type = PersistenceFacade::getOIDParameter($oid, 'type', false);
48  {
49  // don't create all values by default (-> don't use PersistenceFacade::create() directly, just for determining the class)
50  $class = get_class($persistenceFacade->create($type, BUILDDEPTH_SINGLE));
51  $node = new $class;
52  }
53  else {
54  $node = new Node($type);
55  }
56  $node->setOID($oid);
57  $this->_deserializedNodes[$oid] = &$node;
58  }
59  return $this->_deserializedNodes[$oid];
60  }
61 
62  /**
63  * Get all serialized nodes
64  * @return An array of Node references
65  */
66  function getNodes()
67  {
69  }
70 }
71 ?>
Node is the basic component for building trees (although a Node can have one than more parents)...
Definition: class.Node.php:118
AbstractFormat maybe used as base class for specialized formats.
IFormat defines the interface for all formatter classes. Formatter classes are used to map external d...
getOIDParameter($oid, $param, $validate=true)
const BUILDDEPTH_SINGLE