1: <?php
2: /**
3: * This file contains the nav main collection and item class.
4: *
5: * @package Core
6: * @subpackage GenericDB_Model
7: * @version SVN Revision $Rev:$
8: *
9: * @author Frederic Schneider
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: * File collection
20: *
21: * @package Core
22: * @subpackage GenericDB_Model
23: */
24: class cApiNavMainCollection extends ItemCollection {
25:
26: /**
27: * Constructor
28: */
29: public function __construct() {
30: global $cfg;
31: parent::__construct($cfg['tab']['nav_main'], 'idnavm');
32: $this->_setItemClass('cApiNavMain');
33: }
34:
35: /**
36: * Create new item with given values.
37: *
38: * @param string $location
39: * @return cApiNavMain
40: */
41: public function create($location) {
42: $item = $this->createNewItem();
43: $item->set('location', $location);
44: $item->store();
45: return $item;
46: }
47: }
48:
49: /**
50: * NavMain item
51: *
52: * @package Core
53: * @subpackage GenericDB_Model
54: */
55: class cApiNavMain 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']['nav_main'], 'idnavm');
65: $this->setFilters(array(
66: 'addslashes'
67: ), array(
68: 'stripslashes'
69: ));
70: if ($mId !== false) {
71: $this->loadByPrimaryKey($mId);
72: }
73: }
74: }
75: