1: <?php
2:
3: /**
4: * This file contains the nav main collection and item class.
5: *
6: * @package Core
7: * @subpackage GenericDB_Model
8: * @author Frederic Schneider
9: * @copyright four for business AG <www.4fb.de>
10: * @license http://www.contenido.org/license/LIZENZ.txt
11: * @link http://www.4fb.de
12: * @link http://www.contenido.org
13: */
14:
15: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
16:
17: /**
18: * File collection
19: *
20: * @package Core
21: * @subpackage GenericDB_Model
22: */
23: class cApiNavMainCollection extends ItemCollection {
24:
25: /**
26: * Constructor to create an instance of this class.
27: */
28: public function __construct() {
29: global $cfg;
30: parent::__construct($cfg['tab']['nav_main'], 'idnavm');
31: $this->_setItemClass('cApiNavMain');
32: }
33:
34: /**
35: * Create new item with given values.
36: *
37: * @param string $name
38: * @param string $location
39: * @return cApiNavMain
40: */
41: public function create($name, $location, $id = null) {
42: $item = $this->createNewItem();
43:
44: if ($id != null) {
45: $item->set('idnavm', $id);
46: }
47:
48: $item->set('name', $name);
49: $item->set('location', $location);
50: $item->store();
51: return $item;
52: }
53: }
54:
55: /**
56: * NavMain item
57: *
58: * @package Core
59: * @subpackage GenericDB_Model
60: */
61: class cApiNavMain extends Item {
62:
63: /**
64: * Constructor to create an instance of this class.
65: *
66: * @param mixed $mId [optional]
67: * Specifies the ID of item to load
68: */
69: public function __construct($mId = false) {
70: global $cfg;
71: parent::__construct($cfg['tab']['nav_main'], 'idnavm');
72: $this->setFilters(array(
73: 'addslashes'
74: ), array(
75: 'stripslashes'
76: ));
77: if ($mId !== false) {
78: $this->loadByPrimaryKey($mId);
79: }
80: }
81: }
82: