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 cApiMailLogCollection extends ItemCollection {
25:
26: 27: 28:
29: public function __construct() {
30: global $cfg;
31: parent::__construct($cfg['tab']['mail_log'], 'idmail');
32: $this->_setItemClass('cApiMailLog');
33: }
34:
35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48:
49: public function create($from, $to, $replyTo, $cc, $bcc, $subject, $body, $created, $charset, $contentType) {
50: $item = $this->createNewItem();
51:
52: $item->set('from', json_encode($from));
53: $item->set('to', json_encode($to));
54: $item->set('reply_to', json_encode($replyTo));
55: $item->set('cc', json_encode($cc));
56: $item->set('bcc', json_encode($bcc));
57: $item->set('subject', $subject);
58: $item->set('body', $body);
59: $date = date('Y-m-d H:i:s', $created);
60: $item->set('created', $date, false);
61: $idclient = cRegistry::getClientId();
62: $item->set('idclient', $idclient);
63: $idlang = cRegistry::getLanguageId();
64: $item->set('idlang', $idlang);
65: $item->set('charset', $charset);
66: $item->set('content_type', $contentType);
67:
68: $item->store();
69:
70: return $item;
71: }
72: }
73:
74: 75: 76: 77: 78: 79:
80: class cApiMailLog extends Item {
81:
82: 83: 84: 85: 86:
87: public function __construct($mId = false) {
88: global $cfg;
89: parent::__construct($cfg['tab']['mail_log'], 'idmail');
90: $this->setFilters(array(), array());
91: if ($mId !== false) {
92: $this->loadByPrimaryKey($mId);
93: }
94: }
95: }
96: