1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
15:
16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
17:
18: 19: 20: 21: 22: 23:
24: class cApiNavSubCollection extends ItemCollection {
25:
26: 27: 28:
29: public function __construct() {
30: global $cfg;
31: parent::__construct($cfg['tab']['nav_sub'], 'idnavs');
32: $this->_setItemClass('cApiNavSub');
33:
34:
35: $this->_setJoinPartner('cApiNavMainCollection');
36: $this->_setJoinPartner('cApiAreaCollection');
37: }
38:
39: public function create($navm, $area, $level, $location, $online = '1') {
40: $item = parent::createNewItem();
41:
42: if (is_string($area)) {
43: $c = new cApiArea();
44: $c->loadBy('name', $area);
45:
46: if ($c->isLoaded()) {
47: $area = $c->get('idarea');
48: } else {
49: $area = 0;
50: cWarning(__FILE__, __LINE__, "Could not resolve area [$area] passed to method [create], assuming 0");
51: }
52: }
53:
54: $navm = cSecurity::toInteger($navm);
55: $level = cSecurity::toInteger($level);
56: $location = cSecurity::escapeString($location);
57: $online = cSecurity::toInteger($online);
58:
59: $item->set('idnavm', $navm);
60: $item->set('idarea', $area);
61: $item->set('level', $level);
62: $item->set('location', $location);
63: $item->set('online', $online);
64:
65: $item->store();
66:
67: return ($item);
68: }
69:
70: }
71:
72: 73: 74: 75: 76: 77:
78: class cApiNavSub extends Item {
79:
80: 81: 82: 83: 84:
85: public function __construct($mId = false) {
86: global $cfg;
87: parent::__construct($cfg['tab']['nav_sub'], 'idnavs');
88: $this->setFilters(array(
89: 'addslashes'
90: ), array(
91: 'stripslashes'
92: ));
93: if ($mId !== false) {
94: $this->loadByPrimaryKey($mId);
95: }
96: }
97:
98: }
99: