1: <?php
 2: /**
 3:  * This file contains the container configuration collection and item class.
 4:  *
 5:  * @package          Core
 6:  * @subpackage       GenericDB_Model
 7:  * @version          SVN Revision $Rev:$
 8:  *
 9:  * @author           Timo Hummel
10:  * @copyright        four for business AG <www.4fb.de>
11:  * @license          http://www.contenido.org/license/LIZENZ.txt
12:  * @link             http://www.4fb.de
13:  * @link             http://www.contenido.org
14:  */
15: 
16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
17: 
18: /**
19:  * Container configuration collection
20:  *
21:  * @package Core
22:  * @subpackage GenericDB_Model
23:  */
24: class cApiContainerConfigurationCollection extends ItemCollection {
25: 
26:     public function __construct($select = false) {
27:         global $cfg;
28:         parent::__construct($cfg['tab']['container_conf'], 'idcontainerc');
29:         $this->_setItemClass('cApiContainerConfiguration');
30: 
31:         // set the join partners so that joins can be used via link() method
32:         $this->_setJoinPartner('cApiTemplateConfigurationCollection');
33: 
34:         if ($select !== false) {
35:             $this->select($select);
36:         }
37:     }
38: 
39:     public function create($idtplcfg, $number, $container) {
40:         $item = parent::createNewItem();
41:         $item->set('idtplcfg', (int) $idtplcfg);
42:         $item->set('number', (int) $number);
43:         $item->set('container', $this->escape($container));
44:         $item->store();
45:     }
46: 
47: }
48: 
49: /**
50:  * Container configuration item
51:  *
52:  * @package Core
53:  * @subpackage GenericDB_Model
54:  */
55: class cApiContainerConfiguration extends Item {
56: 
57:     /**
58:      * Constructor Function
59:      *
60:      * @param mixed $mId Specifies the ID of item to load
61:      */
62:     public function __construct($mId = false) {
63:         global $cfg;
64:         parent::__construct($cfg['tab']['container_conf'], 'idcontainerc');
65:         $this->setFilters(array(), array());
66:         if ($mId !== false) {
67:             $this->loadByPrimaryKey($mId);
68:         }
69:     }
70: }
71: