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