Supportcenter - Version 0.1.0

Version Notes

supportCenter for magento1.4

Download this release

Release Info

Developer Magento Core Team
Extension Supportcenter
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

Files changed (74) hide show
  1. app/code/local/Magestore/Magenotification/Block/Rewrite/AdminhtmlNotificationGridRendererActions.php +37 -0
  2. app/code/local/Magestore/Magenotification/Block/Rewrite/AdminhtmlNotificationWindow.php +18 -0
  3. app/code/local/Magestore/Magenotification/Helper/Data.php +6 -0
  4. app/code/local/Magestore/Magenotification/Model/Magenotification.php +171 -0
  5. app/code/local/Magestore/Magenotification/Model/Mysql4/Magenotification.php +9 -0
  6. app/code/local/Magestore/Magenotification/Model/Mysql4/Magenotification/Collection.php +10 -0
  7. app/code/local/Magestore/Magenotification/Model/Observer.php +10 -0
  8. app/code/local/Magestore/Magenotification/Model/Rewrite/AdminnotificationMysql4Inbox.php +44 -0
  9. app/code/local/Magestore/Magenotification/Model/Source/Time.php +38 -0
  10. app/code/local/Magestore/Magenotification/Model/Status.php +15 -0
  11. app/code/local/Magestore/Magenotification/controllers/Adminhtml/MagenotificationController.php +25 -0
  12. app/code/local/Magestore/Magenotification/etc/adminhtml.xml +52 -0
  13. app/code/local/Magestore/Magenotification/etc/config.xml +94 -0
  14. app/code/local/Magestore/Magenotification/etc/system.xml +60 -0
  15. app/code/local/Magestore/Magenotification/sql/magenotification_setup/mysql4-install-0.1.0.php +21 -0
  16. app/code/local/Magestore/Supportcenter/Block/Adminhtml/Department.php +12 -0
  17. app/code/local/Magestore/Supportcenter/Block/Adminhtml/Department/Edit.php +45 -0
  18. app/code/local/Magestore/Supportcenter/Block/Adminhtml/Department/Edit/Form.php +19 -0
  19. app/code/local/Magestore/Supportcenter/Block/Adminhtml/Department/Edit/Tab/Form.php +53 -0
  20. app/code/local/Magestore/Supportcenter/Block/Adminhtml/Department/Edit/Tabs.php +24 -0
  21. app/code/local/Magestore/Supportcenter/Block/Adminhtml/Department/Grid.php +155 -0
  22. app/code/local/Magestore/Supportcenter/Block/Adminhtml/Renderer/Closedticket.php +9 -0
  23. app/code/local/Magestore/Supportcenter/Block/Adminhtml/Renderer/Openticket.php +9 -0
  24. app/code/local/Magestore/Supportcenter/Block/Adminhtml/Renderer/Totalticket.php +9 -0
  25. app/code/local/Magestore/Supportcenter/Block/Adminhtml/Renderer/Waittingticket.php +9 -0
  26. app/code/local/Magestore/Supportcenter/Block/Adminhtml/Ticket.php +12 -0
  27. app/code/local/Magestore/Supportcenter/Block/Adminhtml/Ticket/Grid.php +154 -0
  28. app/code/local/Magestore/Supportcenter/Block/Adminhtml/Ticket/Reply.php +50 -0
  29. app/code/local/Magestore/Supportcenter/Block/Adminhtml/Ticket/Reply/Form.php +20 -0
  30. app/code/local/Magestore/Supportcenter/Block/Adminhtml/Ticket/Reply/Tab/Detail.php +44 -0
  31. app/code/local/Magestore/Supportcenter/Block/Adminhtml/Ticket/Reply/Tab/Form.php +85 -0
  32. app/code/local/Magestore/Supportcenter/Block/Adminhtml/Ticket/Reply/Tab/Reply.php +72 -0
  33. app/code/local/Magestore/Supportcenter/Block/Adminhtml/Ticket/Reply/Tab/Statuslog.php +70 -0
  34. app/code/local/Magestore/Supportcenter/Block/Adminhtml/Ticket/Reply/Tabs.php +42 -0
  35. app/code/local/Magestore/Supportcenter/Block/Department.php +28 -0
  36. app/code/local/Magestore/Supportcenter/Block/Ticket.php +58 -0
  37. app/code/local/Magestore/Supportcenter/Block/Viewticket.php +51 -0
  38. app/code/local/Magestore/Supportcenter/Helper/Data.php +42 -0
  39. app/code/local/Magestore/Supportcenter/Model/Department.php +35 -0
  40. app/code/local/Magestore/Supportcenter/Model/Departmentstatus.php +15 -0
  41. app/code/local/Magestore/Supportcenter/Model/Mysql4/Department.php +11 -0
  42. app/code/local/Magestore/Supportcenter/Model/Mysql4/Department/Collection.php +21 -0
  43. app/code/local/Magestore/Supportcenter/Model/Mysql4/Replyticket.php +12 -0
  44. app/code/local/Magestore/Supportcenter/Model/Mysql4/Replyticket/Collection.php +11 -0
  45. app/code/local/Magestore/Supportcenter/Model/Mysql4/Statuslog.php +10 -0
  46. app/code/local/Magestore/Supportcenter/Model/Mysql4/Statuslog/Collection.php +10 -0
  47. app/code/local/Magestore/Supportcenter/Model/Mysql4/Ticket.php +13 -0
  48. app/code/local/Magestore/Supportcenter/Model/Mysql4/Ticket/Collection.php +38 -0
  49. app/code/local/Magestore/Supportcenter/Model/Replyticket.php +56 -0
  50. app/code/local/Magestore/Supportcenter/Model/Sendmail.php +14 -0
  51. app/code/local/Magestore/Supportcenter/Model/Session.php +13 -0
  52. app/code/local/Magestore/Supportcenter/Model/Statuslog.php +10 -0
  53. app/code/local/Magestore/Supportcenter/Model/Ticket.php +133 -0
  54. app/code/local/Magestore/Supportcenter/Model/Ticketstatus.php +17 -0
  55. app/code/local/Magestore/Supportcenter/controllers/Adminhtml/DepartmentController.php +214 -0
  56. app/code/local/Magestore/Supportcenter/controllers/Adminhtml/GuestticketController.php +209 -0
  57. app/code/local/Magestore/Supportcenter/controllers/Adminhtml/TicketController.php +214 -0
  58. app/code/local/Magestore/Supportcenter/controllers/GuestController.php +104 -0
  59. app/code/local/Magestore/Supportcenter/controllers/IndexController.php +130 -0
  60. app/code/local/Magestore/Supportcenter/etc/adminhtml.xml +49 -0
  61. app/code/local/Magestore/Supportcenter/etc/config.xml +118 -0
  62. app/code/local/Magestore/Supportcenter/etc/system.xml +94 -0
  63. app/code/local/Magestore/Supportcenter/sql/supportcenter_setup/mysql4-install-0.1.0.php +83 -0
  64. app/design/adminhtml/default/default/layout/supportcenter.xml +15 -0
  65. app/design/adminhtml/default/default/template/supportcenter/detail.phtml +44 -0
  66. app/design/frontend/default/default/layout/supportcenter.xml +56 -0
  67. app/design/frontend/default/default/template/supportcenter/supportcenter.phtml +80 -0
  68. app/design/frontend/default/default/template/supportcenter/supportcenterguest.phtml +48 -0
  69. app/design/frontend/default/default/template/supportcenter/viewticket.phtml +76 -0
  70. app/design/frontend/default/default/template/supportcenter/viewticketguest.phtml +92 -0
  71. app/etc/modules/Magestore_Magenotification.xml +9 -0
  72. app/etc/modules/Magestore_Supportcenter.xml +9 -0
  73. package.xml +27 -0
  74. skin/frontend/default/default/css/magestore/supportcenter.css +15 -0
app/code/local/Magestore/Magenotification/Block/Rewrite/AdminhtmlNotificationGridRendererActions.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Magenotification_Block_Rewrite_AdminhtmlNotificationGridRendererActions
3
+ extends Mage_Adminhtml_Block_Notification_Grid_Renderer_Actions
4
+ {
5
+ public function render(Varien_Object $row)
6
+ {
7
+
8
+ if(! Mage::getModel('magenotification/magenotification')->is_existedUrl($row->getUrl()))
9
+ {
10
+ return parent::render($row);
11
+ }
12
+
13
+ $read_url = $this->getUrl('magenotification/adminhtml_magenotification/readdetail',array('id'=>$row->getId()));
14
+
15
+ if (!$row->getIsRead()) {
16
+ return sprintf('<a target="_blank" href="%s">%s</a> | <a href="%s">%s</a> | <a href="%s" onClick="deleteConfirm(\'%s\',this.href); return false;">%s</a>',
17
+ $read_url,
18
+ Mage::helper('adminnotification')->__('Read Details'),
19
+ $this->getUrl('*/*/markAsRead/', array('_current'=>true, 'id' => $row->getId())),
20
+ Mage::helper('adminnotification')->__('Mark as Read'),
21
+ $this->getUrl('*/*/remove/', array('_current'=>true, 'id' => $row->getId())),
22
+ Mage::helper('adminnotification')->__('Are you sure?'),
23
+ Mage::helper('adminnotification')->__('Remove')
24
+ );
25
+ }
26
+ else {
27
+ return sprintf('<a target="_blank" href="%s">%s</a> | <a href="%s" onClick="deleteConfirm(\'%s\',this.href); return false;">%s</a>',
28
+ $read_url,
29
+ Mage::helper('adminnotification')->__('Read Details'),
30
+ $this->getUrl('*/*/remove/', array('_current'=>true, 'id' => $row->getId())),
31
+ Mage::helper('adminnotification')->__('Are you sure?'),
32
+ Mage::helper('adminnotification')->__('Remove')
33
+ );
34
+ }
35
+ }
36
+
37
+ }
app/code/local/Magestore/Magenotification/Block/Rewrite/AdminhtmlNotificationWindow.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Magenotification_Block_Rewrite_AdminhtmlNotificationWindow extends Mage_Adminhtml_Block_Notification_Window
3
+ {
4
+ protected function _construct()
5
+ {
6
+ parent::_construct();
7
+
8
+ if(Mage::getModel('magenotification/magenotification')->is_existedUrl($this->getLastNotice()->getUrl()))
9
+ {
10
+ $url = $this->getUrl('magenotification/adminhtml_magenotification/readdetail',array('id'=>$this->getLastNotice()->getId()));
11
+
12
+ $this->setHeaderText(addslashes($this->__('Magestore Message')));
13
+
14
+ $this->setNoticeMessageUrl(addslashes($url));
15
+ }
16
+ }
17
+
18
+ }
app/code/local/Magestore/Magenotification/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
app/code/local/Magestore/Magenotification/Model/Magenotification.php ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Model_Magenotification extends Mage_Core_Model_Abstract
4
+ {
5
+ const XML_FREQUENCY_PATH = 'magenotification/general/frequency';
6
+ const XML_LAST_UPDATE_PATH = 'magenotification/general/last_update';
7
+ const XML_MAGESTORE_URL_PATH = 'magenotification/general/magestore_url';
8
+
9
+ public function _construct()
10
+ {
11
+ parent::_construct();
12
+ $this->_init('magenotification/magenotification');
13
+ }
14
+
15
+ public function checkUpdate()
16
+ {
17
+ $timestamp = Mage::getModel('core/date')->timestamp(time());
18
+
19
+ if (($this->getFrequency() + $this->getLastUpdate()) > $timestamp)
20
+ {
21
+ return $this;
22
+ }
23
+
24
+ $notificationXml = $this->getNotificationData();
25
+
26
+ $noticeData = array();
27
+
28
+ if ($notificationXml && $notificationXml->item)
29
+ {
30
+ foreach ($notificationXml->item as $item) {
31
+ $noticeData[] = array(
32
+ 'severity' => (int)$item->severity,
33
+ 'date_added' => $this->getDate((string)$item->date_added),
34
+ 'title' => (string)$item->title,
35
+ 'description' => (string)$item->description,
36
+ 'url' => (string)$item->url,
37
+ );
38
+ }
39
+
40
+ if($noticeData)
41
+ {
42
+ $this ->parse(array_reverse($noticeData));
43
+
44
+ $this->setLastUpdate();
45
+ }
46
+ }
47
+ return $this;
48
+ }
49
+
50
+
51
+ public function getLastUpdate()
52
+ {
53
+ $timestring = Mage::getStoreConfig(self::XML_LAST_UPDATE_PATH);
54
+
55
+ return strtotime($timestring);
56
+ }
57
+
58
+ public function setLastUpdate()
59
+ {
60
+ $config = Mage::getModel('core/config');
61
+ $timestamp = Mage::getModel('core/date')->timestamp(time());
62
+
63
+ $config ->saveConfig(self::XML_LAST_UPDATE_PATH,$timestamp);
64
+ $config->cleanCache();
65
+ }
66
+
67
+ public function getFrequency()
68
+ {
69
+ return Mage::getStoreConfig(self::XML_FREQUENCY_PATH) * 3600;
70
+ }
71
+
72
+ public function getMagestoreUrl()
73
+ {
74
+ $lastTimeNotice = strtotime($this->getLastNotice()->getAddedDate());
75
+
76
+ return Mage::getStoreConfig(self::XML_MAGESTORE_URL_PATH) .'/magenotification/service/getfeed/lastupdatetime/'. $lastTimeNotice;
77
+ }
78
+
79
+ public function getNotificationData()
80
+ {
81
+ $curl = new Varien_Http_Adapter_Curl();
82
+ $curl->setConfig(array(
83
+ 'timeout' => 2
84
+ ));
85
+ $curl->write(Zend_Http_Client::GET, $this->getMagestoreUrl(), '1.0');
86
+ $data = $curl->read();
87
+
88
+ if ($data === false) {
89
+ return false;
90
+ }
91
+ $data = preg_split('/^\r?$/m', $data, 2);
92
+ $data = trim($data[1]);
93
+ $curl->close();
94
+
95
+ try {
96
+ $xml = new SimpleXMLElement($data);
97
+ }
98
+ catch (Exception $e) {
99
+ return false;
100
+ }
101
+
102
+ return $xml;
103
+ }
104
+
105
+ public function getNotificationXml()
106
+ {
107
+ try {
108
+ $data = $this->getNotificationData();
109
+ $xml = new SimpleXMLElement($data);
110
+ }
111
+ catch (Exception $e) {
112
+ $xml = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8" ?>');
113
+ }
114
+
115
+ return $xml;
116
+ }
117
+
118
+ public function getDate($rssDate)
119
+ {
120
+ return gmdate('Y-m-d H:i:s', strtotime($rssDate));
121
+ }
122
+
123
+ public function parse($data)
124
+ {
125
+ if(count($data))
126
+ {
127
+ $inbox = Mage::getModel('adminnotification/inbox');
128
+
129
+ try{
130
+ foreach($data as $item)
131
+ {
132
+ if(! $this->is_existedUrl($item['url']) )
133
+ {
134
+ $inbox->setData($item)
135
+ ->save();
136
+
137
+ $this->setUrl($inbox->getUrl());
138
+ $this->setNotificationId($inbox->getId());
139
+ $this->setAddedDate($inbox->getDateAdded());
140
+ $this->save();
141
+
142
+ //unset Id
143
+ $this->setId(null);
144
+ $inbox->setId(null);
145
+ }
146
+ }
147
+ } catch(Exception $e) {
148
+
149
+ Mage::getSingleton('core/session')->addError($e->getMessage());
150
+ }
151
+ }
152
+ }
153
+
154
+ public function is_existedUrl($url)
155
+ {
156
+ $collection = $this->getCollection()
157
+ ->addFieldToFilter('url',$url);
158
+ if(count($collection))
159
+ return true;
160
+
161
+ return false;
162
+ }
163
+
164
+ public function getLastNotice()
165
+ {
166
+ $item = $this->getCollection()
167
+ ->setOrder('added_date','DESC')
168
+ ->getFirstItem();
169
+ return $item;
170
+ }
171
+ }
app/code/local/Magestore/Magenotification/Model/Mysql4/Magenotification.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Model_Mysql4_Magenotification extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ protected function _construct()
6
+ {
7
+ $this->_init('magenotification/magenotification', 'magenotification_id');
8
+ }
9
+ }
app/code/local/Magestore/Magenotification/Model/Mysql4/Magenotification/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Model_Mysql4_Magenotification_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('magenotification/magenotification');
9
+ }
10
+ }
app/code/local/Magestore/Magenotification/Model/Observer.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Model_Observer
4
+ {
5
+ public function controllerActionPredispatch($observer)
6
+ {
7
+ Mage::getModel('magenotification/magenotification')->checkUpdate();
8
+ return;
9
+ }
10
+ }
app/code/local/Magestore/Magenotification/Model/Rewrite/AdminnotificationMysql4Inbox.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Model_Rewrite_AdminnotificationMysql4Inbox extends Mage_AdminNotification_Model_Mysql4_Inbox
4
+ {
5
+ public function loadLatestNotice(Mage_AdminNotification_Model_Inbox $object)
6
+ {
7
+ $select = $this->_getReadAdapter()->select()
8
+ ->from($this->getMainTable())
9
+ ->order($this->getIdFieldName() . ' desc')
10
+ ->where('is_read <> 1')
11
+ ->where('is_remove <> 1')
12
+ ->limit(1);
13
+
14
+ $data = $this->_getReadAdapter()->fetchRow($select);
15
+
16
+ if ($data) {
17
+ $object->setData($data);
18
+ }
19
+
20
+ $this->_afterLoad($object);
21
+
22
+ return $this;
23
+ }
24
+
25
+ public function getNoticeStatus(Mage_AdminNotification_Model_Inbox $object)
26
+ {
27
+ $select = $this->_getReadAdapter()->select()
28
+ ->from($this->getMainTable(), array(
29
+ 'severity' => 'severity',
30
+ 'count_notice' => 'COUNT(' . $this->getIdFieldName() . ')'))
31
+ ->group('severity')
32
+ ->where('is_remove=?', 0)
33
+ ->where('is_read=?', 0);
34
+
35
+
36
+
37
+ $return = array();
38
+ $rowSet = $this->_getReadAdapter()->fetchAll($select);
39
+ foreach ($rowSet as $row) {
40
+ $return[$row['severity']] = $row['count_notice'];
41
+ }
42
+ return $return;
43
+ }
44
+ }
app/code/local/Magestore/Magenotification/Model/Source/Time.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Model_Source_Time extends Mage_Core_Model_Config_Data
4
+ {
5
+ protected function _afterLoad()
6
+ {
7
+ $value = (string)$this->getValue();
8
+ if($value == '')
9
+ {
10
+ $timestamp = $this->getTimestamp();
11
+
12
+ $html = date('Y-m-d H:i:s',$timestamp);
13
+
14
+ } else {
15
+ $html = date('Y-m-d H:i:s',intval($value));
16
+ }
17
+
18
+ $this->setValue($html);
19
+
20
+ }
21
+
22
+ protected function _beforeSave()
23
+ {
24
+ $value = $this->getValue();
25
+ $value = strtotime($value);
26
+ $this->setValue($value);
27
+ }
28
+
29
+ private function getTimestamp()
30
+ {
31
+ return Mage::getModel('core/date')->timestamp(time());
32
+ }
33
+
34
+ public function toOptionArray()
35
+ {
36
+
37
+ }
38
+ }
app/code/local/Magestore/Magenotification/Model/Status.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Model_Status extends Varien_Object
4
+ {
5
+ const STATUS_ENABLED = 1;
6
+ const STATUS_DISABLED = 2;
7
+
8
+ static public function getOptionArray()
9
+ {
10
+ return array(
11
+ self::STATUS_ENABLED => Mage::helper('magenotification')->__('Enabled'),
12
+ self::STATUS_DISABLED => Mage::helper('magenotification')->__('Disabled')
13
+ );
14
+ }
15
+ }
app/code/local/Magestore/Magenotification/controllers/Adminhtml/MagenotificationController.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Magenotification_Adminhtml_MagenotificationController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+
6
+ public function readdetailAction()
7
+ {
8
+ include(Mage::getBaseDir() . DS .'lib'. DS .'PEAR'. DS .'HTTP'. DS .'HTTP.php');
9
+
10
+ $id = $this->getRequest()->getParam('id');
11
+
12
+ $notice = Mage::getModel('adminnotification/inbox')->load($id);
13
+
14
+ $notice->setIsRead(1);
15
+
16
+ $notice->save();
17
+
18
+ $http = new HTTP();
19
+
20
+ $http->redirect($notice->getUrl());
21
+
22
+ return;
23
+ }
24
+
25
+ }
app/code/local/Magestore/Magenotification/etc/adminhtml.xml ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <all>
6
+ <title>Allow Everything</title>
7
+ </all>
8
+ <admin>
9
+ <children>
10
+ <system>
11
+ <children>
12
+ <config>
13
+ <children>
14
+ <magenotification translate="title">
15
+ <title>MageNotification</title>
16
+ <sort_order>50</sort_order>
17
+ </magenotification>
18
+ </children>
19
+ </config>
20
+ </children>
21
+ </system>
22
+ </children>
23
+ </admin>
24
+ </resources>
25
+ </acl>
26
+ <acl>
27
+ <resources>
28
+ <all>
29
+ <title>Allow Everything</title>
30
+ </all>
31
+ <admin>
32
+ <children>
33
+ <Magestore_Magenotification>
34
+ <title>Magenotification Module</title>
35
+ <sort_order>10</sort_order>
36
+ </Magestore_Magenotification>
37
+ </children>
38
+ </admin>
39
+ </resources>
40
+ </acl>
41
+ <events>
42
+ <controller_action_predispatch>
43
+ <observers>
44
+ <magestore_magenotification_observer>
45
+ <type>singleton</type>
46
+ <class>magenotification/observer</class>
47
+ <method>controllerActionPredispatch</method>
48
+ </magestore_magenotification_observer>
49
+ </observers>
50
+ </controller_action_predispatch>
51
+ </events>
52
+ </config>
app/code/local/Magestore/Magenotification/etc/config.xml ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Magestore_Magenotification>
5
+ <version>0.1.0</version>
6
+ </Magestore_Magenotification>
7
+ </modules>
8
+ <admin>
9
+ <routers>
10
+ <magenotification>
11
+ <use>admin</use>
12
+ <args>
13
+ <module>Magestore_Magenotification</module>
14
+ <frontName>magenotification</frontName>
15
+ </args>
16
+ </magenotification>
17
+ </routers>
18
+ </admin>
19
+ <adminhtml>
20
+ <layout>
21
+ <updates>
22
+ <magenotification>
23
+ <file>magenotification.xml</file>
24
+ </magenotification>
25
+ </updates>
26
+ </layout>
27
+ </adminhtml>
28
+ <global>
29
+ <models>
30
+ <magenotification>
31
+ <class>Magestore_Magenotification_Model</class>
32
+ <resourceModel>magenotification_mysql4</resourceModel>
33
+ </magenotification>
34
+ <magenotification_mysql4>
35
+ <class>Magestore_Magenotification_Model_Mysql4</class>
36
+ <entities>
37
+ <magenotification>
38
+ <table>magenotification</table>
39
+ </magenotification>
40
+ </entities>
41
+ </magenotification_mysql4>
42
+ <adminnotification_mysql4>
43
+ <rewrite>
44
+ <inbox>Magestore_Magenotification_Model_Rewrite_AdminnotificationMysql4Inbox</inbox>
45
+ </rewrite>
46
+ </adminnotification_mysql4>
47
+ </models>
48
+ <resources>
49
+ <magenotification_setup>
50
+ <setup>
51
+ <module>Magestore_Magenotification</module>
52
+ </setup>
53
+ <connection>
54
+ <use>core_setup</use>
55
+ </connection>
56
+ </magenotification_setup>
57
+ <magenotification_write>
58
+ <connection>
59
+ <use>core_write</use>
60
+ </connection>
61
+ </magenotification_write>
62
+ <magenotification_read>
63
+ <connection>
64
+ <use>core_read</use>
65
+ </connection>
66
+ </magenotification_read>
67
+ </resources>
68
+ <blocks>
69
+ <magenotification>
70
+ <class>Magestore_Magenotification_Block</class>
71
+ </magenotification>
72
+ <adminhtml>
73
+ <rewrite>
74
+ <notification_window>Magestore_Magenotification_Block_Rewrite_AdminhtmlNotificationWindow</notification_window>
75
+ <notification_grid_renderer_actions>Magestore_Magenotification_Block_Rewrite_AdminhtmlNotificationGridRendererActions</notification_grid_renderer_actions>
76
+ </rewrite>
77
+ </adminhtml>
78
+ </blocks>
79
+ <helpers>
80
+ <magenotification>
81
+ <class>Magestore_Magenotification_Helper</class>
82
+ </magenotification>
83
+ </helpers>
84
+ </global>
85
+ <default>
86
+ <magenotification>
87
+ <general>
88
+ <frequency>1</frequency>
89
+ <last_update backend_model="magenotification/source_time"></last_update>
90
+ <magestore_url>http://www.magestore.com/index.php</magestore_url>
91
+ </general>
92
+ </magenotification>
93
+ </default>
94
+ </config>
app/code/local/Magestore/Magenotification/etc/system.xml ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <magestore translate="label">
5
+ <label>Magestore Extension</label>
6
+ <sort_order>400</sort_order>
7
+ </magestore>
8
+ </tabs>
9
+ <sections>
10
+ <magenotification translate="label" module="magenotification">
11
+ <class>separator-top</class>
12
+ <label>MageNotification</label>
13
+ <tab>magestore</tab>
14
+ <frontend_type>text</frontend_type>
15
+ <sort_order>299</sort_order>
16
+ <show_in_default>1</show_in_default>
17
+ <show_in_website>1</show_in_website>
18
+ <show_in_store>1</show_in_store>
19
+ <groups>
20
+ <general translate="label">
21
+ <label>General Infomation</label>
22
+ <frontend_type>text</frontend_type>
23
+ <sort_order>1</sort_order>
24
+ <show_in_default>1</show_in_default>
25
+ <show_in_website>1</show_in_website>
26
+ <show_in_store>1</show_in_store>
27
+ <fields>
28
+
29
+ <frequency translate="label">
30
+ <label>Update frequency</label>
31
+ <frontend_type>select</frontend_type>
32
+ <source_model>adminhtml/system_config_source_notification_frequency</source_model>
33
+ <sort_order>1</sort_order>
34
+ <show_in_default>1</show_in_default>
35
+ <show_in_website>1</show_in_website>
36
+ <show_in_store>1</show_in_store>
37
+ </frequency>
38
+ <last_update translate="label">
39
+ <label>Last update</label>
40
+ <frontend_type>label</frontend_type>
41
+ <backend_model>magenotification/source_time</backend_model>
42
+ <sort_order>2</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>0</show_in_website>
45
+ <show_in_store>0</show_in_store>
46
+ </last_update>
47
+ <magestore_url translate="label">
48
+ <label>Magestore Url</label>
49
+ <frontend_type>label</frontend_type>
50
+ <sort_order>3</sort_order>
51
+ <show_in_default>1</show_in_default>
52
+ <show_in_website>0</show_in_website>
53
+ <show_in_store>0</show_in_store>
54
+ </magestore_url>
55
+ </fields>
56
+ </general>
57
+ </groups>
58
+ </magenotification>
59
+ </sections>
60
+ </config>
app/code/local/Magestore/Magenotification/sql/magenotification_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ DROP TABLE IF EXISTS {$this->getTable('magenotification')};
10
+ CREATE TABLE {$this->getTable('magenotification')} (
11
+ `magenotification_id` int(11) unsigned NOT NULL auto_increment,
12
+ `notification_id` int(10) unsigned NOT NULL,
13
+ `url` varchar(255) NOT NULL default '',
14
+ `added_date` datetime NOT NULL,
15
+ UNIQUE (`notification_id`, `url`),
16
+ PRIMARY KEY (`magenotification_id`)
17
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
18
+
19
+ ");
20
+
21
+ $installer->endSetup();
app/code/local/Magestore/Supportcenter/Block/Adminhtml/Department.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportcenter_Block_Adminhtml_Department extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_department';
7
+ $this->_blockGroup = 'supportcenter';
8
+ $this->_headerText = Mage::helper('supportcenter')->__('Department Manager');
9
+ $this->_addButtonLabel = Mage::helper('supportcenter')->__('Add Department');
10
+ parent::__construct();
11
+ }
12
+ }
app/code/local/Magestore/Supportcenter/Block/Adminhtml/Department/Edit.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportcenter_Block_Adminhtml_Department_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+
9
+ $this->_objectId = 'id';
10
+ $this->_blockGroup = 'supportcenter';
11
+ $this->_controller = 'adminhtml_department';
12
+
13
+ $this->_updateButton('save', 'label', Mage::helper('supportcenter')->__('Save Department'));
14
+ $this->_updateButton('delete', 'label', Mage::helper('supportcenter')->__('Delete Department'));
15
+
16
+ $this->_addButton('saveandcontinue', array(
17
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
18
+ 'onclick' => 'saveAndContinueEdit()',
19
+ 'class' => 'save',
20
+ ), -100);
21
+
22
+ $this->_formScripts[] = "
23
+ function toggleEditor() {
24
+ if (tinyMCE.getInstanceById('supportcenter_content') == null) {
25
+ tinyMCE.execCommand('mceAddControl', false, 'supportcenter_content');
26
+ } else {
27
+ tinyMCE.execCommand('mceRemoveControl', false, 'supportcenter_content');
28
+ }
29
+ }
30
+
31
+ function saveAndContinueEdit(){
32
+ editForm.submit($('edit_form').action+'back/edit/');
33
+ }
34
+ ";
35
+ }
36
+
37
+ public function getHeaderText()
38
+ {
39
+ if( Mage::registry('department_data') && Mage::registry('department_data')->getId() ) {
40
+ return Mage::helper('supportcenter')->__("Edit Department '%s'", $this->htmlEscape(Mage::registry('department_data')->getDepartmentTitle()));
41
+ } else {
42
+ return Mage::helper('supportcenter')->__('Add Department');
43
+ }
44
+ }
45
+ }
app/code/local/Magestore/Supportcenter/Block/Adminhtml/Department/Edit/Form.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportcenter_Block_Adminhtml_Department_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form(array(
8
+ 'id' => 'edit_form',
9
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
10
+ 'method' => 'post',
11
+ 'enctype' => 'multipart/form-data'
12
+ )
13
+ );
14
+
15
+ $form->setUseContainer(true);
16
+ $this->setForm($form);
17
+ return parent::_prepareForm();
18
+ }
19
+ }
app/code/local/Magestore/Supportcenter/Block/Adminhtml/Department/Edit/Tab/Form.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportcenter_Block_Adminhtml_Department_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+ $fieldset = $form->addFieldset('department_form', array('legend'=>Mage::helper('supportcenter')->__('Department information')));
10
+
11
+ $fieldset->addField('is_active', 'select', array(
12
+ 'label' => Mage::helper('supportcenter')->__('Active'),
13
+ 'required' => true,
14
+ 'name' => 'is_active',
15
+ 'values' => array(
16
+ array(
17
+ 'value' => 1,
18
+ 'label' => Mage::helper('supportcenter')->__('Yes'),
19
+ ),
20
+
21
+ array(
22
+ 'value' => 0,
23
+ 'label' => Mage::helper('supportcenter')->__('No'),
24
+ ),
25
+ ),
26
+ ));
27
+
28
+ $fieldset->addField('department_title', 'text', array(
29
+ 'label' => Mage::helper('supportcenter')->__('Title'),
30
+ 'class' => 'required-entry',
31
+ 'required' => true,
32
+ 'name' => 'department_title',
33
+ ));
34
+
35
+
36
+ $fieldset->addField('department_email', 'text', array(
37
+ 'label' => Mage::helper('supportcenter')->__('Email'),
38
+ 'class' => 'required-entry',
39
+ 'required' => true,
40
+ 'name' => 'department_email',
41
+ ));
42
+
43
+
44
+ if ( Mage::getSingleton('adminhtml/session')->getSupportcenterData() )
45
+ {
46
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getSupportcenterData());
47
+ Mage::getSingleton('adminhtml/session')->setSupportcenterData(null);
48
+ } elseif ( Mage::registry('department_data') ) {
49
+ $form->setValues(Mage::registry('department_data')->getData());
50
+ }
51
+ return parent::_prepareForm();
52
+ }
53
+ }
app/code/local/Magestore/Supportcenter/Block/Adminhtml/Department/Edit/Tabs.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportcenter_Block_Adminhtml_Department_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('department_tabs');
10
+ $this->setDestElementId('edit_form');
11
+ $this->setTitle(Mage::helper('supportcenter')->__('Department Information'));
12
+ }
13
+
14
+ protected function _beforeToHtml()
15
+ {
16
+ $this->addTab('form_section', array(
17
+ 'label' => Mage::helper('supportcenter')->__('Department Information'),
18
+ 'title' => Mage::helper('supportcenter')->__('Department Information'),
19
+ 'content' => $this->getLayout()->createBlock('supportcenter/adminhtml_department_edit_tab_form')->toHtml(),
20
+ ));
21
+
22
+ return parent::_beforeToHtml();
23
+ }
24
+ }
app/code/local/Magestore/Supportcenter/Block/Adminhtml/Department/Grid.php ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportcenter_Block_Adminhtml_Department_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('supportcenterGrid');
9
+ $this->setDefaultSort('department_id');
10
+ $this->setDefaultDir('ASC');
11
+ $this->setSaveParametersInSession(true);
12
+ }
13
+
14
+ protected function _prepareCollection()
15
+ {
16
+ $collection = Mage::getModel('supportcenter/department')->getCollection();
17
+ //$collection = Mage::getResourceModel('supportcenter/ticket_collection')->addCountTickets();
18
+ $this->setCollection($collection);
19
+ return parent::_prepareCollection();
20
+ }
21
+
22
+
23
+ protected function _prepareColumns()
24
+ {
25
+ $this->addColumn('department_id', array(
26
+ 'header' => Mage::helper('supportcenter')->__('ID'),
27
+ 'align' =>'right',
28
+ 'width' => '50px',
29
+ 'index' => 'department_id',
30
+ ));
31
+
32
+ $this->addColumn('department_title', array(
33
+ 'header' => Mage::helper('supportcenter')->__('Title'),
34
+ 'align' =>'left',
35
+ 'index' => 'department_title',
36
+ ));
37
+
38
+ $this->addColumn('department_email', array(
39
+ 'header' => Mage::helper('supportcenter')->__('Email'),
40
+ 'index' => 'department_email',
41
+ ));
42
+
43
+ $this->addColumn('total_ticket', array(
44
+ 'header' => Mage::helper('supportcenter')->__('Total Tickets'),
45
+ 'index' => 'department_id',
46
+ 'width' => '50px',
47
+ 'renderer' => 'supportcenter/adminhtml_renderer_totalticket',
48
+ 'filter' => false,
49
+ 'sort' => false
50
+ ));
51
+
52
+
53
+ $this->addColumn('open_ticket', array(
54
+ 'header' => Mage::helper('supportcenter')->__('Open'),
55
+ 'index' => 'department_id',
56
+ 'width' => '50px',
57
+ 'renderer' => 'supportcenter/adminhtml_renderer_openticket',
58
+ 'filter' => false,
59
+ 'sort' => false
60
+ ));
61
+
62
+ $this->addColumn('closed_ticket', array(
63
+ 'header' => Mage::helper('supportcenter')->__('Closed'),
64
+ 'index' => 'department_id',
65
+ 'width' => '50px',
66
+ 'renderer' => 'supportcenter/adminhtml_renderer_closedticket',
67
+ 'filter' => false,
68
+ 'sort' => false
69
+ ));
70
+
71
+ $this->addColumn('watting_ticket', array(
72
+ 'header' => Mage::helper('supportcenter')->__('WFC'),
73
+ 'index' => 'department_id',
74
+ 'width' => '50px',
75
+ 'renderer' => 'supportcenter/adminhtml_renderer_waittingticket',
76
+ 'filter' => false,
77
+ 'sort' => false
78
+ ));
79
+
80
+
81
+ $this->addColumn('is_active', array(
82
+ 'header' => Mage::helper('supportcenter')->__('Active'),
83
+ 'align' => 'left',
84
+ 'width' => '50px',
85
+ 'index' => 'is_active',
86
+ 'type' => 'options',
87
+ 'options' => array(
88
+ 1 => 'Yes',
89
+ 0 => 'No',
90
+ ),
91
+ ));
92
+
93
+
94
+
95
+ $this->addColumn('action',
96
+ array(
97
+ 'header' => Mage::helper('supportcenter')->__('Action'),
98
+ 'width' => '100',
99
+ 'type' => 'action',
100
+ 'getter' => 'getId',
101
+ 'actions' => array(
102
+ array(
103
+ 'caption' => Mage::helper('supportcenter')->__('Edit'),
104
+ 'url' => array('base'=> '*/*/edit'),
105
+ 'field' => 'id'
106
+ )
107
+ ),
108
+ 'filter' => false,
109
+ 'sortable' => false,
110
+ 'index' => 'stores',
111
+ 'is_system' => true,
112
+ ));
113
+
114
+ //$this->addExportType('*/*/exportCsv', Mage::helper('supportcenter')->__('CSV'));
115
+ //$this->addExportType('*/*/exportXml', Mage::helper('supportcenter')->__('XML'));
116
+
117
+ return parent::_prepareColumns();
118
+ }
119
+
120
+ protected function _prepareMassaction()
121
+ {
122
+ $this->setMassactionIdField('department_id');
123
+ $this->getMassactionBlock()->setFormFieldName('department');
124
+
125
+ $this->getMassactionBlock()->addItem('delete', array(
126
+ 'label' => Mage::helper('supportcenter')->__('Delete'),
127
+ 'url' => $this->getUrl('*/*/massDelete'),
128
+ 'confirm' => Mage::helper('supportcenter')->__('Are you sure?')
129
+ ));
130
+
131
+ $isActive = Mage::getSingleton('supportcenter/departmentstatus')->getOptionArray();
132
+
133
+ array_unshift( $isActive, array('label'=>'', 'value'=>''));
134
+ $this->getMassactionBlock()->addItem('is_active', array(
135
+ 'label'=> Mage::helper('supportcenter')->__('Change Active'),
136
+ 'url' => $this->getUrl('*/*/massIsactive', array('_current'=>true)),
137
+ 'additional' => array(
138
+ 'visibility' => array(
139
+ 'name' => 'is_active',
140
+ 'type' => 'select',
141
+ 'class' => 'required-entry',
142
+ 'label' => Mage::helper('supportcenter')->__('Active'),
143
+ 'values' => $isActive
144
+ )
145
+ )
146
+ ));
147
+ return $this;
148
+ }
149
+
150
+ public function getRowUrl($row)
151
+ {
152
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
153
+ }
154
+
155
+ }
app/code/local/Magestore/Supportcenter/Block/Adminhtml/Renderer/Closedticket.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportcenter_Block_Adminhtml_Renderer_Closedticket extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
3
+ {
4
+ public function render(Varien_Object $row)
5
+ {
6
+ $data = Mage::helper('supportcenter')->getClosedTicket($row->getData($this->getColumn()->getIndex()));
7
+ return $data;
8
+ }
9
+ }
app/code/local/Magestore/Supportcenter/Block/Adminhtml/Renderer/Openticket.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportcenter_Block_Adminhtml_Renderer_Openticket extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
3
+ {
4
+ public function render(Varien_Object $row)
5
+ {
6
+ $data = Mage::helper('supportcenter')->getOpenTicket($row->getData($this->getColumn()->getIndex()));
7
+ return $data;
8
+ }
9
+ }
app/code/local/Magestore/Supportcenter/Block/Adminhtml/Renderer/Totalticket.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportcenter_Block_Adminhtml_Renderer_Totalticket extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
3
+ {
4
+ public function render(Varien_Object $row)
5
+ {
6
+ $data = Mage::helper('supportcenter')->getTotalTicket($row->getData($this->getColumn()->getIndex()));
7
+ return $data;
8
+ }
9
+ }
app/code/local/Magestore/Supportcenter/Block/Adminhtml/Renderer/Waittingticket.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportcenter_Block_Adminhtml_Renderer_Waittingticket extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
3
+ {
4
+ public function render(Varien_Object $row)
5
+ {
6
+ $data = Mage::helper('supportcenter')->getWaittingTicket($row->getData($this->getColumn()->getIndex()));
7
+ return $data;
8
+ }
9
+ }
app/code/local/Magestore/Supportcenter/Block/Adminhtml/Ticket.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportcenter_Block_Adminhtml_Ticket extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_ticket';
7
+ $this->_blockGroup = 'supportcenter';
8
+ $this->_headerText = Mage::helper('supportcenter')->__('Ticket Manager');
9
+ parent::__construct();
10
+ $this->_removeButton('add', 'label');
11
+ }
12
+ }
app/code/local/Magestore/Supportcenter/Block/Adminhtml/Ticket/Grid.php ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportcenter_Block_Adminhtml_Ticket_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
+ {
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+ $this->setId('ticketGrid');
8
+ $this->setDefaultSort('ticket_id');
9
+ $this->setDefaultDir('DESC');
10
+ $this->setSaveParametersInSession(true);
11
+ }
12
+
13
+ protected function _prepareCollection()
14
+ {
15
+ $collection = Mage::getResourceModel('supportcenter/ticket_collection')->getFullTable();
16
+ /* foreach ($collection as $col){
17
+ $col->setData('customer_name', $col->getCustomerFirstname() . ' ' . $col->getCustomerLastname());
18
+ } */
19
+
20
+ $this->setCollection($collection);
21
+ return parent::_prepareCollection();
22
+ }
23
+
24
+
25
+ protected function _prepareColumns()
26
+ {
27
+ $this->addColumn('ticket_id', array(
28
+ 'header' => Mage::helper('supportcenter')->__('ID'),
29
+ 'index' => 'ticket_id',
30
+ ));
31
+
32
+ $this->addColumn('ticket_title', array(
33
+ 'header' => Mage::helper('supportcenter')->__('Title'),
34
+ 'align' =>'left',
35
+ 'index' => 'ticket_title',
36
+ ));
37
+
38
+
39
+ $this->addColumn('created_time', array(
40
+ 'header' => Mage::helper('supportcenter')->__('Created Time'),
41
+ 'width' => '150px',
42
+ 'index' => 'created_time',
43
+ 'type' => 'datetime'
44
+ ));
45
+
46
+ $this->addColumn('last_reply_time', array(
47
+ 'header' => Mage::helper('supportcenter')->__('Last Reply Time'),
48
+ 'width' => '150px',
49
+ 'index' => 'last_reply_time',
50
+ 'type' => 'datetime'
51
+ ));
52
+
53
+
54
+ $this->addColumn('total_reply', array(
55
+ 'header' => Mage::helper('supportcenter')->__('Replies'),
56
+ 'index' => 'total_reply',
57
+ 'type' => 'number'
58
+ ));
59
+
60
+ $departments = Mage::getModel('supportcenter/department')->getActiveDepartmentsOption1();
61
+ $this->addColumn('department_id', array(
62
+ 'header' => Mage::helper('supportcenter')->__('Department'),
63
+ 'width' => '150px',
64
+ 'index' => 'department_id',
65
+ 'type' => 'options',
66
+ 'options' => $departments
67
+ ));
68
+
69
+ $this->addColumn('customer_name', array(
70
+ 'header' => Mage::helper('supportcenter')->__('Customer'),
71
+ 'width' => '150px',
72
+ 'index' => 'customer_name',
73
+ ));
74
+
75
+ /* $this->addColumn('total_reply', array(
76
+ 'header' => Mage::helper('supportcenter')->__('Replies'),
77
+ 'width' => '150px',
78
+ 'index' => 'total_reply',
79
+ )); */
80
+
81
+ $this->addColumn('status', array(
82
+ 'header' => Mage::helper('supportcenter')->__('Status'),
83
+ 'align' => 'left',
84
+ 'width' => '80px',
85
+ 'index' => 'status',
86
+ 'type' => 'options',
87
+ 'options' => array(
88
+ 1 => 'Open',
89
+ 2 => 'Closed',
90
+ 3 => 'Waiting for customer'
91
+ ),
92
+ ));
93
+
94
+ $this->addColumn('action',
95
+ array(
96
+ 'header' => Mage::helper('supportcenter')->__('Action'),
97
+ 'width' => '100',
98
+ 'type' => 'action',
99
+ 'getter' => 'getId',
100
+ 'actions' => array(
101
+ array(
102
+ 'caption' => Mage::helper('supportcenter')->__('Reply'),
103
+ 'url' => array('base'=> '*/*/reply'),
104
+ 'field' => 'id'
105
+ )
106
+ ),
107
+ 'filter' => false,
108
+ 'sortable' => false,
109
+ 'index' => 'stores',
110
+ 'is_system' => true,
111
+ ));
112
+
113
+ //$this->addExportType('*/*/exportCsv', Mage::helper('supportcenter')->__('CSV'));
114
+ //$this->addExportType('*/*/exportXml', Mage::helper('supportcenter')->__('XML'));
115
+
116
+ return parent::_prepareColumns();
117
+ }
118
+
119
+ protected function _prepareMassaction()
120
+ {
121
+ $this->setMassactionIdField('ticket_id');
122
+ $this->getMassactionBlock()->setFormFieldName('ticket');
123
+
124
+ $this->getMassactionBlock()->addItem('delete', array(
125
+ 'label' => Mage::helper('supportcenter')->__('Delete'),
126
+ 'url' => $this->getUrl('*/*/massDelete'),
127
+ 'confirm' => Mage::helper('supportcenter')->__('Are you sure?')
128
+ ));
129
+
130
+ $statuses = Mage::getSingleton('supportcenter/ticketstatus')->getOptionArray();
131
+
132
+ array_unshift($statuses, array('label'=>'', 'value'=>''));
133
+ $this->getMassactionBlock()->addItem('status', array(
134
+ 'label'=> Mage::helper('supportcenter')->__('Change status'),
135
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
136
+ 'additional' => array(
137
+ 'visibility' => array(
138
+ 'name' => 'status',
139
+ 'type' => 'select',
140
+ 'class' => 'required-entry',
141
+ 'label' => Mage::helper('supportcenter')->__('Status'),
142
+ 'values' => $statuses
143
+ )
144
+ )
145
+ ));
146
+ return $this;
147
+ }
148
+
149
+ public function getRowUrl($row)
150
+ {
151
+ return $this->getUrl('*/*/reply', array('id' => $row->getId()));
152
+ }
153
+
154
+ }
app/code/local/Magestore/Supportcenter/Block/Adminhtml/Ticket/Reply.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportcenter_Block_Adminhtml_Ticket_Reply extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ protected $_mode = 'reply';
6
+
7
+ public function __construct()
8
+ {
9
+ parent::__construct();
10
+
11
+ $this->_objectId = 'id';
12
+ $this->_blockGroup = 'supportcenter';
13
+ $this->_controller = 'adminhtml_ticket';
14
+ //$this->_mode = 'reply';
15
+
16
+ $this->_updateButton('save', 'label', Mage::helper('supportcenter')->__('Send Reply'));
17
+
18
+ $this->_removeButton('delete', 'label');
19
+
20
+ /* $this->_addButton('saveandcontinueedit', array(
21
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
22
+ 'onclick' => 'saveAndContinueEdit()',
23
+ 'class' => 'save',
24
+ ), -100); */
25
+
26
+ $this->_formScripts[] = "
27
+ function toggleEditor() {
28
+ if (tinyMCE.getInstanceById('supportcenter_content') == null) {
29
+ tinyMCE.execCommand('mceAddControl', false, 'supportcenter_content');
30
+ } else {
31
+ tinyMCE.execCommand('mceRemoveControl', false, 'supportcenter_content');
32
+ }
33
+ }
34
+
35
+ function saveAndContinueEdit(){
36
+ editForm.submit($('edit_form').action+'back/reply/');
37
+ }
38
+ ";
39
+ }
40
+
41
+
42
+ public function getHeaderText()
43
+ {
44
+ // if( Mage::registry('ticket_data') && Mage::registry('ticket_data')->getId() ) {
45
+ return Mage::helper('supportcenter')->__("Ticket #'%s'", $this->htmlEscape(Mage::registry('ticket_data')->getTicketTitle()));
46
+ /* } else {
47
+ return Mage::helper('supportcenter')->__('Add Ticket');
48
+ } */
49
+ }
50
+ }
app/code/local/Magestore/Supportcenter/Block/Adminhtml/Ticket/Reply/Form.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportcenter_Block_Adminhtml_Ticket_Reply_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+
6
+ protected function _prepareForm()
7
+ {
8
+ $form = new Varien_Data_Form(array(
9
+ 'id' => 'edit_form',
10
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
11
+ 'method' => 'post',
12
+ 'enctype' => 'multipart/form-data'
13
+ )
14
+ );
15
+
16
+ $form->setUseContainer(true);
17
+ $this->setForm($form);
18
+ return parent::_prepareForm();
19
+ }
20
+ }
app/code/local/Magestore/Supportcenter/Block/Adminhtml/Ticket/Reply/Tab/Detail.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <?php
3
+ class Magestore_Supportcenter_Block_Adminhtml_Ticket_Reply_Tab_Detail extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->setTemplate('supportcenter/detail.phtml');
9
+ }
10
+
11
+ public function detailTicket(){
12
+ $ticketId = $this->getRequest()->getParam('id');
13
+ $ticket = Mage::getModel('supportcenter/ticket')->load($ticketId);
14
+ return $ticket;
15
+ }
16
+
17
+ public function getClosedInfo($ticket){
18
+ $closedLog = Mage::getModel('supportcenter/statuslog')->getCollection()
19
+ ->addFieldToFilter('ticket_id', array('eq'=>$ticket->getId()))
20
+ ->addFieldToFilter('status', array('eq'=>'2'))
21
+ ->setOrder('time', 'DESC')
22
+ ;
23
+ foreach($closedLog as $cLog){
24
+ $admin = Mage::getModel('admin/user')->load($cLog->getAdminId());
25
+ $closedInfo['lockedby'] = $admin->getName();
26
+ $closedInfo['time'] = Mage::getModel('core/date')->date($cLog->getTime());
27
+ break;
28
+ }
29
+
30
+ return $closedInfo;
31
+ }
32
+
33
+
34
+ public function getDepartmentTitle($departmentId){
35
+ return Mage::getModel('supportcenter/ticket')->getDepartmentTitle($departmentId);
36
+ }
37
+
38
+ public function getDepartmentEmail($departmentId){
39
+ $department = Mage::getModel('supportcenter/department')->load($departmentId);
40
+ return $department->getDepartmentEmail();
41
+ }
42
+
43
+
44
+ }
app/code/local/Magestore/Supportcenter/Block/Adminhtml/Ticket/Reply/Tab/Form.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportcenter_Block_Adminhtml_Ticket_Reply_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
3
+ {
4
+ protected function _construct()
5
+ {
6
+ //$this->setTemplate('supportcenter/detail.phtml');
7
+ parent::_construct();
8
+
9
+ }
10
+
11
+ protected function _prepareForm()
12
+ {
13
+ $form = new Varien_Data_Form();
14
+ $this->setForm($form);
15
+ $fieldset = $form->addFieldset('ticket_form', array('legend'=>Mage::helper('supportcenter')->__('Reply Ticket')));
16
+
17
+ /* $options = Mage::getModel('supportcenter/ticket')->getReplyCustomers();
18
+ $fieldset->addField('customer_id', 'select', array(
19
+ 'label' => Mage::helper('supportcenter')->__('Customer'),
20
+ 'class' => 'required-entry',
21
+ 'required' => true,
22
+ 'name' => 'customer_id',
23
+ 'values' => $options,
24
+ ));
25
+
26
+
27
+ $options = Mage::getModel('supportcenter/department')->getActiveDepartmentsOption();
28
+ $fieldset->addField('department_id', 'select', array(
29
+ 'label' => Mage::helper('supportcenter')->__('Department'),
30
+ 'class' => 'required-entry',
31
+ 'required' => true,
32
+ 'name' => 'department_id',
33
+ 'values' => $options,
34
+ ));
35
+
36
+ $fieldset->addField('ticket_title', 'text', array(
37
+ 'label' => Mage::helper('supportcenter')->__('Title'),
38
+ 'class' => 'required-entry',
39
+ 'required' => true,
40
+ 'name' => 'ticket_title',
41
+ ));
42
+
43
+ $fieldset->addField('status', 'select', array(
44
+ 'label' => Mage::helper('supportcenter')->__('Status'),
45
+ 'name' => 'status',
46
+ 'values' => array(
47
+ array(
48
+ 'value' => 1,
49
+ 'label' => Mage::helper('supportcenter')->__('Open'),
50
+ ),
51
+
52
+ array(
53
+ 'value' => 2,
54
+ 'label' => Mage::helper('supportcenter')->__('Closed'),
55
+ ),
56
+
57
+ array(
58
+ 'value' => 3,
59
+ 'label' => Mage::helper('supportcenter')->__('Waitting for customer'),
60
+ ),
61
+ ),
62
+ )); */
63
+
64
+ $fieldset->addField('content', 'editor', array(
65
+ 'name' => 'content',
66
+ 'label' => Mage::helper('supportcenter')->__('Message'),
67
+ 'title' => Mage::helper('supportcenter')->__('Message'),
68
+ 'style' => 'width:500px; height:200px;',
69
+ 'wysiwyg' => false,
70
+ 'required' => true,
71
+ ));
72
+
73
+ /* if ( Mage::getSingleton('adminhtml/session')->getTicketData() )
74
+ {
75
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getTicketData());
76
+ Mage::getSingleton('adminhtml/session')->setTicketData(null);
77
+ } elseif ( Mage::registry('ticket_data') ) {
78
+ $form->setValues(Mage::registry('ticket_data')->getData());
79
+ } */
80
+
81
+
82
+ return parent::_prepareForm();
83
+ }
84
+ }
85
+ ?>
app/code/local/Magestore/Supportcenter/Block/Adminhtml/Ticket/Reply/Tab/Reply.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportcenter_Block_Adminhtml_Ticket_Reply_Tab_Reply extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
+
8
+ parent::__construct();
9
+ $this->setId('replyTicketGrid');
10
+ $this->setDefaultSort('reply_ticket_id');
11
+ $this->setDefaultDir('DESC');
12
+ //$this->setUseAjax(true);
13
+ $this->setSaveParametersInSession(true);
14
+ }
15
+
16
+ public function getCustomerName(){
17
+ $ticketId = $this->getRequest()->getParam('id');
18
+ $ticket = Mage::getModel('supportcenter/ticket')->load($ticketId);
19
+ return $ticket->getCustomerName();
20
+ }
21
+
22
+ public function getDepartmentTitle(){
23
+ $ticketId = $this->getRequest()->getParam('id');
24
+ $ticket = Mage::getModel('supportcenter/ticket')->load($ticketId);
25
+ return Mage::getModel('supportcenter/ticket')->getDepartmentTitle($ticket->getDepartmentId());
26
+ }
27
+
28
+ protected function _prepareCollection()
29
+ {
30
+ $ticketId = $this->getRequest()->getParam('id');
31
+ $collection = Mage::getModel('supportcenter/replyticket')->getCollection()
32
+ ->addFieldToFilter('ticket_id', array('eq'=>$ticketId));
33
+
34
+ $this->setCollection($collection);
35
+ return parent::_prepareCollection();
36
+ }
37
+
38
+ protected function _prepareColumns()
39
+ {
40
+ $this->addColumn('reply_ticket_id', array(
41
+ 'header' => Mage::helper('supportcenter')->__('ID'),
42
+ 'align' =>'right',
43
+ 'index' => 'reply_ticket_id',
44
+ 'type' => 'number',
45
+ ));
46
+
47
+ $this->addColumn('sender', array(
48
+ 'header' => Mage::helper('supportcenter')->__('Sender'),
49
+ 'width' => '150px',
50
+ 'index' => 'customer_sender',
51
+ 'type' => 'options',
52
+ 'options' => array(
53
+ 1 => $this->getCustomerName(),
54
+ 0 => $this->getDepartmentTitle(),
55
+ ),
56
+ ));
57
+
58
+ $this->addColumn('content', array(
59
+ 'header' => Mage::helper('supportcenter')->__('Content'),
60
+ 'index' => 'content',
61
+ ));
62
+
63
+ $this->addColumn('created_time', array(
64
+ 'header' => Mage::helper('supportcenter')->__('Created Time'),
65
+ 'width' => '150px',
66
+ 'index' => 'created_time',
67
+ 'type' => 'datetime'
68
+ ));
69
+
70
+ return parent::_prepareColumns();
71
+ }
72
+ }
app/code/local/Magestore/Supportcenter/Block/Adminhtml/Ticket/Reply/Tab/Statuslog.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportcenter_Block_Adminhtml_Ticket_Reply_Tab_Statuslog extends Mage_Adminhtml_Block_Widget_Grid
3
+ {
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+ $this->setId('statusLogGrid');
8
+ $this->setDefaultSort('status_log_id');
9
+ $this->setDefaultDir('DESC');
10
+ //$this->setUseAjax(true);
11
+ $this->setSaveParametersInSession(true);
12
+ }
13
+
14
+ public function getAdmins(){
15
+ $collection = Mage::getModel('admin/user')->getCollection();
16
+
17
+ foreach($collection as $admin){
18
+ $admins[$admin->getUserId()] = $admin->getFirstname() . ' ' . $admin->getLastname();
19
+ }
20
+
21
+ return $admins;
22
+ }
23
+
24
+ protected function _prepareCollection()
25
+ {
26
+ $ticketId = $this->getRequest()->getParam('id');
27
+ $collection = Mage::getModel('supportcenter/statuslog')->getCollection()
28
+ ->addFieldToFilter('ticket_id', array('eq'=>$ticketId));
29
+ $this->setCollection($collection);
30
+ return parent::_prepareCollection();
31
+ }
32
+
33
+ protected function _prepareColumns()
34
+ {
35
+ $this->addColumn('status_log_id', array(
36
+ 'header' => Mage::helper('supportcenter')->__('ID'),
37
+ 'align' =>'right',
38
+ 'index' => 'status_log_id',
39
+ 'type' => 'number',
40
+ ));
41
+
42
+ $this->addColumn('admin_id', array(
43
+ 'header' => Mage::helper('supportcenter')->__('Admin/Department'),
44
+ 'width' => '150px',
45
+ 'index' => 'admin_id',
46
+ 'type' => 'options',
47
+ 'options' => $this->getAdmins(),
48
+ ));
49
+
50
+ $this->addColumn('status', array(
51
+ 'header' => Mage::helper('supportcenter')->__('Status'),
52
+ 'index' => 'status',
53
+ 'type' => 'options',
54
+ 'options' => array(
55
+ 1 => Mage::helper('supportcenter')->__('Open'),
56
+ 2 => Mage::helper('supportcenter')->__('Closed'),
57
+ 3 => Mage::helper('supportcenter')->__('Waitting for customer'),
58
+ ),
59
+ ));
60
+
61
+ $this->addColumn('time', array(
62
+ 'header' => Mage::helper('supportcenter')->__('Time'),
63
+ 'width' => '150px',
64
+ 'index' => 'time',
65
+ 'type' => 'datetime'
66
+ ));
67
+
68
+ return parent::_prepareColumns();
69
+ }
70
+ }
app/code/local/Magestore/Supportcenter/Block/Adminhtml/Ticket/Reply/Tabs.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportcenter_Block_Adminhtml_Ticket_Reply_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('supportcenter_tabs');
10
+ $this->setDestElementId('edit_form');
11
+ $this->setTitle(Mage::helper('supportcenter')->__('Detail Ticket'));
12
+ }
13
+
14
+ protected function _beforeToHtml()
15
+ {
16
+ $this->addTab('reply_section', array(
17
+ 'label' => Mage::helper('supportcenter')->__('View reply'),
18
+ 'title' => Mage::helper('supportcenter')->__('View reply'),
19
+ 'content' => $this->getLayout()->createBlock('supportcenter/adminhtml_ticket_reply_tab_reply')->toHtml(),
20
+ ));
21
+
22
+ $this->addTab('ticket_info', array(
23
+ 'label' => Mage::helper('supportcenter')->__('Ticket Information'),
24
+ 'title' => Mage::helper('supportcenter')->__('Ticket Information'),
25
+ 'content' => $this->getLayout()->createBlock('supportcenter/adminhtml_ticket_reply_tab_detail')->toHtml(),
26
+ ));
27
+
28
+ $this->addTab('reply_form', array(
29
+ 'label' => Mage::helper('supportcenter')->__('Reply'),
30
+ 'title' => Mage::helper('supportcenter')->__('Reply'),
31
+ 'content' => $this->getLayout()->createBlock('supportcenter/adminhtml_ticket_reply_tab_form')->toHtml(),
32
+ ));
33
+
34
+ $this->addTab('status_log', array(
35
+ 'label' => Mage::helper('supportcenter')->__('Status log'),
36
+ 'title' => Mage::helper('supportcenter')->__('Status log'),
37
+ 'content' => $this->getLayout()->createBlock('supportcenter/adminhtml_ticket_reply_tab_statuslog')->toHtml(),
38
+ ));
39
+
40
+ return parent::_beforeToHtml();
41
+ }
42
+ }
app/code/local/Magestore/Supportcenter/Block/Department.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportcenter_Block_Department extends Mage_Core_Block_Template
3
+ {
4
+ public function _prepareLayout()
5
+ {
6
+ return parent::_prepareLayout();
7
+ }
8
+
9
+
10
+ /* public function getSupportcenter()
11
+ {
12
+ if (!$this->hasData('supportcenter')) {
13
+ $this->setData('supportcenter', Mage::registry('supportcenter'));
14
+ }
15
+ return $this->getData('supportcenter');
16
+
17
+ }
18
+
19
+ public function getDepartment()
20
+ {
21
+ $store_id = Mage::helper("supportcenter")->getStoreId();
22
+ $collection = Mage::getModel("supportcenter")
23
+ ->setStoreId($store_id)
24
+ ->getCollection();
25
+
26
+ return $collection;
27
+ } */
28
+ }
app/code/local/Magestore/Supportcenter/Block/Ticket.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportcenter_Block_Ticket extends Mage_Core_Block_Template
3
+
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ if(Mage::getSingleton('customer/session')->isLoggedIn()){
9
+ $tickets = $this->getTicketsOfCustomer();
10
+ $this->setTickets($tickets);
11
+ }
12
+ }
13
+
14
+ public function _prepareLayout()
15
+ {
16
+ $headBlock = $this->getLayout()->getBlock('head');
17
+ $headBlock->setTitle(Mage::helper('supportcenter')->__('Support Center'));
18
+
19
+ if(Mage::getSingleton('customer/session')->isLoggedIn()){
20
+ $tickets = $this->getTicketsOfCustomer();
21
+ $pager = $this->getLayout()->createBlock('page/html_pager')
22
+ ->setCollection($this->getTickets());
23
+ $this->setChild('pager', $pager);
24
+ }
25
+ return parent::_prepareLayout();
26
+ }
27
+
28
+ public function getTicketsOfCustomer(){
29
+ $customerId = Mage::getSingleton('customer/session')->getCustomerId();
30
+ $collection = Mage::getModel('supportcenter/ticket')
31
+ ->getCollection()
32
+ ->addFieldToFilter('customer_id', array('eq'=>$customerId))
33
+ ->setOrder('ticket_id', 'DESC');
34
+ return $collection;
35
+ }
36
+
37
+ public function getDepartmentTitle($departmentId){
38
+ return Mage::getModel('supportcenter/ticket')->getDepartmentTitle($departmentId);
39
+ }
40
+
41
+ public function getTotalReplies($ticketId){
42
+ $replies = Mage::getModel('supportcenter/replyticket')->getRepliesTicket($ticketId);
43
+ return count($replies);
44
+ }
45
+
46
+
47
+
48
+ public function getPagerHtml()
49
+ {
50
+ return $this->getChildHtml('pager');
51
+ }
52
+
53
+ public function getViewUrl($ticket)
54
+ {
55
+ return $this->getUrl('*/*/view', array('ticket_id' => $ticket->getId()));
56
+ }
57
+
58
+ }
app/code/local/Magestore/Supportcenter/Block/Viewticket.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportcenter_Block_Viewticket extends Mage_Core_Block_Template
3
+
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $ticketId = (int) $this->getRequest()->getParam('ticket_id');
9
+ $replies = $this->getRepliesTicket($ticketId);
10
+ $this->setViewTickets($replies);
11
+ }
12
+
13
+ public function _prepareLayout()
14
+ {
15
+ $headBlock = $this->getLayout()->getBlock('head');
16
+ $headBlock->setTitle(Mage::helper('supportcenter')->__('Detail Ticket'));
17
+
18
+ $pager = $this->getLayout()->createBlock('page/html_pager')
19
+ ->setCollection($this->getViewTickets());
20
+
21
+ $this->setChild('pager', $pager);
22
+ return parent::_prepareLayout();
23
+ }
24
+
25
+ public function getTicket(){
26
+ $ticketId = (int) $this->getRequest()->getParam('ticket_id');
27
+ $ticket = Mage::getModel('supportcenter/ticket')->load($ticketId);
28
+ return $ticket;
29
+ }
30
+
31
+ public function getRepliesTicket($ticketId){
32
+ return Mage::getModel('supportcenter/replyticket')->getRepliesTicket($ticketId);
33
+ }
34
+
35
+ public function getPagerHtml(){
36
+ return $this->getChildHtml('pager');
37
+ }
38
+
39
+ public function getSender($reply){
40
+ $ticket = Mage::getModel('supportcenter/ticket')->load($reply->getTicketId());
41
+ if($reply->getCustomerSender() == 1){ // sender is customer
42
+ return $ticket->getCustomerName();
43
+ }
44
+ else{
45
+ $department = Mage::getModel('supportcenter/department')->load($ticket->getDepartmentId());
46
+ return $department->getDepartmentTitle();
47
+
48
+ }
49
+ }
50
+
51
+ }
app/code/local/Magestore/Supportcenter/Helper/Data.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportcenter_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+ public function getSupportcenterUrl()
6
+ {
7
+ $url = $this->_getUrl("supportcenter/guest", array());
8
+
9
+ return $url;
10
+ }
11
+
12
+ public function getTotalTicket($departmentId){
13
+ $collection = Mage::getModel('supportcenter/ticket')->getCollection()
14
+ ->addFieldToFilter('department_id', array('eq'=>$departmentId));
15
+
16
+ return $collection->getSize();
17
+
18
+
19
+ }
20
+
21
+ public function getOpenTicket($departmentId){
22
+ $collection = Mage::getModel('supportcenter/ticket')->getCollection()
23
+ ->addFieldToFilter('department_id', array('eq'=>$departmentId))
24
+ ->addFieldToFilter('status', array('eq'=>'1'));
25
+ return $collection->getSize();
26
+ }
27
+
28
+ public function getClosedTicket($departmentId){
29
+ $collection = Mage::getModel('supportcenter/ticket')->getCollection()
30
+ ->addFieldToFilter('department_id', array('eq'=>$departmentId))
31
+ ->addFieldToFilter('status', array('eq'=>'2'));
32
+ return $collection->getSize();
33
+ }
34
+
35
+ public function getWaittingTicket($departmentId){
36
+ $collection = Mage::getModel('supportcenter/ticket')->getCollection()
37
+ ->addFieldToFilter('department_id', array('eq'=>$departmentId))
38
+ ->addFieldToFilter('status', array('eq'=>'3'));
39
+ return $collection->getSize();
40
+ }
41
+
42
+ }
app/code/local/Magestore/Supportcenter/Model/Department.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportcenter_Model_Department extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('supportcenter/department');
9
+ }
10
+
11
+
12
+ public function getActiveDepartmentsOption(){
13
+ $collection = Mage::getModel('supportcenter/department')->getCollection()
14
+ ->addFieldToFilter('is_active', array('eq'=>'1'));
15
+ $options = array();
16
+ foreach($collection as $department){
17
+ $option['title'] = $department->getDepartmentTitle();
18
+ $option['email'] = $department->getDepartmentEmail();
19
+ $option['value'] = $department->getDepartmentId();
20
+ $option['label'] = $option['title'] . ' <' . $option['email'] . '>';
21
+ $options[] = $option;
22
+ }
23
+ return $options;
24
+ }
25
+
26
+ public function getActiveDepartmentsOption1(){
27
+ $collection = Mage::getModel('supportcenter/department')->getCollection()
28
+ ->addFieldToFilter('is_active', array('eq'=>'1'));
29
+ $options = array();
30
+ foreach($collection as $department){
31
+ $options[$department->getDepartmentId()] = $department->getDepartmentTitle();
32
+ }
33
+ return $options;
34
+ }
35
+ }
app/code/local/Magestore/Supportcenter/Model/Departmentstatus.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportcenter_Model_Departmentstatus extends Varien_Object
4
+ {
5
+ const STATUS_YES = 1;
6
+ const STATUS_NO = 0;
7
+
8
+ static public function getOptionArray()
9
+ {
10
+ return array(
11
+ self::STATUS_YES => Mage::helper('supportcenter')->__('Yes'),
12
+ self::STATUS_NO => Mage::helper('supportcenter')->__('No')
13
+ );
14
+ }
15
+ }
app/code/local/Magestore/Supportcenter/Model/Mysql4/Department.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportcenter_Model_Mysql4_Department extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ // Note that the supportcenter_id refers to the key field in your database table.
8
+ $this->_init('supportcenter/department', 'department_id');
9
+ }
10
+
11
+ }
app/code/local/Magestore/Supportcenter/Model/Mysql4/Department/Collection.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportcenter_Model_Mysql4_Department_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('supportcenter/department');
9
+ }
10
+
11
+ public function addCountTickets(){
12
+ $this->getSelect()
13
+ ->joinLeft(array('tickets'=>$this->getTable('supportcenter/ticket')), 'tickets.department_id = main_table.department_id', array('ticket_id'=>'ticket_id', 'ticket_status'=>'status'));
14
+
15
+ //->columns(array("total_ticket" => "COUNT(tickets.ticket_id)"))
16
+ //->where('tickets.ticket_status = ?', Mage_Sales_Model_Order::STATE_CANCELED)
17
+ //->group("main_table.department_id");
18
+
19
+ return $this;
20
+ }
21
+ }
app/code/local/Magestore/Supportcenter/Model/Mysql4/Replyticket.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportcenter_Model_Mysql4_Replyticket extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ // Note that the supportcenter_id refers to the key field in your database table.
8
+ $this->_init('supportcenter/replyticket', 'reply_ticket_id');
9
+ }
10
+
11
+
12
+ }
app/code/local/Magestore/Supportcenter/Model/Mysql4/Replyticket/Collection.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportcenter_Model_Mysql4_Replyticket_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
3
+ {
4
+ public function _construct()
5
+ {
6
+ parent::_construct();
7
+ $this->_init('supportcenter/replyticket');
8
+ }
9
+
10
+
11
+ }
app/code/local/Magestore/Supportcenter/Model/Mysql4/Statuslog.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportcenter_Model_Mysql4_Statuslog extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ // Note that the supportcenter_id refers to the key field in your database table.
8
+ $this->_init('supportcenter/statuslog', 'status_log_id');
9
+ }
10
+ }
app/code/local/Magestore/Supportcenter/Model/Mysql4/Statuslog/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportcenter_Model_Mysql4_Statuslog_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('supportcenter/statuslog');
9
+ }
10
+ }
app/code/local/Magestore/Supportcenter/Model/Mysql4/Ticket.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportcenter_Model_Mysql4_Ticket extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ // Note that the supportcenter_id refers to the key field in your database table.
8
+ $this->_init('supportcenter/ticket', 'ticket_id');
9
+ }
10
+
11
+
12
+
13
+ }
app/code/local/Magestore/Supportcenter/Model/Mysql4/Ticket/Collection.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportcenter_Model_Mysql4_Ticket_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('supportcenter/ticket');
9
+ }
10
+
11
+ public function getFullTable(){
12
+ $this->getSelect()
13
+ ->joinLeft(array('customer_email_table' =>$this->getTable('customer/entity')),
14
+ 'customer_email_table.entity_id = main_table.customer_id', array('customer_email'=>'email') );
15
+ return $this;
16
+ }
17
+
18
+ public function addCountTickets(){
19
+ $this->getSelect()
20
+ ->columns(array("total_ticket" => "COUNT(ticket_id)"))
21
+ //->where('status = ?', Mage_Sales_Model_Order::STATE_CANCELED)
22
+ ->group('main_table.department_id');
23
+
24
+ /* ->columns(array("open_ticket" => "COUNT(ticket_id)"))
25
+ ->where('status = ?', 1)
26
+ ->group('main_table.department_id')
27
+ */
28
+
29
+ /* ->columns(array("closed_ticket" => "COUNT(ticket_id)"))
30
+ ->where('status = ?', 2)
31
+ ->group('main_table.department_id', ); */
32
+
33
+ /* ->columns(array("watting_ticket" => "COUNT(ticket_id)"))
34
+ ->where('status = ?', 3)
35
+ ->group('main_table.department_id'); */
36
+ return $this;
37
+ }
38
+ }
app/code/local/Magestore/Supportcenter/Model/Replyticket.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportcenter_Model_Replyticket extends Mage_Core_Model_Abstract
3
+ {
4
+ public function _construct()
5
+ {
6
+ parent::_construct();
7
+ $this->_init('supportcenter/replyticket');
8
+ }
9
+
10
+ public function getRepliesTicket($ticketId){
11
+ $collection = Mage::getModel('supportcenter/replyticket')
12
+ ->getCollection()
13
+ ->addFieldToFilter('ticket_id', array('eq'=>$ticketId))
14
+ ->setOrder('reply_ticket_id', 'DESC');
15
+ return $collection;
16
+ }
17
+
18
+ /* public function getAllReply($ticketId){
19
+
20
+ } */
21
+
22
+ /* protected function _getRepliesByCustomerTicket($ticketId){
23
+ $collection = Mage::getModel('supportcenter/replyticket')
24
+ ->getCollection()
25
+ ->addFieldToFilter('ticket_id', array('eq'=>$ticketId))
26
+ ->addFieldToFilter('customer_sender', array('eq'=>'1'))
27
+ ->setOrder('reply_ticket_id', 'DESC');
28
+ return $collection;
29
+ }
30
+
31
+ protected function _getRepliesByDepartmentTicket($ticketId){
32
+ $collection = Mage::getModel('supportcenter/replyticket')
33
+ ->getCollection()
34
+ ->addFieldToFilter('ticket_id', array('eq'=>$ticketId))
35
+ ->addFieldToFilter('customer_sender', array('eq'=>'0'))
36
+ ->setOrder('reply_ticket_id', 'DESC');
37
+ return $collection;
38
+ }
39
+
40
+ public function getFullRepliesTicket($ticketId){
41
+ $collection1 = $this->_getRepliesByDepartmentTicket($ticketId)
42
+ ->getSelect()
43
+ ->joinLeft(array('ticket_table'=>Mage::getSingleton('core/resource')->getTableName('supportcenter/replyticket')), 'ticket_table.ticket_id = main_table.ticket_id', array('sender_id'=>'department_id'))
44
+ ->joinLeft(array('department_table'=>Mage::getSingleton('core/resource')->getTableName('supportcenter/department')), 'department_table.department_id = main_table.sender_id', array('sender_name'=>'department_title'));
45
+
46
+ $collection2 = $this->_getRepliesByCustomerTicket($ticketId)
47
+ ->getSelect()
48
+ ->joinLeft(array('ticket_table'=>Mage::getSingleton('core/resource')->getTableName('supportcenter/replyticket')), 'ticket_table.ticket_id = main_table.ticket_id', array('sender_id'=>'customer_id'))
49
+ ->joinLeft(array('d_table'=>Mage::getSingleton('core/resource')->getTableName('supportcenter/department')), 'department_table.department_id = main_table.sender_id', array('sender_name'=>'department_title'));
50
+
51
+ }
52
+ */
53
+
54
+
55
+
56
+ }
app/code/local/Magestore/Supportcenter/Model/Sendmail.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportcenter_Model_Sendmail extends Varien_Object
3
+ {
4
+ public function toOptionArray()
5
+ {
6
+ return array(
7
+ array('value'=>'1', 'label'=>Mage::helper('featuredproduct')->__('Yes')),
8
+ array('value'=>'0', 'label'=>Mage::helper('featuredproduct')->__('No')),
9
+
10
+ );
11
+ }
12
+
13
+ }
14
+ ?>
app/code/local/Magestore/Supportcenter/Model/Session.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportcenter_Model_Session extends Mage_Core_Model_Session_Abstract
3
+ {
4
+ //protected $_ticket;
5
+
6
+ public function __construct()
7
+ {
8
+ //parent::__construct();
9
+ $this->init('supportcenter');
10
+ }
11
+
12
+
13
+ }
app/code/local/Magestore/Supportcenter/Model/Statuslog.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportcenter_Model_Statuslog extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('supportcenter/statuslog');
9
+ }
10
+ }
app/code/local/Magestore/Supportcenter/Model/Ticket.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportcenter_Model_Ticket extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('supportcenter/ticket');
9
+ }
10
+
11
+
12
+
13
+ public function getReplyCustomers(){
14
+ $collection = Mage::getResourceModel('supportcenter/ticket_collection')->getFullTable();
15
+ $options = array();
16
+ foreach($collection as $ticket){
17
+ //$option['firstname'] = $ticket->getCustomerFirstname();
18
+ //$option['lastname'] = $ticket->getCustomerLastname();
19
+ $option['name'] = $ticket->getCustomerName();
20
+ $option['email'] = $ticket->getCustomerEmail();
21
+ $option['value'] = $ticket->getCustomerId();
22
+ $option['label'] = $option['name'] . ' <' . $option['email'] . '>';
23
+ $options[] = $option;
24
+ }
25
+ return $options;
26
+ }
27
+
28
+
29
+ public function getDepartmentTitle($departmentId){
30
+ $department = Mage::getModel('supportcenter/department')->load($departmentId);
31
+ return $department->getDepartmentTitle();
32
+ }
33
+
34
+ protected function _getEmails($configPath)
35
+ {
36
+ $data = Mage::getStoreConfig($configPath);
37
+ if (!empty($data)) {
38
+ return explode(',', $data);
39
+ }
40
+ return false;
41
+ }
42
+
43
+ public function sendMailToAdmin($ticket, $isReply, $content)
44
+ {
45
+ $mailSubject = '[Support Center] ';
46
+ if($isReply == 1)
47
+ $mailSubject .= 'Re: ';
48
+ $mailSubject .= $ticket->getTicketTitle();
49
+ $templateId = Mage::getStoreConfig('supportcenter/general/email_to_admin');
50
+
51
+ $department = Mage::getModel('supportcenter/department')->load($ticket->getDepartmentId());
52
+
53
+ $sendTo[] = array(
54
+ 'email' => $department->getDepartmentEmail(),
55
+ 'name' => $department->getDepartmentTitle()
56
+ );
57
+
58
+ $sender = array ('name'=>$ticket->getCustomerName(), 'email'=>$ticket->getCustomerEmail());
59
+
60
+ $link = '';
61
+
62
+ $vars = array( 'content'=>$content,
63
+ 'title'=>$ticket->getTicketTitle(),
64
+ 'sender'=>$sender['name'],
65
+ 'recipient'=>'',
66
+ 'link' =>$link);
67
+
68
+ $sendEmail = Mage::getModel('core/email_template');
69
+ $copyMethod = Mage::getStoreConfig('supportcenter/general/copy_method');
70
+ $copyTo = $this->_getEmails('supportcenter/general/copy_to');
71
+ if ($copyTo && $copyMethod == 'bcc') {
72
+ foreach ($copyTo as $email) {
73
+ $sendEmail->addBcc($email);
74
+ }
75
+ }
76
+
77
+ if ($copyTo && $copyMethod == 'copy'){
78
+ foreach ($copyTo as $email) {
79
+ $sendTo[] = array(
80
+ 'name' => null,
81
+ 'email' => $email
82
+ );
83
+ }
84
+ }
85
+
86
+ foreach ($sendTo as $recipient) {
87
+ try{
88
+ $sendEmail->setTemplateSubject($mailSubject)
89
+ ->sendTransactional(
90
+ $templateId,
91
+ $sender,
92
+ $recipient['email'],
93
+ $recipient['name'],
94
+ $vars);
95
+ }catch(Exception $e){
96
+ Mage::getSingleton('core/session')->addError($e->getMessage());
97
+ }
98
+ }
99
+ }
100
+
101
+ public function sendReplyMailToCustomer($ticket, $content)
102
+ {
103
+ $mailSubject = '[Support Center] Re: ' . $ticket->getTicketTitle();
104
+ $templateId = Mage::getStoreConfig('supportcenter/general/email_to_customer');
105
+
106
+ $email = $ticket->getCustomerEmail();
107
+ $name = $ticket->getCustomerName();
108
+
109
+ $department = Mage::getModel('supportcenter/department')->load($ticket->getDepartmentId());
110
+ $sender = array ('name'=>$department->getDepartmentTitle(), 'email'=>$department->getDepartmentEmail());
111
+
112
+ if($ticket->getVerifyCode() == ''){
113
+ $link = 'supportcenter/index/view/ticket_id/' . $ticket->getId();
114
+ } else {
115
+ $link = 'supportcenter/guest/view/ticket_id/' . $ticket->getId() . '/key/' . $ticket->getVerifyCode();
116
+ }
117
+
118
+ $vars = array( 'content'=>$content,
119
+ 'title'=>$ticket->getTicketTitle(),
120
+ 'sender'=>$sender['name'],
121
+ 'recipient'=>$name,
122
+ 'link' =>$link
123
+ );
124
+
125
+ try{
126
+ Mage::getModel('core/email_template')
127
+ ->setTemplateSubject($mailSubject)
128
+ ->sendTransactional($templateId, $sender, $email, $name, $vars);
129
+ }catch(Exception $e){
130
+ Mage::getSingleton('core/session')->addError($e->getMessage());
131
+ }
132
+ }
133
+ }
app/code/local/Magestore/Supportcenter/Model/Ticketstatus.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportcenter_Model_Ticketstatus extends Varien_Object
4
+ {
5
+ const STATUS_OPEN = 1;
6
+ const STATUS_CLOSED = 2;
7
+ const STATUS_WAITTING = 3;
8
+
9
+ static public function getOptionArray()
10
+ {
11
+ return array(
12
+ self::STATUS_OPEN => Mage::helper('supportcenter')->__('Open'),
13
+ self::STATUS_CLOSED => Mage::helper('supportcenter')->__('Closed'),
14
+ self::STATUS_WAITTING => Mage::helper('supportcenter')->__('Waitting for customer')
15
+ );
16
+ }
17
+ }
app/code/local/Magestore/Supportcenter/controllers/Adminhtml/DepartmentController.php ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportcenter_Adminhtml_DepartmentController extends Mage_Adminhtml_Controller_action
4
+ {
5
+
6
+ protected function _initAction() {
7
+ $this->loadLayout()
8
+ ->_setActiveMenu('supportcenter/department')
9
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Departments Manager'), Mage::helper('adminhtml')->__('Department Manager'));
10
+
11
+ return $this;
12
+ }
13
+
14
+ public function indexAction() {
15
+ $this->_initAction()
16
+ ->renderLayout();
17
+ }
18
+
19
+ public function editAction() {
20
+ $id = $this->getRequest()->getParam('id');
21
+ $model = Mage::getModel('supportcenter/department')->load($id);
22
+
23
+ if ($model->getId() || $id == 0) {
24
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
25
+ if (!empty($data)) {
26
+ $model->setData($data);
27
+ }
28
+
29
+ Mage::register('department_data', $model);
30
+
31
+ $this->loadLayout();
32
+ $this->_setActiveMenu('supportcenter/department');
33
+
34
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Department Manager'), Mage::helper('adminhtml')->__('Department Manager'));
35
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Department News'), Mage::helper('adminhtml')->__('Department News'));
36
+
37
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
38
+
39
+ $this->_addContent($this->getLayout()->createBlock('supportcenter/adminhtml_department_edit'))
40
+ ->_addLeft($this->getLayout()->createBlock('supportcenter/adminhtml_department_edit_tabs'));
41
+
42
+ $this->renderLayout();
43
+ } else {
44
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('supportcenter')->__('Department does not exist'));
45
+ $this->_redirect('*/*/');
46
+ }
47
+ }
48
+
49
+ public function newAction() {
50
+ $this->_forward('edit');
51
+ }
52
+
53
+ public function saveAction() {
54
+ if ($data = $this->getRequest()->getPost()) {
55
+
56
+ if(isset($_FILES['filename']['name']) && $_FILES['filename']['name'] != '') {
57
+ try {
58
+ /* Starting upload */
59
+ $uploader = new Varien_File_Uploader('filename');
60
+
61
+ // Any extention would work
62
+ $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
63
+ $uploader->setAllowRenameFiles(false);
64
+
65
+ // Set the file upload mode
66
+ // false -> get the file directly in the specified folder
67
+ // true -> get the file in the product like folders
68
+ // (file.jpg will go in something like /media/f/i/file.jpg)
69
+ $uploader->setFilesDispersion(false);
70
+
71
+ // We set media as the upload dir
72
+ $path = Mage::getBaseDir('media') . DS ;
73
+ $uploader->save($path, $_FILES['filename']['name'] );
74
+
75
+ } catch (Exception $e) {
76
+
77
+ }
78
+
79
+ //this way the name is saved in DB
80
+ $data['filename'] = $_FILES['filename']['name'];
81
+ }
82
+
83
+
84
+ $model = Mage::getModel('supportcenter/department');
85
+ $model->setData($data)
86
+ ->setId($this->getRequest()->getParam('id'));
87
+
88
+ try {
89
+ if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
90
+ $model->setCreatedTime(now())
91
+ ->setUpdateTime(now());
92
+ } else {
93
+ $model->setUpdateTime(now());
94
+ }
95
+
96
+ $model->save();
97
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('supportcenter')->__('Department was successfully saved'));
98
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
99
+
100
+ if ($this->getRequest()->getParam('back')) {
101
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
102
+ return;
103
+ }
104
+ $this->_redirect('*/*/');
105
+ return;
106
+ } catch (Exception $e) {
107
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
108
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
109
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
110
+ return;
111
+ }
112
+ }
113
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('supportcenter')->__('Unable to find department to save'));
114
+ $this->_redirect('*/*/');
115
+ }
116
+
117
+ public function deleteAction() {
118
+ if( $this->getRequest()->getParam('id') > 0 ) {
119
+ try {
120
+ $model = Mage::getModel('supportcenter/department');
121
+
122
+ $model->setId($this->getRequest()->getParam('id'))
123
+ ->delete();
124
+
125
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Department was successfully deleted'));
126
+ $this->_redirect('*/*/');
127
+ } catch (Exception $e) {
128
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
129
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
130
+ }
131
+ }
132
+ $this->_redirect('*/*/');
133
+ }
134
+
135
+ public function massDeleteAction() {
136
+ $departmentIds = $this->getRequest()->getParam('department');
137
+ if(!is_array($departmentIds)) {
138
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select department(s)'));
139
+ } else {
140
+ try {
141
+ foreach ($departmentIds as $departmentId) {
142
+ $department = Mage::getModel('supportcenter/department')->load($departmentId);
143
+ $department->delete();
144
+ }
145
+ Mage::getSingleton('adminhtml/session')->addSuccess(
146
+ Mage::helper('adminhtml')->__(
147
+ 'Total of %d record(s) were successfully deleted', count($departmentIds)
148
+ )
149
+ );
150
+ } catch (Exception $e) {
151
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
152
+ }
153
+ }
154
+ $this->_redirect('*/*/index');
155
+ }
156
+
157
+ public function massIsactiveAction()
158
+ {
159
+ $departmentIds= $this->getRequest()->getParam('department');
160
+ if(!is_array($departmentIds)) {
161
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select department(s)'));
162
+ } else {
163
+ try {
164
+ foreach ($departmentIds as $departmentId) {
165
+ $department = Mage::getSingleton('supportcenter/department')
166
+ ->load($departmentId)
167
+ ->setIsActive($this->getRequest()->getParam('is_active'))
168
+ ->setIsMassupdate(true)
169
+ ->save();
170
+ }
171
+ $this->_getSession()->addSuccess(
172
+ $this->__('Total of %d record(s) were successfully updated', count($departmentIds))
173
+ );
174
+ } catch (Exception $e) {
175
+ $this->_getSession()->addError($e->getMessage());
176
+ }
177
+ }
178
+ $this->_redirect('*/*/index');
179
+ }
180
+
181
+ public function exportCsvAction()
182
+ {
183
+ $fileName = 'supportcenter.csv';
184
+ $content = $this->getLayout()->createBlock('supportcenter/adminhtml_department_grid')
185
+ ->getCsv();
186
+
187
+ $this->_sendUploadResponse($fileName, $content);
188
+ }
189
+
190
+ public function exportXmlAction()
191
+ {
192
+ $fileName = 'supportcenter.xml';
193
+ $content = $this->getLayout()->createBlock('supportcenter/adminhtml_department_grid')
194
+ ->getXml();
195
+
196
+ $this->_sendUploadResponse($fileName, $content);
197
+ }
198
+
199
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
200
+ {
201
+ $response = $this->getResponse();
202
+ $response->setHeader('HTTP/1.1 200 OK','');
203
+ $response->setHeader('Pragma', 'public', true);
204
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
205
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
206
+ $response->setHeader('Last-Modified', date('r'));
207
+ $response->setHeader('Accept-Ranges', 'bytes');
208
+ $response->setHeader('Content-Length', strlen($content));
209
+ $response->setHeader('Content-type', $contentType);
210
+ $response->setBody($content);
211
+ $response->sendResponse();
212
+ die;
213
+ }
214
+ }
app/code/local/Magestore/Supportcenter/controllers/Adminhtml/GuestticketController.php ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportcenter_Adminhtml_GuestticketController extends Mage_Adminhtml_Controller_action
3
+ {
4
+
5
+ protected function _initAction() {
6
+ $this->loadLayout()
7
+ ->_setActiveMenu('supportcenter/guestticket')
8
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Tickets Manager'), Mage::helper('adminhtml')->__('Ticket Manager'));
9
+
10
+ return $this;
11
+ }
12
+
13
+ public function indexAction() {
14
+ $this->_initAction()
15
+ ->renderLayout();
16
+ }
17
+
18
+
19
+ public function replyAction() {
20
+ $id = $this->getRequest()->getParam('id');
21
+ $model = Mage::getModel('supportcenter/ticket')->load($id);
22
+
23
+ /* if ($model->getId() || $id == 0) {
24
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
25
+ if (!empty($data)) {
26
+ $model->setData($data);
27
+ } */
28
+
29
+ Mage::register('ticket_data', $model);
30
+
31
+ $this->loadLayout();
32
+ $this->_setActiveMenu('supportcenter/ticket');
33
+
34
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Ticket Manager'), Mage::helper('adminhtml')->__('Ticket Manager'));
35
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Ticket News'), Mage::helper('adminhtml')->__('Ticket News'));
36
+
37
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
38
+
39
+ $this->_addContent($this->getLayout()->createBlock('supportcenter/adminhtml_ticket_reply'))
40
+ ->_addLeft($this->getLayout()->createBlock('supportcenter/adminhtml_ticket_reply_tabs'));
41
+
42
+ $this->renderLayout();
43
+ /* } else {
44
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('supportcenter')->__('Ticket does not exist'));
45
+ $this->_redirect('//');
46
+ } */
47
+ }
48
+
49
+ /* public function newAction() {
50
+ $this->_forward('reply');
51
+ } */
52
+
53
+ public function saveAction() {
54
+ if ($content = $this->getRequest()->getPost('content')) {
55
+ $ticketId = $this->getRequest()->getParam('id');
56
+ $replyModel = Mage::getModel('supportcenter/replyticket');
57
+ $replyModel->setContent($content);
58
+ $replyModel->setTicketId($ticketId);
59
+ $replyModel->setCustomerSender(0);
60
+
61
+ $ticketModel = Mage::getModel('supportcenter/ticket');
62
+ $ticketModel->setId($ticketId);
63
+
64
+
65
+ try {
66
+ $ticketModel->setLastReplyTime(now());
67
+ $replyModel->setCreatedTime(now());
68
+ $replyModel->save();
69
+
70
+ $replies = Mage::getModel('supportcenter/replyticket')->getRepliesTicket($ticketId);
71
+ $ticketModel->setTotalReply($replies->getSize());
72
+ $ticketModel->setStatus(3);
73
+ $ticketModel->save();
74
+
75
+ $isSendMail = Mage::getStoreConfig('supportcenter/general/send_email_to_customer');
76
+ if($isSendMail == 1){
77
+ $ticket = Mage::getModel('supportcenter/ticket')->load($ticketId);
78
+ Mage::getModel('supportcenter/ticket')
79
+ ->sendReplyMailToCustomer($ticket, $replyModel->getContent(), 0);
80
+ }
81
+
82
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('supportcenter')->__('Reply was successfully sent'));
83
+
84
+
85
+ //Mage::getSingleton('adminhtml/session')->setFormData(false);
86
+
87
+ if ($this->getRequest()->getParam('back')) {
88
+ $this->_redirect('*/*/reply', array('id' => $ticketModel->getId()));
89
+ return;
90
+ }
91
+ $this->_redirect('*/*/');
92
+ return;
93
+ } catch (Exception $e) {
94
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
95
+ //Mage::getSingleton('adminhtml/session')->setFormData($data);
96
+ $this->_redirect('*/*/reply', array('id' => $this->getRequest()->getParam('id')));
97
+ return;
98
+ }
99
+ }
100
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('supportcenter')->__('Unable to find reply to send'));
101
+ $this->_redirect('*/*/');
102
+ }
103
+
104
+ public function deleteAction() {
105
+ if( $this->getRequest()->getParam('id') > 0 ) {
106
+ try {
107
+ $model = Mage::getModel('supportcenter/ticket');
108
+
109
+ $model->setId($this->getRequest()->getParam('id'))
110
+ ->delete();
111
+
112
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Ticket was successfully deleted'));
113
+ $this->_redirect('*/*/');
114
+ } catch (Exception $e) {
115
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
116
+ $this->_redirect('*/*/reply', array('id' => $this->getRequest()->getParam('id')));
117
+ }
118
+ }
119
+ $this->_redirect('*/*/');
120
+ }
121
+
122
+ public function massDeleteAction() {
123
+ $ticketIds = $this->getRequest()->getParam('ticket');
124
+ if(!is_array($ticketIds)) {
125
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
126
+ } else {
127
+ try {
128
+ foreach ($ticketIds as $ticketId) {
129
+ $ticket = Mage::getModel('supportcenter/ticket')->load($ticketId);
130
+ $ticket->delete();
131
+ }
132
+ Mage::getSingleton('adminhtml/session')->addSuccess(
133
+ Mage::helper('adminhtml')->__(
134
+ 'Total of %d record(s) were successfully deleted', count($ticketIds)
135
+ )
136
+ );
137
+ } catch (Exception $e) {
138
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
139
+ }
140
+ }
141
+ $this->_redirect('*/*/index');
142
+ }
143
+
144
+ public function massStatusAction()
145
+ {
146
+ $ticketIds = $this->getRequest()->getParam('ticket');
147
+ if(!is_array($ticketIds)) {
148
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
149
+ } else {
150
+ try {
151
+ foreach ($ticketIds as $ticketId) {
152
+ $ticket = Mage::getSingleton('supportcenter/ticket')
153
+ ->load($ticketId)
154
+ ->setStatus($this->getRequest()->getParam('status'))
155
+ ->setIsMassupdate(true)
156
+ ->save();
157
+
158
+ $admin= Mage::getSingleton('admin/session')->getUser();
159
+ $statuslog = Mage::getSingleton('supportcenter/statuslog');
160
+ $statuslog->setAdminId($admin->getId());
161
+ $statuslog->setTicketId($ticketId);
162
+ $statuslog->setTime(now());
163
+ $statuslog->setStatus($this->getRequest()->getParam('status'));
164
+ $statuslog->save();
165
+ }
166
+ $this->_getSession()->addSuccess(
167
+ $this->__('Total of %d record(s) were successfully updated', count($ticketIds))
168
+ );
169
+ } catch (Exception $e) {
170
+ $this->_getSession()->addError($e->getMessage());
171
+ }
172
+ }
173
+ $this->_redirect('*/*/index');
174
+ }
175
+
176
+ public function exportCsvAction()
177
+ {
178
+ $fileName = 'supportcenter.csv';
179
+ $content = $this->getLayout()->createBlock('supportcenter/adminhtml_supportcenter_grid')
180
+ ->getCsv();
181
+
182
+ $this->_sendUploadResponse($fileName, $content);
183
+ }
184
+
185
+ public function exportXmlAction()
186
+ {
187
+ $fileName = 'supportcenter.xml';
188
+ $content = $this->getLayout()->createBlock('supportcenter/adminhtml_supportcenter_grid')
189
+ ->getXml();
190
+
191
+ $this->_sendUploadResponse($fileName, $content);
192
+ }
193
+
194
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
195
+ {
196
+ $response = $this->getResponse();
197
+ $response->setHeader('HTTP/1.1 200 OK','');
198
+ $response->setHeader('Pragma', 'public', true);
199
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
200
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
201
+ $response->setHeader('Last-Modified', date('r'));
202
+ $response->setHeader('Accept-Ranges', 'bytes');
203
+ $response->setHeader('Content-Length', strlen($content));
204
+ $response->setHeader('Content-type', $contentType);
205
+ $response->setBody($content);
206
+ $response->sendResponse();
207
+ die;
208
+ }
209
+ }
app/code/local/Magestore/Supportcenter/controllers/Adminhtml/TicketController.php ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magestore_Supportcenter_Adminhtml_TicketController extends Mage_Adminhtml_Controller_action
3
+ {
4
+
5
+ protected function _initAction() {
6
+ $this->loadLayout()
7
+ ->_setActiveMenu('supportcenter/ticket')
8
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Tickets Manager'), Mage::helper('adminhtml')->__('Ticket Manager'));
9
+
10
+ return $this;
11
+ }
12
+
13
+ public function indexAction() {
14
+ $this->_initAction()
15
+ ->renderLayout();
16
+ }
17
+
18
+ /* public function gridAction()
19
+ {
20
+ $this->loadLayout();
21
+ $this->getResponse()->setBody($this->getLayout()->createBlock('supportcenter/ticket_reply_tab_reply')->toHtml());
22
+ } */
23
+
24
+ public function replyAction() {
25
+ $id = $this->getRequest()->getParam('id');
26
+ $model = Mage::getModel('supportcenter/ticket')->load($id);
27
+
28
+ /* if ($model->getId() || $id == 0) {
29
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
30
+ if (!empty($data)) {
31
+ $model->setData($data);
32
+ } */
33
+
34
+ Mage::register('ticket_data', $model);
35
+
36
+ $this->loadLayout();
37
+ $this->_setActiveMenu('supportcenter/ticket');
38
+
39
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Ticket Manager'), Mage::helper('adminhtml')->__('Ticket Manager'));
40
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Ticket News'), Mage::helper('adminhtml')->__('Ticket News'));
41
+
42
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
43
+
44
+ $this->_addContent($this->getLayout()->createBlock('supportcenter/adminhtml_ticket_reply'))
45
+ ->_addLeft($this->getLayout()->createBlock('supportcenter/adminhtml_ticket_reply_tabs'));
46
+
47
+ $this->renderLayout();
48
+ /* } else {
49
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('supportcenter')->__('Ticket does not exist'));
50
+ $this->_redirect('//');
51
+ } */
52
+ }
53
+
54
+ /* public function newAction() {
55
+ $this->_forward('reply');
56
+ } */
57
+
58
+ public function saveAction() {
59
+ if ($content = $this->getRequest()->getPost('content')) {
60
+ $ticketId = $this->getRequest()->getParam('id');
61
+ $replyModel = Mage::getModel('supportcenter/replyticket');
62
+ $replyModel->setContent($content);
63
+ $replyModel->setTicketId($ticketId);
64
+ $replyModel->setCustomerSender(0);
65
+
66
+ $ticketModel = Mage::getModel('supportcenter/ticket');
67
+ $ticketModel->setId($ticketId);
68
+
69
+
70
+ try {
71
+ $ticketModel->setLastReplyTime(now());
72
+ $replyModel->setCreatedTime(now());
73
+ $replyModel->save();
74
+
75
+ $replies = Mage::getModel('supportcenter/replyticket')->getRepliesTicket($ticketId);
76
+ $ticketModel->setTotalReply($replies->getSize());
77
+ $ticketModel->setStatus(3);
78
+ $ticketModel->save();
79
+
80
+ $isSendMail = Mage::getStoreConfig('supportcenter/general/send_email_to_customer');
81
+ if($isSendMail == 1){
82
+ $ticket = Mage::getModel('supportcenter/ticket')->load($ticketId);
83
+ Mage::getModel('supportcenter/ticket')
84
+ ->sendReplyMailToCustomer($ticket, $replyModel->getContent(), 0);
85
+ }
86
+
87
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('supportcenter')->__('Reply was successfully sent'));
88
+
89
+
90
+ //Mage::getSingleton('adminhtml/session')->setFormData(false);
91
+
92
+ if ($this->getRequest()->getParam('back')) {
93
+ $this->_redirect('*/*/reply', array('id' => $ticketModel->getId()));
94
+ return;
95
+ }
96
+ $this->_redirect('*/*/');
97
+ return;
98
+ } catch (Exception $e) {
99
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
100
+ //Mage::getSingleton('adminhtml/session')->setFormData($data);
101
+ $this->_redirect('*/*/reply', array('id' => $this->getRequest()->getParam('id')));
102
+ return;
103
+ }
104
+ }
105
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('supportcenter')->__('Unable to find reply to send'));
106
+ $this->_redirect('*/*/');
107
+ }
108
+
109
+ public function deleteAction() {
110
+ if( $this->getRequest()->getParam('id') > 0 ) {
111
+ try {
112
+ $model = Mage::getModel('supportcenter/ticket');
113
+
114
+ $model->setId($this->getRequest()->getParam('id'))
115
+ ->delete();
116
+
117
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Ticket was successfully deleted'));
118
+ $this->_redirect('*/*/');
119
+ } catch (Exception $e) {
120
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
121
+ $this->_redirect('*/*/reply', array('id' => $this->getRequest()->getParam('id')));
122
+ }
123
+ }
124
+ $this->_redirect('*/*/');
125
+ }
126
+
127
+ public function massDeleteAction() {
128
+ $ticketIds = $this->getRequest()->getParam('ticket');
129
+ if(!is_array($ticketIds)) {
130
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
131
+ } else {
132
+ try {
133
+ foreach ($ticketIds as $ticketId) {
134
+ $ticket = Mage::getModel('supportcenter/ticket')->load($ticketId);
135
+ $ticket->delete();
136
+ }
137
+ Mage::getSingleton('adminhtml/session')->addSuccess(
138
+ Mage::helper('adminhtml')->__(
139
+ 'Total of %d record(s) were successfully deleted', count($ticketIds)
140
+ )
141
+ );
142
+ } catch (Exception $e) {
143
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
144
+ }
145
+ }
146
+ $this->_redirect('*/*/index');
147
+ }
148
+
149
+ public function massStatusAction()
150
+ {
151
+ $ticketIds = $this->getRequest()->getParam('ticket');
152
+ if(!is_array($ticketIds)) {
153
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
154
+ } else {
155
+ try {
156
+ foreach ($ticketIds as $ticketId) {
157
+ $ticket = Mage::getSingleton('supportcenter/ticket')
158
+ ->load($ticketId)
159
+ ->setStatus($this->getRequest()->getParam('status'))
160
+ ->setIsMassupdate(true)
161
+ ->save();
162
+
163
+ $admin= Mage::getSingleton('admin/session')->getUser();
164
+ $statuslog = Mage::getSingleton('supportcenter/statuslog');
165
+ $statuslog->setAdminId($admin->getId());
166
+ $statuslog->setTicketId($ticketId);
167
+ $statuslog->setTime(now());
168
+ $statuslog->setStatus($this->getRequest()->getParam('status'));
169
+ $statuslog->save();
170
+ }
171
+ $this->_getSession()->addSuccess(
172
+ $this->__('Total of %d record(s) were successfully updated', count($ticketIds))
173
+ );
174
+ } catch (Exception $e) {
175
+ $this->_getSession()->addError($e->getMessage());
176
+ }
177
+ }
178
+ $this->_redirect('*/*/index');
179
+ }
180
+
181
+ public function exportCsvAction()
182
+ {
183
+ $fileName = 'supportcenter.csv';
184
+ $content = $this->getLayout()->createBlock('supportcenter/adminhtml_supportcenter_grid')
185
+ ->getCsv();
186
+
187
+ $this->_sendUploadResponse($fileName, $content);
188
+ }
189
+
190
+ public function exportXmlAction()
191
+ {
192
+ $fileName = 'supportcenter.xml';
193
+ $content = $this->getLayout()->createBlock('supportcenter/adminhtml_supportcenter_grid')
194
+ ->getXml();
195
+
196
+ $this->_sendUploadResponse($fileName, $content);
197
+ }
198
+
199
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
200
+ {
201
+ $response = $this->getResponse();
202
+ $response->setHeader('HTTP/1.1 200 OK','');
203
+ $response->setHeader('Pragma', 'public', true);
204
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
205
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
206
+ $response->setHeader('Last-Modified', date('r'));
207
+ $response->setHeader('Accept-Ranges', 'bytes');
208
+ $response->setHeader('Content-Length', strlen($content));
209
+ $response->setHeader('Content-type', $contentType);
210
+ $response->setBody($content);
211
+ $response->sendResponse();
212
+ die;
213
+ }
214
+ }
app/code/local/Magestore/Supportcenter/controllers/GuestController.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportcenter_GuestController extends Mage_Core_Controller_Front_Action
4
+ {
5
+
6
+ protected function _getSession()
7
+ {
8
+ return Mage::getSingleton('supportcenter/session');
9
+ }
10
+
11
+ public function indexAction()
12
+ {
13
+ $this->loadLayout();
14
+ $this->_initLayoutMessages('supportcenter/session');
15
+ $this->renderLayout();
16
+ }
17
+
18
+ public function sendAction(){
19
+ $data = $this->getRequest()->getPost();
20
+ $model = Mage::getModel('supportcenter/ticket');
21
+ $model->setData($data);
22
+ try {
23
+
24
+ $model->setCustomerId(NULL);
25
+ $model->setCreatedTime(now());
26
+ $code = md5($model->getCreatedTime());
27
+ $model->setVerifyCode($code);
28
+ $model->setStatus(1);
29
+ $model->save();
30
+
31
+ $isSendMail = Mage::getStoreConfig('supportcenter/general/send_email_to_department');
32
+ if($isSendMail == 1){
33
+ $ticket = Mage::getModel('supportcenter/ticket')->load($model->getId());
34
+ Mage::getModel('supportcenter/ticket')->sendMailToAdmin($ticket, 0, $model->getContent());
35
+ }
36
+ $this->_getSession()->addSuccess($this->__('The ticket has been sent.'));
37
+ $this->_redirect('supportcenter/guest');
38
+
39
+ return;
40
+ }
41
+ catch (Mage_Core_Exception $e) {
42
+ $this->_getSession()->addError($e->getMessage());
43
+ }
44
+ catch (Exception $e) {
45
+ $this->_getSession()->addException($e, $this->__('Cannot send the ticket.'));
46
+ }
47
+ }
48
+
49
+ public function replyAction()
50
+ {
51
+ $data = $this->getRequest()->getPost();
52
+ $replyModel = Mage::getModel('supportcenter/replyticket');
53
+ $replyModel->setData($data);
54
+ $ticketModel = Mage::getModel('supportcenter/ticket');
55
+ $ticketId = $this->getRequest()->getParam('ticket_id');
56
+ try {
57
+ $replyModel->setCreatedTime(now());
58
+ $replyModel->setCustomerSender(1);
59
+ $replyModel->save();
60
+
61
+ $ticketModel->setLastReplyTime(now());
62
+ $ticketModel->setId($ticketId);
63
+ $replies = Mage::getModel('supportcenter/replyticket')->getRepliesTicket($ticketId);
64
+ $ticketModel->setTotalReply($replies->getSize());
65
+ $ticketModel->setStatus(1);
66
+ $ticketModel->save();
67
+
68
+ $ticket = Mage::getModel('supportcenter/ticket')->load($ticketId);
69
+ $isSendMail = Mage::getStoreConfig('supportcenter/general/send_email_to_department');
70
+ if($isSendMail == 1){
71
+ Mage::getModel('supportcenter/ticket')->sendMailToAdmin($ticket, $replyModel->getContent());
72
+ }
73
+
74
+ $this->_getSession()->addSuccess($this->__('The reply has been sent.'));
75
+ $this->_redirect('*/*/view', array('ticket_id'=>$replyModel->getTicketId(), 'key'=>$ticket->getVerifyCode()));
76
+ return;
77
+ }
78
+ catch (Mage_Core_Exception $e) {
79
+ $this->_getSession()->addError($e->getMessage());
80
+ }
81
+ catch (Exception $e) {
82
+ $this->_getSession()->addException($e, $this->__('Cannot send the reply.'));
83
+ }
84
+
85
+ }
86
+
87
+ public function viewAction(){
88
+ //http://www.localhost.com/magento/index.php/supportcenter/guest/view/ticket_id/4/key/bf4d7582585238a16f1a44ba0401d525
89
+ $this->loadLayout();
90
+ $id = $this->getRequest()->getParam('ticket_id');
91
+ $ticket = Mage::getModel('supportcenter/ticket')->load($id);
92
+ $key = $this->getRequest()->getParam('key');
93
+ if (!$ticket->getId()) {
94
+ $this->_getSession()->addError($this->__('No ticket.'));
95
+ $this->_redirect('*/*/');
96
+ }elseif($ticket->getVerifyCode() != $key) {
97
+ $this->_getSession()->addError($this->__('No access permission.'));
98
+ $this->_redirect('*/*/');
99
+ }
100
+
101
+ //$this->_initLayoutMessages('supportcenter/session');
102
+ $this->renderLayout();
103
+ }
104
+ }
app/code/local/Magestore/Supportcenter/controllers/IndexController.php ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magestore_Supportcenter_IndexController extends Mage_Core_Controller_Front_Action
4
+ {
5
+
6
+ protected function _getSession()
7
+ {
8
+ return Mage::getSingleton('supportcenter/session');
9
+ }
10
+
11
+ public function preDispatch()
12
+ {
13
+ parent::preDispatch();
14
+
15
+ if (!Mage::getSingleton('customer/session')->authenticate($this)) {
16
+ $this->setFlag('', 'no-dispatch', true);
17
+ }
18
+ }
19
+
20
+ public function indexAction()
21
+ {
22
+ /* $isLoggedIn = Mage::getSingleton('customer/session')->isLoggedIn();
23
+ if(!$isLoggedIn) */
24
+
25
+ $this->loadLayout();
26
+ $this->_initLayoutMessages('customer/session');
27
+ $this->_initLayoutMessages('supportcenter/session');
28
+ $this->renderLayout();
29
+ }
30
+
31
+ function sendAction(){
32
+ if (!$this->_validateFormKey()) {
33
+ return $this->_redirect('*/*/');
34
+ }
35
+
36
+ $data = $this->getRequest()->getPost();
37
+ $ticketModel = Mage::getModel('supportcenter/ticket');
38
+ $ticketModel->setData($data);
39
+ $customerId = Mage::getSingleton('customer/session')->getCustomerId();
40
+ $customerName = Mage::getSingleton('customer/customer')->load($customerId)->getName();
41
+ $customerEmail = Mage::getSingleton('customer/customer')->load($customerId)->getEmail();
42
+
43
+ try {
44
+ $ticketModel->setCreatedTime(now());
45
+ $ticketModel->setCustomerId($customerId);
46
+ $ticketModel->setCustomerName($customerName);
47
+ $ticketModel->setCustomerEmail($customerEmail);
48
+ $ticketModel->save();
49
+
50
+ $isSendMail = Mage::getStoreConfig('supportcenter/general/send_email_to_department');
51
+ if($isSendMail == 1){
52
+ $ticket = Mage::getModel('supportcenter/ticket')->load($ticketModel->getId());
53
+ Mage::getModel('supportcenter/ticket')->sendMailToAdmin($ticket, 0, $ticketModel->getContent());
54
+ }
55
+
56
+ $this->_getSession()->addSuccess($this->__('The ticket has been sent.'));
57
+ $this->_redirect('supportcenter');
58
+
59
+ return;
60
+ }
61
+ catch (Mage_Core_Exception $e) {
62
+ $this->_getSession()->addError($e->getMessage());
63
+ }
64
+ catch (Exception $e) {
65
+ $this->_getSession()->addException($e, $this->__('Cannot send the ticket.'));
66
+ }
67
+ }
68
+
69
+ public function replyAction()
70
+ {
71
+ if (!$this->_validateFormKey()) {
72
+ return $this->_redirect('*/*/view', array('ticket_id'=>$this->getRequest()->getParam('ticket_id')));
73
+ }
74
+
75
+ $data = $this->getRequest()->getPost();
76
+ $replyModel = Mage::getModel('supportcenter/replyticket');
77
+ $replyModel->setData($data);
78
+ $ticketModel = Mage::getModel('supportcenter/ticket');
79
+ $ticketId = $this->getRequest()->getParam('ticket_id');
80
+ try {
81
+ $replyModel->setCreatedTime(now());
82
+ $replyModel->setCustomerSender(1);
83
+ $replyModel->save();
84
+
85
+ $ticketModel->setLastReplyTime(now());
86
+ $ticketModel->setId($ticketId);
87
+ $replies = Mage::getModel('supportcenter/replyticket')->getRepliesTicket($ticketId);
88
+ $ticketModel->setTotalReply($replies->getSize());
89
+ $ticketModel->setStatus(1);
90
+ $ticketModel->save();
91
+
92
+ $isSendMail = Mage::getStoreConfig('supportcenter/general/send_email_to_department');
93
+ if($isSendMail == 1){
94
+ $ticket = Mage::getModel('supportcenter/ticket')->load($ticketId);
95
+ Mage::getModel('supportcenter/ticket')->sendMailToAdmin($ticket, 1, $replyModel->getContent());
96
+ }
97
+
98
+ $this->_getSession()->addSuccess($this->__('The reply has been sent.'));
99
+ $this->_redirect('*/*/view', array('ticket_id'=>$replyModel->getTicketId()));
100
+ return;
101
+ }
102
+ catch (Mage_Core_Exception $e) {
103
+ $this->_getSession()->addError($e->getMessage());
104
+ }
105
+ catch (Exception $e) {
106
+ $this->_getSession()->addException($e, $this->__('Cannot send the reply.'));
107
+ }
108
+
109
+ }
110
+
111
+ public function viewAction()
112
+ {
113
+ $this->loadLayout();
114
+ $id = $this->getRequest()->getParam('ticket_id');
115
+ $ticket = Mage::getModel('supportcenter/ticket')->load($id);
116
+ $customerId = Mage::getModel('customer/session')->getCustomerId();
117
+
118
+ if (!$ticket->getId()) {
119
+ $this->_getSession()->addError($this->__('No ticket.'));
120
+ $this->_redirect('*/*/');
121
+ }elseif($ticket->getCustomerId() != $customerId) {
122
+ $this->_getSession()->addError($this->__('No access permission.'));
123
+ $this->_redirect('*/*/');
124
+ }
125
+
126
+ //$this->_initLayoutMessages('supportcenter/session');
127
+ $this->renderLayout();
128
+ }
129
+
130
+ }
app/code/local/Magestore/Supportcenter/etc/adminhtml.xml ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <menu>
4
+ <supportcenter module="supportcenter">
5
+ <title>Support Center</title>
6
+ <sort_order>71</sort_order>
7
+ <children>
8
+ <department module="supportcenter">
9
+ <title>Manage Deparment</title>
10
+ <sort_order>0</sort_order>
11
+ <action>supportcenter/adminhtml_department</action>
12
+ </department>
13
+ <ticket module="supportcenter">
14
+ <title>Manage Ticket</title>
15
+ <sort_order>0</sort_order>
16
+ <action>supportcenter/adminhtml_ticket</action>
17
+ </ticket>
18
+ </children>
19
+ </supportcenter>
20
+ </menu>
21
+ <acl>
22
+ <resources>
23
+ <all>
24
+ <title>Allow Everything</title>
25
+ </all>
26
+ <admin>
27
+ <children>
28
+ <system>
29
+ <children>
30
+ <config>
31
+ <children>
32
+ <supportcenter translate="title">
33
+ <title>Support Center</title>
34
+ <sort_order>50</sort_order>
35
+ </supportcenter>
36
+ </children>
37
+ </config>
38
+ </children>
39
+ </system>
40
+ <Magestore_Supportcenter>
41
+ <title>Supportcenter Module</title>
42
+ <sort_order>10</sort_order>
43
+ </Magestore_Supportcenter>
44
+ </children>
45
+ </admin>
46
+ </resources>
47
+ </acl>
48
+
49
+ </config>
app/code/local/Magestore/Supportcenter/etc/config.xml ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Magestore_Supportcenter>
5
+ <version>0.1.0</version>
6
+ </Magestore_Supportcenter>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <supportcenter>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Magestore_Supportcenter</module>
14
+ <frontName>supportcenter</frontName>
15
+ </args>
16
+ </supportcenter>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <supportcenter>
21
+ <file>supportcenter.xml</file>
22
+ </supportcenter>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <admin>
27
+ <routers>
28
+ <supportcenter>
29
+ <use>admin</use>
30
+ <args>
31
+ <module>Magestore_Supportcenter</module>
32
+ <frontName>supportcenter</frontName>
33
+ </args>
34
+ </supportcenter>
35
+ </routers>
36
+ </admin>
37
+ <adminhtml>
38
+ <layout>
39
+ <updates>
40
+ <supportcenter>
41
+ <file>supportcenter.xml</file>
42
+ </supportcenter>
43
+ </updates>
44
+ </layout>
45
+ </adminhtml>
46
+ <global>
47
+ <models>
48
+ <supportcenter>
49
+ <class>Magestore_Supportcenter_Model</class>
50
+ <resourceModel>supportcenter_mysql4</resourceModel>
51
+ </supportcenter>
52
+ <supportcenter_mysql4>
53
+ <class>Magestore_Supportcenter_Model_Mysql4</class>
54
+ <entities>
55
+ <department>
56
+ <table>sc_department</table>
57
+ </department>
58
+ <ticket>
59
+ <table>sc_ticket</table>
60
+ </ticket>
61
+ <replyticket>
62
+ <table>sc_reply_ticket</table>
63
+ </replyticket>
64
+ <statuslog>
65
+ <table>sc_status_log</table>
66
+ </statuslog>
67
+ </entities>
68
+ </supportcenter_mysql4>
69
+ </models>
70
+ <resources>
71
+ <supportcenter_setup>
72
+ <setup>
73
+ <module>Magestore_Supportcenter</module>
74
+ </setup>
75
+ <connection>
76
+ <use>core_setup</use>
77
+ </connection>
78
+ </supportcenter_setup>
79
+ <supportcenter_write>
80
+ <connection>
81
+ <use>core_write</use>
82
+ </connection>
83
+ </supportcenter_write>
84
+ <supportcenter_read>
85
+ <connection>
86
+ <use>core_read</use>
87
+ </connection>
88
+ </supportcenter_read>
89
+ </resources>
90
+ <blocks>
91
+ <supportcenter>
92
+ <class>Magestore_Supportcenter_Block</class>
93
+ </supportcenter>
94
+ </blocks>
95
+ <helpers>
96
+ <supportcenter>
97
+ <class>Magestore_Supportcenter_Helper</class>
98
+ </supportcenter>
99
+ </helpers>
100
+
101
+ <template>
102
+ <email>
103
+ <supportcenter_general_email_to_admin translate="label" module="supportcenter">
104
+ <label>Support center email to admin</label>
105
+ <file>supportcenter_email_to_admin.html</file>
106
+ <type>html</type>
107
+ </supportcenter_general_email_to_admin>
108
+
109
+ <supportcenter_general_email_to_customer translate="label" module="supportcenter">
110
+ <label>Support center email to customer</label>
111
+ <file>supportcenter_email_to_customer.html</file>
112
+ <type>html</type>
113
+ </supportcenter_general_email_to_customer>
114
+ </email>
115
+ </template>
116
+
117
+ </global>
118
+ </config>
app/code/local/Magestore/Supportcenter/etc/system.xml ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <magestore translate="label">
5
+ <label>Magestore Extension</label>
6
+ <sort_order>400</sort_order>
7
+ </magestore>
8
+ </tabs>
9
+
10
+ <sections>
11
+ <supportcenter translate="label" module="supportcenter">
12
+ <class>separator-top</class>
13
+ <label>Support Center</label>
14
+ <tab>magestore</tab>
15
+ <frontend_type>text</frontend_type>
16
+ <sort_order>300</sort_order>
17
+ <show_in_default>1</show_in_default>
18
+ <show_in_website>1</show_in_website>
19
+ <show_in_store>1</show_in_store>
20
+ <groups>
21
+ <general translate="label">
22
+ <label>Support Center Configuration</label>
23
+ <frontend_type>text</frontend_type>
24
+ <sort_order>1</sort_order>
25
+ <show_in_default>1</show_in_default>
26
+ <show_in_website>1</show_in_website>
27
+ <show_in_store>0</show_in_store>
28
+ <fields>
29
+ <send_email_to_department translate="label">
30
+ <label>Send email to department</label>
31
+ <frontend_type>select</frontend_type>
32
+ <source_model>supportcenter/sendmail</source_model>
33
+ <sort_order>2</sort_order>
34
+ <show_in_default>1</show_in_default>
35
+ <show_in_website>1</show_in_website>
36
+ <show_in_store>1</show_in_store>
37
+ <comment></comment>
38
+ </send_email_to_department>
39
+
40
+ <send_email_to_customer translate="label">
41
+ <label>Send email to customer</label>
42
+ <frontend_type>select</frontend_type>
43
+ <source_model>supportcenter/sendmail</source_model>
44
+ <sort_order>3</sort_order>
45
+ <show_in_default>1</show_in_default>
46
+ <show_in_website>1</show_in_website>
47
+ <show_in_store>1</show_in_store>
48
+ <comment></comment>
49
+ </send_email_to_customer>
50
+
51
+ <email_to_admin translate="label">
52
+ <label>Email To Admin Template</label>
53
+ <frontend_type>select</frontend_type>
54
+ <source_model>adminhtml/system_config_source_email_template</source_model>
55
+ <sort_order>4</sort_order>
56
+ <show_in_default>1</show_in_default>
57
+ <show_in_website>1</show_in_website>
58
+ <show_in_store>1</show_in_store>
59
+ </email_to_admin>
60
+
61
+ <email_to_customer translate="label">
62
+ <label>Email To Customer Template</label>
63
+ <frontend_type>select</frontend_type>
64
+ <source_model>adminhtml/system_config_source_email_template</source_model>
65
+ <sort_order>5</sort_order>
66
+ <show_in_default>1</show_in_default>
67
+ <show_in_website>1</show_in_website>
68
+ <show_in_store>1</show_in_store>
69
+ </email_to_customer>
70
+
71
+ <copy_to translate="label comment">
72
+ <label>Send Order Email Copy To</label>
73
+ <frontend_type>text</frontend_type>
74
+ <sort_order>6</sort_order>
75
+ <show_in_default>1</show_in_default>
76
+ <show_in_website>1</show_in_website>
77
+ <show_in_store>1</show_in_store>
78
+ <comment>Comma-separated.</comment>
79
+ </copy_to>
80
+ <copy_method translate="label">
81
+ <label>Send Order Email Copy Method</label>
82
+ <frontend_type>select</frontend_type>
83
+ <source_model>adminhtml/system_config_source_email_method</source_model>
84
+ <sort_order>7</sort_order>
85
+ <show_in_default>1</show_in_default>
86
+ <show_in_website>1</show_in_website>
87
+ <show_in_store>1</show_in_store>
88
+ </copy_method>
89
+ </fields>
90
+ </general>
91
+ </groups>
92
+ </supportcenter>
93
+ </sections>
94
+ </config>
app/code/local/Magestore/Supportcenter/sql/supportcenter_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+
4
+ $configValuesMap = array(
5
+ 'supportcenter/general/email_to_admin' => 'supportcenter_general_email_to_admin',
6
+ 'supportcenter/general/email_to_customer' => 'supportcenter_general_email_to_customer',
7
+ 'supportcenter/general/send_email_to_department' => 1,
8
+ 'supportcenter/general/send_email_to_customer' => 1,
9
+ 'supportcenter/general/copy_method' => 'bbc',
10
+ 'supportcenter/general/copy_to' => ''
11
+ );
12
+
13
+ foreach ($configValuesMap as $configPath=>$configValue) {
14
+ $installer->setConfigData($configPath, $configValue);
15
+ }
16
+
17
+
18
+ $installer->startSetup();
19
+
20
+ $installer->run("
21
+
22
+ DROP TABLE IF EXISTS {$this->getTable('sc_department')};
23
+ CREATE TABLE {$this->getTable('sc_department')} (
24
+ `department_id` int(5) unsigned NOT NULL auto_increment,
25
+ `department_title` varchar(255) NOT NULL default '',
26
+ `department_email` varchar(255) NOT NULL default '',
27
+ `is_active` tinyint(1) NOT NULL default '1',
28
+ PRIMARY KEY (`department_id`)
29
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
30
+
31
+ DROP TABLE IF EXISTS {$this->getTable('sc_ticket')};
32
+ CREATE TABLE {$this->getTable('sc_ticket')} (
33
+ `ticket_id` int(11) unsigned NOT NULL auto_increment,
34
+ `ticket_title` varchar(255) NOT NULL default '',
35
+ `department_id` int(5) unsigned NOT NULL,
36
+ `customer_id` int(10) unsigned NULL,
37
+ `customer_name` varchar(255) NOT NULL,
38
+ `customer_email` varchar(255) NOT NULL,
39
+ `status` tinyint(1) unsigned NOT NULL default '1',
40
+ `content` text NOT NULL,
41
+ `created_time` datetime NOT NULL default '0000-00-00 00:00:00',
42
+ `last_reply_time` datetime NULL,
43
+ `total_reply` int(5) unsigned NOT NULL DEFAULT '0',
44
+ `verify_code` varchar(44) NOT NULL,
45
+ INDEX(`department_id`),
46
+ INDEX(`customer_id`),
47
+ FOREIGN KEY (`department_id`) REFERENCES `{$this->getTable('sc_department')}` (`department_id`) ON DELETE CASCADE ON UPDATE CASCADE,
48
+ FOREIGN KEY (`customer_id`) REFERENCES `{$this->getTable('customer_entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
49
+ PRIMARY KEY (`ticket_id`)
50
+
51
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
52
+
53
+ DROP TABLE IF EXISTS {$this->getTable('sc_reply_ticket')};
54
+ CREATE TABLE {$this->getTable('sc_reply_ticket')} (
55
+ `reply_ticket_id` int(11) unsigned NOT NULL auto_increment,
56
+ `ticket_id` int(11) unsigned NOT NULL,
57
+ `content` text NOT NULL,
58
+ `created_time` datetime NOT NULL default '0000-00-00 00:00:00',
59
+ `customer_sender` tinyint(1) unsigned NOT NULL,
60
+ PRIMARY KEY (`reply_ticket_id`),
61
+ INDEX(`ticket_id`),
62
+ FOREIGN KEY (`ticket_id`) REFERENCES `{$this->getTable('sc_ticket')}` (`ticket_id`) ON DELETE CASCADE ON UPDATE CASCADE
63
+
64
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
65
+
66
+ DROP TABLE IF EXISTS {$this->getTable('sc_status_log')};
67
+ CREATE TABLE {$this->getTable('sc_status_log')} (
68
+ `status_log_id` int(11) unsigned NOT NULL auto_increment,
69
+ `ticket_id` int(11) unsigned NOT NULL DEFAULT '0',
70
+ `admin_id` mediumint(9) unsigned NOT NULL DEFAULT '0',
71
+ `status` tinyint(1) unsigned NOT NULL DEFAULT '0',
72
+ `time` datetime NOT NULL default '0000-00-00 00:00:00',
73
+ PRIMARY KEY (`status_log_id`),
74
+ INDEX(`ticket_id`),
75
+ INDEX(`admin_id`),
76
+ FOREIGN KEY (`ticket_id`) REFERENCES `{$this->getTable('sc_ticket')}` (`ticket_id`) ON DELETE CASCADE ON UPDATE CASCADE,
77
+ FOREIGN KEY (`admin_id`) REFERENCES `{$this->getTable('admin_user')}` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
78
+
79
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
80
+
81
+ ");
82
+
83
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/supportcenter.xml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <supportcenter_adminhtml_department_index>
4
+ <reference name="content">
5
+ <block type="supportcenter/adminhtml_department" name="department" />
6
+ </reference>
7
+ </supportcenter_adminhtml_department_index>
8
+
9
+ <supportcenter_adminhtml_ticket_index>
10
+ <reference name="content">
11
+ <block type="supportcenter/adminhtml_ticket" name="ticket" />
12
+ </reference>
13
+ </supportcenter_adminhtml_ticket_index>
14
+
15
+ </layout>
app/design/adminhtml/default/default/template/supportcenter/detail.phtml ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $ticket = $this->detailTicket()?>
2
+ <?php $status = array('1'=>'Open', '2'=>'Closed', '3'=>'Waitting for customer')?>
3
+ <div class="entry-edit">
4
+ <div class="entry-edit-head">
5
+ Detail Ticket
6
+ </div>
7
+ <div class="fieldset">
8
+ <table cellspacing="0" class="form-list">
9
+ <tr>
10
+ <td class="label"><label><?php echo Mage::helper('supportcenter')->__('Sender') ?></label></td>
11
+ <td>
12
+ <strong><?php echo $ticket->getCustomerName()?></strong> (<?php echo $ticket->getCustomerEmail()?>)
13
+ </td>
14
+ </tr>
15
+ <tr>
16
+ <td class="label"><label><?php echo Mage::helper('supportcenter')->__('Department') ?></label></td>
17
+ <td>
18
+ <strong><?php echo $this->getDepartmentTitle($ticket->getDepartmentId()) ?></strong> (<?php echo $this->getDepartmentEmail($ticket->getDepartmentId())?>)
19
+ </td>
20
+ </tr>
21
+ <tr>
22
+ <td class="label"><label><?php echo Mage::helper('supportcenter')->__('Sent Time') ?></label></td>
23
+ <td><strong><?php echo $this->formatDate($ticket->getCreatedTime(), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM) . ' ' . $this->formatTime($ticket->getCreatedTime()) ?></strong></td>
24
+ </tr>
25
+ <tr>
26
+ <td class="label"><label><?php echo Mage::helper('supportcenter')->__('Status') ?></label></td>
27
+ <td><strong><?php echo $status[$ticket->getStatus()] ?></strong></td>
28
+ </tr>
29
+ <?php if($ticket->getStatus() == 2){?>
30
+ <?php $closedInfo = $this->getClosedInfo($ticket)?>
31
+ <tr>
32
+ <td class="label"><label><?php echo Mage::helper('supportcenter')->__('Locked by') ?></label></td>
33
+ <td><strong><?php echo $closedInfo['lockedby'] ?></strong> (<?php echo $this->formatDate($closedInfo['time'], Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM) . ' ' . $this->formatTime($closedInfo['time'])?>)</td>
34
+ </tr>
35
+
36
+ <?php }?>
37
+
38
+ <tr>
39
+ <td class="label"><label><?php echo Mage::helper('supportcenter')->__('Content') ?></label></td>
40
+ <td><strong><?php echo $ticket->getContent() ?></strong></td>
41
+ </tr>
42
+ </table>
43
+ </div>
44
+ </div>
app/design/frontend/default/default/layout/supportcenter.xml ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addCss"><stylesheet>css/magestore/supportcenter.css</stylesheet></action>
6
+ </reference>
7
+ <reference name="top.links">
8
+ <action method="addLink" translate="label title" module="supportcenter"><label>Support Center</label><url helper="supportcenter/getSupportcenterUrl"/><title>Supportcenter</title><prepare/><urlParams/><position>10</position></action>
9
+ </reference>
10
+ </default>
11
+ <supportcenter_index_index translate="label">
12
+ <label>Support Center</label>
13
+ <update handle="customer_account"/>
14
+ <reference name="content">
15
+ <block type="supportcenter/ticket" name="supportcenter" template="supportcenter/supportcenter.phtml" />
16
+ <block type="customer/account_dashboard" name="customer.account.link.back" template="customer/account/link/back.phtml"/>
17
+ </reference>
18
+ </supportcenter_index_index>
19
+
20
+ <supportcenter_index_view translate="label">
21
+ <label>Support Center</label>
22
+ <update handle="customer_account"/>
23
+ <reference name="content">
24
+ <block type="supportcenter/viewticket" name="viewticket" template="supportcenter/viewticket.phtml" />
25
+ <block type="customer/account_dashboard" name="customer.account.link.back" template="customer/account/link/back.phtml"/>
26
+ </reference>
27
+ </supportcenter_index_view>
28
+
29
+ <supportcenter_guest_index translate="label">
30
+ <label>Support Center</label>
31
+ <reference name="content">
32
+ <block type="supportcenter/ticket" name="supportcenterguest" template="supportcenter/supportcenterguest.phtml" />
33
+ </reference>
34
+ </supportcenter_guest_index>
35
+
36
+ <supportcenter_guest_view translate="label">
37
+ <label>Support Center</label>
38
+ <reference name="content">
39
+ <block type="supportcenter/viewticket" name="viewticketguest" template="supportcenter/viewticketguest.phtml" />
40
+ </reference>
41
+ </supportcenter_guest_view>
42
+
43
+ <customer_account>
44
+ <reference name="customer_account_navigation">
45
+ <action method="addLink" translate="label" module="supportcenter"><name>support</name><path>supportcenter</path><label>Support Center</label></action>
46
+ </reference>
47
+ </customer_account>
48
+
49
+ <customer_logged_in>
50
+ <!-- Removes 'Log Out' link - Default position: 60 -->
51
+ <reference name="top.links">
52
+ <action method="removeLinkByUrl"><url helper="supportcenter/getSupportcenterUrl"/></action>
53
+ </reference>
54
+ </customer_logged_in>
55
+
56
+ </layout>
app/design/frontend/default/default/template/supportcenter/supportcenter.phtml ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
2
+ <div class="page-title">
3
+ <h1><?php echo $this->__('Support center') ?></h1>
4
+ </div>
5
+ <?php $tickets = $this->getTickets()?>
6
+ <?php $status = array('1'=>'Open', '2'=>'Closed', '3'=>'Waiting for customer')?>
7
+ <?php echo $this->getPagerHtml(); ?>
8
+ <?php if($tickets->getSize()){?>
9
+ <table class="data-table" id="tickets-table">
10
+ <col width="1" />
11
+ <col width="1"/>
12
+ <col />
13
+ <col width="1"/>
14
+ <col width="1" />
15
+ <col width="1" />
16
+ <thead>
17
+ <tr>
18
+ <th><?php echo $this->__('Ticket #') ?></th>
19
+ <th><?php echo $this->__('Date') ?></th>
20
+ <th><?php echo $this->__('Title') ?></th>
21
+ <th><?php echo $this->__('Department') ?></th>
22
+ <th><span class="nobr"><?php echo $this->__('Replies') ?></span></th>
23
+ <th><span class="nobr"><?php echo $this->__('Status') ?></span></th>
24
+ </tr>
25
+ </thead>
26
+ <tbody>
27
+
28
+ <?php foreach($tickets as $ticket){ ?>
29
+ <?php ?>
30
+ <tr onclick="window.location.href='<?php echo $this->getViewUrl($ticket) ?>'">
31
+ <td class="a-center"><?php echo $ticket->getTicketId() ?></td>
32
+ <td class="a-center"><?php echo $this->formatDate($ticket->getCreatedTime()) ?></td>
33
+ <td><?php echo $ticket->getTicketTitle() ?></td>
34
+ <td><?php echo $this->getDepartmentTitle($ticket->getDepartmentId()) ?></td>
35
+ <td class="a-center"><?php echo $ticket->getTotalReply()/* $this->getTotalReplies($ticket->getTicketId()) */ ?></td>
36
+ <td class="a-center"><?php echo $status[$ticket->getStatus()] ?></td>
37
+ </tr>
38
+ <?php }?>
39
+ </tbody>
40
+ </table>
41
+ <?php }?>
42
+ <script type="text/javascript">
43
+ decorateTable('tickets-table');
44
+ </script>
45
+ <?php echo $this->getPagerHtml(); ?>
46
+ <form action="<?php echo $this->getUrl('supportcenter/index/send') ?>" method="post" id="form-validate">
47
+ <?php echo $this->getBlockHtml('formkey')?>
48
+ <div class="fieldset">
49
+ <h2 class="legend"><?php echo $this->__('Create new ticket') ?></h2>
50
+ <div class="form-list">
51
+ <label for="title" class="required"><?php echo $this->__('Title') ?><em>*</em></label>
52
+ <div class="input-box">
53
+ <input type="text" name="ticket_title" id="ticket_title" title="<?php echo $this->__('Title') ?>" class="input-text required-entry" />
54
+ </div>
55
+ <label for="department" class="required"><?php echo $this->__('Department') ?><em>*</em></label>
56
+ <div class="input-box">
57
+ <select name="department_id" id="department_id" title="<?php echo $this->__('Department') ?>" class="input-text required-entry">
58
+ <?php $departments = Mage::getModel('supportcenter/department')->getActiveDepartmentsOption()?>
59
+ <?php foreach($departments as $department){?>
60
+ <option value="<?php echo $department['value'] ?>"><?php echo $department['title'] ?></option>
61
+ <?php }?>
62
+ </select>
63
+ </div>
64
+
65
+ <label for="content" class="required"><?php echo $this->__('Message') ?><em>*</em></label>
66
+ <div class="input-box">
67
+ <textarea name="content" id="content" title="<?php echo $this->__('Message') ?>" class="input-text required-entry" style="width:545px"></textarea>
68
+ </div>
69
+ </div>
70
+ <div class="buttons-set">
71
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
72
+ <button type="submit" title="<?php echo $this->__('Send') ?>" class="button"><span><span><?php echo $this->__('Send') ?></span></span></button>
73
+ </div>
74
+ </div>
75
+ </form>
76
+ <script type="text/javascript">
77
+ //<![CDATA[
78
+ var dataForm = new VarienForm('form-validate', true);
79
+ //]]>
80
+ </script>
app/design/frontend/default/default/template/supportcenter/supportcenterguest.phtml ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
2
+ <div class="page-title">
3
+ <h1><?php echo $this->__('Support center for guest') ?></h1>
4
+ </div>
5
+ <form action="<?php echo $this->getUrl('supportcenter/guest/send') ?>" method="post" id="form-validate">
6
+ <?php /* echo $this->getBlockHtml('formkey') */?>
7
+ <div class="fieldset">
8
+ <h2 class="legend"><?php echo $this->__('Create ticket') ?></h2>
9
+ <div class="form-list">
10
+ <label for="name" class="required"><?php echo $this->__('Name') ?><em>*</em></label>
11
+ <div class="input-box">
12
+ <input type="text" name="customer_name" id="customer_name" title="<?php echo $this->__('Title') ?>" class="input-text required-entry" />
13
+ </div>
14
+ <label for="email" class="required"><?php echo $this->__('Email') ?><em>*</em></label>
15
+ <div class="input-box">
16
+ <input type="text" name="customer_email" id="customer_email" title="<?php echo $this->__('Title') ?>" class="input-text required-entry" />
17
+ </div>
18
+ <label for="title" class="required"><?php echo $this->__('Title') ?><em>*</em></label>
19
+ <div class="input-box">
20
+ <input type="text" name="ticket_title" id="ticket_title" title="<?php echo $this->__('Title') ?>" class="input-text required-entry" />
21
+ </div>
22
+ <label for="department" class="required"><?php echo $this->__('Department') ?><em>*</em></label>
23
+ <div class="input-box">
24
+ <select name="department_id" id="department_id" title="<?php echo $this->__('Department') ?>" class="input-text required-entry">
25
+ <?php $departments = Mage::getModel('supportcenter/department')->getActiveDepartmentsOption()?>
26
+ <?php foreach($departments as $department){?>
27
+ <option value="<?php echo $department['value'] ?>"><?php echo $department['title'] ?></option>
28
+ <?php }?>
29
+ </select>
30
+ </div>
31
+
32
+ <label for="content" class="required"><?php echo $this->__('Message') ?><em>*</em></label>
33
+ <div class="input-box">
34
+ <textarea name="content" id="content" title="<?php echo $this->__('Message') ?>" class="input-text required-entry" style="width:400px"></textarea>
35
+ </div>
36
+
37
+ </div>
38
+ <div class="buttons-set">
39
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
40
+ <button type="submit" title="<?php echo $this->__('Send') ?>" class="button"><span><span><?php echo $this->__('Send') ?></span></span></button>
41
+ </div>
42
+ </div>
43
+ </form>
44
+ <script type="text/javascript">
45
+ //<![CDATA[
46
+ var dataForm = new VarienForm('form-validate', true);
47
+ //]]>
48
+ </script>
app/design/frontend/default/default/template/supportcenter/viewticket.phtml ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
2
+ <?php $ticket = $this->getTicket()?>
3
+ <div class="page-title">
4
+ <h1><?php echo $this->__('[#' . $ticket->getTicketId() . '] ' . $ticket->getTicketTitle()) ?></h1>
5
+ </div>
6
+ <?php $status = array('1'=>'Open', '2'=>'Closed', '3'=>'Waiting for customer')?>
7
+ <?php $department = Mage::getModel('supportcenter/department')->load($ticket->getDepartmentId());?>
8
+ <?php $replies = $this->getViewTickets()?>
9
+ <div class="fieldset">
10
+ <h2 class="legend"><?php echo $this->__('Ticket Information') ?></h2>
11
+ <table cellspacing="0" class="form-list">
12
+ <tr>
13
+ <td class="label"><?php echo $this->__('Department:') ?></td>
14
+ <td><strong><?php echo $this->__($department->getDepartmentTitle()) ?></strong></td>
15
+ </tr>
16
+ <tr>
17
+ <td class="label"><?php echo $this->__('Status:') ?></td>
18
+ <td <?php if($ticket->getStatus() == 2){ ?> class="closed" <?php }?>>
19
+ <strong><?php echo $this->__($status[$ticket->getStatus()]) ?></strong>
20
+ </td>
21
+ </tr>
22
+ </table>
23
+ </div>
24
+ <?php echo $this->getPagerHtml(); ?>
25
+ <?php if(count($replies)){?>
26
+ <table class="data-table" id="ticket-table">
27
+ <col width="15%" />
28
+ <col />
29
+ <col width="15%"/>
30
+
31
+ <thead>
32
+ <tr>
33
+ <th><?php echo $this->__('Sender') ?></th>
34
+ <th><?php echo $this->__('Content') ?></th>
35
+ <th><?php echo $this->__('Time') ?></th>
36
+ </tr>
37
+ </thead>
38
+ <tbody>
39
+ <?php foreach($replies as $reply){ ?>
40
+ <tr>
41
+ <td><?php echo $this->getSender($reply)?></td>
42
+ <td><?php echo $reply->getContent() ?></td>
43
+ <td><?php echo $this->formatDate($reply->getCreatedTime(), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM) . ' ' . $this->formatTime($reply->getCreatedTime())?></td>
44
+ </tr>
45
+ <?php }?>
46
+ </tbody>
47
+ </table>
48
+ <script type="text/javascript">
49
+ decorateTable('tickets-table');
50
+ </script>
51
+ <?php }?>
52
+ <?php echo $this->getPagerHtml(); ?>
53
+ <?php if($ticket->getStatus() != '2'){?>
54
+ <form action="<?php echo $this->getUrl('supportcenter/index/reply', array('ticket_id'=>$ticket->getTicketId())) ?>" method="post" id="form-send-reply">
55
+ <?php echo $this->getBlockHtml('formkey')?>
56
+ <div class="fieldset">
57
+ <h2 class="legend"><?php echo $this->__('Reply ticket') ?></h2>
58
+ <div class="form-list">
59
+ <label for="content" class="required"><?php echo $this->__('Message') ?><em>*</em></label>
60
+ <div class="input-box">
61
+ <textarea name="content" id="content" title="<?php echo $this->__('Message') ?>" class="input-text required-entry" style="width:545px"></textarea>
62
+ </div>
63
+ <input name="ticket_id" id="ticket_id" type="hidden" value="<?php echo $ticket->getTicketId() ?>" />
64
+ </div>
65
+ <div class="buttons-set">
66
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
67
+ <button type="submit" title="<?php echo $this->__('Send') ?>" class="button"><span><span><?php echo $this->__('Send') ?></span></span></button>
68
+ </div>
69
+ </div>
70
+ </form>
71
+ <?php }?>
72
+ <script type="text/javascript">
73
+ //<![CDATA[
74
+ var dataForm = new VarienForm('form-send-reply', true);
75
+ //]]>
76
+ </script>
app/design/frontend/default/default/template/supportcenter/viewticketguest.phtml ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
2
+ <?php $ticket = $this->getTicket()?>
3
+ <div class="page-title">
4
+ <h1><?php echo $this->__('[#' . $ticket->getTicketId() . '] ' . $ticket->getTicketTitle()) ?></h1>
5
+ </div>
6
+ <?php $status = array('1'=>'Open', '2'=>'Closed', '3'=>'Waiting for customer')?>
7
+ <?php $department = Mage::getModel('supportcenter/department')->load($ticket->getDepartmentId());?>
8
+ <?php $replies = $this->getViewTickets()?>
9
+ <div class="fieldset">
10
+ <h2 class="legend"><?php echo $this->__('Ticket Information') ?></h2>
11
+ <table cellspacing="0" class="form-list">
12
+ <col width="20%" />
13
+ <col />
14
+ <tr>
15
+ <td class="label"><?php echo $this->__('Sender:') ?></td>
16
+ <td><strong><?php echo $this->__($ticket->getCustomerName()) ?></strong></td>
17
+ </tr>
18
+ <tr>
19
+ <td class="label"><?php echo $this->__('Date:') ?></td>
20
+ <td><strong><?php echo $this->__($this->formatDate($ticket->getCreatedTime())) ?></strong></td>
21
+ </tr>
22
+ <tr>
23
+ <td class="label"><?php echo $this->__('Department:') ?></td>
24
+ <td><strong><?php echo $this->__($department->getDepartmentTitle()) ?></strong></td>
25
+ </tr>
26
+ <tr>
27
+ <td class="label"><?php echo $this->__('Status:') ?></td>
28
+ <td <?php if($ticket->getStatus() == 2){ ?> class="closed" <?php }?>>
29
+ <strong><?php echo $this->__($status[$ticket->getStatus()]) ?></strong>
30
+ </td>
31
+ </tr>
32
+ <tr>
33
+ <td class="label"><?php echo $this->__('Content:') ?></td>
34
+ <td>
35
+ <strong><?php echo $this->__($ticket->getContent()) ?></strong>
36
+ </td>
37
+ </tr>
38
+ </table>
39
+ </div>
40
+ <?php echo $this->getPagerHtml(); ?>
41
+ <?php if(count($replies)){?>
42
+ <table class="data-table" id="ticket-table">
43
+ <col width="20%" />
44
+ <col />
45
+ <col width="20%"/>
46
+
47
+ <thead>
48
+ <tr>
49
+ <th><?php echo $this->__('Sender') ?></th>
50
+ <th><?php echo $this->__('Content') ?></th>
51
+ <th><?php echo $this->__('Time') ?></th>
52
+ </tr>
53
+ </thead>
54
+ <tbody>
55
+ <?php foreach($replies as $reply){ ?>
56
+ <tr>
57
+ <td><?php echo $this->getSender($reply)?></td>
58
+ <td><?php echo $reply->getContent() ?></td>
59
+ <td><?php echo $this->formatDate($reply->getCreatedTime(), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM) . ' ' . $this->formatTime($reply->getCreatedTime())?></td>
60
+ </tr>
61
+ <?php }?>
62
+ </tbody>
63
+ </table>
64
+ <script type="text/javascript">
65
+ decorateTable('tickets-table');
66
+ </script>
67
+ <?php }?>
68
+ <?php echo $this->getPagerHtml(); ?>
69
+ <?php if($ticket->getStatus() != '2'){?>
70
+ <form action="<?php echo $this->getUrl('supportcenter/guest/reply', array('ticket_id'=>$ticket->getTicketId())) ?>" method="post" id="form-send-reply">
71
+ <?php echo $this->getBlockHtml('formkey')?>
72
+ <div class="fieldset">
73
+ <h2 class="legend"><?php echo $this->__('Reply ticket') ?></h2>
74
+ <div class="form-list">
75
+ <label for="content" class="required"><?php echo $this->__('Message') ?><em>*</em></label>
76
+ <div class="input-box">
77
+ <textarea name="content" id="content" title="<?php echo $this->__('Message') ?>" class="input-text required-entry" style="width:400px"></textarea>
78
+ </div>
79
+ <input name="ticket_id" id="ticket_id" type="hidden" value="<?php echo $ticket->getTicketId() ?>" />
80
+ </div>
81
+ <div class="buttons-set">
82
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
83
+ <button type="submit" title="<?php echo $this->__('Send') ?>" class="button"><span><span><?php echo $this->__('Send') ?></span></span></button>
84
+ </div>
85
+ </div>
86
+ </form>
87
+ <?php }?>
88
+ <script type="text/javascript">
89
+ //<![CDATA[
90
+ var dataForm = new VarienForm('form-send-reply', true);
91
+ //]]>
92
+ </script>
app/etc/modules/Magestore_Magenotification.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Magestore_Magenotification>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Magestore_Magenotification>
8
+ </modules>
9
+ </config>
app/etc/modules/Magestore_Supportcenter.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Magestore_Supportcenter>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Magestore_Supportcenter>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Supportcenter</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/osl-3.0.php">http://www.opensource.org/licenses/osl-3.0.php</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>support center for magento1.4</summary>
10
+ <description>Support Center is a ticket system for Magento.
11
+ Admin features:
12
+ + Create and magage department
13
+ + Magento ticket, post reply
14
+ + Edit email template
15
+
16
+ Frontend Features:
17
+ + Submit ticket for guest
18
+ + Submit ticket for store's user
19
+ + Manage ticket for store's user</description>
20
+ <notes>supportCenter for magento1.4</notes>
21
+ <authors><author><name>Magestore</name><user>auto-converted</user><email>support@magestore.com</email></author></authors>
22
+ <date>2010-08-23</date>
23
+ <time>03:37:31</time>
24
+ <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="supportcenter.xml" hash="d0367b847ec36d1da74dee4ac2cf4628"/></dir><dir name="template"><dir name="supportcenter"><file name="detail.phtml" hash="131705335d3c4f79e8ae0b17aa7d0b47"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="supportcenter.xml" hash="c251e3b352d806e1822ba1b3a85205e3"/></dir><dir name="template"><dir name="supportcenter"><file name="supportcenter.phtml" hash="7e48e92678a22da7d247ad12f49e285a"/><file name="supportcenterguest.phtml" hash="b5dd1d7626e01f14cd8db0a84e5728d8"/><file name="viewticket.phtml" hash="5b2d4fd7ba9c9d113ea4b53314e2d0f3"/><file name="viewticketguest.phtml" hash="100012d462ee5031dda922f4d3478d1d"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><dir name="magestore"><file name="supportcenter.css" hash="b608178d669c5d2d1189ebe2532ec7e2"/></dir></dir></dir></dir></dir></target><target name="magelocal"><dir name="Magestore"><dir name="Magenotification"><dir name="Block"><dir name="Rewrite"><file name="AdminhtmlNotificationGridRendererActions.php" hash="331cbb39b387dcd383ffc509b37d7d9d"/><file name="AdminhtmlNotificationWindow.php" hash="3e56b378d2ed9ba6c4f16a40584c6048"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="MagenotificationController.php" hash="63e248a61bfab1632ce793e82aae6838"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="b11e412be30d2a7551f882e0ecdd49e2"/><file name="config.xml" hash="0f4ff4abeb15bd1aef233b84ac60ec04"/><file name="system.xml" hash="5800b9273dca7033421123c1291a2e1c"/></dir><dir name="Helper"><file name="Data.php" hash="6baea4b2a64e41440a2655c4e2a7c530"/></dir><dir name="Model"><file name="Magenotification.php" hash="d0924fab55bcc34cc55b656dad32c89a"/><file name="Observer.php" hash="bda50edf2ac2db242a3efa02a83fdb2b"/><file name="Status.php" hash="ca2c85ad22dbe6e97231081acfbb42b1"/><dir name="Mysql4"><file name="Magenotification.php" hash="d0effb08b44e58cd484dd5bd21da5e38"/><dir name="Magenotification"><file name="Collection.php" hash="7859b80ac9a3b37765a4b1140de343a9"/></dir></dir><dir name="Rewrite"><file name="AdminnotificationMysql4Inbox.php" hash="aeaa8818a3bd85f123b3d9b5c7d51806"/></dir><dir name="Source"><file name="Time.php" hash="33236ea396f02464dba81bf384362a27"/></dir></dir><dir name="sql"><dir name="magenotification_setup"><file name="mysql4-install-0.1.0.php" hash="72f2c9d3151b75d22c839bd94e6bfe6a"/></dir></dir></dir><dir name="Supportcenter"><dir name="Block"><file name="Department.php" hash="00fa60202f044a6e470ef03fa05df425"/><file name="Ticket.php" hash="13e6e850d2b8ca30f1a69482411d0cda"/><file name="Viewticket.php" hash="bba54e2435c29085f9817184b0713322"/><dir name="Adminhtml"><file name="Department.php" hash="baa062d9acaa9a59cd87fdcede119000"/><file name="Ticket.php" hash="fee945b4aa7b5ccce2407df634bf18f7"/><dir name="Department"><file name="Edit.php" hash="024347a1fde547f2236a47ed71d02fe4"/><file name="Grid.php" hash="8098b69dbce4b2974148a3fdcd0f14a5"/><dir name="Edit"><file name="Form.php" hash="4dc10931637c3e82af69f7d6b936a3b4"/><file name="Tabs.php" hash="e67bf52feb2e71134f7a176561072e1b"/><dir name="Tab"><file name="Form.php" hash="f7a044d8215ea7b950fcdd54ad1f4803"/></dir></dir></dir><dir name="Renderer"><file name="Closedticket.php" hash="8e6d10d9998271e1318afbc5a4660533"/><file name="Openticket.php" hash="d0df16ab2e1277b49e09863cf092c827"/><file name="Totalticket.php" hash="41d790e57e876b3c22bcb65fb6f47aba"/><file name="Waittingticket.php" hash="fec5ff3196481b679ba7b4ad9638837b"/></dir><dir name="Ticket"><file name="Grid.php" hash="6deefd407196df7f64f76ecfabb423b2"/><file name="Reply.php" hash="c0b325c5bf291ccc70f667459b3cecd8"/><dir name="Reply"><file name="Form.php" hash="90a9b0954b31ee61c74be395b65f0782"/><file name="Tabs.php" hash="1dce9040aa72d4fa5c2c29c3e3f9215c"/><dir name="Tab"><file name="Detail.php" hash="f8100b7a0249f4ada42909dd0b92d153"/><file name="Form.php" hash="7d57fcf493ac8f4ff39c0bff4206242b"/><file name="Reply.php" hash="47d55312f921a33868ce394f9131fe92"/><file name="Statuslog.php" hash="e7be6f6e1c30de920a25d25d7e229e1c"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="GuestController.php" hash="66092008f5dc8fdc0915a4ec3bdca00c"/><file name="IndexController.php" hash="2ce7d957aa2e3f589214683d8496d38e"/><dir name="Adminhtml"><file name="DepartmentController.php" hash="09793a82a60a91dca93b0ee5977a2aa3"/><file name="GuestticketController.php" hash="ab9492106e6c1321ef10f340e052cffe"/><file name="TicketController.php" hash="bef271c8271631a0376d05043e76b8ec"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="b3b5ff3d793b3865976da22bbaeaa4ae"/><file name="config.xml" hash="a4e3e7e1f9b43375c63dd97e0007b25c"/><file name="system.xml" hash="dfa08f4277d420183266b54a250986f0"/></dir><dir name="Helper"><file name="Data.php" hash="1a5a6f91dc1ae7d811612cbafcef80d5"/></dir><dir name="Model"><file name="Department.php" hash="9191cd258720c5518098355dc2a5b193"/><file name="Departmentstatus.php" hash="64ef78c6331bb2d11e89c5273df11f87"/><file name="Replyticket.php" hash="c6641f13690e58cc25317fd39a70c29f"/><file name="Sendmail.php" hash="f4d0570c19813f7910d3086d3ea7c06d"/><file name="Session.php" hash="c193776670f19368bd418ffb7e4b499e"/><file name="Statuslog.php" hash="1e4cd086381d509390ccfb4865acfff0"/><file name="Ticket.php" hash="2e2697abb7c82f22cbc764be02949c01"/><file name="Ticketstatus.php" hash="ec3b20ddd201aecc2e3727db0927189b"/><dir name="Mysql4"><file name="Department.php" hash="5df759e08f079464d18f641c24058dbd"/><file name="Replyticket.php" hash="51af7381f30d53b836556139a2fc8452"/><file name="Statuslog.php" hash="56e14aca293d6b9b3c1bf9258c65e8b4"/><file name="Ticket.php" hash="5bae9b1df2aa88ff0b96b425e03cc02c"/><dir name="Department"><file name="Collection.php" hash="a1d27f77d76ef2868aeb4c3c1b2533d9"/></dir><dir name="Replyticket"><file name="Collection.php" hash="e061e41392034fba5173d78ce95918d2"/></dir><dir name="Statuslog"><file name="Collection.php" hash="9e0218d36c0c1a2fa83bd6f236a2969b"/></dir><dir name="Ticket"><file name="Collection.php" hash="7b5052bf8c79d9c606f39515b1795239"/></dir></dir></dir><dir name="sql"><dir name="supportcenter_setup"><file name="mysql4-install-0.1.0.php" hash="947237eb12a05469472f502f1dd59c87"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magestore_Magenotification.xml" hash="940e13b33cbf2e9452ecdc231b5868b9"/><file name="Magestore_Supportcenter.xml" hash="fb8619ce87bf37631dbbfdc1c9b10fc4"/></dir></target></contents>
25
+ <compatible/>
26
+ <dependencies/>
27
+ </package>
skin/frontend/default/default/css/magestore/supportcenter.css ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .form-list td{
2
+ width:200px;
3
+ }
4
+ .form-list td.closed {
5
+ color:red;
6
+ }
7
+
8
+ #tickets-table tr:hover{
9
+ background:#FCF5DD;
10
+ cursor:pointer;
11
+ }
12
+
13
+ #tickets-table tr th:hover{
14
+ cursor:default;
15
+ }