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: public function create($area, $idframe, $idfile) {
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: $item->set('idarea', (int) $area);
55: $item->set('idfile', (int) $idfile);
56: $item->set('idframe', (int) $idframe);
57:
58: $item->store();
59:
60: return ($item);
61: }
62:
63: }
64:
65: 66: 67: 68: 69: 70:
71: class cApiFrameFile extends Item {
72:
73: 74: 75: 76: 77:
78: public function __construct($mId = false) {
79: global $cfg;
80: parent::__construct($cfg['tab']['framefiles'], 'idframefile');
81: $this->setFilters(array(
82: 'addslashes'
83: ), array(
84: 'stripslashes'
85: ));
86: if ($mId !== false) {
87: $this->loadByPrimaryKey($mId);
88: }
89: }
90: }
91: