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 cApiFrameFileCollection extends ItemCollection {
25:
26: 27: 28:
29: public function __construct() {
30: global $cfg;
31: parent::__construct($cfg['tab']['framefiles'], 'idframefile');
32: $this->_setItemClass('cApiFrameFile');
33:
34:
35: $this->_setJoinPartner('cApiAreaCollection');
36: $this->_setJoinPartner('cApiFileCollection');
37: }
38:
39: 40: 41: 42: 43: 44: 45:
46: public function create($area, $idframe, $idfile) {
47: $item = parent::createNewItem();
48:
49: if (is_string($area)) {
50: $c = new cApiArea();
51: $c->loadBy('name', $area);
52:
53: if ($c->isLoaded()) {
54: $area = $c->get('idarea');
55: } else {
56: $area = 0;
57: cWarning(__FILE__, __LINE__, "Could not resolve area [$area] passed to method [create], assuming 0");
58: }
59: }
60:
61: $item->set('idarea', (int) $area);
62: $item->set('idfile', (int) $idfile);
63: $item->set('idframe', (int) $idframe);
64:
65: $item->store();
66:
67: return ($item);
68: }
69: }
70:
71: 72: 73: 74: 75: 76:
77: class cApiFrameFile extends Item {
78:
79: 80: 81: 82: 83:
84: public function __construct($mId = false) {
85: global $cfg;
86: parent::__construct($cfg['tab']['framefiles'], 'idframefile');
87: $this->setFilters(array(
88: 'addslashes'
89: ), array(
90: 'stripslashes'
91: ));
92: if ($mId !== false) {
93: $this->loadByPrimaryKey($mId);
94: }
95: }
96: }
97: