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 cApiCommunicationCollection extends ItemCollection {
25:
26: 27: 28:
29: public function __construct() {
30: global $cfg;
31: parent::__construct($cfg['tab']['communications'], 'idcommunication');
32: $this->_setItemClass('cApiCommunication');
33:
34:
35: $this->_setJoinPartner('cApiClientCollection');
36: }
37:
38: 39: 40: 41: 42:
43: public function create() {
44: global $auth, $client;
45: $item = parent::createNewItem();
46:
47: $item->set('idclient', (int) $client);
48: $item->set('author', $auth->auth['uid']);
49: $item->set('created', date('Y-m-d H:i:s'), false);
50:
51: return $item;
52: }
53:
54: }
55:
56: 57: 58: 59: 60: 61:
62: class cApiCommunication extends Item {
63:
64: 65: 66: 67: 68:
69: public function __construct($mId = false) {
70: global $cfg;
71: parent::__construct($cfg['tab']['communications'], 'idcommunication');
72: if ($mId !== false) {
73: $this->loadByPrimaryKey($mId);
74: }
75: }
76:
77: 78: 79:
80: public function store() {
81: global $auth;
82: $this->set('modifiedby', $auth->auth['uid']);
83: $this->set('modified', date('Y-m-d H:i:s'), false);
84:
85: return parent::store();
86: }
87:
88: }
89: