1: <?php
2:
3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13:
14:
15: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
16:
17: 18: 19: 20: 21: 22:
23: class cApiActionlogCollection extends ItemCollection {
24:
25: 26: 27: 28: 29: 30:
31: public function __construct() {
32: global $cfg;
33: parent::__construct($cfg['tab']['actionlog'], 'idlog');
34: $this->_setItemClass('cApiActionlog');
35:
36:
37: $this->_setJoinPartner('cApiUserCollection');
38: $this->_setJoinPartner('cApiClientCollection');
39: $this->_setJoinPartner('cApiLanguageCollection');
40: $this->_setJoinPartner('cApiActionCollection');
41: $this->_setJoinPartner('cApiCategoryArticleCollection');
42: }
43:
44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55:
56: public function create($userId, $idclient, $idlang, $idaction, $idcatart, $logtimestamp = '') {
57: $item = $this->createNewItem();
58:
59: if (empty($logtimestamp)) {
60: $logtimestamp = date('Y-m-d H:i:s');
61: }
62:
63: $item->set('user_id', $userId);
64: $item->set('idclient', $idclient);
65: $item->set('idlang', $idlang);
66: $item->set('idaction', $idaction);
67: $item->set('idcatart', $idcatart);
68: $item->set('logtimestamp', $logtimestamp);
69:
70: $item->store();
71:
72: return $item;
73: }
74:
75: }
76:
77: 78: 79: 80: 81: 82:
83: class cApiActionlog extends Item {
84:
85: 86: 87: 88: 89: 90:
91: public function __construct($mId = false) {
92: global $cfg;
93: parent::__construct($cfg['tab']['actionlog'], 'idlog');
94: $this->setFilters(array(), array());
95: if ($mId !== false) {
96: $this->loadByPrimaryKey($mId);
97: }
98: }
99:
100: 101: 102: 103: 104: 105: 106: 107: 108:
109: public function setField($name, $value, $bSafe = true) {
110: switch ($name) {
111: case 'idclient':
112: $value = (int) $value;
113: break;
114: case 'idlang':
115: $value = (int) $value;
116: break;
117: case 'idaction':
118: $value = (int) $value;
119: break;
120: case 'idcatart':
121: $value = (int) $value;
122: break;
123: }
124:
125: return parent::setField($name, $value, $bSafe);
126: }
127:
128: }
129: