Uni_Supportticket - Version 0.1.0

Version Notes

This is first release

Download this release

Release Info

Developer Unicode Systems
Extension Uni_Supportticket
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

Files changed (85) hide show
  1. app/code/community/Uni/Supportticket/Block/Adminhtml/Customer/Edit/Tabs.php +25 -0
  2. app/code/community/Uni/Supportticket/Block/Adminhtml/Customer/Edit/Tabsw.php +106 -0
  3. app/code/community/Uni/Supportticket/Block/Adminhtml/Report/Supportticket.php +13 -0
  4. app/code/community/Uni/Supportticket/Block/Adminhtml/Report/Supportticket/Grid.php +175 -0
  5. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticket.php +18 -0
  6. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticket/Customergrid.php +192 -0
  7. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticket/Edit.php +26 -0
  8. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticket/Edit/Form.php +18 -0
  9. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticket/Edit/Tab/Form.php +143 -0
  10. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticket/Edit/Tabs.php +26 -0
  11. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticket/Grid.php +144 -0
  12. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticket/Grid/Renderer/Collisiontype.php +16 -0
  13. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticket/Grid/Renderer/State.php +14 -0
  14. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketbackend.php +5 -0
  15. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketdepartment.php +18 -0
  16. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketdepartment/Edit.php +44 -0
  17. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketdepartment/Edit/Form.php +18 -0
  18. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketdepartment/Edit/Tab/Form.php +48 -0
  19. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketdepartment/Edit/Tabs.php +21 -0
  20. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketdepartment/Grid.php +107 -0
  21. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketpriority.php +18 -0
  22. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketpriority/Edit.php +44 -0
  23. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketpriority/Edit/Form.php +17 -0
  24. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketpriority/Edit/Tab/Form.php +61 -0
  25. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketpriority/Edit/Tabs.php +21 -0
  26. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketpriority/Grid.php +112 -0
  27. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketreply.php +19 -0
  28. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketreply/Edit.php +40 -0
  29. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketreply/Edit/Form.php +65 -0
  30. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketreply/Edit/Tab/Form.php +41 -0
  31. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketreply/Edit/Tabs.php +21 -0
  32. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketreply/Grid.php +71 -0
  33. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketreplywithticketid.php +18 -0
  34. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketreplywithticketid/Grid.php +91 -0
  35. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketreplywithticketid/Renderer/Userrole.php +30 -0
  36. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketstatus.php +18 -0
  37. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketstatus/Edit.php +43 -0
  38. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketstatus/Edit/Form.php +18 -0
  39. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketstatus/Edit/Tab/Form.php +61 -0
  40. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketstatus/Edit/Tabs.php +21 -0
  41. app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketstatus/Grid.php +97 -0
  42. app/code/community/Uni/Supportticket/Block/Index.php +22 -0
  43. app/code/community/Uni/Supportticket/Block/Supportticket.php +47 -0
  44. app/code/community/Uni/Supportticket/Block/Supportticketreply.php +42 -0
  45. app/code/community/Uni/Supportticket/Helper/Data.php +95 -0
  46. app/code/community/Uni/Supportticket/Model/Mysql4/Supportticket.php +8 -0
  47. app/code/community/Uni/Supportticket/Model/Mysql4/Supportticket/Collection.php +52 -0
  48. app/code/community/Uni/Supportticket/Model/Mysql4/Supportticketdepartment.php +8 -0
  49. app/code/community/Uni/Supportticket/Model/Mysql4/Supportticketdepartment/Collection.php +12 -0
  50. app/code/community/Uni/Supportticket/Model/Mysql4/Supportticketpriority.php +8 -0
  51. app/code/community/Uni/Supportticket/Model/Mysql4/Supportticketpriority/Collection.php +56 -0
  52. app/code/community/Uni/Supportticket/Model/Mysql4/Supportticketreply.php +8 -0
  53. app/code/community/Uni/Supportticket/Model/Mysql4/Supportticketreply/Collection.php +52 -0
  54. app/code/community/Uni/Supportticket/Model/Mysql4/Supportticketstatus.php +8 -0
  55. app/code/community/Uni/Supportticket/Model/Mysql4/Supportticketstatus/Collection.php +60 -0
  56. app/code/community/Uni/Supportticket/Model/Supportticket.php +12 -0
  57. app/code/community/Uni/Supportticket/Model/Supportticketdepartment.php +12 -0
  58. app/code/community/Uni/Supportticket/Model/Supportticketpriority.php +12 -0
  59. app/code/community/Uni/Supportticket/Model/Supportticketreply.php +12 -0
  60. app/code/community/Uni/Supportticket/Model/Supportticketstatus.php +12 -0
  61. app/code/community/Uni/Supportticket/controllers/Adminhtml/Report/SupportticketController.php +33 -0
  62. app/code/community/Uni/Supportticket/controllers/Adminhtml/SupportticketController.php +320 -0
  63. app/code/community/Uni/Supportticket/controllers/Adminhtml/SupportticketController_1.php +259 -0
  64. app/code/community/Uni/Supportticket/controllers/Adminhtml/SupportticketbackendController.php +10 -0
  65. app/code/community/Uni/Supportticket/controllers/Adminhtml/SupportticketdepartmentController.php +215 -0
  66. app/code/community/Uni/Supportticket/controllers/Adminhtml/SupportticketpriorityController.php +215 -0
  67. app/code/community/Uni/Supportticket/controllers/Adminhtml/SupportticketreplyController.php +167 -0
  68. app/code/community/Uni/Supportticket/controllers/Adminhtml/SupportticketstatusController.php +224 -0
  69. app/code/community/Uni/Supportticket/controllers/IndexController.php +25 -0
  70. app/code/community/Uni/Supportticket/controllers/SupportticketController.php +165 -0
  71. app/code/community/Uni/Supportticket/controllers/SupportticketreplyController.php +165 -0
  72. app/code/community/Uni/Supportticket/etc/adminhtml.xml +23 -0
  73. app/code/community/Uni/Supportticket/etc/config.xml +228 -0
  74. app/code/community/Uni/Supportticket/etc/system.xml +57 -0
  75. app/code/community/Uni/Supportticket/sql/supportticket_setup/mysql4-install-0.1.0.php +90 -0
  76. app/design/adminhtml/default/default/layout/supportticket.xml +34 -0
  77. app/design/frontend/default/default/layout/supportticket.xml +39 -0
  78. app/design/frontend/default/default/template/supportticket/index.phtml +110 -0
  79. app/design/frontend/default/default/template/supportticket/supportticket.phtml +59 -0
  80. app/design/frontend/default/default/template/supportticket/supportticketreply.phtml +56 -0
  81. app/design/frontend/default/default/template/supportticket/view.phtml +101 -0
  82. app/etc/modules/Uni_Supportticket.xml +10 -0
  83. app/locale/en_US/template/email/support_ticket_form.html +17 -0
  84. app/locale/en_US/template/email/support_ticket_reply.html +7 -0
  85. package.xml +20 -0
app/code/community/Uni/Supportticket/Block/Adminhtml/Customer/Edit/Tabs.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Adminhtml_Customer_Edit_Tabs extends Mage_Adminhtml_Block_Customer_Edit_Tabs {
4
+
5
+ public function __construct() {
6
+ parent::__construct();
7
+ $this->setId('customer_info_tabs');
8
+ $this->setDestElementId('edit_form');
9
+ $this->setTitle(Mage::helper('customer')->__('Customer Information'));
10
+ }
11
+
12
+ protected function _beforeToHtml() {
13
+
14
+ $this->addTab('supportticket', array(
15
+ 'label' => Mage::helper('supportticket')->__('Customer Support Ticket'),
16
+ 'content' => $this->getLayout()->createBlock('supportticket/adminhtml_supportticket_customergrid')->initForm()->toHtml(),
17
+ 'active' => Mage::registry('supportticket_data')
18
+ ));
19
+
20
+ $this->_updateActiveTab();
21
+ Varien_Profiler::stop('customer/tabs');
22
+ return parent::_beforeToHtml();
23
+ }
24
+
25
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Customer/Edit/Tabsw.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // echo 'innnnnn';exit;
3
+
4
+ class Uni_Supportticket_Block_Adminhtml_Customer_Edit_Tabs extends Mage_Adminhtml_Block_Customer_Edit_Tabs {
5
+
6
+ // public function __construct()
7
+ // {
8
+ // parent::__construct();
9
+ // $this->setId('customer_info_tabs');
10
+ // $this->setDestElementId('edit_form');
11
+ // $this->setTitle(Mage::helper('customer')->__('Customer Information'));
12
+ // }
13
+
14
+ protected function _beforeToHtml()
15
+ {
16
+ // echo 'innnnnn';exit;
17
+ /*
18
+ if (Mage::registry('current_customer')->getId()) {
19
+ $this->addTab('view', array(
20
+ 'label' => Mage::helper('customer')->__('Customer View'),
21
+ 'content' => $this->getLayout()->createBlock('adminhtml/customer_edit_tab_view')->toHtml(),
22
+ 'active' => true
23
+ ));
24
+ }
25
+ */
26
+ // $this->addTab('account', array(
27
+ // 'label' => Mage::helper('customer')->__('Account Information'),
28
+ // 'content' => $this->getLayout()->createBlock('adminhtml/customer_edit_tab_account')->initForm()->toHtml(),
29
+ // 'active' => Mage::registry('current_customer')->getId() ? false : true
30
+ // ));
31
+ $this->addTab('supportticket', array(
32
+ 'label' => Mage::helper('supportticket')->__('Customer Support Ticket'),
33
+ 'content' => $this->getLayout()->createBlock('supportticket/adminhtml_supportticket_customergrid')->initForm()->toHtml(),
34
+ 'active' => Mage::registry('supportticket_data')->getId() ? false : true
35
+ ));
36
+
37
+ // $this->addTab('addresses', array(
38
+ // 'label' => Mage::helper('customer')->__('Addresses'),
39
+ // 'content' => $this->getLayout()->createBlock('adminhtml/customer_edit_tab_addresses')->initForm()->toHtml(),
40
+ // ));
41
+
42
+
43
+ // load: Orders, Shopping Cart, Wishlist, Product Reviews, Product Tags - with ajax
44
+
45
+ // if (Mage::registry('current_customer')->getId()) {
46
+ //
47
+ // if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
48
+ // $this->addTab('orders', array(
49
+ // 'label' => Mage::helper('customer')->__('Orders'),
50
+ // 'class' => 'ajax',
51
+ // 'url' => $this->getUrl('*/*/orders', array('_current' => true)),
52
+ // ));
53
+ // }
54
+ //
55
+ // $this->addTab('cart', array(
56
+ // 'label' => Mage::helper('customer')->__('Shopping Cart'),
57
+ // 'class' => 'ajax',
58
+ // 'url' => $this->getUrl('*/*/carts', array('_current' => true)),
59
+ // ));
60
+ //
61
+ // $this->addTab('wishlist', array(
62
+ // 'label' => Mage::helper('customer')->__('Wishlist'),
63
+ // 'class' => 'ajax',
64
+ // 'url' => $this->getUrl('*/*/wishlist', array('_current' => true)),
65
+ // ));
66
+ //
67
+ // if (Mage::getSingleton('admin/session')->isAllowed('newsletter/subscriber')) {
68
+ // $this->addTab('newsletter', array(
69
+ // 'label' => Mage::helper('customer')->__('Newsletter'),
70
+ // 'content' => $this->getLayout()->createBlock('adminhtml/customer_edit_tab_newsletter')->initForm()->toHtml()
71
+ // ));
72
+ // }
73
+ //
74
+ // if (Mage::getSingleton('admin/session')->isAllowed('catalog/reviews_ratings')) {
75
+ // $this->addTab('reviews', array(
76
+ // 'label' => Mage::helper('customer')->__('Product Reviews'),
77
+ // 'class' => 'ajax',
78
+ // 'url' => $this->getUrl('*/*/productReviews', array('_current' => true)),
79
+ // ));
80
+ // }
81
+ //
82
+ // if (Mage::getSingleton('admin/session')->isAllowed('catalog/tag')) {
83
+ // $this->addTab('tags', array(
84
+ // 'label' => Mage::helper('customer')->__('Product Tags'),
85
+ // 'class' => 'ajax',
86
+ // 'url' => $this->getUrl('*/*/productTags', array('_current' => true)),
87
+ // ));
88
+ // }
89
+ // }
90
+
91
+ $this->_updateActiveTab();
92
+ Varien_Profiler::stop('customer/tabs');
93
+ return parent::_beforeToHtml();
94
+ }
95
+
96
+ // protected function _updateActiveTab()
97
+ // {
98
+ // $tabId = $this->getRequest()->getParam('tab');
99
+ // if( $tabId ) {
100
+ // $tabId = preg_replace("#{$this->getId()}_#", '', $tabId);
101
+ // if($tabId) {
102
+ // $this->setActiveTab($tabId);
103
+ // }
104
+ // }
105
+ // }
106
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Report/Supportticket.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Adminhtml_Report_Supportticket extends Mage_Adminhtml_Block_Widget_Grid_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+ $this->_controller = 'adminhtml_report_supportticket';
8
+ $this->_blockGroup = "supportticket";
9
+ $this->_headerText = Mage::helper('supportticket')->__('Supportticket Report');
10
+ parent::__construct();
11
+ $this->_removeButton('add');
12
+ }
13
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Report/Supportticket/Grid.php ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Uni_Supportticket_Block_Adminhtml_Report_Supportticket_Grid extends Mage_Adminhtml_Block_Report_Grid
3
+ {
4
+
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('gridSupportticketReport');
9
+ $this->setTemplate('report/grid.phtml');
10
+ $this->setSubReportSize(0);
11
+ }
12
+
13
+ protected function _prepareCollection()
14
+ {
15
+ parent::_prepareCollection();
16
+ $this->getCollection()->initReport('supportticket/supportticket_collection');
17
+ }
18
+
19
+ protected function _prepareColumns()
20
+ {
21
+
22
+
23
+ $this->addColumn('entity_id', array(
24
+ 'header' => $this->__('entity_id'),
25
+ 'sortable' => false,
26
+ 'index' => 'entity_id'
27
+ ));
28
+ $this->addColumn('ticket_id', array(
29
+ 'header' => $this->__('ticket_id'),
30
+ 'sortable' => false,
31
+ 'index' => 'ticket_id'
32
+ ));
33
+ $this->addColumn('user_name', array(
34
+ 'header' => $this->__('user_name'),
35
+ 'sortable' => false,
36
+ 'index' => 'user_name'
37
+ ));
38
+ $this->addColumn('department', array(
39
+ 'header' => $this->__('department'),
40
+ 'sortable' => false,
41
+ 'index' => 'department'
42
+ ));
43
+ $this->addColumn('ticket_priority', array(
44
+ 'header' => $this->__('ticket_priority'),
45
+ 'sortable' => false,
46
+ 'index' => 'ticket_priority'
47
+ ));
48
+ $this->addColumn('ticket_subject', array(
49
+ 'header' => $this->__('ticket_subject'),
50
+ 'sortable' => false,
51
+ 'index' => 'ticket_subject'
52
+ ));
53
+ $this->addColumn('ticket_message', array(
54
+ 'header' => $this->__('ticket_message'),
55
+ 'sortable' => false,
56
+ 'index' => 'ticket_message'
57
+ ));
58
+ $this->addColumn('ticket_attachment', array(
59
+ 'header' => $this->__('ticket_attachment'),
60
+ 'sortable' => false,
61
+ 'index' => 'ticket_attachment'
62
+ ));
63
+ $this->addColumn('update_time', array(
64
+ 'header' => $this->__('update_time'),
65
+ 'sortable' => false,
66
+ 'index' => 'update_time'
67
+ ));
68
+ $this->addColumn('create_time', array(
69
+ 'header' => $this->__('create_time'),
70
+ 'sortable' => false,
71
+ 'index' => 'create_time'
72
+ ));
73
+ $this->addColumn('reply_count', array(
74
+ 'header' => $this->__('reply_count'),
75
+ 'sortable' => false,
76
+ 'index' => 'reply_count'
77
+ ));
78
+ $this->addColumn('ticket_status', array(
79
+ 'header' => $this->__('ticket_status'),
80
+ 'sortable' => false,
81
+ 'index' => 'ticket_status'
82
+ ));
83
+
84
+ /*
85
+
86
+ //demo code
87
+
88
+ $this->addColumn('county', array(
89
+ 'header' => $this->__('County'),
90
+ 'sortable' => false,
91
+ 'index' => 'county'
92
+ ));
93
+
94
+ $this->addColumn('city', array(
95
+ 'header' => $this->__('City'),
96
+ 'sortable' => false,
97
+ 'index' => 'city'
98
+ ));
99
+
100
+ $baseCurrencyCode = $this->getCurrentCurrencyCode();
101
+
102
+ $this->addColumn('tax_rate', array(
103
+ 'header' => $this->__('Tax Rate'),
104
+ 'align' => 'right',
105
+ 'sortable' => false,
106
+ 'index' => 'tax_rate',
107
+ 'type' => 'text',
108
+ ));
109
+
110
+ $this->addColumn('tax_collected_amount', array(
111
+ 'header' => $this->__('Tax Collected'),
112
+ 'align' => 'right',
113
+ 'sortable' => false,
114
+ 'type' => 'currency',
115
+ 'currency_code' => $baseCurrencyCode,
116
+ 'index' => 'tax_collected_amount',
117
+ 'total' => 'sum',
118
+ 'renderer' => 'adminhtml/report_grid_column_renderer_currency'
119
+ ));
120
+
121
+ $this->addColumn('taxed_sales_amount', array(
122
+ 'header' => $this->__('Taxed Sales'),
123
+ 'align' => 'right',
124
+ 'sortable' => false,
125
+ 'type' => 'currency',
126
+ 'currency_code' => $baseCurrencyCode,
127
+ 'index' => 'taxed_sales_amount',
128
+ 'total' => 'sum',
129
+ 'renderer' => 'adminhtml/report_grid_column_renderer_currency'
130
+ ));
131
+
132
+ $this->addColumn('out_of_state_sales_amount', array(
133
+ 'header' => $this->__('Out of State Sales'),
134
+ 'align' => 'right',
135
+ 'sortable' => false,
136
+ 'type' => 'currency',
137
+ 'currency_code' => $baseCurrencyCode,
138
+ 'index' => 'out_of_state_sales_amount',
139
+ 'total' => 'sum',
140
+ 'renderer' => 'adminhtml/report_grid_column_renderer_currency'
141
+ ));
142
+
143
+ $this->addColumn('non_taxable_sales_amount', array(
144
+ 'header' => $this->__('Non-Taxable Sales'),
145
+ 'align' => 'right',
146
+ 'sortable' => false,
147
+ 'type' => 'currency',
148
+ 'currency_code' => $baseCurrencyCode,
149
+ 'index' => 'non_taxable_sales_amount',
150
+ 'total' => 'sum',
151
+ 'renderer' => 'adminhtml/report_grid_column_renderer_currency'
152
+ ));
153
+
154
+ $this->addColumn('total_order_amount_amount', array(
155
+ 'header' => $this->__('Total Order Amount'),
156
+ 'align' => 'right',
157
+ 'sortable' => false,
158
+ 'type' => 'currency',
159
+ 'currency_code' => $baseCurrencyCode,
160
+ 'index' => 'total_order_amount_amount',
161
+ 'total' => 'sum',
162
+ 'renderer' => 'adminhtml/report_grid_column_renderer_currency'
163
+ ));
164
+
165
+ //demo code
166
+
167
+ */
168
+
169
+ $this->addExportType('*/*/exportSupportticketCsv', Mage::helper('supportticket')->__('CSV'));
170
+ $this->addExportType('*/*/exportSupportticketExcel', Mage::helper('supportticket')->__('Excel'));
171
+
172
+ return parent::_prepareColumns();
173
+ }
174
+
175
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticket.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Adminhtml_Supportticket extends Mage_Adminhtml_Block_Widget_Grid_Container {
4
+
5
+ /**
6
+ * Set custom labels and headers
7
+ *
8
+ */
9
+ public function __construct() {
10
+
11
+ $this->_controller = "adminhtml_supportticket";
12
+ $this->_blockGroup = "supportticket";
13
+ $this->_headerText = Mage::helper("supportticket")->__("Support Ticket Manager");
14
+ $this->_addButtonLabel = Mage::helper("supportticket")->__("Add New Ticket");
15
+ parent::__construct();
16
+ }
17
+
18
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticket/Customergrid.php ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Adminhtml_Supportticket_Customergrid extends Mage_Adminhtml_Block_Widget_Grid {
4
+
5
+ public function __construct() {
6
+ parent::__construct();
7
+ $this->setId("supportticketGrid");
8
+ $this->setDefaultSort("last_reply_time");
9
+ $this->setDefaultDir("DESC");
10
+ $this->setSaveParametersInSession(true);
11
+ $this->setFilterVisibility(false);
12
+ $this->setFilterVisibility(false);
13
+
14
+ // parent::__construct();
15
+ }
16
+ public function getMainButtonsHtml() {
17
+ $html = parent::getMainButtonsHtml();
18
+ $_id = Mage::registry('current_customer')->getId();
19
+ $_name = Mage::registry('current_customer')->getName();
20
+ $_email = Mage::registry('current_customer')->getEmail();
21
+ $create_button = $this->getLayout()->createBlock('adminhtml/widget_button')
22
+ ->setData(array(
23
+ 'label' => Mage::helper('adminhtml')->__('Create Ticket'),
24
+ 'onclick'=>"setLocation('" . $this->getUrl('supportticket/adminhtml_supportticket/new', array('id' => $_id,'name'=>$_name,'email'=>$_email)) . "')",
25
+ 'class' => 'add'
26
+ ));
27
+ $html .= $create_button->toHtml();
28
+ return $html;
29
+ }
30
+
31
+ public function initForm() {
32
+ // $form = new Varien_Data_Form();
33
+ // $form->setHtmlIdPrefix('_account');
34
+ // $form->setFieldNameSuffix('account');
35
+ // $customer = Mage::registry('current_customer');
36
+
37
+ /** @var $customerForm Mage_Customer_Model_Form */
38
+ // $customerForm = Mage::getModel('customer/form');
39
+ // $customerForm->setEntity($customer)
40
+ // ->setFormCode('adminhtml_customer')
41
+ // ->initDefaultValues();
42
+ //
43
+ // $fieldset = $form->addFieldset('base_fieldset', array(
44
+ // 'legend' => Mage::helper('customer')->__('Account Information')
45
+ // ));
46
+ //
47
+ // $attributes = $customerForm->getAttributes();
48
+ // foreach ($attributes as $attribute) {
49
+ // /* @var $attribute Mage_Eav_Model_Entity_Attribute */
50
+ // $attribute->setFrontendLabel(Mage::helper('customer')->__($attribute->getFrontend()->getLabel()));
51
+ // $attribute->unsIsVisible();
52
+ // }
53
+ //
54
+ //
55
+ // $form->setValues($customer->getData());
56
+ // $this->setForm($form);
57
+ return $this;
58
+ }
59
+
60
+ protected function _prepareCollection() {
61
+ $_id = Mage::registry('current_customer')->getId();
62
+ $collection = Mage::getModel("supportticket/supportticket")->getCollection();
63
+ $collection->addFieldToFilter('user_id', $_id);
64
+ $this->setCollection($collection);
65
+ return parent::_prepareCollection();
66
+ }
67
+
68
+ protected function _prepareColumns() {
69
+ // $this->addColumn("entity_id", array(
70
+ // "header" => Mage::helper("supportticket")->__("ID"),
71
+ // "align" => "right",
72
+ // "width" => "50px",
73
+ // "type" => "number",
74
+ // "index" => "entity_id",
75
+ // ));
76
+
77
+ $this->addColumn("ticket_id", array(
78
+ "header" => Mage::helper("supportticket")->__("ID"),
79
+ "index" => "ticket_id",
80
+ ));
81
+ $this->addColumn('last_reply_time', array(
82
+ 'header' => Mage::helper('supportticket')->__('Last Reply Time'),
83
+ 'index' => 'update_time',
84
+ 'type' => 'datetime',
85
+ ));
86
+ $this->addColumn("user_name", array(
87
+ "header" => Mage::helper("supportticket")->__("User Name"),
88
+ "index" => "user_name",
89
+ ));
90
+ $this->addColumn('department', array(
91
+ 'header' => Mage::helper('supportticket')->__('Department'),
92
+ 'index' => 'department',
93
+ 'type' => 'options',
94
+ 'options' => Uni_Supportticket_Block_Adminhtml_Supportticket_Grid::getOptionArray3(),
95
+ ));
96
+
97
+ $this->addColumn('ticket_priority', array(
98
+ 'header' => Mage::helper('supportticket')->__('Priority'),
99
+ 'index' => 'ticket_priority',
100
+ 'type' => 'options',
101
+ // 'options' => Uni_Supportticket_Block_Adminhtml_Supportticket_Grid::getOptionArray4(),
102
+ 'renderer'=> new Uni_Supportticket_Block_Adminhtml_Supportticket_Grid_Renderer_Collisiontype(),
103
+
104
+ ));
105
+
106
+ $this->addColumn("ticket_subject", array(
107
+ "header" => Mage::helper("supportticket")->__("Subject"),
108
+ "index" => "ticket_subject",
109
+ ));
110
+
111
+
112
+ $this->addColumn("reply_count", array(
113
+ "header" => Mage::helper("supportticket")->__("Messages"),
114
+ "index" => "reply_count",
115
+ ));
116
+ $this->addColumn('ticket_status', array(
117
+ 'header' => Mage::helper('supportticket')->__('Status'),
118
+ 'index' => 'ticket_status',
119
+ 'type' => 'options',
120
+ // 'options' => Uni_Supportticket_Block_Adminhtml_Supportticket_Grid::getOptionArray11(),
121
+ 'renderer'=> new Uni_Supportticket_Block_Adminhtml_Supportticket_Grid_Renderer_State(),
122
+
123
+ ));
124
+
125
+ $this->addColumn('create_time', array(
126
+ 'header' => Mage::helper('supportticket')->__('Created'),
127
+ 'index' => 'create_time',
128
+ 'type' => 'datetime',
129
+ ));
130
+ $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
131
+ $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel'));
132
+
133
+ return parent::_prepareColumns();
134
+ }
135
+
136
+
137
+ // public function getRowUrl($row) {
138
+ // return $this->getUrl("supportticket/adminhtml_supportticket/edit", array("id" => $row->getId()));
139
+ // }
140
+
141
+ // protected function _prepareMassaction() {
142
+ // $this->setMassactionIdField('entity_id');
143
+ // $this->getMassactionBlock()->setFormFieldName('entity_ids');
144
+ // $this->getMassactionBlock()->setUseSelectAll(true);
145
+ // $this->getMassactionBlock()->addItem('remove_supportticket', array(
146
+ // 'label' => Mage::helper('supportticket')->__('Remove Supportticket'),
147
+ // 'url' => $this->getUrl('*/adminhtml_supportticket/massRemove'),
148
+ // 'confirm' => Mage::helper('supportticket')->__('Are you sure?')
149
+ // ));
150
+ // return $this;
151
+ // }
152
+
153
+ static public function getOptionArray3() {
154
+ $data_array = Mage::helper('supportticket')->getAdminTicketDepartments();
155
+ return($data_array);
156
+ }
157
+
158
+ static public function getValueArray3() {
159
+ $data_array = array();
160
+ foreach (Uni_Supportticket_Block_Adminhtml_Supportticket_Grid::getOptionArray3() as $k => $v) {
161
+ $data_array[] = array('value' => $k, 'label' => $v);
162
+ }
163
+ return($data_array);
164
+ }
165
+
166
+ static public function getOptionArray4() {
167
+ $data_array = Mage::helper('supportticket')->getAdminTicketPrioritys();
168
+ return($data_array);
169
+ }
170
+
171
+ static public function getValueArray4() {
172
+ $data_array = array();
173
+ foreach (Uni_Supportticket_Block_Adminhtml_Supportticket_Grid::getOptionArray4() as $k => $v) {
174
+ $data_array[] = array('value' => $k, 'label' => $v);
175
+ }
176
+ return($data_array);
177
+ }
178
+
179
+ static public function getOptionArray11() {
180
+ $data_array = Mage::helper('supportticket')->getAdminTicketStatuses();
181
+ return($data_array);
182
+ }
183
+
184
+ static public function getValueArray11() {
185
+ $data_array = array();
186
+ foreach (Uni_Supportticket_Block_Adminhtml_Supportticket_Grid::getOptionArray11() as $k => $v) {
187
+ $data_array[] = array('value' => $k, 'label' => $v);
188
+ }
189
+ return($data_array);
190
+ }
191
+
192
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticket/Edit.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Adminhtml_Supportticket_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
4
+
5
+ public function __construct() {
6
+
7
+ parent::__construct();
8
+ $this->_objectId = "entity_id";
9
+ $this->_blockGroup = "supportticket";
10
+ $this->_controller = "adminhtml_supportticket";
11
+ $this->_updateButton("save", "label", Mage::helper("supportticket")->__("Save"));
12
+ $this->_updateButton("delete", "label", Mage::helper("supportticket")->__("Delete"));
13
+
14
+ }
15
+
16
+ public function getHeaderText() {
17
+ if (Mage::registry("supportticket_data") && Mage::registry("supportticket_data")->getId()) {
18
+
19
+ return Mage::helper("supportticket")->__("Edit Ticket ID : '%s'", $this->htmlEscape(Mage::registry("supportticket_data")->getTicketId()));
20
+ } else {
21
+
22
+ return Mage::helper("supportticket")->__("New Support Ticket");
23
+ }
24
+ }
25
+
26
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticket/Edit/Form.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Adminhtml_Supportticket_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {
4
+
5
+ protected function _prepareForm() {
6
+ $form = new Varien_Data_Form(array(
7
+ "id" => "edit_form",
8
+ "action" => $this->getUrl("*/*/save", array("id" => $this->getRequest()->getParam("id"))),
9
+ "method" => "post",
10
+ "enctype" => "multipart/form-data",
11
+ )
12
+ );
13
+ $form->setUseContainer(true);
14
+ $this->setForm($form);
15
+ return parent::_prepareForm();
16
+ }
17
+
18
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticket/Edit/Tab/Form.php ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Adminhtml_Supportticket_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("supportticket_form", array("legend" => Mage::helper("supportticket")->__("Ticket Details")));
10
+
11
+ $fieldset->addField("is_admin", "hidden", array(
12
+ "label" => Mage::helper("supportticket")->__("Is Admin"),
13
+ "name" => 'is_admin1'
14
+ ));
15
+ if ($this->getRequest()->getActionName() == 'new') {
16
+ $fieldset->addField("user_name", "text", array(
17
+ "label" => Mage::helper("supportticket")->__("Customer Name"),
18
+ "class" => "required-entry",
19
+ "required" => true,
20
+ "name" => "user_name",
21
+ ));
22
+ } else {
23
+ $fieldset->addField("user_name", "text", array(
24
+ "label" => Mage::helper("supportticket")->__("Customer Name"),
25
+ "class" => "required-entry",
26
+ "required" => true,
27
+ "name" => "user_name",
28
+ 'readonly' => TRUE,
29
+ ));
30
+ }
31
+ $fieldset->addField("ticket_id", "hidden", array(
32
+ "label" => Mage::helper("supportticket")->__("Ticket ID"),
33
+ "name" => "ticket_id",
34
+ ));
35
+ if ($this->getRequest()->getActionName() == 'new') {
36
+ $fieldset->addField("user_email", "text", array(
37
+ "label" => Mage::helper("supportticket")->__("Customer Email"),
38
+ "class" => "required-entry validate-email",
39
+ "required" => true,
40
+ "name" => "user_email",
41
+ ));
42
+ } else {
43
+ $fieldset->addField("user_email", "text", array(
44
+ "label" => Mage::helper("supportticket")->__("Customer Email"),
45
+ "class" => "required-entry validate-email",
46
+ "required" => true,
47
+ "name" => "user_email",
48
+ 'readonly' => TRUE,
49
+ ));
50
+ }
51
+
52
+ $fieldset->addField('department', 'select', array(
53
+ 'label' => Mage::helper('supportticket')->__('Department'),
54
+ 'values' => Uni_Supportticket_Block_Adminhtml_Supportticket_Grid::getValueArray3(),
55
+ 'name' => 'department',
56
+ "class" => "required-entry",
57
+ "required" => true,
58
+ 'readonly' => TRUE,
59
+ ));
60
+ $fieldset->addField('ticket_priority', 'select', array(
61
+ 'label' => Mage::helper('supportticket')->__('Ticket Priority'),
62
+ 'values' => Uni_Supportticket_Block_Adminhtml_Supportticket_Grid::getValueArray4(),
63
+ 'name' => 'ticket_priority',
64
+ "class" => "required-entry",
65
+ "required" => true,
66
+ ));
67
+ $fieldset->addField("ticket_subject", "text", array(
68
+ "label" => Mage::helper("supportticket")->__("Ticket Subject"),
69
+ "class" => "required-entry",
70
+ "required" => true,
71
+ "name" => "ticket_subject",
72
+ ));
73
+
74
+ $fieldset->addField("ticket_message", "textarea", array(
75
+ "label" => Mage::helper("supportticket")->__("Ticket Message"),
76
+ "class" => "required-entry",
77
+ "required" => true,
78
+ "name" => "ticket_message",
79
+ ));
80
+
81
+ if ($this->getRequest()->getActionName() == 'new') {
82
+ $fieldset->addField("create_ticket_attachment", "file", array(
83
+ "label" => Mage::helper("supportticket")->__("Ticket Attachment"),
84
+ "name" => "create_ticket_attachment",
85
+ "note" => "maximum file upload size is 10MB",
86
+ ));
87
+ } else {
88
+
89
+ $fieldset->addField("ticket_attachment", "file", array(
90
+ "label" => Mage::helper("supportticket")->__("Ticket Attachment"),
91
+ "name" => "ticket_attachment",
92
+ "note" => "maximum file upload size is 10MB",
93
+ ));
94
+ }
95
+
96
+ $fieldset->addField("reply_count", "hidden", array(
97
+ "label" => Mage::helper("supportticket")->__("Reply Count"),
98
+ "name" => "reply_count",
99
+ ));
100
+
101
+ $fieldset->addField('ticket_status', 'select', array(
102
+ 'label' => Mage::helper('supportticket')->__('Ticket Status'),
103
+ 'values' => Uni_Supportticket_Block_Adminhtml_Supportticket_Grid::getValueArray11(),
104
+ 'name' => 'ticket_status',
105
+ "class" => "required-entry",
106
+ "required" => true,
107
+ ));
108
+
109
+ if ($this->getRequest()->getActionName() !== 'new') {
110
+ $fieldset->addField("ticket_replies", "textarea", array(
111
+ "label" => Mage::helper("supportticket")->__("Replies"),
112
+ "name" => "ticket_repliess",
113
+ "class" => "required-entry",
114
+ "required" => true,
115
+ ));
116
+ }
117
+
118
+ if ($this->getParamValues()) {
119
+ $form->setValues($this->getParamValues());
120
+ } elseif (Mage::getSingleton("adminhtml/session")->getSupportticketData()) {
121
+ $form->setValues(Mage::getSingleton("adminhtml/session")->getSupportticketData());
122
+
123
+ Mage::getSingleton("adminhtml/session")->setSupportticketData(null);
124
+ } elseif (Mage::registry("supportticket_data")) {
125
+ $data = Mage::registry("supportticket_data")->getData();
126
+ $data['is_admin'] = 1;
127
+ $form->setValues($data);
128
+ }
129
+ return parent::_prepareForm();
130
+ }
131
+
132
+ public function getParamValues() {
133
+ $data = array();
134
+ $data['user_email'] = $this->getRequest()->getParam('email');
135
+ $data['user_name'] = $this->getRequest()->getParam('name');
136
+ if (isset($data['user_email']) && $data['user_email'] && isset($data['user_name']) && $data['user_name']) {
137
+ return $data;
138
+ } else {
139
+ return NULL;
140
+ }
141
+ }
142
+
143
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticket/Edit/Tabs.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Adminhtml_Supportticket_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
4
+
5
+ public function __construct() {
6
+ parent::__construct();
7
+ $this->setId("supportticket_tabs");
8
+ $this->setDestElementId("edit_form");
9
+ $this->setTitle(Mage::helper("supportticket")->__("Support Ticket"));
10
+ }
11
+
12
+ protected function _beforeToHtml() {
13
+ $this->addTab("form_section", array(
14
+ "label" => Mage::helper("supportticket")->__("Support Ticket Information"),
15
+ "title" => Mage::helper("supportticket")->__("Support Ticket Information"),
16
+ "content" => $this->getLayout()->createBlock("supportticket/adminhtml_supportticket_edit_tab_form")->toHtml(),
17
+ ));
18
+ $this->addTab("form_section1", array(
19
+ "label" => Mage::helper("supportticket")->__("View Threads"),
20
+ "title" => Mage::helper("supportticket")->__("View Threads"),
21
+ "content" => $this->getLayout()->createBlock("supportticket/adminhtml_supportticketreplywithticketid")->toHtml(),
22
+ ));
23
+ return parent::_beforeToHtml();
24
+ }
25
+
26
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticket/Grid.php ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Adminhtml_Supportticket_Grid extends Mage_Adminhtml_Block_Widget_Grid {
4
+
5
+ public function __construct() {
6
+ parent::__construct();
7
+ $this->setId("supportticketGrid");
8
+ $this->setDefaultSort("entity_id");
9
+ $this->setDefaultDir("DESC");
10
+ $this->setSaveParametersInSession(true);
11
+ }
12
+
13
+ public function initForm() {
14
+
15
+ return $this;
16
+ }
17
+
18
+ protected function _prepareCollection() {
19
+ $collection = Mage::getModel("supportticket/supportticket")->getCollection();
20
+ $this->setCollection($collection);
21
+ return parent::_prepareCollection();
22
+ }
23
+
24
+ protected function _prepareColumns() {
25
+ $this->addColumn("entity_id", array(
26
+ "header" => Mage::helper("supportticket")->__("ID"),
27
+ "align" => "right",
28
+ "width" => "50px",
29
+ "type" => "number",
30
+ "index" => "entity_id",
31
+ ));
32
+
33
+ $this->addColumn("ticket_id", array(
34
+ "header" => Mage::helper("supportticket")->__("Ticket Id"),
35
+ "index" => "ticket_id",
36
+ ));
37
+ $this->addColumn("user_name", array(
38
+ "header" => Mage::helper("supportticket")->__("User Name"),
39
+ "index" => "user_name",
40
+ ));
41
+ $this->addColumn('department', array(
42
+ 'header' => Mage::helper('supportticket')->__('Department'),
43
+ 'index' => 'department',
44
+ 'type' => 'options',
45
+ 'options' => Uni_Supportticket_Block_Adminhtml_Supportticket_Grid::getOptionArray3(),
46
+ ));
47
+
48
+ $this->addColumn('ticket_priority', array(
49
+ 'header' => Mage::helper('supportticket')->__('Ticket Priority'),
50
+ 'index' => 'ticket_priority',
51
+ 'type' => 'options',
52
+ // 'options' => Uni_Supportticket_Block_Adminhtml_Supportticket_Grid::getOptionArray4(),
53
+ 'renderer' => new Uni_Supportticket_Block_Adminhtml_Supportticket_Grid_Renderer_Collisiontype(),
54
+ ));
55
+
56
+ $this->addColumn("ticket_subject", array(
57
+ "header" => Mage::helper("supportticket")->__("Ticket Subject"),
58
+ "index" => "ticket_subject",
59
+ ));
60
+
61
+ $this->addColumn('update_time', array(
62
+ 'header' => Mage::helper('supportticket')->__('Update Time'),
63
+ 'index' => 'update_time',
64
+ 'type' => 'datetime',
65
+ ));
66
+ $this->addColumn("reply_count", array(
67
+ "header" => Mage::helper("supportticket")->__("Reply Count"),
68
+ "index" => "reply_count",
69
+ ));
70
+ $this->addColumn('ticket_status', array(
71
+ 'header' => Mage::helper('supportticket')->__('Ticket Status'),
72
+ 'index' => 'ticket_status',
73
+ 'type' => 'options',
74
+ // 'options' => Uni_Supportticket_Block_Adminhtml_Supportticket_Grid::getOptionArray11(),
75
+ 'renderer' => new Uni_Supportticket_Block_Adminhtml_Supportticket_Grid_Renderer_State(),
76
+ ));
77
+
78
+ $this->addColumn('create_time', array(
79
+ 'header' => Mage::helper('supportticket')->__('Create Time'),
80
+ 'index' => 'create_time',
81
+ 'type' => 'datetime',
82
+ ));
83
+ $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
84
+
85
+
86
+ return parent::_prepareColumns();
87
+ }
88
+
89
+ public function getRowUrl($row) {
90
+ return $this->getUrl("*/*/edit", array("id" => $row->getId(), "ticket_id" => $row->getTicketId()));
91
+ }
92
+
93
+ protected function _prepareMassaction() {
94
+ $this->setMassactionIdField('entity_id');
95
+ $this->getMassactionBlock()->setFormFieldName('entity_ids');
96
+ $this->getMassactionBlock()->setUseSelectAll(true);
97
+ $this->getMassactionBlock()->addItem('remove_supportticket', array(
98
+ 'label' => Mage::helper('supportticket')->__('Remove Supportticket'),
99
+ 'url' => $this->getUrl('*/adminhtml_supportticket/massRemove'),
100
+ 'confirm' => Mage::helper('supportticket')->__('Are you sure?')
101
+ ));
102
+ return $this;
103
+ }
104
+
105
+ static public function getOptionArray3() {
106
+ $data_array = Mage::helper('supportticket')->getAdminTicketDepartments();
107
+ return($data_array);
108
+ }
109
+
110
+ static public function getValueArray3() {
111
+ $data_array = array();
112
+ foreach (Uni_Supportticket_Block_Adminhtml_Supportticket_Grid::getOptionArray3() as $k => $v) {
113
+ $data_array[] = array('value' => $k, 'label' => $v);
114
+ }
115
+ return($data_array);
116
+ }
117
+
118
+ static public function getOptionArray4() {
119
+ $data_array = Mage::helper('supportticket')->getAdminTicketPrioritys();
120
+ return($data_array);
121
+ }
122
+
123
+ static public function getValueArray4() {
124
+ $data_array = array();
125
+ foreach (Uni_Supportticket_Block_Adminhtml_Supportticket_Grid::getOptionArray4() as $k => $v) {
126
+ $data_array[] = array('value' => $k, 'label' => $v);
127
+ }
128
+ return($data_array);
129
+ }
130
+
131
+ static public function getOptionArray11() {
132
+ $data_array = Mage::helper('supportticket')->getAdminTicketStatuses();
133
+ return($data_array);
134
+ }
135
+
136
+ static public function getValueArray11() {
137
+ $data_array = array();
138
+ foreach (Uni_Supportticket_Block_Adminhtml_Supportticket_Grid::getOptionArray11() as $k => $v) {
139
+ $data_array[] = array('value' => $k, 'label' => $v);
140
+ }
141
+ return($data_array);
142
+ }
143
+
144
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticket/Grid/Renderer/Collisiontype.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Adminhtml_Supportticket_Grid_Renderer_Collisiontype extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
4
+
5
+ public function render(Varien_Object $row) {
6
+ $value = $row->getTicketPriority();
7
+ $collection = Mage::getModel("supportticket/supportticketpriority");
8
+ $title = $collection->load($value)->getTitle();
9
+ $color = $collection->load($value)->getFontColor();
10
+ $color1 = $collection->load($value)->getBackgroundColor();
11
+ return '<span style="color:' . $color . '; background-color:' . $color1 . '"><b>' . $title . '</b></span>';
12
+ }
13
+
14
+ }
15
+ ?>
16
+
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticket/Grid/Renderer/State.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Uni_Supportticket_Block_Adminhtml_Supportticket_Grid_Renderer_State extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
3
+ {
4
+ public function render(Varien_Object $row) {
5
+ $value = $row->getTicketStatus();
6
+ $collection = Mage::getModel("supportticket/supportticketstatus");
7
+ $title = $collection->load($value)->getTitle();
8
+ $color = $collection->load($value)->getFontColor();
9
+ $color1 = $collection->load($value)->getBackgroundColor();
10
+ return '<span style="color:'.$color.'; background-color:'.$color1.'"><b>'.$title.'</b></span>';
11
+ }
12
+ }
13
+ ?>
14
+
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketbackend.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Adminhtml_Supportticketbackend extends Mage_Adminhtml_Block_Template {
4
+
5
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketdepartment.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Adminhtml_Supportticketdepartment extends Mage_Adminhtml_Block_Widget_Grid_Container {
4
+
5
+ /**
6
+ * Set custom labels and headers
7
+ *
8
+ */
9
+ public function __construct() {
10
+
11
+ $this->_controller = "adminhtml_supportticketdepartment";
12
+ $this->_blockGroup = "supportticket";
13
+ $this->_headerText = Mage::helper("supportticket")->__("Departments Manager");
14
+ $this->_addButtonLabel = Mage::helper("supportticket")->__("Add Department");
15
+ parent::__construct();
16
+ }
17
+
18
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketdepartment/Edit.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Adminhtml_Supportticketdepartment_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
4
+
5
+ public function __construct() {
6
+
7
+ parent::__construct();
8
+ $this->_objectId = "entity_id";
9
+ $this->_blockGroup = "supportticket";
10
+ $this->_controller = "adminhtml_supportticketdepartment";
11
+ if(Mage::registry("supportticketdepartment_data") && Mage::registry("supportticketdepartment_data")->getIsSystem()>0)
12
+ {
13
+ $this->_updateButton("delete", "disabled", Mage::helper("supportticket")->__("disabled"));
14
+ }
15
+ $this->_updateButton("save", "label", Mage::helper("supportticket")->__("Save Item"));
16
+ $this->_updateButton("delete", "label", Mage::helper("supportticket")->__("Delete"));
17
+
18
+ $this->_addButton("saveandcontinue", array(
19
+ "label" => Mage::helper("supportticket")->__("Save And Continue Edit"),
20
+ "onclick" => "saveAndContinueEdit()",
21
+ "class" => "save",
22
+ ), -100);
23
+
24
+
25
+
26
+ $this->_formScripts[] = "
27
+
28
+ function saveAndContinueEdit(){
29
+ editForm.submit($('edit_form').action+'back/edit/');
30
+ }
31
+ ";
32
+ }
33
+
34
+ public function getHeaderText() {
35
+ if (Mage::registry("supportticketdepartment_data") && Mage::registry("supportticketdepartment_data")->getId()) {
36
+
37
+ return Mage::helper("supportticket")->__("Edit Item '%s'", $this->htmlEscape(Mage::registry("supportticketdepartment_data")->getTitle()));
38
+ } else {
39
+
40
+ return Mage::helper("supportticket")->__("Add Department");
41
+ }
42
+ }
43
+
44
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketdepartment/Edit/Form.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Adminhtml_Supportticketdepartment_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {
4
+
5
+ protected function _prepareForm() {
6
+ $form = new Varien_Data_Form(array(
7
+ "id" => "edit_form",
8
+ "action" => $this->getUrl("*/*/save", array("id" => $this->getRequest()->getParam("id"))),
9
+ "method" => "post",
10
+ "enctype" => "multipart/form-data",
11
+ )
12
+ );
13
+ $form->setUseContainer(true);
14
+ $this->setForm($form);
15
+ return parent::_prepareForm();
16
+ }
17
+
18
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketdepartment/Edit/Tab/Form.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Adminhtml_Supportticketdepartment_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("supportticket_form", array("legend" => Mage::helper("supportticket")->__("Department Details")));
10
+
11
+ $fieldset->addField("title", "text", array(
12
+ "label" => Mage::helper("supportticket")->__("Title"),
13
+ "class" => "required-entry",
14
+ "required" => true,
15
+ "name" => "title",
16
+ ));
17
+
18
+ if (Mage::registry("supportticketdepartment_data") && Mage::registry("supportticketdepartment_data")->getIsSystem()>0 ) {
19
+ $fieldset->addField('dep_status', 'select', array(
20
+ 'label' => Mage::helper('supportticket')->__('Status'),
21
+ 'values' => Uni_Supportticket_Block_Adminhtml_Supportticketdepartment_Grid::getValueArray2(),
22
+ 'name' => 'dep_status',
23
+ "class" => "required-entry",
24
+ 'disabled' => 'disabled',
25
+ "required" => true,
26
+ 'note'=>'System Department cannot be disabled or deleted'
27
+ ));
28
+ } else {
29
+ $fieldset->addField('dep_status', 'select', array(
30
+ 'label' => Mage::helper('supportticket')->__('Status'),
31
+ 'values' => Uni_Supportticket_Block_Adminhtml_Supportticketdepartment_Grid::getValueArray2(),
32
+ 'name' => 'dep_status',
33
+ "class" => "required-entry",
34
+ "required" => true,
35
+ ));
36
+ }
37
+
38
+
39
+ if (Mage::getSingleton("adminhtml/session")->getSupportticketdepartmentData()) {
40
+ $form->setValues(Mage::getSingleton("adminhtml/session")->getSupportticketdepartmentData());
41
+ Mage::getSingleton("adminhtml/session")->setSupportticketdepartmentData(null);
42
+ } elseif (Mage::registry("supportticketdepartment_data")) {
43
+ $form->setValues(Mage::registry("supportticketdepartment_data")->getData());
44
+ }
45
+ return parent::_prepareForm();
46
+ }
47
+
48
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketdepartment/Edit/Tabs.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Uni_Supportticket_Block_Adminhtml_Supportticketdepartment_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
3
+ {
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+ $this->setId("supportticketdepartment_tabs");
8
+ $this->setDestElementId("edit_form");
9
+ $this->setTitle(Mage::helper("supportticket")->__("Department"));
10
+ }
11
+ protected function _beforeToHtml()
12
+ {
13
+ $this->addTab("form_section", array(
14
+ "label" => Mage::helper("supportticket")->__("Department information"),
15
+ "title" => Mage::helper("supportticket")->__("Item Information"),
16
+ "content" => $this->getLayout()->createBlock("supportticket/adminhtml_supportticketdepartment_edit_tab_form")->toHtml(),
17
+ ));
18
+ return parent::_beforeToHtml();
19
+ }
20
+
21
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketdepartment/Grid.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Adminhtml_Supportticketdepartment_Grid extends Mage_Adminhtml_Block_Widget_Grid {
4
+
5
+ public function __construct() {
6
+ parent::__construct();
7
+ $this->setId("supportticketdepartmentGrid");
8
+ $this->setDefaultSort("entity_id");
9
+ $this->setDefaultDir("ASC");
10
+ $this->setSaveParametersInSession(true);
11
+ }
12
+
13
+ protected function _prepareCollection() {
14
+ $collection = Mage::getModel("supportticket/supportticketdepartment")->getCollection();
15
+ $this->setCollection($collection);
16
+ return parent::_prepareCollection();
17
+ }
18
+
19
+ protected function _prepareColumns() {
20
+ $this->addColumn("entity_id", array(
21
+ "header" => Mage::helper("supportticket")->__("ID"),
22
+ "align" => "right",
23
+ "width" => "50px",
24
+ "type" => "number",
25
+ "index" => "entity_id",
26
+ ));
27
+
28
+ $this->addColumn("title", array(
29
+ "header" => Mage::helper("supportticket")->__("Department Title"),
30
+ "index" => "title",
31
+ ));
32
+
33
+ $this->addColumn('is_system', array(
34
+ 'header' => Mage::helper('supportticket')->__('Is System'),
35
+ 'index' => 'is_system',
36
+ 'type' => 'options',
37
+ 'options' => array('1' => 'Yes', '0' => 'No')
38
+ ));
39
+
40
+ $this->addColumn('dep_status', array(
41
+ 'header' => Mage::helper('supportticket')->__('Status'),
42
+ 'index' => 'dep_status',
43
+ 'type' => 'options',
44
+ 'options' => Uni_Supportticket_Block_Adminhtml_Supportticketdepartment_Grid::getOptionArray2(),
45
+ ));
46
+
47
+ $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
48
+ $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel'));
49
+
50
+ return parent::_prepareColumns();
51
+ }
52
+
53
+ public function getRowUrl($row) {
54
+ return $this->getUrl("*/*/edit", array("id" => $row->getId()));
55
+ }
56
+
57
+ protected function _prepareMassaction() {
58
+ $this->setMassactionIdField('entity_id');
59
+ $this->getMassactionBlock()->setFormFieldName('entity_ids');
60
+ $this->getMassactionBlock()->setUseSelectAll(true);
61
+ $this->getMassactionBlock()->addItem('status', array(
62
+ 'label' => Mage::helper('supportticket')->__('Change status'),
63
+ 'url' => $this->getUrl('*/adminhtml_supportticketdepartment/massStatus'),
64
+ 'additional' => array(
65
+ 'visibility' => array(
66
+ 'name' => 'status',
67
+ 'type' => 'select',
68
+ 'class' => 'required-entry',
69
+ 'label' => Mage::helper('supportticket')->__('Status'),
70
+ 'values' => Uni_Supportticket_Block_Adminhtml_Supportticketdepartment_Grid::getOptionArray2(),
71
+ )
72
+ )
73
+ ));
74
+ return $this;
75
+ }
76
+
77
+ static public function getOptionArray2() {
78
+ $data_array = array();
79
+ $data_array[0] = 'Enable';
80
+ $data_array[1] = 'Disable';
81
+ return($data_array);
82
+ }
83
+
84
+ static public function getOptionArray3() {
85
+ $data_array = array();
86
+ $data_array[0] = 'No';
87
+ $data_array[1] = 'Yes';
88
+ return($data_array);
89
+ }
90
+
91
+ static public function getValueArray2() {
92
+ $data_array = array();
93
+ foreach (Uni_Supportticket_Block_Adminhtml_Supportticketdepartment_Grid::getOptionArray2() as $k => $v) {
94
+ $data_array[] = array('value' => $k, 'label' => $v);
95
+ }
96
+ return($data_array);
97
+ }
98
+
99
+ static public function getValueArray3() {
100
+ $data_array = array();
101
+ foreach (Uni_Supportticket_Block_Adminhtml_Supportticketdepartment_Grid::getOptionArray3() as $k => $v) {
102
+ $data_array[] = array('value' => $k, 'label' => $v);
103
+ }
104
+ return($data_array);
105
+ }
106
+
107
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketpriority.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Adminhtml_Supportticketpriority extends Mage_Adminhtml_Block_Widget_Grid_Container {
4
+
5
+ /**
6
+ * Set custom labels and headers
7
+ *
8
+ */
9
+ public function __construct() {
10
+
11
+ $this->_controller = "adminhtml_supportticketpriority";
12
+ $this->_blockGroup = "supportticket";
13
+ $this->_headerText = Mage::helper("supportticket")->__("Support Ticket Priority Manager");
14
+ $this->_addButtonLabel = Mage::helper("supportticket")->__("Add New Priority");
15
+ parent::__construct();
16
+ }
17
+
18
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketpriority/Edit.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Adminhtml_Supportticketpriority_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
4
+
5
+ public function __construct() {
6
+
7
+ parent::__construct();
8
+ $this->_objectId = "entity_id";
9
+ $this->_blockGroup = "supportticket";
10
+ $this->_controller = "adminhtml_supportticketpriority";
11
+ if (Mage::registry("supportticketpriority_data") && Mage::registry("supportticketpriority_data")->getIsSystem()>0 )
12
+ {
13
+ $this->_updateButton("delete", "disabled", Mage::helper("supportticket")->__("disabled"));
14
+ }
15
+ $this->_updateButton("save", "label", Mage::helper("supportticket")->__("Save"));
16
+ $this->_updateButton("delete", "label", Mage::helper("supportticket")->__("Delete"));
17
+
18
+ $this->_addButton("saveandcontinue", array(
19
+ "label" => Mage::helper("supportticket")->__("Save And Continue Edit"),
20
+ "onclick" => "saveAndContinueEdit()",
21
+ "class" => "save",
22
+ ), -100);
23
+
24
+
25
+
26
+ $this->_formScripts[] = "
27
+
28
+ function saveAndContinueEdit(){
29
+ editForm.submit($('edit_form').action+'back/edit/');
30
+ }
31
+ ";
32
+ }
33
+
34
+ public function getHeaderText() {
35
+ if (Mage::registry("supportticketpriority_data") && Mage::registry("supportticketpriority_data")->getId()) {
36
+
37
+ return Mage::helper("supportticket")->__("Edit Item '%s'", $this->htmlEscape(Mage::registry("supportticketpriority_data")->getTitle()));
38
+ } else {
39
+
40
+ return Mage::helper("supportticket")->__("Add Ticket Priority");
41
+ }
42
+ }
43
+
44
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketpriority/Edit/Form.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Uni_Supportticket_Block_Adminhtml_Supportticketpriority_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
3
+ {
4
+ protected function _prepareForm()
5
+ {
6
+ $form = new Varien_Data_Form(array(
7
+ "id" => "edit_form",
8
+ "action" => $this->getUrl("*/*/save", array("id" => $this->getRequest()->getParam("id"))),
9
+ "method" => "post",
10
+ "enctype" =>"multipart/form-data",
11
+ )
12
+ );
13
+ $form->setUseContainer(true);
14
+ $this->setForm($form);
15
+ return parent::_prepareForm();
16
+ }
17
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketpriority/Edit/Tab/Form.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Adminhtml_Supportticketpriority_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("supportticket_form", array("legend" => Mage::helper("supportticket")->__("General information")));
10
+
11
+ $fieldset->addField("title", "text", array(
12
+ "label" => Mage::helper("supportticket")->__("Title"),
13
+ "class" => "required-entry",
14
+ "required" => true,
15
+ "name" => "title",
16
+ ));
17
+
18
+ $fieldset->addField("font_color", "text", array(
19
+ "label" => Mage::helper("supportticket")->__("Font Color"),
20
+ "class" => "required-entry",
21
+ "required" => true,
22
+ "name" => "font_color",
23
+ ));
24
+
25
+ $fieldset->addField("background_color", "text", array(
26
+ "label" => Mage::helper("supportticket")->__("Background Color"),
27
+ // "class" => "required-entry",
28
+ // "required" => true,
29
+ "name" => "background_color",
30
+ ));
31
+
32
+ if (Mage::registry("supportticketpriority_data") && Mage::registry("supportticketpriority_data")->getIsSystem()>0 ) {
33
+ $fieldset->addField('ticket_priority', 'select', array(
34
+ 'label' => Mage::helper('supportticket')->__('Status'),
35
+ 'values' => Uni_Supportticket_Block_Adminhtml_Supportticketpriority_Grid::getValueArray28(),
36
+ 'name' => 'ticket_priority',
37
+ "class" => "required-entry",
38
+ 'disabled' => 'disabled',
39
+ "required" => true,
40
+ 'note'=>'System Priority cannot be disabled or deleted'
41
+ ));}
42
+ else{
43
+ $fieldset->addField('ticket_priority', 'select', array(
44
+ 'label' => Mage::helper('supportticket')->__('Status'),
45
+ 'values' => Uni_Supportticket_Block_Adminhtml_Supportticketpriority_Grid::getValueArray28(),
46
+ 'name' => 'ticket_priority',
47
+ "class" => "required-entry",
48
+ "required" => true,
49
+ ));
50
+ }
51
+
52
+ if (Mage::getSingleton("adminhtml/session")->getSupportticketpriorityData()) {
53
+ $form->setValues(Mage::getSingleton("adminhtml/session")->getSupportticketpriorityData());
54
+ Mage::getSingleton("adminhtml/session")->setSupportticketpriorityData(null);
55
+ } elseif (Mage::registry("supportticketpriority_data")) {
56
+ $form->setValues(Mage::registry("supportticketpriority_data")->getData());
57
+ }
58
+ return parent::_prepareForm();
59
+ }
60
+
61
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketpriority/Edit/Tabs.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Uni_Supportticket_Block_Adminhtml_Supportticketpriority_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
3
+ {
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+ $this->setId("supportticketpriority_tabs");
8
+ $this->setDestElementId("edit_form");
9
+ $this->setTitle(Mage::helper("supportticket")->__("New Ticket Priority Information"));
10
+ }
11
+ protected function _beforeToHtml()
12
+ {
13
+ $this->addTab("form_section", array(
14
+ "label" => Mage::helper("supportticket")->__("Priority Information"),
15
+ "title" => Mage::helper("supportticket")->__("Priority Information"),
16
+ "content" => $this->getLayout()->createBlock("supportticket/adminhtml_supportticketpriority_edit_tab_form")->toHtml(),
17
+ ));
18
+ return parent::_beforeToHtml();
19
+ }
20
+
21
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketpriority/Grid.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Adminhtml_Supportticketpriority_Grid extends Mage_Adminhtml_Block_Widget_Grid {
4
+
5
+ public function __construct() {
6
+ parent::__construct();
7
+ $this->setId("supportticketpriorityGrid");
8
+ $this->setDefaultSort("entity_id");
9
+ $this->setDefaultDir("ASC");
10
+ $this->setSaveParametersInSession(true);
11
+ }
12
+
13
+ protected function _prepareCollection() {
14
+ $collection = Mage::getModel("supportticket/supportticketpriority")->getCollection();
15
+ $this->setCollection($collection);
16
+ return parent::_prepareCollection();
17
+ }
18
+
19
+ protected function _prepareColumns() {
20
+ $this->addColumn("entity_id", array(
21
+ "header" => Mage::helper("supportticket")->__("ID"),
22
+ "align" => "right",
23
+ "width" => "50px",
24
+ "type" => "number",
25
+ "index" => "entity_id",
26
+ ));
27
+
28
+ $this->addColumn("title", array(
29
+ "header" => Mage::helper("supportticket")->__("Title"),
30
+ "index" => "title",
31
+ ));
32
+ $this->addColumn("font_color", array(
33
+ "header" => Mage::helper("supportticket")->__("Font Color"),
34
+ "index" => "font_color",
35
+ ));
36
+ $this->addColumn("background_color", array(
37
+ "header" => Mage::helper("supportticket")->__("Background Color"),
38
+ "index" => "background_color",
39
+ ));
40
+ $this->addColumn('is_system', array(
41
+ 'header' => Mage::helper('supportticket')->__('Is System'),
42
+ 'index' => 'is_system',
43
+ 'type' => 'options',
44
+ 'options' => array('1'=>'Yes','0'=>'No')
45
+ ));
46
+ $this->addColumn('ticket_priority', array(
47
+ 'header' => Mage::helper('supportticket')->__('Status'),
48
+ 'index' => 'ticket_priority',
49
+ 'type' => 'options',
50
+ 'options' => Uni_Supportticket_Block_Adminhtml_Supportticketpriority_Grid::getOptionArray28(),
51
+ ));
52
+
53
+ $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
54
+ $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel'));
55
+
56
+ return parent::_prepareColumns();
57
+ }
58
+
59
+ public function getRowUrl($row) {
60
+ return $this->getUrl("*/*/edit", array("id" => $row->getId()));
61
+ }
62
+
63
+ // protected function _prepareMassaction() {
64
+ // $this->setMassactionIdField('entity_id');
65
+ // $this->getMassactionBlock()->setFormFieldName('entity_ids');
66
+ // $this->getMassactionBlock()->setUseSelectAll(true);
67
+ // $this->getMassactionBlock()->addItem('remove_supportticketpriority', array(
68
+ // 'label' => Mage::helper('supportticket')->__('Change Status'),
69
+ // 'url' => $this->getUrl('*/adminhtml_supportticketpriority/massStatus'),
70
+ // 'confirm' => Mage::helper('supportticket')->__('Are you sure?')
71
+ // ));
72
+ // return $this;
73
+ // }
74
+
75
+
76
+ protected function _prepareMassaction() {
77
+ $this->setMassactionIdField('entity_id');
78
+ $this->getMassactionBlock()->setFormFieldName('entity_ids');
79
+ $this->getMassactionBlock()->setUseSelectAll(true);
80
+ $this->getMassactionBlock()->addItem('status', array(
81
+ 'label' => Mage::helper('supportticket')->__('Change status'),
82
+ 'url' => $this->getUrl('*/adminhtml_supportticketpriority/massStatus'),
83
+ 'additional' => array(
84
+ 'visibility' => array(
85
+ 'name' => 'status',
86
+ 'type' => 'select',
87
+ 'class' => 'required-entry',
88
+ 'label' => Mage::helper('supportticket')->__('Status'),
89
+ 'values' => Uni_Supportticket_Block_Adminhtml_Supportticketpriority_Grid::getOptionArray28(),
90
+ )
91
+ )
92
+ ));
93
+ return $this;
94
+ }
95
+
96
+
97
+ static public function getOptionArray28() {
98
+ $data_array = array();
99
+ $data_array[0] = 'Disable';
100
+ $data_array[1] = 'Enable';
101
+ return($data_array);
102
+ }
103
+
104
+ static public function getValueArray28() {
105
+ $data_array = array();
106
+ foreach (Uni_Supportticket_Block_Adminhtml_Supportticketdepartment_Grid::getOptionArray2() as $k => $v) {
107
+ $data_array[] = array('value' => $k, 'label' => $v);
108
+ }
109
+ return($data_array);
110
+ }
111
+
112
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketreply.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Adminhtml_Supportticketreply extends Mage_Adminhtml_Block_Widget_Grid_Container {
4
+
5
+ /**
6
+ * Set custom labels and headers
7
+ *
8
+ */
9
+ public function __construct() {
10
+
11
+ $this->_controller = "adminhtml_supportticketreply";
12
+ $this->_blockGroup = "supportticket";
13
+ $this->_headerText = Mage::helper("supportticket")->__("Supportticket Reply Manager");
14
+ $this->_addButtonLabel = Mage::helper("supportticket")->__("Add New Item");
15
+ parent::__construct();
16
+ $this->_removeButton('add');
17
+ }
18
+
19
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketreply/Edit.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Adminhtml_Supportticketreply_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
4
+
5
+ public function __construct() {
6
+
7
+ parent::__construct();
8
+ $this->_objectId = "entity_id";
9
+ $this->_blockGroup = "supportticket";
10
+ $this->_controller = "adminhtml_supportticketreply";
11
+ $this->_updateButton("save", "label", Mage::helper("supportticket")->__("Save Item"));
12
+ $this->_updateButton("delete", "label", Mage::helper("supportticket")->__("Delete Item"));
13
+
14
+ $this->_addButton("saveandcontinue", array(
15
+ "label" => Mage::helper("supportticket")->__("Save And Continue Edit"),
16
+ "onclick" => "saveAndContinueEdit()",
17
+ "class" => "save",
18
+ ), -100);
19
+
20
+
21
+
22
+ $this->_formScripts[] = "
23
+
24
+ function saveAndContinueEdit(){
25
+ editForm.submit($('edit_form').action+'back/edit/');
26
+ }
27
+ ";
28
+ }
29
+
30
+ public function getHeaderText() {
31
+ if (Mage::registry("supportticketreply_data") && Mage::registry("supportticketreply_data")->getId()) {
32
+
33
+ return Mage::helper("supportticket")->__("Edit Item '%s'", $this->htmlEscape(Mage::registry("supportticketreply_data")->getId()));
34
+ } else {
35
+
36
+ return Mage::helper("supportticket")->__("Add Item");
37
+ }
38
+ }
39
+
40
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketreply/Edit/Form.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Uni_Supportticket_Block_Adminhtml_Supportticketreply_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
3
+ {
4
+ protected function _prepareForm()
5
+ {
6
+ $form = new Varien_Data_Form(array(
7
+ "id" => "edit_form",
8
+ "action" => $this->getUrl("*/*/save", array("id" => $this->getRequest()->getParam("id"))),
9
+ "method" => "post",
10
+ "enctype" =>"multipart/form-data",
11
+ )
12
+ );
13
+ $form->setUseContainer(true);
14
+ $this->setForm($form);
15
+ return parent::_prepareForm();
16
+ }
17
+ }
18
+ //{
19
+ // protected function _prepareForm()
20
+ // {
21
+ // $supportticketForm = new Varien_Data_Form(array(
22
+ // 'id' => 'edit_form',
23
+ // 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
24
+ // 'method' => 'post',
25
+ // ));
26
+ // $supportticketForm->setUseContainer(true);
27
+ // $this->setForm($supportticketForm);
28
+ //
29
+ // $fieldset = $supportticketForm->addFieldset('supportticket_form', array(
30
+ // 'legend' => Mage::helper('supportticket')->__('Item Information'),
31
+ // 'class' => 'fieldset-wide',
32
+ // )
33
+ // );
34
+ //
35
+ // $fieldset->addField("ticket_id", "text", array(
36
+ // "label" => Mage::helper("supportticket")->__("Ticket Id"),
37
+ // "name" => "ticket_id",
38
+ // ));
39
+ //
40
+ // $fieldset->addField("user_name", "text", array(
41
+ // "label" => Mage::helper("supportticket")->__("User Name"),
42
+ // "name" => "user_name",
43
+ // ));
44
+ //
45
+ // $fieldset->addField("ticket_attachment", "text", array(
46
+ // "label" => Mage::helper("supportticket")->__("Ticket Attachment"),
47
+ // "name" => "ticket_attachment",
48
+ // ));
49
+ //
50
+ // $fieldset->addField("ticket_replies", "text", array(
51
+ // "label" => Mage::helper("supportticket")->__("Ticket Replies"),
52
+ // "name" => "ticket_replies",
53
+ // ));
54
+ //
55
+ //
56
+ // if ( Mage::getSingleton('adminhtml/session')->getSupportticketData() )
57
+ // {
58
+ // $supportticketForm -> setValues(Mage::getSingleton('adminhtml/session')->getSupportticketData());
59
+ // Mage::getSingleton('adminhtml/session')->getSupportticketData(null);
60
+ // } elseif ( Mage::registry('supportticket_data') ) {
61
+ // $supportticketForm-> setValues(Mage::registry('supportticket_data')->getData());
62
+ // }
63
+ // return parent::_prepareForm();
64
+ // }
65
+ //}
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketreply/Edit/Tab/Form.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Adminhtml_Supportticketreply_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("supportticket_form", array("legend" => Mage::helper("supportticket")->__("Item information")));
10
+
11
+ $fieldset->addField("ticket_id", "text", array(
12
+ "label" => Mage::helper("supportticket")->__("Ticket Id"),
13
+ "name" => "ticket_id",
14
+ ));
15
+
16
+ $fieldset->addField("user_name", "text", array(
17
+ "label" => Mage::helper("supportticket")->__("User Name"),
18
+ "name" => "user_name",
19
+ ));
20
+
21
+ $fieldset->addField("ticket_attachment", "text", array(
22
+ "label" => Mage::helper("supportticket")->__("Ticket Attachment"),
23
+ "name" => "ticket_attachment",
24
+ ));
25
+
26
+ $fieldset->addField("ticket_replies", "text", array(
27
+ "label" => Mage::helper("supportticket")->__("Ticket Replies"),
28
+ "name" => "ticket_replies",
29
+ ));
30
+
31
+
32
+ if (Mage::getSingleton("adminhtml/session")->getSupportticketreplyData()) {
33
+ $form->setValues(Mage::getSingleton("adminhtml/session")->getSupportticketreplyData());
34
+ Mage::getSingleton("adminhtml/session")->setSupportticketreplyData(null);
35
+ } elseif (Mage::registry("supportticketreply_data")) {
36
+ $form->setValues(Mage::registry("supportticketreply_data")->getData());
37
+ }
38
+ return parent::_prepareForm();
39
+ }
40
+
41
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketreply/Edit/Tabs.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Uni_Supportticket_Block_Adminhtml_Supportticketreply_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
3
+ {
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+ $this->setId("supportticketreply_tabs");
8
+ $this->setDestElementId("edit_form");
9
+ $this->setTitle(Mage::helper("supportticket")->__("Item Information"));
10
+ }
11
+ protected function _beforeToHtml()
12
+ {
13
+ $this->addTab("form_section", array(
14
+ "label" => Mage::helper("supportticket")->__("Item Information"),
15
+ "title" => Mage::helper("supportticket")->__("Item Information"),
16
+ "content" => $this->getLayout()->createBlock("supportticket/adminhtml_supportticketreply_edit_tab_form")->toHtml(),
17
+ ));
18
+ return parent::_beforeToHtml();
19
+ }
20
+
21
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketreply/Grid.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Adminhtml_Supportticketreply_Grid extends Mage_Adminhtml_Block_Widget_Grid {
4
+
5
+ public function __construct() {
6
+ parent::__construct();
7
+ $this->setId("supportticketreplyGrid");
8
+ $this->setDefaultSort("entity_id");
9
+ $this->setDefaultDir("DESC");
10
+ $this->setSaveParametersInSession(true);
11
+ }
12
+
13
+ protected function _prepareCollection() {
14
+ $collection = Mage::getModel("supportticket/supportticketreply")->getCollection();
15
+ $this->setCollection($collection);
16
+ return parent::_prepareCollection();
17
+ }
18
+
19
+ protected function _prepareColumns() {
20
+ $this->addColumn("entity_id", array(
21
+ "header" => Mage::helper("supportticket")->__("ID"),
22
+ "align" => "right",
23
+ "width" => "50px",
24
+ "type" => "number",
25
+ "index" => "entity_id",
26
+ ));
27
+
28
+ $this->addColumn("ticket_id", array(
29
+ "header" => Mage::helper("supportticket")->__("Ticket Id"),
30
+ "index" => "ticket_id",
31
+ ));
32
+ $this->addColumn("user_name", array(
33
+ "header" => Mage::helper("supportticket")->__("User Name"),
34
+ "index" => "user_name",
35
+ ));
36
+ // $this->addColumn("ticket_attachment", array(
37
+ // "header" => Mage::helper("supportticket")->__("Ticket Attachment"),
38
+ // "index" => "ticket_attachment",
39
+ // ));
40
+ $this->addColumn("reply_time", array(
41
+ "header" => Mage::helper("supportticket")->__("Reply Time"),
42
+ "index" => "reply_time",
43
+ "type" => "datetime"
44
+ ));
45
+ $this->addColumn("ticket_replies", array(
46
+ "header" => Mage::helper("supportticket")->__("Ticket Replies"),
47
+ "index" => "ticket_replies",
48
+ ));
49
+ $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
50
+ $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel'));
51
+
52
+ return parent::_prepareColumns();
53
+ }
54
+
55
+ // public function getRowUrl($row) {
56
+ // return $this->getUrl("*/*/edit", array("id" => $row->getId()));
57
+ // }
58
+
59
+ // protected function _prepareMassaction() {
60
+ // $this->setMassactionIdField('entity_id');
61
+ // $this->getMassactionBlock()->setFormFieldName('entity_ids');
62
+ // $this->getMassactionBlock()->setUseSelectAll(true);
63
+ // $this->getMassactionBlock()->addItem('remove_supportticketreply', array(
64
+ // 'label' => Mage::helper('supportticket')->__('Remove Supportticketreply'),
65
+ // 'url' => $this->getUrl('*/adminhtml_supportticketreply/massRemove'),
66
+ // 'confirm' => Mage::helper('supportticket')->__('Are you sure?')
67
+ // ));
68
+ // return $this;
69
+ // }
70
+
71
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketreplywithticketid.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Adminhtml_Supportticketreplywithticketid extends Mage_Adminhtml_Block_Widget_Grid_Container {
4
+
5
+ /**
6
+ * Set custom labels and headers
7
+ *
8
+ */
9
+ public function __construct() {
10
+
11
+ $this->_controller = "adminhtml_supportticketreplywithticketid";
12
+ $this->_blockGroup = "supportticket";
13
+ $this->_headerText = Mage::helper("supportticket")->__("Supportticket Reply Manager");
14
+ parent::__construct();
15
+ $this->_removeButton('add');
16
+ }
17
+
18
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketreplywithticketid/Grid.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Uni_Supportticket_Block_Adminhtml_Supportticketreplywithticketid_Grid extends Mage_Adminhtml_Block_Widget_Grid {
3
+
4
+ public function __construct() {
5
+ parent::__construct();
6
+ $this->setId("supportticketreplyGrid");
7
+ $this->setDefaultSort("entity_id");
8
+ $this->setDefaultDir("DESC");
9
+ $this->setSaveParametersInSession(true);
10
+ }
11
+
12
+ protected function _prepareCollection() {
13
+ $ticket_id = $this->getRequest()->getParam('ticket_id');
14
+ $collection = Mage::getModel("supportticket/supportticketreply")->getCollection();
15
+ $collection->addFieldToFilter('ticket_id', $ticket_id);
16
+ $this->setCollection($collection);
17
+ return parent::_prepareCollection();
18
+ }
19
+
20
+ protected function _prepareColumns() {
21
+ $this->addColumn("entity_id", array(
22
+ "header" => Mage::helper("supportticket")->__("ID"),
23
+ "align" => "right",
24
+ "width" => "50px",
25
+ "type" => "number",
26
+ "index" => "entity_id",
27
+ 'filter' => false,
28
+ ));
29
+
30
+ $this->addColumn("ticket_id", array(
31
+ "header" => Mage::helper("supportticket")->__("Ticket Id"),
32
+ "index" => "ticket_id",
33
+ 'filter' => false,
34
+ ));
35
+ $this->addColumn("user_name", array(
36
+ "header" => Mage::helper("supportticket")->__("User Name"),
37
+ "index" => "user_name",
38
+ 'filter' => false,
39
+ ));
40
+ // $this->addColumn("ticket_attachment", array(
41
+ // "header" => Mage::helper("supportticket")->__("Ticket Attachment"),
42
+ // "index" => "ticket_attachment",
43
+ // ));
44
+ $this->addColumn("reply_time", array(
45
+ "header" => Mage::helper("supportticket")->__("Reply Time"),
46
+ "index" => "reply_time",
47
+ "type" => "datetime",
48
+ 'filter' => false,
49
+ ));
50
+ $this->addColumn("ticket_replies", array(
51
+ "header" => Mage::helper("supportticket")->__("Ticket Replies"),
52
+ "index" => "ticket_replies",
53
+ ));
54
+ $this->addColumn("is_admin", array(
55
+ "header" => Mage::helper("supportticket")->__("User Role"),
56
+ "index" => "is_admin",
57
+ 'renderer' => new Uni_Supportticket_Block_Adminhtml_Supportticketreplywithticketid_Renderer_Userrole,
58
+ ));
59
+ // $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
60
+ // $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel'));
61
+
62
+ return parent::_prepareColumns();
63
+ }
64
+
65
+ protected function _prepareMassaction() {
66
+ $this->setMassactionIdField('entity_id');
67
+ $this->getMassactionBlock()->setFormFieldName('entity_ids');
68
+ $this->getMassactionBlock()->setUseSelectAll(true);
69
+ $this->getMassactionBlock()->addItem('remove_supportticketreply', array(
70
+ 'label' => Mage::helper('supportticket')->__('Remove Supportticketreply'),
71
+ 'url' => $this->getUrl('*/adminhtml_supportticketreply/massRemove'),
72
+ 'confirm' => Mage::helper('supportticket')->__('Are you sure?')
73
+ ));
74
+ return $this;
75
+ }
76
+
77
+ static public function getOptionArray20() {
78
+ $data_array = array();
79
+ foreach (Uni_Supportticket_Block_Adminhtml_Supportticketreplywithticketid_Grid::getSatatusArray() as $k => $v) {
80
+ $data_array[] = array('value' => $k, 'label' => $v);
81
+ }
82
+ return($data_array);
83
+ }
84
+
85
+ static public function getSatatusArray() {
86
+ $data_array = array();
87
+ $data_array[0] = 'user';
88
+ $data_array[1] = 'admin';
89
+ return $data_array;
90
+ }
91
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketreplywithticketid/Renderer/Userrole.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * To change this license header, choose License Headers in Project Properties.
5
+ * To change this template file, choose Tools | Templates
6
+ * and open the template in the editor.
7
+ */
8
+
9
+ /**
10
+ * Description of Userrole
11
+ *
12
+ * @author unicode
13
+ */
14
+ class Uni_Supportticket_Block_Adminhtml_Supportticketreplywithticketid_Renderer_Userrole extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
15
+
16
+ //put your code here
17
+ const IS_ADMIN = 1;
18
+
19
+ public function render(Varien_Object $row) {
20
+ $is_user = $row->getData('is_admin');
21
+ Mage::log($is_user,null,'nimit.log');
22
+ if($is_user == self::IS_ADMIN){
23
+ return '<span style="color:red"><b>Admin</b></span>';
24
+ }else{
25
+ return '<span style="color:green"><b>User</b></span>';
26
+ }
27
+
28
+ }
29
+
30
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketstatus.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Adminhtml_Supportticketstatus extends Mage_Adminhtml_Block_Widget_Grid_Container {
4
+
5
+ /**
6
+ * Set custom labels and headers
7
+ *
8
+ */
9
+ public function __construct() {
10
+
11
+ $this->_controller = "adminhtml_supportticketstatus";
12
+ $this->_blockGroup = "supportticket";
13
+ $this->_headerText = Mage::helper("supportticket")->__("Support Ticket Status Manager");
14
+ $this->_addButtonLabel = Mage::helper("supportticket")->__("Add New Status");
15
+ parent::__construct();
16
+ }
17
+
18
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketstatus/Edit.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Adminhtml_Supportticketstatus_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
4
+
5
+ public function __construct() {
6
+
7
+ parent::__construct();
8
+ $this->_objectId = "entity_id";
9
+ $this->_blockGroup = "supportticket";
10
+ $this->_controller = "adminhtml_supportticketstatus";
11
+ if (Mage::registry("supportticketstatus_data") && Mage::registry("supportticketstatus_data")->getIsSystem() > 0) {
12
+ $this->_updateButton("delete", "disabled", Mage::helper("supportticket")->__("disabled"));
13
+ }
14
+ $this->_updateButton("save", "label", Mage::helper("supportticket")->__("Save"));
15
+ $this->_updateButton("delete", "label", Mage::helper("supportticket")->__("Delete"));
16
+
17
+ $this->_addButton("saveandcontinue", array(
18
+ "label" => Mage::helper("supportticket")->__("Save And Continue Edit"),
19
+ "onclick" => "saveAndContinueEdit()",
20
+ "class" => "save",
21
+ ), -100);
22
+
23
+
24
+
25
+ $this->_formScripts[] = "
26
+
27
+ function saveAndContinueEdit(){
28
+ editForm.submit($('edit_form').action+'back/edit/');
29
+ }
30
+ ";
31
+ }
32
+
33
+ public function getHeaderText() {
34
+ if (Mage::registry("supportticketstatus_data") && Mage::registry("supportticketstatus_data")->getId()) {
35
+
36
+ return Mage::helper("supportticket")->__("Edit Item '%s'", $this->htmlEscape(Mage::registry("supportticketstatus_data")->getTitle()));
37
+ } else {
38
+
39
+ return Mage::helper("supportticket")->__("Add New Status");
40
+ }
41
+ }
42
+
43
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketstatus/Edit/Form.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Adminhtml_Supportticketstatus_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {
4
+
5
+ protected function _prepareForm() {
6
+ $form = new Varien_Data_Form(array(
7
+ "id" => "edit_form",
8
+ "action" => $this->getUrl("*/*/save", array("id" => $this->getRequest()->getParam("id"))),
9
+ "method" => "post",
10
+ "enctype" => "multipart/form-data",
11
+ )
12
+ );
13
+ $form->setUseContainer(true);
14
+ $this->setForm($form);
15
+ return parent::_prepareForm();
16
+ }
17
+
18
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketstatus/Edit/Tab/Form.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Adminhtml_Supportticketstatus_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("supportticket_form", array("legend" => Mage::helper("supportticket")->__("General information")));
10
+
11
+ $fieldset->addField("title", "text", array(
12
+ "label" => Mage::helper("supportticket")->__("Title"),
13
+ "class" => "required-entry",
14
+ "required" => true,
15
+ "name" => "title",
16
+ ));
17
+
18
+ $fieldset->addField("font_color", "text", array(
19
+ "label" => Mage::helper("supportticket")->__("Font Color"),
20
+ "class" => "required-entry",
21
+ "required" => true,
22
+ "name" => "font_color",
23
+ ));
24
+
25
+ $fieldset->addField("background_color", "text", array(
26
+ "label" => Mage::helper("supportticket")->__("Background Color"),
27
+ // "class" => "required-entry",
28
+ // "required" => true,
29
+ "name" => "background_color",
30
+ ));
31
+
32
+ if (Mage::registry("supportticketstatus_data") && Mage::registry("supportticketstatus_data")->getIsSystem()>0 ){
33
+ $fieldset->addField('ticket_status', 'select', array(
34
+ 'label' => Mage::helper('supportticket')->__('Ticket Status'),
35
+ 'values' => Uni_Supportticket_Block_Adminhtml_Supportticketstatus_Grid::getValueArray23(),
36
+ 'name' => 'ticket_status',
37
+ "class" => "required-entry",
38
+ 'disabled' => 'disabled',
39
+ "required" => true,
40
+ ));
41
+ } else {
42
+ $fieldset->addField('ticket_status', 'select', array(
43
+ 'label' => Mage::helper('supportticket')->__('Ticket Status'),
44
+ 'values' => Uni_Supportticket_Block_Adminhtml_Supportticketstatus_Grid::getValueArray23(),
45
+ 'name' => 'ticket_status',
46
+ "class" => "required-entry",
47
+ "required" => true,
48
+ 'note'=>'System Status cannot be disabled or deleted'
49
+ ));
50
+ }
51
+
52
+ if (Mage::getSingleton("adminhtml/session")->getSupportticketstatusData()) {
53
+ $form->setValues(Mage::getSingleton("adminhtml/session")->getSupportticketstatusData());
54
+ Mage::getSingleton("adminhtml/session")->setSupportticketstatusData(null);
55
+ } elseif (Mage::registry("supportticketstatus_data")) {
56
+ $form->setValues(Mage::registry("supportticketstatus_data")->getData());
57
+ }
58
+ return parent::_prepareForm();
59
+ }
60
+
61
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketstatus/Edit/Tabs.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Adminhtml_Supportticketstatus_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
4
+
5
+ public function __construct() {
6
+ parent::__construct();
7
+ $this->setId("supportticketstatus_tabs");
8
+ $this->setDestElementId("edit_form");
9
+ $this->setTitle(Mage::helper("supportticket")->__("New Ticket Status Information"));
10
+ }
11
+
12
+ protected function _beforeToHtml() {
13
+ $this->addTab("form_section", array(
14
+ "label" => Mage::helper("supportticket")->__("Ticket Information"),
15
+ "title" => Mage::helper("supportticket")->__("Item Information"),
16
+ "content" => $this->getLayout()->createBlock("supportticket/adminhtml_supportticketstatus_edit_tab_form")->toHtml(),
17
+ ));
18
+ return parent::_beforeToHtml();
19
+ }
20
+
21
+ }
app/code/community/Uni/Supportticket/Block/Adminhtml/Supportticketstatus/Grid.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Adminhtml_Supportticketstatus_Grid extends Mage_Adminhtml_Block_Widget_Grid {
4
+
5
+ public function __construct() {
6
+ parent::__construct();
7
+ $this->setId("supportticketstatusGrid");
8
+ $this->setDefaultSort("entity_id");
9
+ $this->setDefaultDir("ASC");
10
+ $this->setSaveParametersInSession(true);
11
+ }
12
+
13
+ protected function _prepareCollection() {
14
+ $collection = Mage::getModel("supportticket/supportticketstatus")->getCollection();
15
+ $this->setCollection($collection);
16
+ return parent::_prepareCollection();
17
+ }
18
+
19
+ protected function _prepareColumns() {
20
+ $this->addColumn("entity_id", array(
21
+ "header" => Mage::helper("supportticket")->__("ID"),
22
+ "align" => "right",
23
+ "width" => "50px",
24
+ "type" => "number",
25
+ "index" => "entity_id",
26
+ ));
27
+
28
+ $this->addColumn("title", array(
29
+ "header" => Mage::helper("supportticket")->__("Title"),
30
+ "index" => "title",
31
+ ));
32
+ $this->addColumn("font_color", array(
33
+ "header" => Mage::helper("supportticket")->__("Font Color"),
34
+ "index" => "font_color",
35
+ ));
36
+ $this->addColumn("background_color", array(
37
+ "header" => Mage::helper("supportticket")->__("Background Color"),
38
+ "index" => "background_color",
39
+ ));
40
+ $this->addColumn('is_system', array(
41
+ 'header' => Mage::helper('supportticket')->__('Is System'),
42
+ 'index' => 'is_system',
43
+ 'type' => 'options',
44
+ 'options' => array('1'=>'Yes','0'=>'No')
45
+ ));
46
+ $this->addColumn('ticket_status', array(
47
+ 'header' => Mage::helper('supportticket')->__('Ticket Status'),
48
+ 'index' => 'ticket_status',
49
+ 'type' => 'options',
50
+ 'options' => Uni_Supportticket_Block_Adminhtml_Supportticketstatus_Grid::getOptionArray23(),
51
+ ));
52
+
53
+ $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
54
+ $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel'));
55
+
56
+ return parent::_prepareColumns();
57
+ }
58
+
59
+ public function getRowUrl($row) {
60
+ return $this->getUrl("*/*/edit", array("id" => $row->getId()));
61
+ }
62
+
63
+ protected function _prepareMassaction() {
64
+ $this->setMassactionIdField('entity_id');
65
+ $this->getMassactionBlock()->setFormFieldName('entity_ids');
66
+ $this->getMassactionBlock()->setUseSelectAll(true);
67
+ $this->getMassactionBlock()->addItem('status', array(
68
+ 'label' => Mage::helper('supportticket')->__('Change status'),
69
+ 'url' => $this->getUrl('*/adminhtml_supportticketstatus/massStatus'),
70
+ 'additional' => array(
71
+ 'visibility' => array(
72
+ 'name' => 'status',
73
+ 'type' => 'select',
74
+ 'class' => 'required-entry',
75
+ 'label' => Mage::helper('supportticket')->__('Status'),
76
+ 'values' => Uni_Supportticket_Block_Adminhtml_Supportticketstatus_Grid::getOptionArray23(),
77
+ )
78
+ )
79
+ ));
80
+ return $this;
81
+ }
82
+ static public function getOptionArray23() {
83
+ $data_array = array();
84
+ $data_array[0] = 'Disable';
85
+ $data_array[1] = 'Enable';
86
+ return($data_array);
87
+ }
88
+
89
+ static public function getValueArray23() {
90
+ $data_array = array();
91
+ foreach (Uni_Supportticket_Block_Adminhtml_Supportticketstatus_Grid::getOptionArray23() as $k => $v) {
92
+ $data_array[] = array('value' => $k, 'label' => $v);
93
+ }
94
+ return($data_array);
95
+ }
96
+
97
+ }
app/code/community/Uni/Supportticket/Block/Index.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Index extends Mage_Core_Block_Template {
4
+
5
+
6
+ /*
7
+ * get form action
8
+ */
9
+ public function getFormAction() {
10
+ return $this->getUrl('supportticket/supportticket/save');
11
+ }
12
+
13
+ /*
14
+ * generate random ticket ids for backend and frontend
15
+ */
16
+ public function generateCode($l, $c = 'ABCDEFGHIJKLMNOPQRSTUVXYZ1234567890') {
17
+ for ($s = '', $cl = strlen($c) - 1, $i = 0; $i < $l; $s .= $c[mt_rand(0, $cl)], ++$i)
18
+ ;
19
+ return $s;
20
+ }
21
+
22
+ }
app/code/community/Uni/Supportticket/Block/Supportticket.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Supportticket extends Mage_Core_Block_Template {
4
+ /*
5
+ *
6
+ */
7
+
8
+ public function __construct() {
9
+ parent::__construct();
10
+ $datasets = Mage::getModel('supportticket/supportticket')->getCollection();
11
+ $this->setDatasets($datasets);
12
+ }
13
+
14
+ /*
15
+ *
16
+ */
17
+
18
+ protected function _prepareLayout() {
19
+ parent::_prepareLayout();
20
+ $customerData = Mage::getSingleton('customer/session')->getCustomer();
21
+ $pager = $this->getLayout()->createBlock('page/html_pager')->setCollection($this->getDatasets()->addFieldToFilter('user_id', $customerData->getId()));
22
+ $this->setChild('pager', $pager);
23
+ $this->getDatasets()->load();
24
+ return $this;
25
+ }
26
+
27
+ public function getPagerHtml() {
28
+ return $this->getChildHtml('pager');
29
+ }
30
+
31
+ /*
32
+ * get form action
33
+ */
34
+
35
+ public function getFormAction() {
36
+ return $this->geturl('supportticket/supportticketreply/save');
37
+ }
38
+
39
+ /*
40
+ * get ticket information by id
41
+ */
42
+
43
+ public function getTicketInfo($id) {
44
+ return Mage::getModel('supportticket/supportticket')->load($id);
45
+ }
46
+
47
+ }
app/code/community/Uni/Supportticket/Block/Supportticketreply.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Block_Supportticketreply extends Mage_Core_Block_Template {
4
+
5
+ /*
6
+ *
7
+ */
8
+ public function __construct() {
9
+ parent::__construct();
10
+ $datasets = Mage::getModel('supportticket/supportticketreply')->getCollection();
11
+ $this->setDatasets($datasets);
12
+ }
13
+
14
+ /*
15
+ *
16
+ */
17
+ protected function _prepareLayout() {
18
+ parent::_prepareLayout();
19
+ $customerData = Mage::getSingleton('customer/session')->getCustomer();
20
+ $tick = $this->getCurrentTicketId($this->getRequest()->getParam('id'));
21
+ $pager = $this->getLayout()->createBlock('page/html_pager')->setCollection($this->getDatasets()->addFieldToFilter('ticket_id', $tick));
22
+ $this->setChild('pager', $pager);
23
+ $this->getDatasets()->load();
24
+ return $this;
25
+ }
26
+
27
+ /*
28
+ *
29
+ */
30
+ public function getPagerHtml() {
31
+ return $this->getChildHtml('pager');
32
+ }
33
+
34
+ /*
35
+ * take params $id return current ticket id on reply page frontend
36
+ */
37
+ public function getCurrentTicketId($id) {
38
+ $model = mage::getModel('supportticket/supportticket')->load($id);
39
+ return $model->getTicketId();
40
+ }
41
+
42
+ }
app/code/community/Uni/Supportticket/Helper/Data.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ ?>
4
+
5
+ <?php
6
+
7
+ class Uni_Supportticket_Helper_Data extends Mage_Core_Helper_Abstract {
8
+
9
+ /*
10
+ * to get support ticket status array
11
+ */
12
+ public function getTicketStatuses() {
13
+ $_collection = Mage::getModel('supportticket/supportticketstatus')->getCollection();
14
+
15
+ $_status = array();
16
+ foreach ($_collection as $values) {
17
+ if ($values['ticket_status'] == 1) {
18
+ $_status[] = array('value' => $values['entity_id'], 'label' => $values['title']);
19
+ }
20
+ }
21
+ return $_status;
22
+ }
23
+
24
+ /*
25
+ * to get support ticket priority array
26
+ */
27
+ public function getTicketPrioritys() {
28
+ $_collection = Mage::getModel('supportticket/supportticketpriority')->getCollection();
29
+ $_priority = array();
30
+ foreach ($_collection as $values) {
31
+ if ($values['ticket_priority'] == 1) {
32
+ $_priority[] = array('value' => $values['entity_id'], 'label' => $values['title']);
33
+ }
34
+ }
35
+ return $_priority;
36
+ }
37
+
38
+ /*
39
+ * to get support ticket department array
40
+ */
41
+ public function getTicketDepartments() {
42
+ $_collection = Mage::getModel('supportticket/supportticketdepartment')->getCollection();
43
+
44
+ $_priority = array();
45
+ foreach ($_collection as $values) {
46
+ if ($values['dep_status'] == 0) {
47
+ $_priority[] = array('value' => $values['entity_id'], 'label' => $values['title']);
48
+ }
49
+ }
50
+ return $_priority;
51
+ }
52
+
53
+ /*
54
+ * to get admin end support ticket status array
55
+ */
56
+ public function getAdminTicketStatuses() {
57
+ $_status = array();
58
+ $_collection = Mage::getModel('supportticket/supportticketstatus')->getCollection();
59
+ $_collection->addFieldToSelect('entity_id');
60
+ $_collection->addFieldToSelect('title');
61
+ foreach ($_collection as $key => $val) {
62
+ $_status[$val['entity_id']] = $val['title'];
63
+ }
64
+ return $_status;
65
+ }
66
+
67
+ /*
68
+ * to get admin end support ticket priority array
69
+ */
70
+ public function getAdminTicketPrioritys() {
71
+ $_status = array();
72
+ $_collection = Mage::getModel('supportticket/supportticketpriority')->getCollection();
73
+ $_collection->addFieldToSelect('entity_id');
74
+ $_collection->addFieldToSelect('title');
75
+ foreach ($_collection as $key => $val) {
76
+ $_status[$val['entity_id']] = $val['title'];
77
+ }
78
+ return $_status;
79
+ }
80
+
81
+ /*
82
+ * to get admin end support ticket department array
83
+ */
84
+ public function getAdminTicketDepartments() {
85
+ $_status = array();
86
+ $_collection = Mage::getModel('supportticket/supportticketdepartment')->getCollection();
87
+ $_collection->addFieldToSelect('entity_id');
88
+ $_collection->addFieldToSelect('title');
89
+ foreach ($_collection as $key => $val) {
90
+ $_status[$val['entity_id']] = $val['title'];
91
+ }
92
+ return $_status;
93
+ }
94
+
95
+ }
app/code/community/Uni/Supportticket/Model/Mysql4/Supportticket.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Uni_Supportticket_Model_Mysql4_Supportticket extends Mage_Core_Model_Mysql4_Abstract
3
+ {
4
+ protected function _construct()
5
+ {
6
+ $this->_init("supportticket/supportticket", "entity_id");
7
+ }
8
+ }
app/code/community/Uni/Supportticket/Model/Mysql4/Supportticket/Collection.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Model_Mysql4_Supportticket_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
4
+
5
+ public function _construct() {
6
+ $this->_init("supportticket/supportticket");
7
+ }
8
+
9
+ /**
10
+ * Join fields
11
+ *
12
+ * @param string $from
13
+ * @param string $to
14
+ * @return Mage_Reports_Model_Resource_Customer_Totals_Collection
15
+ */
16
+ protected function _joinFields($from = '', $to = '') {
17
+
18
+ $this->addFieldToFilter('created_at', array('from' => $from, 'to' => $to, 'datetime' => true));
19
+ return $this;
20
+ }
21
+
22
+ /**
23
+ * Set date range
24
+ *
25
+ * @param string $from
26
+ * @param string $to
27
+ * @return Mage_Reports_Model_Resource_Customer_Totals_Collection
28
+ */
29
+ public function setDateRange($from, $to) {
30
+ $this->_reset()
31
+ ->_joinFields($from, $to);
32
+ return $this;
33
+ }
34
+
35
+ /**
36
+ * Set store filter collection
37
+ *
38
+ * @param array $storeIds
39
+ * @return Mage_Reports_Model_Resource_Customer_Totals_Collection
40
+ */
41
+ public function setStoreIds($storeIds) {
42
+ $vals = array_values($storeIds);
43
+ if (count($storeIds) >= 1 && $vals[0] != '') {
44
+ $this->addFieldToFilter('main_table.store_id', array('in' => (array) $storeIds));
45
+ } else {
46
+
47
+ }
48
+
49
+ return $this;
50
+ }
51
+
52
+ }
app/code/community/Uni/Supportticket/Model/Mysql4/Supportticketdepartment.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Uni_Supportticket_Model_Mysql4_Supportticketdepartment extends Mage_Core_Model_Mysql4_Abstract
3
+ {
4
+ protected function _construct()
5
+ {
6
+ $this->_init("supportticket/supportticketdepartment", "entity_id");
7
+ }
8
+ }
app/code/community/Uni/Supportticket/Model/Mysql4/Supportticketdepartment/Collection.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Uni_Supportticket_Model_Mysql4_Supportticketdepartment_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
3
+ {
4
+
5
+ public function _construct(){
6
+ $this->_init("supportticket/supportticketdepartment");
7
+ }
8
+
9
+
10
+
11
+ }
12
+
app/code/community/Uni/Supportticket/Model/Mysql4/Supportticketpriority.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Uni_Supportticket_Model_Mysql4_Supportticketpriority extends Mage_Core_Model_Mysql4_Abstract
3
+ {
4
+ protected function _construct()
5
+ {
6
+ $this->_init("supportticket/supportticketpriority", "entity_id");
7
+ }
8
+ }
app/code/community/Uni/Supportticket/Model/Mysql4/Supportticketpriority/Collection.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Uni_Supportticket_Model_Mysql4_Supportticketpriority_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
3
+ {
4
+
5
+ public function _construct(){
6
+ $this->_init("supportticket/supportticketpriority");
7
+ }
8
+
9
+
10
+ /**
11
+ * Join fields
12
+ *
13
+ * @param string $from
14
+ * @param string $to
15
+ * @return Mage_Reports_Model_Resource_Customer_Totals_Collection
16
+ */
17
+ protected function _joinFields($from = '', $to = '')
18
+ {
19
+ $this->addFieldToFilter('created_at', array('from' => $from, 'to' => $to, 'datetime' => true));
20
+ return $this;
21
+ }
22
+
23
+ /**
24
+ * Set date range
25
+ *
26
+ * @param string $from
27
+ * @param string $to
28
+ * @return Mage_Reports_Model_Resource_Customer_Totals_Collection
29
+ */
30
+ public function setDateRange($from, $to)
31
+ {
32
+ $this->_reset()
33
+ ->_joinFields($from, $to);
34
+ return $this;
35
+ }
36
+
37
+ /**
38
+ * Set store filter collection
39
+ *
40
+ * @param array $storeIds
41
+ * @return Mage_Reports_Model_Resource_Customer_Totals_Collection
42
+ */
43
+ public function setStoreIds($storeIds)
44
+ {
45
+ $vals = array_values($storeIds);
46
+ if (count($storeIds) >= 1 && $vals[0] != '') {
47
+ $this->addFieldToFilter('main_table.store_id', array('in' => (array)$storeIds));
48
+
49
+ } else {
50
+
51
+ }
52
+
53
+ return $this;
54
+ }
55
+ }
56
+
app/code/community/Uni/Supportticket/Model/Mysql4/Supportticketreply.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Uni_Supportticket_Model_Mysql4_Supportticketreply extends Mage_Core_Model_Mysql4_Abstract
3
+ {
4
+ protected function _construct()
5
+ {
6
+ $this->_init("supportticket/supportticketreply", "entity_id");
7
+ }
8
+ }
app/code/community/Uni/Supportticket/Model/Mysql4/Supportticketreply/Collection.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Model_Mysql4_Supportticketreply_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
4
+
5
+ public function _construct() {
6
+ $this->_init("supportticket/supportticketreply");
7
+ }
8
+
9
+ /**
10
+ * Join fields
11
+ *
12
+ * @param string $from
13
+ * @param string $to
14
+ * @return Mage_Reports_Model_Resource_Customer_Totals_Collection
15
+ */
16
+ protected function _joinFields($from = '', $to = '') {
17
+
18
+ $this->addFieldToFilter('created_at', array('from' => $from, 'to' => $to, 'datetime' => true));
19
+ return $this;
20
+ }
21
+
22
+ /**
23
+ * Set date range
24
+ *
25
+ * @param string $from
26
+ * @param string $to
27
+ * @return Mage_Reports_Model_Resource_Customer_Totals_Collection
28
+ */
29
+ public function setDateRange($from, $to) {
30
+ $this->_reset()
31
+ ->_joinFields($from, $to);
32
+ return $this;
33
+ }
34
+
35
+ /**
36
+ * Set store filter collection
37
+ *
38
+ * @param array $storeIds
39
+ * @return Mage_Reports_Model_Resource_Customer_Totals_Collection
40
+ */
41
+ public function setStoreIds($storeIds) {
42
+ $vals = array_values($storeIds);
43
+ if (count($storeIds) >= 1 && $vals[0] != '') {
44
+ $this->addFieldToFilter('main_table.store_id', array('in' => (array) $storeIds));
45
+ } else {
46
+
47
+ }
48
+
49
+ return $this;
50
+ }
51
+
52
+ }
app/code/community/Uni/Supportticket/Model/Mysql4/Supportticketstatus.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Uni_Supportticket_Model_Mysql4_Supportticketstatus extends Mage_Core_Model_Mysql4_Abstract
3
+ {
4
+ protected function _construct()
5
+ {
6
+ $this->_init("supportticket/supportticketstatus", "entity_id");
7
+ }
8
+ }
app/code/community/Uni/Supportticket/Model/Mysql4/Supportticketstatus/Collection.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Uni_Supportticket_Model_Mysql4_Supportticketstatus_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
3
+ {
4
+
5
+ public function _construct(){
6
+ $this->_init("supportticket/supportticketstatus");
7
+ }
8
+
9
+
10
+ /**
11
+ * Join fields
12
+ *
13
+ * @param string $from
14
+ * @param string $to
15
+ * @return Mage_Reports_Model_Resource_Customer_Totals_Collection
16
+ */
17
+ protected function _joinFields($from = '', $to = '')
18
+ {
19
+
20
+
21
+ $this->addFieldToFilter('created_at', array('from' => $from, 'to' => $to, 'datetime' => true));
22
+ return $this;
23
+ }
24
+
25
+ /**
26
+ * Set date range
27
+ *
28
+ * @param string $from
29
+ * @param string $to
30
+ * @return Mage_Reports_Model_Resource_Customer_Totals_Collection
31
+ */
32
+ public function setDateRange($from, $to)
33
+ {
34
+ $this->_reset()
35
+ ->_joinFields($from, $to);
36
+ return $this;
37
+ }
38
+
39
+ /**
40
+ * Set store filter collection
41
+ *
42
+ * @param array $storeIds
43
+ * @return Mage_Reports_Model_Resource_Customer_Totals_Collection
44
+ */
45
+ public function setStoreIds($storeIds)
46
+ {
47
+ $vals = array_values($storeIds);
48
+ if (count($storeIds) >= 1 && $vals[0] != '') {
49
+ $this->addFieldToFilter('main_table.store_id', array('in' => (array)$storeIds));
50
+
51
+ } else {
52
+
53
+ }
54
+
55
+ return $this;
56
+ }
57
+
58
+
59
+ }
60
+
app/code/community/Uni/Supportticket/Model/Supportticket.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Model_Supportticket extends Mage_Core_Model_Abstract
4
+ {
5
+ protected function _construct(){
6
+
7
+ $this->_init("supportticket/supportticket");
8
+
9
+ }
10
+
11
+ }
12
+
app/code/community/Uni/Supportticket/Model/Supportticketdepartment.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Model_Supportticketdepartment extends Mage_Core_Model_Abstract
4
+ {
5
+ protected function _construct(){
6
+
7
+ $this->_init("supportticket/supportticketdepartment");
8
+
9
+ }
10
+
11
+ }
12
+
app/code/community/Uni/Supportticket/Model/Supportticketpriority.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Model_Supportticketpriority extends Mage_Core_Model_Abstract
4
+ {
5
+ protected function _construct(){
6
+
7
+ $this->_init("supportticket/supportticketpriority");
8
+
9
+ }
10
+
11
+ }
12
+
app/code/community/Uni/Supportticket/Model/Supportticketreply.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Model_Supportticketreply extends Mage_Core_Model_Abstract
4
+ {
5
+ protected function _construct(){
6
+
7
+ $this->_init("supportticket/supportticketreply");
8
+
9
+ }
10
+
11
+ }
12
+
app/code/community/Uni/Supportticket/Model/Supportticketstatus.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Model_Supportticketstatus extends Mage_Core_Model_Abstract
4
+ {
5
+ protected function _construct(){
6
+
7
+ $this->_init("supportticket/supportticketstatus");
8
+
9
+ }
10
+
11
+ }
12
+
app/code/community/Uni/Supportticket/controllers/Adminhtml/Report/SupportticketController.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Uni_Supportticket_Adminhtml_Report_SupportticketController extends Mage_Adminhtml_Controller_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+ $this->_title($this->__('Reports'))
7
+ ->_title($this->__('Supportticket Report'));
8
+
9
+ $this->loadLayout()
10
+ ->_setActiveMenu('supportticket/supportticket')
11
+ ->_addBreadcrumb(Mage::helper('reports')->__('Supportticket Report'),
12
+ Mage::helper('reports')->__('Supportticket Report'))
13
+ ->_addContent($this->getLayout()->createBlock('supportticket/adminhtml_report_supportticket'))
14
+ ->renderLayout();
15
+ }
16
+
17
+
18
+ public function exportSupportticketCsvAction()
19
+ {
20
+ $fileName = 'supportticket_report.csv';
21
+ $content = $this->getLayout()->createBlock('supportticket/adminhtml_report_supportticket_grid')
22
+ ->getCsv();
23
+ $this->_prepareDownloadResponse($fileName, $content);
24
+ }
25
+ public function exportSupportticketExcelAction()
26
+ {
27
+ $fileName = 'supportticket_report.xml';
28
+ $content = $this->getLayout()->createBlock('supportticket/adminhtml_report_supportticket_grid')
29
+ ->getExcel($fileName);
30
+ $this->_prepareDownloadResponse($fileName, $content);
31
+ }
32
+
33
+ }
app/code/community/Uni/Supportticket/controllers/Adminhtml/SupportticketController.php ADDED
@@ -0,0 +1,320 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Adminhtml_SupportticketController extends Mage_Adminhtml_Controller_Action {
4
+
5
+ /**
6
+ * Set active menu and Breadcrumb
7
+ * @return \Uni_Supportticket_Adminhtml_SupportticketController
8
+ */
9
+ protected function _initAction() {
10
+ $this->loadLayout()->_setActiveMenu("supportticket/supportticket")->_addBreadcrumb(Mage::helper("adminhtml")->__("Supportticket Manager"), Mage::helper("adminhtml")->__("Supportticket Manager"));
11
+ return $this;
12
+ }
13
+
14
+ /**
15
+ * Display grid for generated tickets
16
+ */
17
+ public function indexAction() {
18
+ $this->_title($this->__("Supportticket"));
19
+ $this->_title($this->__("Manager Support Ticket"));
20
+
21
+ $this->_initAction();
22
+ $this->renderLayout();
23
+ }
24
+
25
+ /**
26
+ * Rendering layout for ticket edit action
27
+ */
28
+ public function editAction() {
29
+ $this->_title($this->__("Supportticket"));
30
+ $this->_title($this->__("Supportticket"));
31
+ $this->_title($this->__("Edit Item"));
32
+ $id = $this->getRequest()->getParam("id");
33
+ $model = Mage::getModel("supportticket/supportticket")->load($id);
34
+ if ($model->getId()) {
35
+ Mage::register("supportticket_data", $model);
36
+ $this->loadLayout();
37
+ $this->_setActiveMenu("supportticket/supportticket");
38
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Supportticket Manager"), Mage::helper("adminhtml")->__("Supportticket Manager"));
39
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Supportticket Description"), Mage::helper("adminhtml")->__("Supportticket Description"));
40
+ $this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
41
+ $this->_addContent($this->getLayout()->createBlock("supportticket/adminhtml_supportticket_edit"))->_addLeft($this->getLayout()->createBlock("supportticket/adminhtml_supportticket_edit_tabs"));
42
+ $this->renderLayout();
43
+ } else {
44
+ Mage::getSingleton("adminhtml/session")->addError(Mage::helper("supportticket")->__("Item does not exist."));
45
+ $this->_redirect("*/*/");
46
+ }
47
+ }
48
+
49
+ /**
50
+ * Renders layout for new ticket
51
+ */
52
+ public function newAction() {
53
+ $this->_title($this->__("Supportticket"));
54
+ $this->_title($this->__("Supportticket"));
55
+ $this->_title($this->__("New Item"));
56
+ $id = $this->getRequest()->getParam("id");
57
+ $model = Mage::getModel("supportticket/supportticket")->load($id);
58
+ $data = Mage::getSingleton("adminhtml/session")->getFormData(true);
59
+ if (!empty($data)) {
60
+ $model->setData($data);
61
+ }
62
+ Mage::register("supportticket_data", $model);
63
+ $this->loadLayout();
64
+ $this->_setActiveMenu("supportticket/supportticket");
65
+ $this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
66
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Supportticket Manager"), Mage::helper("adminhtml")->__("Supportticket Manager"));
67
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Supportticket Description"), Mage::helper("adminhtml")->__("Supportticket Description"));
68
+ $this->_addContent($this->getLayout()->createBlock("supportticket/adminhtml_supportticket_edit"))->_addLeft($this->getLayout()->createBlock("supportticket/adminhtml_supportticket_edit_tabs"));
69
+ $this->renderLayout();
70
+ }
71
+
72
+ /**
73
+ * Save new TicketTicket
74
+ *
75
+ */
76
+ public function saveAction() {
77
+ $post_data = $this->getRequest()->getPost();
78
+ $_helper = Mage::helper('supportticket');
79
+ if (isset($post_data['ticket_repliess']) && $post_data['ticket_repliess']) {
80
+ $post_data['ticket_replies'] = $post_data['ticket_repliess'];
81
+ }
82
+ if (isset($post_data['is_admin1']) && $post_data['is_admin1']) {
83
+ $post_data['is_admin'] = $post_data['is_admin1'];
84
+ }
85
+ /**
86
+ * if attachment is for new ticket
87
+ */
88
+ if (isset($_FILES['create_ticket_attachment']['name']) and (file_exists($_FILES['create_ticket_attachment']['tmp_name'])) and isset($_FILES['create_ticket_attachment']['size'])) {
89
+ try {
90
+ $_fileSizeCreate = $_FILES['create_ticket_attachment']['size'];
91
+ $_flag = 0;
92
+ if ($_fileSizeCreate > 10485760) {
93
+ $_flag = 1;
94
+ throw new Exception();
95
+ }
96
+ $uploader = new Varien_File_Uploader('create_ticket_attachment');
97
+ $uploader->setAllowRenameFiles(false);
98
+ $uploader->setFilesDispersion(false);
99
+ $filename = "File-" . time() . $_FILES['create_ticket_attachment']['name'];
100
+ $filename = str_replace(' ', '-', $filename);
101
+ $path = Mage::getBaseDir('media') . DS . 'supportticket' . DS;
102
+ if (!is_dir($path)) {
103
+ mkdir($path, 0777, true);
104
+ }
105
+ $uploader->save($path, $filename);
106
+ $newFilename = $uploader->getUploadedFileName();
107
+ $post_data['create_ticket_attachment'] = $filename;
108
+ } catch (Exception $e) {
109
+ if ($_flag == 1) {
110
+ Mage::getSingleton('core/session')->addError(Mage::helper('supportticket')->__('Maximum file size allowed is 10MB'));
111
+ }
112
+ $error = true;
113
+ Mage::getSingleton('core/session')->addError(Mage::helper('supportticket')->__('Uploaded File format not allowed'));
114
+ $this->_redirectReferer();
115
+ return;
116
+ }
117
+ }
118
+ /**
119
+ * if attachment done for editing the ticket
120
+ */ elseif (isset($_FILES['ticket_attachment']['name']) and (file_exists($_FILES['ticket_attachment']['tmp_name'])) and isset($_FILES['ticket_attachment']['size'])) {
121
+ try {
122
+ $_flag2 = 0;
123
+ $_fileSizeEdit = $_FILES['ticket_attachment']['size'];
124
+ if ($_fileSizeEdit > 10485760) {
125
+ $_flag2 = 1;
126
+ throw new Exception();
127
+ }
128
+ $uploader = new Varien_File_Uploader('ticket_attachment');
129
+ $uploader->setAllowRenameFiles(false);
130
+ $uploader->setFilesDispersion(false);
131
+ $filename = "File-" . time() . $_FILES['ticket_attachment']['name'];
132
+ $filename = str_replace(' ', '-', $filename);
133
+ $path = Mage::getBaseDir('media') . DS . 'supportticket' . DS;
134
+ if (!is_dir($path)) {
135
+ mkdir($path, 0777, true);
136
+ }
137
+ $uploader->save($path, $filename);
138
+ $newFilename = $uploader->getUploadedFileName();
139
+ $post_data['ticket_attachment'] = $filename;
140
+ } catch (Exception $e) {
141
+ if ($_flag2 == 1) {
142
+ Mage::getSingleton('core/session')->addError(Mage::helper('supportticket')->__('Maximum file size allowed is 10MB'));
143
+ }
144
+ $error = true;
145
+ Mage::getSingleton('core/session')->addError(Mage::helper('supportticket')->__('Uploaded File format not allowed'));
146
+ $this->_redirectReferer('supportticket');
147
+ return;
148
+ }
149
+ }
150
+
151
+ if ($post_data) {
152
+ try {
153
+ $id = $this->getRequest()->getParam("id");
154
+ $code = Mage::getBlockSingleton('supportticket/index')->generateCode(6);
155
+ $date = date('m/d/Y h:i:s a', time());
156
+ $model = Mage::getModel("supportticket/supportticket")
157
+ ->addData($post_data);
158
+ /**
159
+ * if ticket reply has been done
160
+ */
161
+ if (isset($post_data['ticket_replies']) && $post_data['ticket_replies']) {
162
+ $model1 = Mage::getModel("supportticket/supportticketreply")
163
+ ->addData($post_data);
164
+ $model1->setTicketReplies($post_data['ticket_replies'])
165
+ ->setReplyTime($date)
166
+ ->save();
167
+ if ($post_data['reply_count'] !== null) {
168
+ $repCount = $post_data['reply_count'];
169
+ }
170
+ if (!$id) {
171
+ $model->setTicketId($code)
172
+ ->setCreateTime($date);
173
+ }
174
+ $model->setUpdateTime($date)
175
+ ->setId($this->getRequest()->getParam("id"))
176
+ ->setReplyCount(++$repCount)
177
+ ->save();
178
+ $emailTemplate = Mage::getModel('core/email_template')->loadDefault('supportticketreply_email_email_template');
179
+ $adminEmail = Mage::getStoreConfig('support_ticket_ultimate/general_email_settings/supervisor_email');
180
+ $adminName = Mage::getStoreConfig('support_ticket_ultimate/general_email_settings/supervisor_name');
181
+ if (isset($_FILES['ticket_attachment']['name']) && $_FILES['ticket_attachment']['name']) {
182
+ $attachmentFilePath = Mage::getBaseDir('media') . DS . 'supportticket' . DS . $post_data['ticket_attachment'];
183
+ if (file_exists($attachmentFilePath)) {
184
+ $fileContents = file_get_contents($attachmentFilePath);
185
+ $attachment = $emailTemplate->getMail()->createAttachment($fileContents);
186
+ $attachment->filename = $filename;
187
+ }
188
+ }
189
+ $emailTemplateVariables = array(
190
+ 'ticketid' => $post_data['ticket_id'],
191
+ 'name' => $post_data['user_name'],
192
+ 'reply' => $post_data['ticket_replies'],
193
+ );
194
+ try {
195
+ $emailTemplate->setSenderName($adminName);
196
+ $emailTemplate->setSenderEmail($adminEmail);
197
+ $emailTemplate->send($post_data['user_email'], $adminName, $emailTemplateVariables);
198
+ } catch (Exception $e) {
199
+ echo $e->getMessage();
200
+ }
201
+ }
202
+ // reply code ends
203
+ else {
204
+ if (!$id) {
205
+ $model->setTicketId($code)
206
+ ->setCreateTime($date);
207
+ }
208
+ $model->setUpdateTime($date)
209
+ ->setId($this->getRequest()->getParam("id"))
210
+ ->save();
211
+ $emailTemplate = Mage::getModel('core/email_template')->loadDefault('supportticket_email_email_template');
212
+ if (isset($_FILES['create_ticket_attachment']['name']) && $_FILES['create_ticket_attachment']['name']) {
213
+ $attachmentFilePath = Mage::getBaseDir('media') . DS . 'supportticket' . DS . $post_data['create_ticket_attachment'];
214
+ if (file_exists($attachmentFilePath)) {
215
+ $fileContents = file_get_contents($attachmentFilePath);
216
+ $attachment = $emailTemplate->getMail()->createAttachment($fileContents);
217
+ $attachment->filename = $filename;
218
+ }
219
+ }
220
+ $priorities = $_helper->getAdminTicketPrioritys();
221
+ $departments = $_helper->getAdminTicketDepartments();
222
+ foreach ($priorities as $key => $value) {
223
+ if ($key == $post_data['ticket_priority']) {
224
+ $post_data['ticket_priority'] = $value;
225
+ }
226
+ }
227
+ foreach ($departments as $key => $value) {
228
+ if ($key == $post_data['department']) {
229
+ $post_data['ticket_department'] = $value;
230
+ }
231
+ }
232
+ $adminEmail = Mage::getStoreConfig('support_ticket_ultimate/general_email_settings/supervisor_email');
233
+ $adminName = Mage::getStoreConfig('support_ticket_ultimate/general_email_settings/supervisor_name');
234
+ $emailTemplateVariables = array(
235
+ 'ticketid' => isset($post_data['ticket_id']) ? $post_data['ticket_id'] : $code,
236
+ 'name' => $post_data['user_name'],
237
+ 'email' => $post_data['user_email'],
238
+ 'ticketmsg' => $post_data['ticket_message'],
239
+ 'ticketsub' => $post_data['ticket_subject'],
240
+ 'ticketprio' => $post_data['ticket_priority'],
241
+ 'ticketdept' => $post_data['ticket_department']
242
+ );
243
+ try {
244
+ $emailTemplate->setSenderName($adminName);
245
+ $emailTemplate->setSenderEmail($adminEmail);
246
+ $emailTemplate->send($post_data['user_email'], $post_data['user_name'], $emailTemplateVariables);
247
+ } catch (Exception $e) {
248
+ echo $e->getMessage();
249
+ }
250
+ }
251
+
252
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Support Ticket was successfully saved"));
253
+ Mage::getSingleton("adminhtml/session")->setSupportticketData(false);
254
+
255
+ if ($this->getRequest()->getParam("back")) {
256
+ $this->_redirect("*/*/edit", array("id" => $model->getId()));
257
+ return;
258
+ }
259
+ $this->_redirect("*/*/");
260
+ return;
261
+ } catch (Exception $e) {
262
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
263
+ Mage::getSingleton("adminhtml/session")->setSupportticketData($this->getRequest()->getPost());
264
+ $this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id")));
265
+ return;
266
+ }
267
+ }
268
+ $this->_redirect("*/*/");
269
+ }
270
+
271
+ /**
272
+ * deletes the ticket
273
+ */
274
+ public function deleteAction() {
275
+ if ($this->getRequest()->getParam("id") > 0) {
276
+ try {
277
+ $model = Mage::getModel("supportticket/supportticket");
278
+ $model->setId($this->getRequest()->getParam("id"))->delete();
279
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Item was successfully deleted"));
280
+ $this->_redirect("*/*/");
281
+ } catch (Exception $e) {
282
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
283
+ $this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id")));
284
+ }
285
+ }
286
+ $this->_redirect("*/*/");
287
+ }
288
+
289
+ /**
290
+ * mass removal action
291
+ */
292
+ public function massRemoveAction() {
293
+ try {
294
+ $ids = $this->getRequest()->getPost('entity_ids', array());
295
+ foreach ($ids as $id) {
296
+ $model = Mage::getModel("supportticket/supportticket");
297
+ $model->setId($id)->delete();
298
+ }
299
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Item(s) was successfully removed"));
300
+ } catch (Exception $e) {
301
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
302
+ }
303
+ $this->_redirect('*/*/');
304
+ }
305
+
306
+ /**
307
+ * Export order grid to CSV format
308
+ */
309
+ public function exportCsvAction() {
310
+ $fileName = 'supportticket.csv';
311
+ $grid = $this->getLayout()->createBlock('supportticket/adminhtml_supportticket_grid');
312
+ $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
313
+ }
314
+
315
+ /**
316
+ * Export order grid to Excel XML format
317
+ */
318
+ //
319
+
320
+ }
app/code/community/Uni/Supportticket/controllers/Adminhtml/SupportticketController_1.php ADDED
@@ -0,0 +1,259 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Adminhtml_SupportticketController extends Mage_Adminhtml_Controller_Action {
4
+
5
+ protected function _initAction() {
6
+ $this->loadLayout()->_setActiveMenu("supportticket/supportticket")->_addBreadcrumb(Mage::helper("adminhtml")->__("Supportticket Manager"), Mage::helper("adminhtml")->__("Supportticket Manager"));
7
+ return $this;
8
+ }
9
+
10
+ public function indexAction() {
11
+ $this->_title($this->__("Supportticket"));
12
+ $this->_title($this->__("Manager Support Ticket"));
13
+
14
+ $this->_initAction();
15
+ $this->renderLayout();
16
+ }
17
+
18
+ public function editAction() {
19
+ $this->_title($this->__("Supportticket"));
20
+ $this->_title($this->__("Supportticket"));
21
+ $this->_title($this->__("Edit Item"));
22
+
23
+ $id = $this->getRequest()->getParam("id");
24
+ $model = Mage::getModel("supportticket/supportticket")->load($id);
25
+ if ($model->getId()) {
26
+ Mage::register("supportticket_data", $model);
27
+ $this->loadLayout();
28
+ $this->_setActiveMenu("supportticket/supportticket");
29
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Supportticket Manager"), Mage::helper("adminhtml")->__("Supportticket Manager"));
30
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Supportticket Description"), Mage::helper("adminhtml")->__("Supportticket Description"));
31
+ $this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
32
+ $this->_addContent($this->getLayout()->createBlock("supportticket/adminhtml_supportticket_edit"))->_addLeft($this->getLayout()->createBlock("supportticket/adminhtml_supportticket_edit_tabs"));
33
+ // $this->_addContent($this->getLayout()->createBlock("supportticket/adminhtml_supportticket_edit"));
34
+ $this->renderLayout();
35
+ } else {
36
+ Mage::getSingleton("adminhtml/session")->addError(Mage::helper("supportticket")->__("Item does not exist."));
37
+ $this->_redirect("*/*/");
38
+ }
39
+ }
40
+
41
+ public function newAction() {
42
+
43
+
44
+ $this->_title($this->__("Supportticket"));
45
+ $this->_title($this->__("Supportticket"));
46
+ $this->_title($this->__("New Item"));
47
+
48
+ $id = $this->getRequest()->getParam("id");
49
+ $model = Mage::getModel("supportticket/supportticket")->load($id);
50
+
51
+ $data = Mage::getSingleton("adminhtml/session")->getFormData(true);
52
+ if (!empty($data)) {
53
+ $model->setData($data);
54
+ }
55
+
56
+ Mage::register("supportticket_data", $model);
57
+
58
+ $this->loadLayout();
59
+ $this->_setActiveMenu("supportticket/supportticket");
60
+
61
+ $this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
62
+
63
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Supportticket Manager"), Mage::helper("adminhtml")->__("Supportticket Manager"));
64
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Supportticket Description"), Mage::helper("adminhtml")->__("Supportticket Description"));
65
+
66
+
67
+ $this->_addContent($this->getLayout()->createBlock("supportticket/adminhtml_supportticket_edit"))->_addLeft($this->getLayout()->createBlock("supportticket/adminhtml_supportticket_edit_tabs"));
68
+ // $this->_addContent($this->getLayout()->createBlock("supportticket/adminhtml_supportticket_edit"));
69
+
70
+ $this->renderLayout();
71
+ }
72
+
73
+ public function saveAction() {
74
+ $post_data = $this->getRequest()->getPost();
75
+ $_helper = Mage::helper('supportticket');
76
+ if (isset($post_data['ticket_repliess']) && $post_data['ticket_repliess']) {
77
+ $post_data['ticket_replies'] = $post_data['ticket_repliess'];
78
+ }
79
+ if (isset($post_data['is_admin1']) && $post_data['is_admin1']) {
80
+ $post_data['is_admin'] = $post_data['is_admin1'];
81
+ }
82
+ if (isset($_FILES['ticket_attachment']['name']) and (file_exists($_FILES['ticket_attachment']['tmp_name']))) {
83
+ try {
84
+ $uploader = new Varien_File_Uploader('ticket_attachment');
85
+ // $uploader->setAllowedExtensions(array('doc', 'docx', 'pdf', 'jpg', 'jpeg', 'png', 'bmp', 'gif'));
86
+ $uploader->setAllowRenameFiles(false);
87
+ $uploader->setFilesDispersion(false);
88
+ $filename = "File-" . time() . $_FILES['ticket_attachment']['name'];
89
+ $filename = str_replace(' ', '-', $filename);
90
+ $path = Mage::getBaseDir('media') . DS . 'supportticket' . DS;
91
+ if (!is_dir($path)) {
92
+ mkdir($path, 0777, true);
93
+ }
94
+ $uploader->save($path, $filename);
95
+ $newFilename = $uploader->getUploadedFileName();
96
+ $post_data['ticket_attachment'] = $filename;
97
+ } catch (Exception $e) {
98
+ $error = true;
99
+ Mage::getSingleton('core/session')->addError(Mage::helper('supportticket')->__('Uploaded File format not allowed'));
100
+ $this->_redirect('supportticket');
101
+ return;
102
+ }
103
+ }
104
+
105
+ if ($post_data) {
106
+ // zend_debug::dump($post_data);exit;
107
+ try {
108
+ $id = $this->getRequest()->getParam("id");
109
+ $code = Mage::getBlockSingleton('supportticket/index')->generateCode(6);
110
+ $date = date('m/d/Y h:i:s a', time());
111
+ $model = Mage::getModel("supportticket/supportticket")
112
+ ->addData($post_data);
113
+ if (isset($post_data['ticket_replies']) && $post_data['ticket_replies']) {
114
+ $model1 = Mage::getModel("supportticket/supportticketreply")
115
+ ->addData($post_data);
116
+ $model1->setTicketReplies($post_data['ticket_replies'])
117
+ ->setReplyTime($date)
118
+ ->save();
119
+ $emailTemplate = Mage::getModel('core/email_template')->loadDefault('supportticketreply_email_email_template');
120
+
121
+ $adminEmail = Mage::getStoreConfig('support_ticket_ultimate/general_email_settings/supervisor_email');
122
+ $adminName = Mage::getStoreConfig('support_ticket_ultimate/general_email_settings/supervisor_name');
123
+ $emailTemplateVariables = array(
124
+ // 'userid' => $post_data['user_id'],
125
+ 'ticketid' => $post_data['ticket_id'],
126
+ 'name' => $post_data['user_name'],
127
+ 'reply' => $post_data['ticket_replies'],
128
+ );
129
+ try {
130
+ $emailTemplate->setSenderName($adminName);
131
+ $emailTemplate->setSenderEmail($adminEmail);
132
+ $emailTemplate->send($adminEmail, $adminName, $emailTemplateVariables);
133
+ } catch (Exception $e) {
134
+ echo $e->getMessage();
135
+ }
136
+ }
137
+
138
+ if (!$id) {
139
+ $model->setTicketId($code)
140
+ ->setCreateTime($date);
141
+ }
142
+ if ($post_data['reply_count'] !== null) {
143
+ $repCount = $post_data['reply_count'];
144
+ }
145
+ $model->setUpdateTime($date)
146
+ ->setId($this->getRequest()->getParam("id"))
147
+ ->setReplyCount(++$repCount)
148
+ ->save();
149
+ $emailTemplate = Mage::getModel('core/email_template')->loadDefault('supportticket_email_email_template');
150
+
151
+ $attachmentFilePath = Mage::getBaseDir('media') . DS . 'supportticket' . DS . $filename;
152
+
153
+ if ($_FILES['ticket_attachment']['name']) {
154
+ if (file_exists($attachmentFilePath)) {
155
+ $fileContents = file_get_contents($attachmentFilePath);
156
+ $attachment = $emailTemplate->getMail()->createAttachment($fileContents);
157
+ $attachment->filename = $filename;
158
+ }
159
+ }
160
+ $priorities = $_helper->getAdminTicketPrioritys();
161
+ $departments = $_helper->getAdminTicketDepartments();
162
+ foreach ($priorities as $key => $value) {
163
+ if ($key == $post_data['ticket_priority']) {
164
+ $post_data['ticket_priority'] = $value;
165
+ }
166
+ }
167
+ foreach ($departments as $key => $value) {
168
+ if ($key == $post_data['department']) {
169
+ $post_data['ticket_department'] = $value;
170
+ }
171
+ }
172
+ $adminEmail = Mage::getStoreConfig('support_ticket_ultimate/general_email_settings/supervisor_email');
173
+ $adminName = Mage::getStoreConfig('support_ticket_ultimate/general_email_settings/supervisor_name');
174
+ $emailTemplateVariables = array(
175
+ // 'userid' => $post_data['user_id'],
176
+ 'ticketid' => isset($post_data['ticket_id']) ? $post_data['ticket_id'] : $code,
177
+ 'name' => $post_data['user_name'],
178
+ 'email' => $post_data['user_email'],
179
+ 'ticketmsg' => $post_data['ticket_message'],
180
+ 'ticketsub' => $post_data['ticket_subject'],
181
+ 'ticketprio' => $post_data['ticket_priority'],
182
+ 'ticketdept' => $post_data['ticket_department']
183
+ );
184
+
185
+ try {
186
+ $emailTemplate->setSenderName($adminName);
187
+ $emailTemplate->setSenderEmail($adminEmail);
188
+ $emailTemplate->send($post_data['user_email'],$post_data['user_name'], $emailTemplateVariables);
189
+ } catch (Exception $e) {
190
+ echo $e->getMessage();
191
+ }
192
+
193
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Support Ticket was successfully saved"));
194
+ Mage::getSingleton("adminhtml/session")->setSupportticketData(false);
195
+
196
+ if ($this->getRequest()->getParam("back")) {
197
+ $this->_redirect("*/*/edit", array("id" => $model->getId()));
198
+ return;
199
+ }
200
+ $this->_redirect("*/*/");
201
+ return;
202
+ } catch (Exception $e) {
203
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
204
+ Mage::getSingleton("adminhtml/session")->setSupportticketData($this->getRequest()->getPost());
205
+ $this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id")));
206
+ return;
207
+ }
208
+ }
209
+ $this->_redirect("*/*/");
210
+ }
211
+
212
+ public function deleteAction() {
213
+ if ($this->getRequest()->getParam("id") > 0) {
214
+ try {
215
+ $model = Mage::getModel("supportticket/supportticket");
216
+ $model->setId($this->getRequest()->getParam("id"))->delete();
217
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Item was successfully deleted"));
218
+ $this->_redirect("*/*/");
219
+ } catch (Exception $e) {
220
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
221
+ $this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id")));
222
+ }
223
+ }
224
+ $this->_redirect("*/*/");
225
+ }
226
+
227
+ public function massRemoveAction() {
228
+ try {
229
+ $ids = $this->getRequest()->getPost('entity_ids', array());
230
+ foreach ($ids as $id) {
231
+ $model = Mage::getModel("supportticket/supportticket");
232
+ $model->setId($id)->delete();
233
+ }
234
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Item(s) was successfully removed"));
235
+ } catch (Exception $e) {
236
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
237
+ }
238
+ $this->_redirect('*/*/');
239
+ }
240
+
241
+ /**
242
+ * Export order grid to CSV format
243
+ */
244
+ public function exportCsvAction() {
245
+ $fileName = 'supportticket.csv';
246
+ $grid = $this->getLayout()->createBlock('supportticket/adminhtml_supportticket_grid');
247
+ $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
248
+ }
249
+
250
+ /**
251
+ * Export order grid to Excel XML format
252
+ */
253
+ public function exportExcelAction() {
254
+ $fileName = 'supportticket.xml';
255
+ $grid = $this->getLayout()->createBlock('supportticket/adminhtml_supportticket_grid');
256
+ $this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
257
+ }
258
+
259
+ }
app/code/community/Uni/Supportticket/controllers/Adminhtml/SupportticketbackendController.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Uni_Supportticket_Adminhtml_SupportticketbackendController extends Mage_Adminhtml_Controller_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+ $this->loadLayout();
7
+ $this->_title($this->__("Support Ticket"));
8
+ $this->renderLayout();
9
+ }
10
+ }
app/code/community/Uni/Supportticket/controllers/Adminhtml/SupportticketdepartmentController.php ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Adminhtml_SupportticketdepartmentController extends Mage_Adminhtml_Controller_Action {
4
+
5
+ /**
6
+ * Set active menu and Breadcrumb
7
+ * @return \Uni_Supportticket_Adminhtml_SupportticketdepartmentController
8
+ */
9
+
10
+ protected function _initAction() {
11
+ $this->loadLayout()->_setActiveMenu("supportticket/supportticketdepartment")->_addBreadcrumb(Mage::helper("adminhtml")->__("Supportticketdepartment Manager"), Mage::helper("adminhtml")->__("Supportticketdepartment Manager"));
12
+ return $this;
13
+ }
14
+
15
+ /**
16
+ * Display grid for generated ticket departments
17
+ */
18
+
19
+ public function indexAction() {
20
+ $this->_title($this->__("Support Ticket - Department"));
21
+ $this->_initAction();
22
+ $this->renderLayout();
23
+ }
24
+
25
+ /**
26
+ * Rendering layout for ticket department edit action
27
+ */
28
+
29
+ public function editAction() {
30
+ $this->_title($this->__("Supportticket"));
31
+ $this->_title($this->__("Supportticket department"));
32
+ $this->_title($this->__("Edit Item"));
33
+
34
+ $id = $this->getRequest()->getParam("id");
35
+ $model = Mage::getModel("supportticket/supportticketdepartment")->load($id);
36
+ if ($model->getId()) {
37
+ Mage::register("supportticketdepartment_data", $model);
38
+ $this->loadLayout();
39
+ $this->_setActiveMenu("supportticket/supportticketdepartment");
40
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Supportticketdepartment Manager"), Mage::helper("adminhtml")->__("Supportticketdepartment Manager"));
41
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Supportticketdepartment Description"), Mage::helper("adminhtml")->__("Supportticketdepartment Description"));
42
+ $this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
43
+ $this->_addContent($this->getLayout()->createBlock("supportticket/adminhtml_supportticketdepartment_edit"))->_addLeft($this->getLayout()->createBlock("supportticket/adminhtml_supportticketdepartment_edit_tabs"));
44
+ $this->renderLayout();
45
+ } else {
46
+ Mage::getSingleton("adminhtml/session")->addError(Mage::helper("supportticket")->__("Item does not exist."));
47
+ $this->_redirect("*/*/");
48
+ }
49
+ }
50
+
51
+ /**
52
+ * Renders layout for new ticket
53
+ */
54
+
55
+ public function newAction() {
56
+
57
+ $this->_title($this->__("Supportticket"));
58
+ $this->_title($this->__("Supportticket Department"));
59
+ $this->_title($this->__("New Item"));
60
+
61
+ $id = $this->getRequest()->getParam("id");
62
+ $model = Mage::getModel("supportticket/supportticketdepartment")->load($id);
63
+
64
+ $data = Mage::getSingleton("adminhtml/session")->getFormData(true);
65
+ if (!empty($data)) {
66
+ $model->setData($data);
67
+ }
68
+
69
+ Mage::register("supportticketdepartment_data", $model);
70
+
71
+ $this->loadLayout();
72
+ $this->_setActiveMenu("supportticket/supportticketdepartment");
73
+
74
+ $this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
75
+
76
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Supportticketdepartment Manager"), Mage::helper("adminhtml")->__("Supportticketdepartment Manager"));
77
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Supportticketdepartment Description"), Mage::helper("adminhtml")->__("Supportticketdepartment Description"));
78
+
79
+
80
+ $this->_addContent($this->getLayout()->createBlock("supportticket/adminhtml_supportticketdepartment_edit"))->_addLeft($this->getLayout()->createBlock("supportticket/adminhtml_supportticketdepartment_edit_tabs"));
81
+
82
+ $this->renderLayout();
83
+ }
84
+
85
+
86
+ /**
87
+ * Save new ticket departments
88
+ */
89
+
90
+ public function saveAction() {
91
+
92
+ $post_data = $this->getRequest()->getPost();
93
+
94
+
95
+ if ($post_data) {
96
+
97
+ try {
98
+
99
+
100
+
101
+ $model = Mage::getModel("supportticket/supportticketdepartment")
102
+ ->addData($post_data)
103
+ ->setId($this->getRequest()->getParam("id"))
104
+ ->save();
105
+
106
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Department was successfully saved"));
107
+ Mage::getSingleton("adminhtml/session")->setSupportticketdepartmentData(false);
108
+
109
+ if ($this->getRequest()->getParam("back")) {
110
+ $this->_redirect("*/*/edit", array("id" => $model->getId()));
111
+ return;
112
+ }
113
+ $this->_redirect("*/*/");
114
+ return;
115
+ } catch (Exception $e) {
116
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
117
+ Mage::getSingleton("adminhtml/session")->setSupportticketdepartmentData($this->getRequest()->getPost());
118
+ $this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id")));
119
+ return;
120
+ }
121
+ }
122
+ $this->_redirect("*/*/");
123
+ }
124
+
125
+
126
+ /**
127
+ * Delete ticket departments
128
+ */
129
+
130
+
131
+ public function deleteAction() {
132
+ if ($this->getRequest()->getParam("id") > 0) {
133
+ try {
134
+ $model = Mage::getModel("supportticket/supportticketdepartment");
135
+ $model->setId($this->getRequest()->getParam("id"))->delete();
136
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Item was successfully deleted"));
137
+ $this->_redirect("*/*/");
138
+ } catch (Exception $e) {
139
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
140
+ $this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id")));
141
+ }
142
+ }
143
+ $this->_redirect("*/*/");
144
+ }
145
+
146
+
147
+
148
+ /**
149
+ * Change the status to enable or disable
150
+ */
151
+
152
+
153
+
154
+ public function massStatusAction() {
155
+ $_count1 = 0;
156
+ $_count2 = 0;
157
+ $_params = $this->getRequest()->getParam('entity_ids', array());
158
+ if (!is_array($_params)) {
159
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please Choose an Item to Change Status'));
160
+ } else {
161
+ try {
162
+ $_stMdoel = Mage::getSingleton('supportticket/supportticketdepartment');
163
+ foreach ($_params as $ids) {
164
+ $_stMdoel->load($ids);
165
+ if ($_stMdoel['is_system'] == 1) {
166
+ $_count1++;
167
+ } else {
168
+ $_stMdoel->load($ids)
169
+ ->setDepStatus($this->getRequest()->getParam('status'))
170
+ ->save();
171
+ $_count2++;
172
+ }
173
+ }
174
+ if ($_count1 > 0) {
175
+ Mage::getSingleton('adminhtml/session')->addError($this->__("Total " . $_count1 . " records have not been updated. The system statuses can’t be disabled"));
176
+ if ($_count2 > 0) {
177
+ $this->_getSession()->addSuccess(
178
+ $this->__('Total ' . $_count2 . ' records successfully updated')
179
+ );
180
+ }
181
+ } elseif ($_count2 > 0) {
182
+ $this->_getSession()->addSuccess(
183
+ $this->__('Total ' . $_count2 . ' records successfully updated')
184
+ );
185
+ } else {
186
+ $this->_getSession()->addSuccess(
187
+ $this->__('Total ' . $_count1 + $_count2 . ' records successfully updated')
188
+ );
189
+ }
190
+ } catch (Exception $ex) {
191
+ $this->_getSession()->addError($ex->getMessage());
192
+ }
193
+ }
194
+ $this->_redirect('*/*/index');
195
+ }
196
+
197
+ /**
198
+ * Export order grid to CSV format
199
+ */
200
+ public function exportCsvAction() {
201
+ $fileName = 'supportticketdepartment.csv';
202
+ $grid = $this->getLayout()->createBlock('supportticket/adminhtml_supportticketdepartment_grid');
203
+ $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
204
+ }
205
+
206
+ /**
207
+ * Export order grid to Excel XML format
208
+ */
209
+ public function exportExcelAction() {
210
+ $fileName = 'supportticketdepartment.xml';
211
+ $grid = $this->getLayout()->createBlock('supportticket/adminhtml_supportticketdepartment_grid');
212
+ $this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
213
+ }
214
+
215
+ }
app/code/community/Uni/Supportticket/controllers/Adminhtml/SupportticketpriorityController.php ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Adminhtml_SupportticketpriorityController extends Mage_Adminhtml_Controller_Action {
4
+
5
+ /**
6
+ * Set active menu and Breadcrumb
7
+ * @return \Uni_Supportticket_Adminhtml_SupportticketpriorityController
8
+ */
9
+
10
+
11
+ protected function _initAction() {
12
+ $this->loadLayout()->_setActiveMenu("supportticket/supportticketpriority")->_addBreadcrumb(Mage::helper("adminhtml")->__("Supportticketpriority Manager"), Mage::helper("adminhtml")->__("Supportticketpriority Manager"));
13
+ return $this;
14
+ }
15
+
16
+
17
+ /**
18
+ * Display grid for generated ticket priorities
19
+ */
20
+
21
+ public function indexAction() {
22
+ $this->_title($this->__("Supportticket"));
23
+ $this->_title($this->__("Manager Supportticketpriority"));
24
+
25
+ $this->_initAction();
26
+ $this->renderLayout();
27
+ }
28
+
29
+ /**
30
+ * Rendering layout for ticket edit action
31
+ */
32
+
33
+ public function editAction() {
34
+ $this->_title($this->__("Supportticket"));
35
+ $this->_title($this->__("Supportticketpriority"));
36
+ $this->_title($this->__("Edit Item"));
37
+
38
+ $id = $this->getRequest()->getParam("id");
39
+ $model = Mage::getModel("supportticket/supportticketpriority")->load($id);
40
+ if ($model->getId()) {
41
+ Mage::register("supportticketpriority_data", $model);
42
+ $this->loadLayout();
43
+ $this->_setActiveMenu("supportticket/supportticketpriority");
44
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Supportticketpriority Manager"), Mage::helper("adminhtml")->__("Supportticketpriority Manager"));
45
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Supportticketpriority Description"), Mage::helper("adminhtml")->__("Supportticketpriority Description"));
46
+ $this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
47
+ $this->_addContent($this->getLayout()->createBlock("supportticket/adminhtml_supportticketpriority_edit"))->_addLeft($this->getLayout()->createBlock("supportticket/adminhtml_supportticketpriority_edit_tabs"));
48
+ $this->renderLayout();
49
+ } else {
50
+ Mage::getSingleton("adminhtml/session")->addError(Mage::helper("supportticket")->__("Item does not exist."));
51
+ $this->_redirect("*/*/");
52
+ }
53
+ }
54
+
55
+ /**
56
+ * Renders layout for new ticket priority
57
+ */
58
+
59
+ public function newAction() {
60
+
61
+ $this->_title($this->__("Supportticket"));
62
+ $this->_title($this->__("Supportticketpriority"));
63
+ $this->_title($this->__("New Item"));
64
+
65
+ $id = $this->getRequest()->getParam("id");
66
+ $model = Mage::getModel("supportticket/supportticketpriority")->load($id);
67
+
68
+ $data = Mage::getSingleton("adminhtml/session")->getFormData(true);
69
+ if (!empty($data)) {
70
+ $model->setData($data);
71
+ }
72
+
73
+ Mage::register("supportticketpriority_data", $model);
74
+
75
+ $this->loadLayout();
76
+ $this->_setActiveMenu("supportticket/supportticketpriority");
77
+
78
+ $this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
79
+
80
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Supportticketpriority Manager"), Mage::helper("adminhtml")->__("Supportticketpriority Manager"));
81
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Supportticketpriority Description"), Mage::helper("adminhtml")->__("Supportticketpriority Description"));
82
+
83
+
84
+ $this->_addContent($this->getLayout()->createBlock("supportticket/adminhtml_supportticketpriority_edit"))->_addLeft($this->getLayout()->createBlock("supportticket/adminhtml_supportticketpriority_edit_tabs"));
85
+
86
+ $this->renderLayout();
87
+ }
88
+
89
+
90
+ /**
91
+ * Save new ticket priority
92
+ */
93
+ public function saveAction() {
94
+
95
+ $post_data = $this->getRequest()->getPost();
96
+
97
+
98
+ if ($post_data) {
99
+
100
+ try {
101
+
102
+
103
+
104
+ $model = Mage::getModel("supportticket/supportticketpriority")
105
+ ->addData($post_data)
106
+ ->setId($this->getRequest()->getParam("id"))
107
+ ->save();
108
+
109
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Supportticketpriority was successfully saved"));
110
+ Mage::getSingleton("adminhtml/session")->setSupportticketpriorityData(false);
111
+
112
+ if ($this->getRequest()->getParam("back")) {
113
+ $this->_redirect("*/*/edit", array("id" => $model->getId()));
114
+ return;
115
+ }
116
+ $this->_redirect("*/*/");
117
+ return;
118
+ } catch (Exception $e) {
119
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
120
+ Mage::getSingleton("adminhtml/session")->setSupportticketpriorityData($this->getRequest()->getPost());
121
+ $this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id")));
122
+ return;
123
+ }
124
+ }
125
+ $this->_redirect("*/*/");
126
+ }
127
+
128
+
129
+ /**
130
+ * Delete ticket priority
131
+ */
132
+
133
+ public function deleteAction() {
134
+ if ($this->getRequest()->getParam("id") > 0) {
135
+ try {
136
+ $model = Mage::getModel("supportticket/supportticketpriority");
137
+ $model->setId($this->getRequest()->getParam("id"))->delete();
138
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Item was successfully deleted"));
139
+ $this->_redirect("*/*/");
140
+ } catch (Exception $e) {
141
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
142
+ $this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id")));
143
+ }
144
+ }
145
+ $this->_redirect("*/*/");
146
+ }
147
+
148
+
149
+ /**
150
+ * Change status of ticket priority
151
+ */
152
+
153
+
154
+ public function massStatusAction() {
155
+ $_count1 = 0;
156
+ $_count2 = 0;
157
+ $_params = $this->getRequest()->getParam('entity_ids', array());
158
+ if (!is_array($_params)) {
159
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please Choose an Item to Change Status'));
160
+ } else {
161
+ try {
162
+ $_stMdoel = Mage::getSingleton('supportticket/supportticketpriority');
163
+ foreach ($_params as $ids) {
164
+ $_stMdoel->load($ids);
165
+ if ($_stMdoel['is_system'] == 1) {
166
+ $_count1++;
167
+ } else {
168
+ $_stMdoel->load($ids)
169
+ ->setTicketPriority($this->getRequest()->getParam('status'))
170
+ ->save();
171
+ $_count2++;
172
+ }
173
+ }
174
+ if ($_count1 > 0) {
175
+ Mage::getSingleton('adminhtml/session')->addError($this->__("Total " . $_count1 . " records have not been updated. The system statuses can’t be disabled"));
176
+ if ($_count2 > 0) {
177
+ $this->_getSession()->addSuccess(
178
+ $this->__('Total ' . $_count2 . ' records successfully updated')
179
+ );
180
+ }
181
+ } elseif ($_count2 > 0) {
182
+ $this->_getSession()->addSuccess(
183
+ $this->__('Total ' . $_count2 . ' records successfully updated')
184
+ );
185
+ } else {
186
+ $this->_getSession()->addSuccess(
187
+ $this->__('Total ' . $_count1 + $_count2 . ' records successfully updated')
188
+ );
189
+ }
190
+ } catch (Exception $ex) {
191
+ $this->_getSession()->addError($ex->getMessage());
192
+ }
193
+ }
194
+ $this->_redirect('*/*/index');
195
+ }
196
+
197
+ /**
198
+ * Export order grid to CSV format
199
+ */
200
+ public function exportCsvAction() {
201
+ $fileName = 'supportticketpriority.csv';
202
+ $grid = $this->getLayout()->createBlock('supportticket/adminhtml_supportticketpriority_grid');
203
+ $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
204
+ }
205
+
206
+ /**
207
+ * Export order grid to Excel XML format
208
+ */
209
+ public function exportExcelAction() {
210
+ $fileName = 'supportticketpriority.xml';
211
+ $grid = $this->getLayout()->createBlock('supportticket/adminhtml_supportticketpriority_grid');
212
+ $this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
213
+ }
214
+
215
+ }
app/code/community/Uni/Supportticket/controllers/Adminhtml/SupportticketreplyController.php ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Adminhtml_SupportticketreplyController extends Mage_Adminhtml_Controller_Action {
4
+ /**
5
+ * Set active menu and Breadcrumb
6
+ * @return \Uni_Supportticket_Adminhtml_SupportticketreplyController
7
+ */
8
+ protected function _initAction() {
9
+ $this->loadLayout()->_setActiveMenu("supportticket/supportticketreply")->_addBreadcrumb(Mage::helper("adminhtml")->__("Supportticketreply Manager"), Mage::helper("adminhtml")->__("Supportticketreply Manager"));
10
+ return $this;
11
+ }
12
+
13
+
14
+ /**
15
+ * Display grid for generated ticket reply
16
+ */
17
+ public function indexAction() {
18
+ $this->_title($this->__("Supportticket"));
19
+ $this->_title($this->__("Manager Supportticketreply"));
20
+
21
+ $this->_initAction();
22
+ $this->renderLayout();
23
+ }
24
+
25
+
26
+ /**
27
+ * Rendering layout for ticket edit action
28
+ */
29
+
30
+ public function editAction() {
31
+ $this->_title($this->__("Supportticket"));
32
+ $this->_title($this->__("Supportticketreply"));
33
+ $this->_title($this->__("Edit Item"));
34
+
35
+ $id = $this->getRequest()->getParam("id");
36
+ $model = Mage::getModel("supportticket/supportticketreply")->load($id);
37
+ if ($model->getId()) {
38
+ Mage::register("supportticketreply_data", $model);
39
+ $this->loadLayout();
40
+ $this->_setActiveMenu("supportticket/supportticketreply");
41
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Supportticketreply Manager"), Mage::helper("adminhtml")->__("Supportticketreply Manager"));
42
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Supportticketreply Description"), Mage::helper("adminhtml")->__("Supportticketreply Description"));
43
+ $this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
44
+ $this->_addContent($this->getLayout()->createBlock("supportticket/adminhtml_supportticketreply_edit"))->_addLeft($this->getLayout()->createBlock("supportticket/adminhtml_supportticketreply_edit_tabs"));
45
+ // $this->_addContent($this->getLayout()->createBlock("supportticket/adminhtml_supportticketreply_edit"));
46
+ $this->renderLayout();
47
+ } else {
48
+ Mage::getSingleton("adminhtml/session")->addError(Mage::helper("supportticket")->__("Item does not exist."));
49
+ $this->_redirect("*/*/");
50
+ }
51
+ }
52
+
53
+ /**
54
+ * Renders layout for new ticket priority
55
+ */
56
+
57
+ public function newAction() {
58
+
59
+ $this->_title($this->__("Supportticket"));
60
+ $this->_title($this->__("Supportticketreply"));
61
+ $this->_title($this->__("New Item"));
62
+
63
+ $id = $this->getRequest()->getParam("id");
64
+ $model = Mage::getModel("supportticket/supportticketreply")->load($id);
65
+
66
+ $data = Mage::getSingleton("adminhtml/session")->getFormData(true);
67
+ if (!empty($data)) {
68
+ $model->setData($data);
69
+ }
70
+
71
+ Mage::register("supportticketreply_data", $model);
72
+
73
+ $this->loadLayout();
74
+ $this->_setActiveMenu("supportticket/supportticketreply");
75
+
76
+ $this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
77
+
78
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Supportticketreply Manager"), Mage::helper("adminhtml")->__("Supportticketreply Manager"));
79
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Supportticketreply Description"), Mage::helper("adminhtml")->__("Supportticketreply Description"));
80
+
81
+
82
+ $this->_addContent($this->getLayout()->createBlock("supportticket/adminhtml_supportticketreply_edit"));
83
+ // $this->_addContent($this->getLayout()->createBlock("supportticket/adminhtml_supportticketreply_edit"))->_addLeft($this->getLayout()->createBlock("supportticket/adminhtml_supportticketreply_edit_tabs"));
84
+
85
+ $this->renderLayout() ;
86
+ }
87
+
88
+ /**
89
+ * Save new ticket priority
90
+ */
91
+
92
+ public function saveAction() {
93
+
94
+ $post_data = $this->getRequest()->getPost();
95
+
96
+ // Zend_Debug::dump($post_data);exit;
97
+
98
+ if ($post_data) {
99
+
100
+ try {
101
+
102
+
103
+ $model = Mage::getModel("supportticket/supportticketreply")
104
+ ->addData($post_data)
105
+ ->setId($this->getRequest()->getParam("id"))
106
+ ->save();
107
+
108
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Supportticketreply was successfully saved"));
109
+ Mage::getSingleton("adminhtml/session")->setSupportticketreplyData(false);
110
+
111
+ if ($this->getRequest()->getParam("back")) {
112
+ $this->_redirect("*/*/edit", array("id" => $model->getId()));
113
+ return;
114
+ }
115
+ $this->_redirect("*/*/");
116
+ return;
117
+ } catch (Exception $e) {
118
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
119
+ Mage::getSingleton("adminhtml/session")->setSupportticketreplyData($this->getRequest()->getPost());
120
+ $this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id")));
121
+ return;
122
+ }
123
+ }
124
+ $this->_redirect("*/*/");
125
+ }
126
+
127
+
128
+ /**
129
+ * delete the ticket priority
130
+ */
131
+
132
+ public function deleteAction() {
133
+ if ($this->getRequest()->getParam("id") > 0) {
134
+ try {
135
+ $model = Mage::getModel("supportticket/supportticketreply");
136
+ $model->setId($this->getRequest()->getParam("id"))->delete();
137
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Item was successfully deleted"));
138
+ $this->_redirect("*/*/");
139
+ } catch (Exception $e) {
140
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
141
+ $this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id")));
142
+ }
143
+ }
144
+ $this->_redirect("*/*/");
145
+ }
146
+
147
+
148
+
149
+ /**
150
+ * Export order grid to CSV format
151
+ */
152
+ public function exportCsvAction() {
153
+ $fileName = 'supportticketreply.csv';
154
+ $grid = $this->getLayout()->createBlock('supportticket/adminhtml_supportticketreply_grid');
155
+ $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
156
+ }
157
+
158
+ /**
159
+ * Export order grid to Excel XML format
160
+ */
161
+ public function exportExcelAction() {
162
+ $fileName = 'supportticketreply.xml';
163
+ $grid = $this->getLayout()->createBlock('supportticket/adminhtml_supportticketreply_grid');
164
+ $this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
165
+ }
166
+
167
+ }
app/code/community/Uni/Supportticket/controllers/Adminhtml/SupportticketstatusController.php ADDED
@@ -0,0 +1,224 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_Adminhtml_SupportticketstatusController extends Mage_Adminhtml_Controller_Action {
4
+
5
+
6
+ /**
7
+ * Set active menu and Breadcrumb
8
+ * @return \Uni_Supportticket_Adminhtml_SupportticketstatusController
9
+ */
10
+
11
+
12
+ protected function _initAction() {
13
+ $this->loadLayout()->_setActiveMenu("supportticket/supportticketstatus")->_addBreadcrumb(Mage::helper("adminhtml")->__("Supportticketstatus Manager"), Mage::helper("adminhtml")->__("Supportticketstatus Manager"));
14
+ return $this;
15
+ }
16
+
17
+
18
+ /**
19
+ * Display grid for generated ticket statuses
20
+ */
21
+ public function indexAction() {
22
+ $this->_title($this->__("Supportticket"));
23
+ $this->_title($this->__("Manager Supportticketstatus"));
24
+
25
+ $this->_initAction();
26
+ $this->renderLayout();
27
+ }
28
+
29
+
30
+ /**
31
+ * Rendering layout for ticket edit action
32
+ */
33
+
34
+
35
+ public function editAction() {
36
+ $this->_title($this->__("Supportticket"));
37
+ $this->_title($this->__("Supportticketstatus"));
38
+ $this->_title($this->__("Edit Item"));
39
+
40
+ $id = $this->getRequest()->getParam("id");
41
+ $model = Mage::getModel("supportticket/supportticketstatus")->load($id);
42
+ if ($model->getId()) {
43
+ Mage::register("supportticketstatus_data", $model);
44
+ $this->loadLayout();
45
+ $this->_setActiveMenu("supportticket/supportticketstatus");
46
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Supportticketstatus Manager"), Mage::helper("adminhtml")->__("Supportticketstatus Manager"));
47
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Supportticketstatus Description"), Mage::helper("adminhtml")->__("Supportticketstatus Description"));
48
+ $this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
49
+ $this->_addContent($this->getLayout()->createBlock("supportticket/adminhtml_supportticketstatus_edit"))->_addLeft($this->getLayout()->createBlock("supportticket/adminhtml_supportticketstatus_edit_tabs"));
50
+ $this->renderLayout();
51
+ } else {
52
+ Mage::getSingleton("adminhtml/session")->addError(Mage::helper("supportticket")->__("Item does not exist."));
53
+ $this->_redirect("*/*/");
54
+ }
55
+ }
56
+
57
+
58
+
59
+ /**
60
+ * Renders layout for new ticket priority
61
+ */
62
+
63
+
64
+ public function newAction() {
65
+
66
+ $this->_title($this->__("Supportticket"));
67
+ $this->_title($this->__("Supportticketstatus"));
68
+ $this->_title($this->__("New Item"));
69
+
70
+ $id = $this->getRequest()->getParam("id");
71
+ $model = Mage::getModel("supportticket/supportticketstatus")->load($id);
72
+
73
+ $data = Mage::getSingleton("adminhtml/session")->getFormData(true);
74
+ if (!empty($data)) {
75
+ $model->setData($data);
76
+ }
77
+
78
+ Mage::register("supportticketstatus_data", $model);
79
+
80
+ $this->loadLayout();
81
+ $this->_setActiveMenu("supportticket/supportticketstatus");
82
+
83
+ $this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
84
+
85
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Supportticketstatus Manager"), Mage::helper("adminhtml")->__("Supportticketstatus Manager"));
86
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Supportticketstatus Description"), Mage::helper("adminhtml")->__("Supportticketstatus Description"));
87
+
88
+
89
+ $this->_addContent($this->getLayout()->createBlock("supportticket/adminhtml_supportticketstatus_edit"))->_addLeft($this->getLayout()->createBlock("supportticket/adminhtml_supportticketstatus_edit_tabs"));
90
+ // $this->_addContent($this->getLayout()->createBlock("supportticket/adminhtml_supportticketstatus_edit"));
91
+
92
+ $this->renderLayout();
93
+ }
94
+
95
+
96
+ /**
97
+ * Save new ticket status
98
+ */
99
+
100
+ public function saveAction() {
101
+
102
+ $post_data = $this->getRequest()->getPost();
103
+
104
+
105
+ if ($post_data) {
106
+
107
+ try {
108
+
109
+
110
+
111
+ $model = Mage::getModel("supportticket/supportticketstatus")
112
+ ->addData($post_data)
113
+ ->setId($this->getRequest()->getParam("id"))
114
+ ->save();
115
+
116
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Supportticketstatus was successfully saved"));
117
+ Mage::getSingleton("adminhtml/session")->setSupportticketstatusData(false);
118
+
119
+ if ($this->getRequest()->getParam("back")) {
120
+ $this->_redirect("*/*/edit", array("id" => $model->getId()));
121
+ return;
122
+ }
123
+ $this->_redirect("*/*/");
124
+ return;
125
+ } catch (Exception $e) {
126
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
127
+ Mage::getSingleton("adminhtml/session")->setSupportticketstatusData($this->getRequest()->getPost());
128
+ $this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id")));
129
+ return;
130
+ }
131
+ }
132
+ $this->_redirect("*/*/");
133
+ }
134
+
135
+
136
+ /**
137
+ * Delete ticket status
138
+ */
139
+
140
+ public function deleteAction() {
141
+ if ($this->getRequest()->getParam("id") > 0) {
142
+ try {
143
+ $model = Mage::getModel("supportticket/supportticketstatus");
144
+ $model->setId($this->getRequest()->getParam("id"))->delete();
145
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Item was successfully deleted"));
146
+ $this->_redirect("*/*/");
147
+ } catch (Exception $e) {
148
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
149
+ $this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id")));
150
+ }
151
+ }
152
+ $this->_redirect("*/*/");
153
+ }
154
+
155
+
156
+
157
+ /**
158
+ * Change status of ticket status
159
+ */
160
+
161
+
162
+ public function massStatusAction() {
163
+ $_count1 = 0;
164
+ $_count2 = 0;
165
+ $_params = $this->getRequest()->getParam('entity_ids', array());
166
+ if (!is_array($_params)) {
167
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please Choose an Item to Change Status'));
168
+ } else {
169
+ try {
170
+ $_stMdoel = Mage::getSingleton('supportticket/supportticketstatus');
171
+ foreach ($_params as $ids) {
172
+ $_stMdoel->load($ids);
173
+ if ($_stMdoel['is_system'] == 1) {
174
+ $_count1++;
175
+ } else {
176
+ $_stMdoel->load($ids)
177
+ ->setTicketStatus($this->getRequest()->getParam('status'))
178
+ ->save();
179
+ $_count2++;
180
+ }
181
+ }
182
+ if ($_count1 > 0) {
183
+ Mage::getSingleton('adminhtml/session')->addError($this->__("Total " . $_count1 . " records have not been updated. The system statuses can’t be disabled"));
184
+ if ($_count2 > 0) {
185
+ $this->_getSession()->addSuccess(
186
+ $this->__('Total ' . $_count2 . ' records successfully updated')
187
+ );
188
+ }
189
+ } elseif ($_count2 > 0) {
190
+ $this->_getSession()->addSuccess(
191
+ $this->__('Total ' . $_count2 . ' records successfully updated')
192
+ );
193
+ } else {
194
+ $this->_getSession()->addSuccess(
195
+ $this->__('Total ' . $_count1 + $_count2 . ' records successfully updated')
196
+ );
197
+ }
198
+ } catch (Exception $ex) {
199
+ $this->_getSession()->addError($ex->getMessage());
200
+ }
201
+ }
202
+ $this->_redirect('*/*/index');
203
+ }
204
+
205
+
206
+ /**
207
+ * Export order grid to CSV format
208
+ */
209
+ public function exportCsvAction() {
210
+ $fileName = 'supportticketstatus.csv';
211
+ $grid = $this->getLayout()->createBlock('supportticket/adminhtml_supportticketstatus_grid');
212
+ $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
213
+ }
214
+
215
+ /**
216
+ * Export order grid to Excel XML format
217
+ */
218
+ public function exportExcelAction() {
219
+ $fileName = 'supportticketstatus.xml';
220
+ $grid = $this->getLayout()->createBlock('supportticket/adminhtml_supportticketstatus_grid');
221
+ $this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
222
+ }
223
+
224
+ }
app/code/community/Uni/Supportticket/controllers/IndexController.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Uni_Supportticket_IndexController extends Mage_Core_Controller_Front_Action{
3
+
4
+ /**
5
+ * Display support ticket block on frontend
6
+ */
7
+ public function IndexAction() {
8
+ $this->loadLayout();
9
+ $this->getLayout()->getBlock("head")->setTitle($this->__("Support Ticket"));
10
+ $breadcrumbs = $this->getLayout()->getBlock("breadcrumbs");
11
+ $breadcrumbs->addCrumb("home", array(
12
+ "label" => $this->__("Home Page"),
13
+ "title" => $this->__("Home Page"),
14
+ "link" => Mage::getBaseUrl()
15
+ ));
16
+
17
+ $breadcrumbs->addCrumb("support ticket", array(
18
+ "label" => $this->__("Support Ticket"),
19
+ "title" => $this->__("Support Ticket")
20
+ ));
21
+
22
+ $this->renderLayout();
23
+
24
+ }
25
+ }
app/code/community/Uni/Supportticket/controllers/SupportticketController.php ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_SupportticketController extends Mage_Core_Controller_Front_Action {
4
+
5
+ const SET_DISABLED = 3;
6
+
7
+ /**
8
+ * Display support ticket on frontend
9
+ */
10
+
11
+
12
+ public function IndexAction() {
13
+
14
+ $this->loadLayout();
15
+ $this->getLayout()->getBlock("head")->setTitle($this->__("Supportticket"));
16
+ $breadcrumbs = $this->getLayout()->getBlock("breadcrumbs");
17
+ $breadcrumbs->addCrumb("home", array(
18
+ "label" => $this->__("Home Page"),
19
+ "title" => $this->__("Home Page"),
20
+ "link" => Mage::getBaseUrl()
21
+ ));
22
+
23
+ $breadcrumbs->addCrumb("support ticket", array(
24
+ "label" => $this->__("Supportticket"),
25
+ "title" => $this->__("Supportticket")
26
+ ));
27
+
28
+ $this->renderLayout();
29
+ }
30
+
31
+
32
+
33
+ /**
34
+ * Save support ticket data
35
+ */
36
+
37
+
38
+ public function saveAction() {
39
+ $post_data = $this->getRequest()->getPost();
40
+ $_helper = Mage::helper('supportticket');
41
+
42
+ if ($post_data) {
43
+ try {
44
+ $error = false;
45
+
46
+ // if (!Zend_Validate::is(trim($post_data['ticket_subject']), 'NotEmpty')) {
47
+ // $error = true;
48
+ // }
49
+ if (!Zend_Validate::is(trim($post_data['ticket_message']), 'NotEmpty')) {
50
+ $error = true;
51
+ }
52
+ $filename = '';
53
+ if (isset($_FILES['attachment']['name']) and (file_exists($_FILES['attachment']['tmp_name']))) {
54
+ try {
55
+ $uploader = new Varien_File_Uploader('attachment');
56
+ // $uploader->setAllowedExtensions(array('doc', 'docx', 'pdf', 'jpg', 'jpeg', 'png', 'bmp', 'gif'));
57
+ $uploader->setAllowRenameFiles(false);
58
+ $uploader->setFilesDispersion(false);
59
+ $filename = "File-" . time() . $_FILES['attachment']['name'];
60
+ $filename = str_replace(' ', '-', $filename);
61
+ $path = Mage::getBaseDir('media') . DS . 'supportticket' . DS;
62
+ if (!is_dir($path)) {
63
+ mkdir($path, 0777, true);
64
+ }
65
+ $uploader->save($path, $filename);
66
+ $newFilename = $uploader->getUploadedFileName();
67
+ } catch (Exception $e) {
68
+ $error = true;
69
+ Mage::getSingleton('core/session')->addError(Mage::helper('supportticket')->__('Uploaded File format not allowed'));
70
+ $this->_redirect('supportticket');
71
+ return;
72
+ }
73
+ }
74
+ if ($error) {
75
+ throw new Exception();
76
+ }
77
+ $date = date('m/d/Y h:i:s a', time());
78
+ $model = Mage::getModel("supportticket/supportticket")
79
+ ->addData($post_data)
80
+ ->setUpdateTime($date)
81
+ ->setCreateTime($date)
82
+ ->setId($this->getRequest()->getParam("id"));
83
+ if ($_FILES['attachment']['name'] == ''):
84
+ $model->setTicketAttachment('No Attachment Found');
85
+ else:
86
+ $model->setTicketAttachment($newFilename);
87
+ endif;
88
+ $model->save();
89
+ $emailTemplate = Mage::getModel('core/email_template')->loadDefault('supportticket_email_email_template');
90
+
91
+ $attachmentFilePath = Mage::getBaseDir('media') . DS . 'supportticket' . DS . $filename;
92
+
93
+ if ($_FILES['attachment']['name']) {
94
+ if (file_exists($attachmentFilePath)) {
95
+ $fileContents = file_get_contents($attachmentFilePath);
96
+ $attachment = $emailTemplate->getMail()->createAttachment($fileContents);
97
+ $attachment->filename = $filename;
98
+ }
99
+ }
100
+ $priorities = $_helper->getAdminTicketPrioritys();
101
+ $departments = $_helper->getAdminTicketDepartments();
102
+ foreach ($priorities as $key => $value) {
103
+ if ($key == $post_data['ticket_priority']) {
104
+ $post_data['ticket_priority'] = $value;
105
+ }
106
+ }
107
+ foreach ($departments as $key => $value) {
108
+ if ($key == $post_data['ticket_department']) {
109
+ $post_data['ticket_department'] = $value;
110
+ }
111
+ }
112
+ $adminEmail = Mage::getStoreConfig('support_ticket_ultimate/general_email_settings/supervisor_email');
113
+ $adminName = Mage::getStoreConfig('support_ticket_ultimate/general_email_settings/supervisor_name');
114
+ $emailTemplateVariables = array(
115
+ 'userid' => $post_data['user_id'],
116
+ 'ticketid' => $post_data['ticket_id'],
117
+ 'name' => $post_data['user_name'],
118
+ 'email' => $post_data['user_email'],
119
+ 'ticketmsg' => $post_data['ticket_message'],
120
+ 'ticketsub' => $post_data['ticket_subject'],
121
+ 'ticketprio' => $post_data['ticket_priority'],
122
+ 'ticketdept' => $post_data['ticket_department']
123
+ );
124
+ try {
125
+ $emailTemplate->setSenderName($post_data['user_name']);
126
+ $emailTemplate->setSenderEmail($post_data['user_email']);
127
+ $emailTemplate->send($adminEmail, $adminName, $emailTemplateVariables);
128
+ } catch (Exception $e) {
129
+ echo $e->getMessage();
130
+ }
131
+
132
+ Mage::getSingleton("core/session")->addSuccess(Mage::helper("supportticket")->__("Support Ticket was successfully Posted"));
133
+ Mage::getSingleton("core/session")->setSupportticketData(false);
134
+
135
+ if ($this->getRequest()->getParam("back")) {
136
+ $this->_redirect("*/*/edit", array("id" => $model->getId()));
137
+ return;
138
+ }
139
+ $this->_redirectReferer();
140
+ return;
141
+ } catch (Exception $e) {
142
+ Mage::getSingleton("core/session")->addError($e->getMessage());
143
+ Mage::getSingleton("core/session")->setSupportticketData($this->getRequest()->getPost());
144
+ $this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id")));
145
+ return;
146
+ }
147
+ }
148
+ $this->_redirect("*/*/");
149
+ }
150
+
151
+
152
+
153
+
154
+ /**
155
+ * Close the support ticket
156
+ */
157
+
158
+ public function closeTicketAction(){
159
+ $ticket_id = $this->getRequest()->getParam('id');
160
+ $model = Mage::getModel('supportticket/supportticket')->load($ticket_id);
161
+ $model->setTicketStatus(self::SET_DISABLED)->save();
162
+ $this->_redirect('*/*/',array('id'=>$ticket_id));
163
+ }
164
+
165
+ }
app/code/community/Uni/Supportticket/controllers/SupportticketreplyController.php ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Uni_Supportticket_SupportticketreplyController extends Mage_Core_Controller_Front_Action {
4
+
5
+
6
+
7
+ /**
8
+ * Display support ticket reply on frontend
9
+ */
10
+
11
+ public function IndexAction() {
12
+
13
+ $this->loadLayout();
14
+ $this->getLayout()->getBlock("head")->setTitle($this->__("Supportticketreply"));
15
+ $breadcrumbs = $this->getLayout()->getBlock("breadcrumbs");
16
+ $breadcrumbs->addCrumb("home", array(
17
+ "label" => $this->__("Home Page"),
18
+ "title" => $this->__("Home Page"),
19
+ "link" => Mage::getBaseUrl()
20
+ ));
21
+
22
+ $breadcrumbs->addCrumb("support ticket", array(
23
+ "label" => $this->__("Supportticketreply"),
24
+ "title" => $this->__("Supportticketreply")
25
+ ));
26
+
27
+ $this->renderLayout();
28
+ }
29
+
30
+
31
+
32
+
33
+ /**
34
+ * Save support ticket reply of user
35
+ */
36
+
37
+
38
+ public function saveAction() {
39
+ $post_data = $this->getRequest()->getPost();
40
+ if ($post_data) {
41
+ try {
42
+ $error = false;
43
+ if (!Zend_Validate::is(trim($post_data['ticket_replies']), 'NotEmpty')) {
44
+ $error = true;
45
+ }
46
+ $filename = '';
47
+ if (isset($_FILES['ticket_attachment']['name']) and (file_exists($_FILES['ticket_attachment']['tmp_name']))) {
48
+ try {
49
+ $uploader = new Varien_File_Uploader('ticket_attachment');
50
+ // $uploader->setAllowedExtensions(array('doc', 'docx', 'pdf', 'jpg', 'jpeg', 'png', 'bmp', 'gif'));
51
+ $uploader->setAllowRenameFiles(false);
52
+ $uploader->setFilesDispersion(false);
53
+ $filename = "File-" . time() . $_FILES['ticket_attachment']['name'];
54
+ $filename = str_replace(' ', '-', $filename);
55
+ $path = Mage::getBaseDir('media') . DS . 'supportticketreply' . DS;
56
+ if (!is_dir($path)) {
57
+ mkdir($path, 0777, true);
58
+ }
59
+ $uploader->save($path, $filename);
60
+ $newFilename = $uploader->getUploadedFileName();
61
+ } catch (Exception $e) {
62
+ $error = true;
63
+ Mage::getSingleton('core/session')->addError(Mage::helper('supportticket')->__('Uploaded File format not allowed'));
64
+ $this->_redirect('supportticket');
65
+ return;
66
+ }
67
+ }
68
+ if ($error) {
69
+ throw new Exception();
70
+ }
71
+
72
+ $date = date('m/d/Y h:i:s a', time());
73
+ //for save reply count
74
+ $supporttModel = Mage::getModel("supportticket/supportticket")->load($post_data['id']);
75
+ $repCount = $supporttModel['reply_count'];
76
+ $supporttModel->setReplyCount( ++$repCount);
77
+ $supporttModel->setUpdateTime($date);
78
+ $supporttModel->save();
79
+
80
+ $model = Mage::getModel("supportticket/supportticketreply")
81
+ ->addData($post_data)
82
+ ->setReplyTime($date);
83
+ if ($_FILES['ticket_attachment']['name'] == ''):
84
+ $model->setTicketAttachment('No Attachment Found');
85
+ else:
86
+ $model->setTicketAttachment($filename);
87
+ endif;
88
+ $model->save();
89
+
90
+ $emailTemplate = Mage::getModel('core/email_template')->loadDefault('supportticketreply_email_email_template');
91
+ $attachmentFilePath = Mage::getBaseDir('media') . DS . 'supportticketreply' . DS . $filename;
92
+ if ($_FILES['ticket_attachment']['name']) {
93
+ if (file_exists($attachmentFilePath)) {
94
+ $fileContents = file_get_contents($attachmentFilePath);
95
+ $attachment = $emailTemplate->getMail()->createAttachment($fileContents);
96
+ $attachment->filename = $filename;
97
+ }
98
+ }
99
+
100
+ $adminEmail = Mage::getStoreConfig('support_ticket_ultimate/general_email_settings/supervisor_email');
101
+ $adminName = Mage::getStoreConfig('support_ticket_ultimate/general_email_settings/supervisor_name');
102
+ $emailTemplateVariables = array(
103
+ 'userid' => $post_data['user_id'],
104
+ 'ticketid' => $post_data['ticket_id'],
105
+ 'name' => $post_data['user_name'],
106
+ 'reply' => $post_data['ticket_replies'],
107
+ );
108
+ try {
109
+ $emailTemplate->setSenderName($adminName);
110
+ $emailTemplate->setSenderEmail($adminEmail);
111
+ $emailTemplate->send($adminEmail, $adminName, $emailTemplateVariables);
112
+ } catch (Exception $e) {
113
+ echo $e->getMessage();
114
+ }
115
+
116
+ Mage::getSingleton("core/session")->addSuccess(Mage::helper("supportticket")->__("Reply was successfully Posted"));
117
+ Mage::getSingleton("core/session")->setSupportticketData(false);
118
+
119
+ if ($this->getRequest()->getParam("back")) {
120
+ $this->_redirect("*/*/edit", array("id" => $model->getId()));
121
+ return;
122
+ }
123
+ $this->_redirectReferer();
124
+ return;
125
+ } catch (Exception $e) {
126
+ Mage::getSingleton("core/session")->addError($e->getMessage());
127
+ Mage::getSingleton("core/session")->setSupportticketData($this->getRequest()->getPost());
128
+ $this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id")));
129
+ return;
130
+ }
131
+ }
132
+ $this->_redirect("*/*/");
133
+ }
134
+
135
+ /**
136
+ * Download attachment on frontend
137
+ */
138
+
139
+
140
+ public function downloadAction() {
141
+ $entityid = $this->getRequest()->getParam('entity_id');
142
+ $customer_data = Mage::getModel('supportticket/supportticketreply')->load($entityid)->getData();
143
+ $filename = '';
144
+ if ($customer_data) {
145
+ $filename = $customer_data['ticket_attachment'];
146
+ }
147
+ $filepath = Mage::getBaseDir('media') . DS . 'supportticketreply' . DS . $filename;
148
+
149
+ if (!is_file($filepath) || !is_readable($filepath)) {
150
+ throw new Exception ( );
151
+ }
152
+ $this->getResponse()
153
+ ->setHttpResponseCode(200)
154
+ ->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true)
155
+ ->setHeader('Pragma', 'public', true)
156
+ ->setHeader('Content-type', 'application/force-download')
157
+ ->setHeader('Content-Length', filesize($filepath))
158
+ ->setHeader('Content-Disposition', 'attachment' . '; filename=' . basename($filepath));
159
+ $this->getResponse()->clearBody();
160
+ $this->getResponse()->sendHeaders();
161
+ readfile($filepath);
162
+ exit;
163
+ }
164
+
165
+ }
app/code/community/Uni/Supportticket/etc/adminhtml.xml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <support_ticket_ultimate translate="title" module="supportticket">
12
+ <title>Support Ticket Ultimate Section</title>
13
+ <sort_order>0</sort_order>
14
+ </support_ticket_ultimate>
15
+ </children>
16
+ </config>
17
+ </children>
18
+ </system>
19
+ </children>
20
+ </admin>
21
+ </resources>
22
+ </acl>
23
+ </config>
app/code/community/Uni/Supportticket/etc/config.xml ADDED
@@ -0,0 +1,228 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Uni_Supportticket>
5
+ <version>0.1.0</version>
6
+ </Uni_Supportticket>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <supportticket>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Uni_Supportticket</module>
14
+ <frontName>supportticket</frontName>
15
+ </args>
16
+ </supportticket>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <supportticket>
21
+ <file>supportticket.xml</file>
22
+ </supportticket>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <global>
27
+ <template>
28
+ <email>
29
+ <supportticket_email_email_template translate="label" module="supportticket">
30
+ <label>Support Ticket Form</label>
31
+ <file>support_ticket_form.html</file>
32
+ <type>html</type>
33
+ </supportticket_email_email_template>
34
+ </email>
35
+ </template>
36
+ <template>
37
+ <email>
38
+ <supportticketreply_email_email_template translate="label" module="supportticket">
39
+ <label>Support Ticket Reply</label>
40
+ <file>support_ticket_reply.html</file>
41
+ <type>html</type>
42
+ </supportticketreply_email_email_template>
43
+ </email>
44
+ </template>
45
+ <helpers>
46
+ <supportticket>
47
+ <class>Uni_Supportticket_Helper</class>
48
+ </supportticket>
49
+ </helpers>
50
+ <blocks>
51
+ <supportticket>
52
+ <class>Uni_Supportticket_Block</class>
53
+ </supportticket>
54
+ <adminhtml>
55
+ <rewrite>
56
+ <customer_edit_tabs>Uni_Supportticket_Block_Adminhtml_Customer_Edit_Tabs</customer_edit_tabs>
57
+ </rewrite>
58
+ </adminhtml>
59
+ </blocks>
60
+ <models>
61
+ <supportticket>
62
+ <class>Uni_Supportticket_Model</class>
63
+ <resourceModel>supportticket_mysql4</resourceModel>
64
+ </supportticket>
65
+ <supportticket_mysql4>
66
+ <class>Uni_Supportticket_Model_Mysql4</class>
67
+ <entities>
68
+ <supportticket>
69
+ <table>uni_sprt_tkt</table>
70
+ </supportticket>
71
+ <supportticketreply>
72
+ <table>uni_sprt_tkt_reply</table>
73
+ </supportticketreply>
74
+ <supportticketstatus>
75
+ <table>uni_sprt_tkt_status</table>
76
+ </supportticketstatus>
77
+ <supportticketpriority>
78
+ <table>uni_sprt_tkt_pri</table>
79
+ </supportticketpriority>
80
+ <supportticketdepartment>
81
+ <table>uni_sprt_tkt_dep</table>
82
+ </supportticketdepartment>
83
+ </entities>
84
+ </supportticket_mysql4>
85
+ </models>
86
+ <resources>
87
+ <supportticket_setup>
88
+ <setup>
89
+ <module>Uni_Supportticket</module>
90
+ </setup>
91
+ <connection>
92
+ <use>core_setup</use>
93
+ </connection>
94
+ </supportticket_setup>
95
+ <supportticket_write>
96
+ <connection>
97
+ <use>core_write</use>
98
+ </connection>
99
+ </supportticket_write>
100
+ <supportticket_read>
101
+ <connection>
102
+ <use>core_read</use>
103
+ </connection>
104
+ </supportticket_read>
105
+ </resources>
106
+ </global>
107
+ <admin>
108
+ <routers>
109
+ <supportticket>
110
+ <use>admin</use>
111
+ <args>
112
+ <module>Uni_Supportticket</module>
113
+ <frontName>admin_supportticket</frontName>
114
+ </args>
115
+ </supportticket>
116
+ </routers>
117
+
118
+ </admin>
119
+ <adminhtml>
120
+ <menu>
121
+ <supportticket module="supportticket">
122
+ <title>Support Ticket</title>
123
+ <sort_order>100</sort_order>
124
+ <children>
125
+ <!-- <supportticketbackend module="supportticket">
126
+ <title>Support Ticket</title>
127
+ <sort_order>0</sort_order>
128
+ <action>admin_supportticket/adminhtml_supportticketbackend</action>
129
+ </supportticketbackend>-->
130
+ <supportticket module="supportticket">
131
+ <title>View Support Ticket</title>
132
+ <sort_order>0</sort_order>
133
+ <action>admin_supportticket/adminhtml_supportticket</action>
134
+ </supportticket>
135
+ <supportticketreply module="supportticket">
136
+ <title>Support Ticket Reply</title>
137
+ <sort_order>100</sort_order>
138
+ <action>admin_supportticket/adminhtml_supportticketreply</action>
139
+ </supportticketreply>
140
+
141
+ <!-- <report_supportticket module="supportticket">
142
+ <title>Support Ticket Report</title>
143
+ <sort_order>101</sort_order>
144
+ <action>admin_supportticket/adminhtml_report_supportticket/index</action>
145
+ </report_supportticket>-->
146
+ <supportticketsetting>
147
+ <title>Setting</title>
148
+ <sort_order>500</sort_order>
149
+ <action>adminhtml/system_config/edit/section/support_ticket_ultimate</action>
150
+ </supportticketsetting>
151
+
152
+ <supportticket1 module="supportticket">
153
+ <title>Customization</title>
154
+ <sort_order>101</sort_order>
155
+ <children>
156
+ <supportticketdepartment module="supportticket">
157
+ <title>Department</title>
158
+ <sort_order>0</sort_order>
159
+ <action>admin_supportticket/adminhtml_supportticketdepartment</action>
160
+ </supportticketdepartment>
161
+ <supportticketpriority module="supportticket">
162
+ <title>Priorities</title>
163
+ <sort_order>30</sort_order>
164
+ <action>admin_supportticket/adminhtml_supportticketpriority</action>
165
+ </supportticketpriority>
166
+ <supportticketstatus module="supportticket">
167
+ <title>Statuses</title>
168
+ <sort_order>20</sort_order>
169
+ <action>admin_supportticket/adminhtml_supportticketstatus</action>
170
+ </supportticketstatus>
171
+ </children>
172
+ </supportticket1>
173
+ </children>
174
+ </supportticket>
175
+ </menu>
176
+ <acl>
177
+ <resources>
178
+ <all>
179
+ <title>Allow Everything</title>
180
+ </all>
181
+ <admin>
182
+ <children>
183
+ <supportticket translate="title" module="supportticket">
184
+ <title>Supportticket</title>
185
+ <sort_order>1000</sort_order>
186
+ <children>
187
+ <supportticketbackend translate="title">
188
+ <title>Support Ticket</title>
189
+ </supportticketbackend>
190
+ <supportticket translate="title">
191
+ <title>Manage Supportticket</title>
192
+ <sort_order>0</sort_order>
193
+ </supportticket>
194
+ <supportticketreply translate="title">
195
+ <title>Manage Supportticketreply</title>
196
+ <sort_order>10</sort_order>
197
+ </supportticketreply>
198
+ <supportticketstatus translate="title">
199
+ <title>Manage Supportticketstatus</title>
200
+ <sort_order>20</sort_order>
201
+ </supportticketstatus>
202
+ <supportticketpriority translate="title">
203
+ <title>Manage Supportticketpriority</title>
204
+ <sort_order>30</sort_order>
205
+ </supportticketpriority>
206
+ <supportticketdepartment translate="title">
207
+ <title>Manage Supportticketdepartment</title>
208
+ <sort_order>0</sort_order>
209
+ </supportticketdepartment>
210
+ <report_supportticket translate="title">
211
+ <title>Manage Supportticket Report</title>
212
+ <sort_order>0</sort_order>
213
+ </report_supportticket>
214
+ </children>
215
+ </supportticket>
216
+ </children>
217
+ </admin>
218
+ </resources>
219
+ </acl>
220
+ <layout>
221
+ <updates>
222
+ <supportticket>
223
+ <file>supportticket.xml</file>
224
+ </supportticket>
225
+ </updates>
226
+ </layout>
227
+ </adminhtml>
228
+ </config>
app/code/community/Uni/Supportticket/etc/system.xml ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <unicode_extension translate="label" module="supportticket">
5
+ <label>Unicode Extension</label>
6
+ <sort_order>0</sort_order>
7
+ </unicode_extension>
8
+ </tabs>
9
+ <sections>
10
+ <support_ticket_ultimate translate="label" module="supportticket">
11
+ <label>Support Ticket Ultimate</label>
12
+ <tab>unicode_extension</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>0</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <general_email_settings translate="label">
20
+ <label>Email Configuration</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>0</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+ <supervisor_name translate="label">
28
+ <label>Supervisor Name</label>
29
+ <frontend_type>text</frontend_type>
30
+ <sort_order>0</sort_order>
31
+ <show_in_default>1</show_in_default>
32
+ <show_in_website>1</show_in_website>
33
+ <show_in_store>1</show_in_store>
34
+ </supervisor_name>
35
+ <supervisor_email translate="label">
36
+ <label>Supervisor email(s)</label>
37
+ <frontend_type>text</frontend_type>
38
+ <sort_order>0</sort_order>
39
+ <show_in_default>1</show_in_default>
40
+ <show_in_website>1</show_in_website>
41
+ <show_in_store>1</show_in_store>
42
+ </supervisor_email>
43
+ <email_template_tick translate="label">
44
+ <label>Email Template</label>
45
+ <frontend_type>select</frontend_type>
46
+ <source_model>adminhtml/system_config_source_yesno</source_model>
47
+ <sort_order>0</sort_order>
48
+ <show_in_default>1</show_in_default>
49
+ <show_in_website>1</show_in_website>
50
+ <show_in_store>1</show_in_store>
51
+ </email_template_tick>
52
+ </fields>
53
+ </general_email_settings>
54
+ </groups>
55
+ </support_ticket_ultimate>
56
+ </sections>
57
+ </config>
app/code/community/Uni/Supportticket/sql/supportticket_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+ $installer->run("
7
+ DROP TABLE IF EXISTS {$this->getTable('uni_sprt_tkt')};
8
+ DROP TABLE IF EXISTS {$this->getTable('uni_sprt_tkt_reply')};
9
+ DROP TABLE IF EXISTS {$this->getTable('uni_sprt_tkt_status')};
10
+ DROP TABLE IF EXISTS {$this->getTable('uni_sprt_tkt_pri')};
11
+ DROP TABLE IF EXISTS {$this->getTable('uni_sprt_tkt_dep')};
12
+ CREATE TABLE {$this->getTable('uni_sprt_tkt')} (
13
+ `entity_id` int(11) NOT NULL primary key auto_increment,
14
+ `ticket_id` varchar(30) NOT NULL,
15
+ `user_name` varchar(100) default NULL,
16
+ `user_id` int(11) default NULL,
17
+ `user_email` varchar(100) default NULL,
18
+ `department` varchar(100) NOT NULL default '1',
19
+ `ticket_priority` int(3) NOT NULL default '1',
20
+ `ticket_subject` varchar(100) default NULL,
21
+ `ticket_message` text NOT NULL,
22
+ `ticket_attachment` varchar(50) default NULL,
23
+ `create_time` datetime default NULL,
24
+ `update_time` datetime default NULL,
25
+ `reply_count` int(20) NOT NULL default '0',
26
+ `ticket_status` int(3) NOT NULL default '1'
27
+
28
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
29
+
30
+
31
+ CREATE TABLE {$this->getTable('uni_sprt_tkt_reply')} (
32
+ `entity_id` int(11) NOT NULL primary key auto_increment,
33
+ `ticket_id` varchar(30) NOT NULL,
34
+ `user_name` varchar(100) default NULL,
35
+ `user_id` int(11) default NULL,
36
+ `reply_time` datetime default NULL,
37
+ `ticket_attachment` varchar(50) default NULL,
38
+ `ticket_replies` varchar(150) default NULL,
39
+ `is_admin` int(11) default NULL
40
+
41
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
42
+
43
+ CREATE TABLE {$this->getTable('uni_sprt_tkt_status')} (
44
+ `entity_id` int(11) NOT NULL primary key auto_increment,
45
+ `title` varchar(100) default NULL,
46
+ `font_color` varchar(50) default NULL,
47
+ `background_color` varchar(50) default NULL,
48
+ `is_system` int(10) NOT NULL default '0',
49
+ `ticket_status` int(3) NOT NULL default '0'
50
+
51
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
52
+
53
+
54
+ CREATE TABLE {$this->getTable('uni_sprt_tkt_pri')} (
55
+ `entity_id` int(11) NOT NULL primary key auto_increment,
56
+ `title` varchar(100) default NULL,
57
+ `font_color` varchar(50) default NULL,
58
+ `background_color` varchar(50) default NULL,
59
+ `is_system` int(10) NOT NULL default '0',
60
+ `ticket_priority` int(3) NOT NULL default '0'
61
+
62
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
63
+
64
+
65
+ CREATE TABLE {$this->getTable('uni_sprt_tkt_dep')} (
66
+ `entity_id` int(11) NOT NULL primary key auto_increment,
67
+ `title` varchar(100) default NULL,
68
+ `is_system` int(10) NOT NULL default '0',
69
+ `dep_status` int(3) NOT NULL default '0'
70
+
71
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
72
+
73
+ INSERT INTO {$this->getTable('uni_sprt_tkt_dep')} (`entity_id`, `title`, `is_system`, `dep_status`) VALUES
74
+ (1, 'Sales', 1, 0),
75
+ (2, 'Marketing', 1, 0),
76
+ (3, 'Complain', 1, 0);
77
+
78
+ INSERT INTO {$this->getTable('uni_sprt_tkt_pri')} (`entity_id`, `title`, `font_color`, `background_color`, `is_system`, `ticket_priority`) VALUES
79
+ (1, 'High', 'FF0000', NULL, 1, 1),
80
+ (2, 'Medium', '059E05', NULL, 1, 1),
81
+ (3, 'Low', '000000', NULL, 1, 1);
82
+
83
+ INSERT INTO {$this->getTable('uni_sprt_tkt_status')} (`entity_id`, `title`, `font_color`, `background_color`, `is_system`, `ticket_status`) VALUES
84
+ (1, 'New', 'FF0000', NULL, 1, 1),
85
+ (2, 'Pending', '059E05', NULL, 1, 1),
86
+ (3, 'Close', '000000', NULL, 1, 1);
87
+
88
+ ");
89
+ $installer->endSetup();
90
+
app/design/adminhtml/default/default/layout/supportticket.xml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <supportticket_adminhtml_supportticketbackend_index>
4
+ <reference name="content">
5
+ <block type="supportticket/adminhtml_supportticketbackend" name="supportticketbackend" template="supportticket/supportticketbackend.phtml"/>
6
+ </reference>
7
+ </supportticket_adminhtml_supportticketbackend_index>
8
+ <supportticket_adminhtml_supportticket_index>
9
+
10
+ <reference name="content">
11
+ <block type="supportticket/adminhtml_supportticket" name="supportticket" />
12
+ </reference>
13
+ </supportticket_adminhtml_supportticket_index>
14
+ <supportticket_adminhtml_supportticketreply_index>
15
+ <reference name="content">
16
+ <block type="supportticket/adminhtml_supportticketreply" name="supportticketreply" />
17
+ </reference>
18
+ </supportticket_adminhtml_supportticketreply_index>
19
+ <supportticket_adminhtml_supportticketstatus_index>
20
+ <reference name="content">
21
+ <block type="supportticket/adminhtml_supportticketstatus" name="supportticketstatus" />
22
+ </reference>
23
+ </supportticket_adminhtml_supportticketstatus_index>
24
+ <supportticket_adminhtml_supportticketpriority_index>
25
+ <reference name="content">
26
+ <block type="supportticket/adminhtml_supportticketpriority" name="supportticketpriority" />
27
+ </reference>
28
+ </supportticket_adminhtml_supportticketpriority_index>
29
+ <supportticket_adminhtml_supportticketdepartment_index>
30
+ <reference name="content">
31
+ <block type="supportticket/adminhtml_supportticketdepartment" name="supportticketdepartment" />
32
+ </reference>
33
+ </supportticket_adminhtml_supportticketdepartment_index>
34
+ </layout>
app/design/frontend/default/default/layout/supportticket.xml ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <supportticket_index_index>
4
+ <update handle="customer_account"/>
5
+ <reference name="my.account.wrapper">
6
+ <block type="supportticket/index" name="supportticket_index" template="supportticket/index.phtml">
7
+ <block type="supportticket/supportticket" name="supportticket_supportticket" template="supportticket/supportticket.phtml"/>
8
+ </block>
9
+ </reference>
10
+ </supportticket_index_index>
11
+
12
+ <supportticket_supportticket_index>
13
+ <update handle="customer_account"/>
14
+ <reference name="my.account.wrapper">
15
+ <block type="supportticket/supportticket" name="supportticket_supportticketview" template="supportticket/view.phtml">
16
+ <block type="supportticket/supportticketreply" name="supportticket_supportticketreply" template="supportticket/supportticketreply.phtml"/>
17
+ </block>
18
+ </reference>
19
+ </supportticket_supportticket_index>
20
+
21
+ <supportticket_supportticketreply_index>
22
+ <reference name="root">
23
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
24
+ </reference>
25
+ <reference name="content">
26
+ </reference>
27
+ </supportticket_supportticketreply_index>
28
+
29
+ <customer_account>
30
+ <reference name="customer_account_navigation">
31
+ <action method="addLink" translate="label" module="supportticket">
32
+ <name>supportticket</name>
33
+ <path>supportticket</path>
34
+ <label>Support Ticket</label>
35
+ </action>
36
+ </reference>
37
+ </customer_account>
38
+ </layout>
39
+
app/design/frontend/default/default/template/supportticket/index.phtml ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package rwd_default
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+
28
+ <?php
29
+ $_helper = Mage::helper('supportticket');
30
+ $_status = $_helper->getTicketDepartments();
31
+ $_prioritys = $_helper->getTicketPrioritys();
32
+
33
+ echo $this->getChildHtml('supportticket_supportticket');
34
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
35
+ ?>
36
+ <div id="messages_product_view"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
37
+ <div class="page-title">
38
+ <h1><?php echo $_helper->__('Create New Support Ticket') ?></h1>
39
+ </div>
40
+ <form action="<?php echo $this->getFormAction(); ?>" enctype="multipart/form-data" id="supportTicketForm" method="post" class="scaffold-form">
41
+ <div class="fieldset">
42
+ <p class="required"><?php echo Mage::helper('supportticket')->__('* Required Fields') ?></p>
43
+ <ul class="form-list">
44
+ <li class="fields">
45
+ <div class="field">
46
+ <div class="input-box">
47
+ <label for="ticket_department" class="select-box"><?php echo $_helper->__('Department') ?></label>
48
+ <select name="ticket_department" class="required-entry">
49
+ <?php foreach ($_status as $_priority1): ?>
50
+ <option value="<?php echo $_priority1['value'] ?>" >
51
+ <?php echo $_priority1['label'] ?>
52
+ </option>
53
+ <?php endforeach; ?>
54
+ </select>
55
+ </label>
56
+ </div>
57
+ </div>
58
+ </li>
59
+ <li>
60
+ <div class="field">
61
+ <div class="input-box">
62
+ <label for="ticket_priority" class="select-box"><?php echo $_helper->__('Priority') ?></label>
63
+ <select name="ticket_priority" class="required-entry">
64
+ <?php foreach ($_prioritys as $_priority): ?>
65
+ <option value="<?php echo $_priority['value'] ?>" >
66
+ <?php echo $_priority['label'] ?>
67
+ </option>
68
+ <?php endforeach; ?>
69
+ </select>
70
+ </label>
71
+ </div>
72
+ </div>
73
+ </li>
74
+ <li>
75
+ <label for="ticket_subject"><?php echo Mage::helper('supportticket')->__('Subject') ?></label>
76
+ <div class="input-box">
77
+ <input name="ticket_subject" id="ticket_subject" title="<?php echo Mage::helper('supportticket')->__('Subject') ?>" value="" class="input-text" type="text" />
78
+ </div>
79
+ </li>
80
+
81
+ <li class="wide">
82
+ <label for="ticket_message" class="required"><em>*</em><?php echo Mage::helper('supportticket')->__('Message') ?></label>
83
+ <div class="input-box">
84
+ <textarea name="ticket_message" id="ticket_message" title="<?php echo Mage::helper('supportticket')->__('Message') ?>" class="required-entry input-text" cols="5" rows="3"></textarea>
85
+ </div>
86
+ </li>
87
+ <li class="wide last">
88
+ <div class="input-box attachment">
89
+ <label for="attachment"><?php echo $this->__('Attachment (10 Mb Limit)') ?></label>
90
+ <div class="file-upload btn btn-primary"><span><?php echo $this->__('Upload') ?></span>
91
+ <input name="attachment" id="attachment" title="<?php echo Mage::helper('supportticket')->__('ATTACHMENT') ?>" class="input-file upload" type="file" />
92
+ </div>
93
+
94
+ </div>
95
+ </li>
96
+ </ul>
97
+ </div>
98
+ <div class="buttons-set">
99
+ <input type="hidden" name="user_name" id="user_name" value="<?php echo $customer->getName() ?>"/>
100
+ <input type="hidden" name="user_id" id="user_id" value="<?php echo $customer->getId() ?>"/>
101
+ <input type="hidden" name="ticket_id" id="ticket_id" value="<?php echo $this->generateCode(6) ?>"/>
102
+ <input type="hidden" name="user_email" id="user_name" value="<?php echo $customer->getEmail() ?>"/>
103
+ <button type="submit" title="<?php echo Mage::helper('supportticket')->__('Submit') ?>" class="button"><span><span><?php echo Mage::helper('supportticket')->__('Submit') ?></span></span></button>
104
+ </div>
105
+ </form>
106
+ <script type="text/javascript">
107
+ //<![CDATA[
108
+ var supportTicketForm = new VarienForm('supportTicketForm', true);
109
+ //]]>
110
+ </script>
app/design/frontend/default/default/template/supportticket/supportticket.phtml ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
3
+
4
+ <?php
5
+ $customerData = Mage::getSingleton('customer/session')->getCustomer();
6
+ $_datasets = $this->getDatasets()->addFieldToFilter('user_id', $customerData->getId())->getData();
7
+ $_helper = Mage::helper('supportticket');
8
+ $_tickStatus = $_helper->getTicketStatuses();
9
+ $_tickPriority = $_helper->getTicketPrioritys();
10
+ $_tickDepartment = $_helper->getTicketDepartments();
11
+ ?>
12
+ <div class="page-head">
13
+ <h3><?php echo $this->__('Support Ticket') ?></h3>
14
+ </div>
15
+ <?php echo $this->getPagerHtml(); ?>
16
+ <?php if (count($_datasets)): ?>
17
+ <table cellspacing="0" class="data-table" id="data-table">
18
+ <thead>
19
+ <tr>
20
+ <th><?php echo $this->__('ticket id') ?></th>
21
+ <th><?php echo $this->__('department') ?></th>
22
+ <th><?php echo $this->__('ticket subject') ?></th>
23
+ <th><?php echo $this->__('reply count') ?></th>
24
+ <th><?php echo $this->__('ticket status') ?></th>
25
+ <th> &nbsp; </th>
26
+ </tr>
27
+ </thead>
28
+ <tbody>
29
+ <?php foreach ($_datasets as $_dataset): ?>
30
+ <tr>
31
+ <td valign="middle" style="vertical-align:middle;"><?php echo $_dataset['ticket_id'] ?></td>
32
+ <?php
33
+ foreach ($_tickDepartment as $value):
34
+ if ($_dataset['department'] == $value['value']) :
35
+ ?>
36
+ <td valign="middle" style="vertical-align:middle;"><?php echo $value['label'] ?></td>
37
+ <?php endif;
38
+ endforeach;
39
+ ?>
40
+ <td valign="middle" style="vertical-align:middle;"><?php echo $_dataset['ticket_subject'] ?></td>
41
+ <td valign="middle" style="vertical-align:middle;"><?php echo $_dataset['reply_count'] ?></td>
42
+ <?php
43
+ foreach ($_tickStatus as $value):
44
+ if ($_dataset['ticket_status'] == $value['value']) :
45
+ ?>
46
+ <td valign="middle" style="vertical-align:middle;"><?php echo $value['label'] ?></td>
47
+ <?php endif;
48
+ endforeach;
49
+ ?>
50
+ <td valign="middle" style="vertical-align:middle;"><a href="<?php echo $this->getUrl('supportticket/supportticket/index', array('id' => $_dataset['entity_id'])) ?>" ><?php echo($this->__('View')) ?></a></td>
51
+ </tr>
52
+ <?php endforeach; ?>
53
+ </tbody>
54
+ </table>
55
+ <script type="text/javascript">decorateTable('data-table')</script>
56
+ <?php echo $this->getPagerHtml(); ?>
57
+ <?php else: ?>
58
+ <p><?php echo $this->__('You have submited no data.'); ?></p>
59
+ <?php endif ?>
app/design/frontend/default/default/template/supportticket/supportticketreply.phtml ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php echo $this->getMessagesBlock()->getGroupedHtml();
2
+
3
+ $customerData = Mage::getSingleton('customer/session')->getCustomer();
4
+ $tick = $this->getCurrentTicketId($this->getRequest()->getParam('id'));
5
+ $_datasets = $this->getDatasets()->addFieldToFilter('ticket_id', $tick)->getData();
6
+
7
+ ?>
8
+ <div class="page-head">
9
+ <h3><?php echo $this->__('Support ticket reply') ?></h3>
10
+ </div>
11
+ <?php echo $this->getPagerHtml(); ?>
12
+ <?php if (count($_datasets)): ?>
13
+ <table cellspacing="0" class="data-table" id="data-table">
14
+ <thead>
15
+ <tr>
16
+ <th><?php echo $this->__('ticket id') ?></th>
17
+ <th><?php echo $this->__('Reply Time') ?></th>
18
+ <th><?php echo $this->__('ticket attachment') ?></th>
19
+ <th><?php echo $this->__('ticket replies') ?></th>
20
+ <th><?php echo $this->__('replied by') ?></th>
21
+ <th> &nbsp; </th>
22
+ </tr>
23
+ </thead>
24
+ <tbody>
25
+ <?php foreach ($_datasets as $_dataset): ?>
26
+ <tr>
27
+ <td valign="middle" style="vertical-align:middle;"><?php echo $_dataset['ticket_id'] ?></td>
28
+ <td valign="middle" style="vertical-align:middle;"><?php echo $_dataset['reply_time'] ?></td>
29
+ <td valign="middle" style="vertical-align:middle;">
30
+ <?php
31
+ if ($_dataset['ticket_attachment'] == 'No Attachment Found') {
32
+ echo $_dataset['ticket_attachment'];
33
+ } else {
34
+ ?>
35
+ <a href="<?php echo $this->getUrl('supportticket/supportticketreply/download', array('entity_id' => $_dataset['entity_id'])) ?>"><?php echo $_dataset['ticket_attachment'] ?></a>
36
+ <?php } ?>
37
+ </td>
38
+ <td valign="middle" style="vertical-align:middle;"><?php echo $_dataset['ticket_replies'] ?></td>
39
+ <td valign="middle" style="vertical-align:middle;"><?php if($_dataset['is_admin']==1) {echo $this->__('Admin');}else{ echo $this->__('You');}?></td>
40
+ </tr>
41
+ <?php endforeach; ?>
42
+ </tbody>
43
+ </table>
44
+ <script type="text/javascript">decorateTable('data-table')</script>
45
+ <?php echo $this->getPagerHtml(); ?>
46
+ <?php else: ?>
47
+ <p><?php echo $this->__('You have submited no data.'); ?></p>
48
+ <?php endif ?>
49
+
50
+
51
+ <script type="text/javascript">
52
+ jQuery(document).ready(function (){
53
+
54
+ jQuery('.last').addClass('current');
55
+ });
56
+ </script>
app/design/frontend/default/default/template/supportticket/view.phtml ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <?php
3
+ $id = $this->getRequest()->getParam('id');
4
+ $_info = $this->getTicketInfo($id);
5
+ //Zend_Debug::dump($_info);exit;
6
+ $tick_department = Mage::helper('supportticket')->getTicketDepartments();
7
+ $tick_status = Mage::helper('supportticket')->getTicketStatuses();
8
+ $tick_priority = Mage::helper('supportticket')->getTicketPrioritys();
9
+ $customer_data = Mage::getSingleton('customer/session')->getCustomer();
10
+ $status = $_info->getData('ticket_status');
11
+ //Zend_Debug::dump($_info);
12
+ ?>
13
+ <div id="messages_product_view"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
14
+ <div class="page-title">
15
+ <h1>[<?php echo $_info->getData('ticket_id') ?>]</h1>
16
+ </div>
17
+ <div class="ticket-info">
18
+ <ul>
19
+ <?php
20
+ foreach ($tick_department as $value):
21
+ if ($_info['department'] == $value['value']) :
22
+ ?>
23
+ <li><b><?php echo Mage::helper('supportticket')->__('Department : ') ?></b><span><i><?php echo $value['label'] ?></i></span></li>
24
+ <?php
25
+ endif;
26
+ endforeach;
27
+ ?>
28
+ <?php
29
+ foreach ($tick_status as $value):
30
+ if ($_info['ticket_status'] == $value['value']) :
31
+ ?>
32
+ <li><b><?php echo Mage::helper('supportticket')->__('Status : ') ?></b><span><i><?php echo $value['label'] ?></i></span></li>
33
+ <?php
34
+ endif;
35
+ endforeach;
36
+ ?>
37
+ <?php
38
+ foreach ($tick_priority as $value):
39
+ if ($_info['ticket_priority'] == $value['value']) :
40
+ ?>
41
+ <li><b><?php echo Mage::helper('supportticket')->__('Priority : ') ?></b><span><i><?php echo $value['label'] ?></i></span></li>
42
+ <?php
43
+ endif;
44
+ endforeach;
45
+ ?>
46
+ </ul>
47
+
48
+
49
+ </div>
50
+ <?php if ((int) $status !== 3) { ?>
51
+ <form action="<?php echo $this->getFormAction(); ?>" enctype="multipart/form-data" id="supportTicketReplyForm" method="post" class="scaffold-form">
52
+ <div class="fieldset">
53
+ <p class="required"><?php echo Mage::helper('supportticket')->__('* Required Fields') ?></p>
54
+ <ul class="form-list">
55
+ <li class="wide">
56
+ <label for="ticket_replies" class="required"><em>*</em><?php echo Mage::helper('supportticket')->__('Post a reply') ?></label>
57
+ <div class="input-box">
58
+ <textarea name="ticket_replies" id="ticket_replies" title="<?php echo Mage::helper('supportticket')->__('Post a reply') ?>" class="required-entry input-text" cols="5" rows="3"></textarea>
59
+ </div>
60
+ </li>
61
+ <li class="wide last">
62
+ <div class="input-box attachment">
63
+ <div class="file-upload btn btn-primary"><span><?php echo $this->__('Upload')?> </span>
64
+ <input name="ticket_attachment" id="ticket_attachment" title="<?php echo Mage::helper('supportticket')->__('ATTACHMENT') ?>" class="input-file upload" type="file" />
65
+ </div>
66
+ <label class="attachment-label" for="ticket_attachment"><?php echo Mage::helper('supportticket')->__('ATTACHMENT (if any)') ?></label>
67
+
68
+ </div>
69
+ </li>
70
+ </ul>
71
+ </div>
72
+ <div class="buttons-set">
73
+ <input type="hidden" id="ticket_id" name="ticket_id" value="<?php echo $_info->getData('ticket_id') ?>"/>
74
+ <input type="hidden" id="id" name="id" value="<?php echo $_info->getData('entity_id') ?>"/>
75
+ <input type="hidden" id="user_name" name="user_name" value="<?php echo $customer_data->getName() ?>"/>
76
+ <input type="hidden" id="user_id" name="user_id" value="<?php echo $customer_data->getId() ?>"/>
77
+ <button type="submit" title="<?php echo Mage::helper('supportticket')->__('Post reply') ?>" class="button"><span><span><?php echo Mage::helper('supportticket')->__('Post Reply') ?></span></span></button>
78
+ <button type="button" ticketid="<?php echo $id; ?>" onclick="closeTicket(this);" title="<?php echo Mage::helper('supportticket')->__('Close Ticket') ?>" class="button"><span><span><?php echo Mage::helper('supportticket')->__('Close Ticket') ?></span></span></button>
79
+ </div>
80
+ </form>
81
+ <?php } else { ?>
82
+ <h1><p>This Ticket has been closed.</p></h1>
83
+ <?php } ?>
84
+ <a href="<?php echo $this->getUrl('supportticket') ?>"><span><?php echo $this->__('Back to my Support Ticket') ?></span></a>
85
+
86
+ <script type="text/javascript">
87
+ //<![CDATA[
88
+ var supportTicketReplyForm = new VarienForm('supportTicketReplyForm', true);
89
+ //]]>
90
+
91
+ function closeTicket(obj) {
92
+ var id = jQuery(obj).attr('ticketid');
93
+ var url = "<?php echo $this->getUrl('supportticket/supportticket/closeticket'); ?>";
94
+ if (confirm("You are going to close the ticket!") == true) {
95
+ window.location.href = url + 'id/' + id;
96
+ }
97
+ }
98
+
99
+ </script>
100
+ <?php
101
+ echo $this->getChildHtml('supportticket_supportticketreply'); ?>
app/etc/modules/Uni_Supportticket.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Uni_Supportticket>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <version>0.1.0</version>
8
+ </Uni_Supportticket>
9
+ </modules>
10
+ </config>
app/locale/en_US/template/email/support_ticket_form.html ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject Support TicketForm@-->
2
+ <!--@vars
3
+ {"var data.name":"Sender Name",
4
+ "var data.email":"Sender Email",
5
+ "var data.telephone":"Sender Telephone",
6
+ "var data.comment":"Comment"}
7
+ @-->
8
+ <p>A Support Ticket Has Been Generated</p>
9
+ <p>Details Are Below : </p>
10
+ <!--<b>UserId :</b> {{var userid}}<br>-->
11
+ <b>TicketId :</b> {{var ticketid}}<br>
12
+ <b>Name :</b> {{var name}}<br>
13
+ <b>E-mail :</b> {{var email}}<br>
14
+ <b>TicketMsg :</b> {{var ticketmsg}}<br>
15
+ <b>TicketSub :</b> {{var ticketsub}}<br>
16
+ <b>TicketPrio :</b> {{var ticketprio}}<br>
17
+ <b>TicketDept :</b> {{var ticketdept}}<br>
app/locale/en_US/template/email/support_ticket_reply.html ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <!--@subject Support Ticket Reply@-->
2
+ <p>A Reply Has Been Posted On <b>Ticket Id : </b>{{var ticketid}}</p>
3
+ <p>Details are below : </p>
4
+ <!--<b>User Id : </b>{{var userid}}<br>-->
5
+ <b>User Name: </b>{{var name}}<br>
6
+ <b>Reply: </b>{{var reply}}<br>
7
+
package.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Uni_Supportticket</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Magento Support Ticket module provides the facility to submit a ticket assigned to specific department, priority and revert back with explanatory information.&#xD;
10
+ </summary>
11
+ <description>The extension is capable of collecting the information from various customer groups. Customer just have to post their request, the extension will fetch the request and shown on admin panel plus an email sent to the concerned authority.&#xD;
12
+ </description>
13
+ <notes>This is first release</notes>
14
+ <authors><author><name>Unicode Systems</name><user>Unicode_Systems</user><email>magento@unicodesystems.in</email></author></authors>
15
+ <date>2015-01-24</date>
16
+ <time>09:51:33</time>
17
+ <contents><target name="magecommunity"><dir name="Uni"><dir name="Supportticket"><dir name="Block"><dir name="Adminhtml"><dir name="Customer"><dir name="Edit"><file name="Tabs.php" hash="fc42ad99bc121e7d53483ede7d0ee21d"/><file name="Tabsw.php" hash="0de20b336a63eb363a90603c38f6f9af"/></dir></dir><dir name="Report"><dir name="Supportticket"><file name="Grid.php" hash="955697e267ab3ce320b1216d6d0b4db7"/></dir><file name="Supportticket.php" hash="865baf5a354c7ffb2a683a75662f1545"/></dir><dir name="Supportticket"><file name="Customergrid.php" hash="33f7ff541c3a8593bbba4a2de89b77f4"/><dir name="Edit"><file name="Form.php" hash="5e671ba53815910b197d6188896c8551"/><dir name="Tab"><file name="Form.php" hash="4cf6b33f2a6e6c1d0a248e4d9486e1b9"/></dir><file name="Tabs.php" hash="1e7f16bd4069a4d9768132ef46f40b52"/></dir><file name="Edit.php" hash="d722aefac7d7d98615f5e57efc9ddf40"/><dir name="Grid"><dir name="Renderer"><file name="Collisiontype.php" hash="b65c3022d82bf4f6e2a0d16aff61c04d"/><file name="State.php" hash="46919d69c2c32bd84954c1c59f502720"/></dir></dir><file name="Grid.php" hash="c7efff22dd2de5eac5ee98b20f17542e"/></dir><file name="Supportticket.php" hash="569359f4d5b613f0c65a6c177de109c8"/><file name="Supportticketbackend.php" hash="6f211e8267ac74110addda502d181e51"/><dir name="Supportticketdepartment"><dir name="Edit"><file name="Form.php" hash="0f599a953b1805b1294d21ea63677abe"/><dir name="Tab"><file name="Form.php" hash="47e7bfb967f4f1624d825cfffd0ef7e5"/></dir><file name="Tabs.php" hash="f65ca547100de6eb358251d5ff333dca"/></dir><file name="Edit.php" hash="603bc8f1b5df38631a2da3d9df573cea"/><file name="Grid.php" hash="fb3d239af4f61dca738cb7f85490ddb9"/></dir><file name="Supportticketdepartment.php" hash="c214b7977237edb6e5c870d3f6140666"/><dir name="Supportticketpriority"><dir name="Edit"><file name="Form.php" hash="de92b4fbd20b6a7027fdcd7149fe97b9"/><dir name="Tab"><file name="Form.php" hash="a7a6bf946467954a3c145122d8dea469"/></dir><file name="Tabs.php" hash="2616b7b7618dbdc4fad0e9d7a6a13c50"/></dir><file name="Edit.php" hash="505d432e966925792eb0fe44db677158"/><file name="Grid.php" hash="abf8e53f10ea8f4b83179c60f8abefee"/></dir><file name="Supportticketpriority.php" hash="e6455afb27c806515882c8a89e3794a0"/><dir name="Supportticketreply"><dir name="Edit"><file name="Form.php" hash="8fe2fbd2a54d7c5563d77c84ea273631"/><dir name="Tab"><file name="Form.php" hash="e27ce8ce4b4ffe0d4d9c1db3ecd4bfcf"/></dir><file name="Tabs.php" hash="15295dd12d9b6da83b90a304943a0da0"/></dir><file name="Edit.php" hash="2f44618e199e3584bf35cf9d00ad649b"/><file name="Grid.php" hash="03aa702e1f65b3099495db5de3a2bf07"/></dir><file name="Supportticketreply.php" hash="88417609ae55117a3562bc1479c62929"/><dir name="Supportticketreplywithticketid"><file name="Grid.php" hash="ab759eb7d9a7fc9a93a70103fd8b21f9"/><dir name="Renderer"><file name="Userrole.php" hash="3e083528421daeda6f8aec62eb4f53bf"/></dir></dir><file name="Supportticketreplywithticketid.php" hash="0ad7f1e33f91be8616170068e874789d"/><dir name="Supportticketstatus"><dir name="Edit"><file name="Form.php" hash="b404a4691f2295fb8e93cef4bea4f1cb"/><dir name="Tab"><file name="Form.php" hash="eda63baf9e6bdd463af433f0c34cceb6"/></dir><file name="Tabs.php" hash="df8577faab440f3fa4b2e3b3926654d4"/></dir><file name="Edit.php" hash="9946678f57984fa65942ebea7a8c7a2e"/><file name="Grid.php" hash="0a5b6f2b85aa21f975bbf4369cdfb889"/></dir><file name="Supportticketstatus.php" hash="0e68d18e03e0d44c18280ddb11ba6ee5"/></dir><file name="Index.php" hash="1af33d38eb99d40707963d81075c3e96"/><file name="Supportticket.php" hash="53917ea5dc20bd19f8c26080d4a0b2c5"/><file name="Supportticketreply.php" hash="fcd187d41b2c30bfea1025bc1a8de515"/></dir><dir name="Helper"><file name="Data.php" hash="f4e900b4b6309e4d6cc2b5345f560cf0"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Supportticket"><file name="Collection.php" hash="2708fd37d37aba45563102f8d24ec13a"/></dir><file name="Supportticket.php" hash="966f9fe18be3d2049bb00f137ba4d5f9"/><dir name="Supportticketdepartment"><file name="Collection.php" hash="a04c22ddd5f9faa4f06d88d23282e297"/></dir><file name="Supportticketdepartment.php" hash="339bca69c852e632416fc6b1345e7b07"/><dir name="Supportticketpriority"><file name="Collection.php" hash="9b1ab61ab569ce9b0f4a087e35c305d2"/></dir><file name="Supportticketpriority.php" hash="40e57235920bb2fb10393cf1600bf2f7"/><dir name="Supportticketreply"><file name="Collection.php" hash="061ba35a9f8ed66562a116243aba136f"/></dir><file name="Supportticketreply.php" hash="ff7df59a220cf818c85a6d99332bcab4"/><dir name="Supportticketstatus"><file name="Collection.php" hash="ac30f2d77cd959360adb0a2e31cd5b8e"/></dir><file name="Supportticketstatus.php" hash="99b2bfb98a0290ab319a25a46676f678"/></dir><file name="Supportticket.php" hash="33c8f158216077f1ac43054f6b1a1c49"/><file name="Supportticketdepartment.php" hash="847720c946b686c6644a6ecf15f33066"/><file name="Supportticketpriority.php" hash="2ad95ebca901f3817a2db6c8a2abb8ef"/><file name="Supportticketreply.php" hash="77e51bcceae4744835625130b15b3d68"/><file name="Supportticketstatus.php" hash="cb19d51376fd556f6b22ca663b74f35d"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Report"><file name="SupportticketController.php" hash="10b7c994906c79ca22ab25e89a7121f7"/></dir><file name="SupportticketController.php" hash="a0248d97be244186c0b6c453ae234542"/><file name="SupportticketController_1.php" hash="7e926ba3bcc2bb57837a9a75e06ffcba"/><file name="SupportticketbackendController.php" hash="dd6dfcb659658fbcab9881250f6bb9f9"/><file name="SupportticketdepartmentController.php" hash="2cb3e2ba52dc9b96e0d39924189ecfab"/><file name="SupportticketpriorityController.php" hash="d3e6e464db9cc57679da6c00f0291566"/><file name="SupportticketreplyController.php" hash="f9e3f040a0d2ba5fbdd56048607dd2e4"/><file name="SupportticketstatusController.php" hash="5095589d318868273b0677f61a5163af"/></dir><file name="IndexController.php" hash="a7c9204b6fd0345a12d86f4d9dee23a2"/><file name="SupportticketController.php" hash="c605fd413ff76c5e3eb374060c2baeba"/><file name="SupportticketreplyController.php" hash="486543f953b44b515f3801f41fc71c7e"/></dir><dir name="etc"><file name="adminhtml.xml" hash="bc447ce34231c7f7994b9a933e1d063f"/><file name="config.xml" hash="1b71d57eebdb61b498680afa3d0afb81"/><file name="system.xml" hash="55c05c7712ae9e3cdd98f68dcdea853c"/></dir><dir name="sql"><dir name="supportticket_setup"><file name="mysql4-install-0.1.0.php" hash="704b58cfaa622cd82ec6adf85b7a1aa8"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Uni_Supportticket.xml" hash="295897641bb3c68f8a5cf553efbb41fa"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="supportticket.xml" hash="ff9140af95dd8f83ec7fd16b2ae920b8"/></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="supportticket.xml" hash="4b04fd3c4538bfca3ddf20d5e70a1d39"/></dir><dir name="template"><dir name="supportticket"><file name="index.phtml" hash="7dcedb62b7d4f72316feee1130c1d805"/><file name="supportticket.phtml" hash="d76e3064faffda4300551935fc81472f"/><file name="supportticketreply.phtml" hash="dcbe160871e49f1e86da67fedef693e0"/><file name="view.phtml" hash="f630302e83ff24c38e0d12c055dd4ce4"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="app"><dir name="locale"><dir name="en_US"><dir name="template"><dir name="email"><file name="support_ticket_form.html" hash="66a1076b2299a11f9a1d5b9f257180e3"/><file name="support_ticket_reply.html" hash="2cf97d8b52c01ec196f0c6fbd6f8e640"/></dir></dir></dir></dir></dir></target></contents>
18
+ <compatible/>
19
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
20
+ </package>