TOPefekt_Magesms - Version 1.2.0

Version Notes

2014

Download this release

Release Info

Developer Frantisek Barancik
Extension TOPefekt_Magesms
Version 1.2.0
Comparing to
See all releases


Code changes from version 1.1.5 to 1.2.0

Files changed (64) hide show
  1. app/code/community/Topefekt/Magesms/Block/Answers/Grid.php +1 -1
  2. app/code/community/Topefekt/Magesms/Block/Customer.php +16 -0
  3. app/code/community/Topefekt/Magesms/Block/Customer/Grid.php +16 -0
  4. app/code/community/Topefekt/Magesms/Block/Marketing.php +1 -1
  5. app/code/community/Topefekt/Magesms/Block/Marketing/Customer.php +16 -0
  6. app/code/community/Topefekt/Magesms/Block/Marketing/Form.php +5 -2
  7. app/code/community/Topefekt/Magesms/Block/Marketing/Grid.php +1 -1
  8. app/code/community/Topefekt/Magesms/Block/Marketing/Template.php +16 -0
  9. app/code/community/Topefekt/Magesms/Block/Template/Template.php +16 -0
  10. app/code/community/Topefekt/Magesms/Controller/Action.php +16 -0
  11. app/code/community/Topefekt/Magesms/Controller/Template/Action.php +20 -0
  12. app/code/community/Topefekt/Magesms/Model/Marketing/Filter.php +16 -0
  13. app/code/community/Topefekt/Magesms/Model/Marketing/Filter/Birthday.php +16 -0
  14. app/code/community/Topefekt/Magesms/Model/Marketing/Filter/Birthdayall.php +16 -0
  15. app/code/community/Topefekt/Magesms/Model/Marketing/Filter/City.php +16 -0
  16. app/code/community/Topefekt/Magesms/Model/Marketing/Filter/Collection.php +16 -0
  17. app/code/community/Topefekt/Magesms/Model/Marketing/Filter/Country.php +16 -0
  18. app/code/community/Topefekt/Magesms/Model/Marketing/Filter/Firstname.php +16 -0
  19. app/code/community/Topefekt/Magesms/Model/Marketing/Filter/Gender.php +16 -0
  20. app/code/community/Topefekt/Magesms/Model/Marketing/Filter/Group.php +16 -0
  21. app/code/community/Topefekt/Magesms/Model/Marketing/Filter/Lastname.php +16 -0
  22. app/code/community/Topefekt/Magesms/Model/Marketing/Filter/Newsletter.php +16 -0
  23. app/code/community/Topefekt/Magesms/Model/Marketing/Filter/Register.php +16 -0
  24. app/code/community/Topefekt/Magesms/Model/Marketing/Filter/Type.php +16 -0
  25. app/code/community/Topefekt/Magesms/Model/Marketing/Filter/Website.php +16 -0
  26. app/code/community/Topefekt/Magesms/Model/Mysql4/Marketing/Filter.php +16 -0
  27. app/code/community/Topefekt/Magesms/Model/Mysql4/Marketing/Filter/Collection.php +16 -0
  28. app/code/community/Topefekt/Magesms/Model/Mysql4/Template.php +16 -0
  29. app/code/community/Topefekt/Magesms/Model/Mysql4/Template/Collection.php +16 -0
  30. app/code/community/Topefekt/Magesms/Model/Observer.php +1 -1
  31. app/code/community/Topefekt/Magesms/Model/Sms.php +1 -1
  32. app/code/community/Topefekt/Magesms/Model/Template.php +16 -0
  33. app/code/community/Topefekt/Magesms/controllers/Adminhtml/Magesms/AboutController.php +1 -1
  34. app/code/community/Topefekt/Magesms/controllers/Adminhtml/Magesms/AdminsmsController.php +1 -1
  35. app/code/community/Topefekt/Magesms/controllers/Adminhtml/Magesms/AnswersController.php +1 -1
  36. app/code/community/Topefekt/Magesms/controllers/Adminhtml/Magesms/CustomersmsController.php +1 -1
  37. app/code/community/Topefekt/Magesms/controllers/Adminhtml/Magesms/HistoryController.php +1 -1
  38. app/code/community/Topefekt/Magesms/controllers/Adminhtml/Magesms/MarketingController.php +21 -1
  39. app/code/community/Topefekt/Magesms/controllers/Adminhtml/Magesms/OptoutController.php +1 -1
  40. app/code/community/Topefekt/Magesms/controllers/Adminhtml/Magesms/ProfileController.php +1 -1
  41. app/code/community/Topefekt/Magesms/controllers/Adminhtml/Magesms/PurchasecreditController.php +1 -1
  42. app/code/community/Topefekt/Magesms/controllers/Adminhtml/Magesms/SendsmsController.php +1 -1
  43. app/code/community/Topefekt/Magesms/controllers/Adminhtml/Magesms/StatisticsController.php +1 -1
  44. app/code/community/Topefekt/Magesms/controllers/Adminhtml/Magesms/WizardController.php +1 -1
  45. app/code/community/Topefekt/Magesms/etc/config.xml +7 -1
  46. app/code/community/Topefekt/Magesms/sql/magesms_setup/mysql4-upgrade-1.1.5-1.2.0.php +38 -0
  47. app/design/adminhtml/default/default/template/topefekt/magesms/about.phtml +1 -1
  48. app/design/adminhtml/default/default/template/topefekt/magesms/adminsms.phtml +3 -5
  49. app/design/adminhtml/default/default/template/topefekt/magesms/customersms.phtml +3 -5
  50. app/design/adminhtml/default/default/template/topefekt/magesms/history.phtml +1 -1
  51. app/design/adminhtml/default/default/template/topefekt/magesms/marketing.phtml +3 -5
  52. app/design/adminhtml/default/default/template/topefekt/magesms/marketing/customer.phtml +16 -0
  53. app/design/adminhtml/default/default/template/topefekt/magesms/marketing/form.phtml +16 -0
  54. app/design/adminhtml/default/default/template/topefekt/magesms/optout.phtml +1 -1
  55. app/design/adminhtml/default/default/template/topefekt/magesms/profile.phtml +2 -2
  56. app/design/adminhtml/default/default/template/topefekt/magesms/sendsms.phtml +5 -7
  57. app/design/adminhtml/default/default/template/topefekt/magesms/template/form.phtml +16 -0
  58. app/design/adminhtml/default/default/template/topefekt/magesms/wizard-sender.phtml +1 -1
  59. app/locale/cs_CZ/Topefekt_Magesms.csv +1 -0
  60. app/locale/sk_SK/Topefekt_Magesms.csv +1 -0
  61. js/topefekt/functions.js +5 -2
  62. js/topefekt/template.js +310 -0
  63. package.xml +4 -4
  64. skin/adminhtml/base/default/css/topefekt/magesms/stylesheet.css +1 -1
app/code/community/Topefekt/Magesms/Block/Answers/Grid.php CHANGED
@@ -13,4 +13,4 @@
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
- class Topefekt_Magesms_Block_Answers_Grid extends Mage_Adminhtml_Block_Widget_Grid { public function __construct() { parent::__construct(); $this->setSaveParametersInSession(false); $this->setDefaultSort('cas'); $this->setDefaultDir('DESC'); } protected function _prepareCollection() { $iff7e46827cbb6547116c592bf800f4687428abf9 = Mage::getResourceModel('magesms/answers_collection'); $this->setCollection($iff7e46827cbb6547116c592bf800f4687428abf9); parent::_prepareCollection(); return $this; } protected function _prepareColumns() { $this->addColumn('`from`', array( 'header'=>Mage::helper('magesms')->__('From number'), 'width' => '150px', 'index' => 'from', 'align' => 'right', ) ); $this->addColumn('text', array( 'index' => 'text', 'header'=>Mage::helper('magesms')->__('Text'), ) ); $this->addColumn('cas', array( 'header'=>Mage::helper('magesms')->__('Date'), 'width' => '150px', 'index' => 'cas', 'type' => 'datetime', ) ); $this->addColumn('smsc', array( 'header'=>Mage::helper('magesms')->__('SMS center'), 'width' => '150px', 'index' => 'smsc', 'align' => 'right', 'renderer' => 'Topefekt_Magesms_Block_Answers_Renderer_Smsc', ) ); if (Mage::getSingleton('admin/session')->isAllowed('magesms/answers/mark_as_read') || Mage::getSingleton('admin/session')->isAllowed('magesms/answers/remove')) { $this->addColumn('action', array( 'header' => Mage::helper('magesms')->__('Action'), 'width' => '200px', 'sortable' => false, 'filter' => false, 'type' => 'action', 'is_system' => true, 'renderer' => 'Topefekt_Magesms_Block_Answers_Renderer_Actions' ) ); } $this->addExportType('*/*/exportCsv', Mage::helper('magesms')->__('CSV')); $this->addExportType('*/*/exportExcel', Mage::helper('magesms')->__('Excel XML')); return parent::_prepareColumns(); } protected function _prepareMassaction() { $this->setMassactionIdField('IDs'); $this->getMassactionBlock()->setFormFieldName('answers'); if (Mage::getSingleton('admin/session')->isAllowed('magesms/answers/mark_as_read')) { $this->getMassactionBlock()->addItem('mark_as_read', array( 'label' => Mage::helper('magesms')->__('Mark as Read'), 'url' => $this->getUrl('*/*/massMarkAsRead', array('_current'=>true)), )); } if (Mage::getSingleton('admin/session')->isAllowed('magesms/answers/remove')) { $this->getMassactionBlock()->addItem('remove', array( 'label' => Mage::helper('magesms')->__('Remove'), 'url' => $this->getUrl('*/*/massRemove'), 'confirm' => Mage::helper('magesms')->__('Are you sure?') )); } return $this; } protected function getNoFilterMassactionColumn(){ return true; } public function getRowClass(Varien_Object $iebe3a16a01f87f9a4ebbb9731163db3e3e64cc3d) { return $iebe3a16a01f87f9a4ebbb9731163db3e3e64cc3d->getProhlednuto() ? 'read' : 'unread'; } public function getRowClickCallback() { return false; } }
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
+ class Topefekt_Magesms_Block_Answers_Grid extends Mage_Adminhtml_Block_Widget_Grid { public function __construct() { parent::__construct(); $this->setSaveParametersInSession(false); $this->setDefaultSort('cas'); $this->setDefaultDir('DESC'); } protected function _prepareCollection() { $iff7e46827cbb6547116c592bf800f4687428abf9 = Mage::getResourceModel('magesms/answers_collection'); $this->setCollection($iff7e46827cbb6547116c592bf800f4687428abf9); parent::_prepareCollection(); return $this; } protected function _prepareColumns() { $this->addColumn('from', array( 'header'=>Mage::helper('magesms')->__('From number'), 'width' => '150px', 'index' => 'from', 'align' => 'right', ) ); $this->addColumn('text', array( 'index' => 'text', 'header'=>Mage::helper('magesms')->__('Text'), ) ); $this->addColumn('cas', array( 'header'=>Mage::helper('magesms')->__('Date'), 'width' => '150px', 'index' => 'cas', 'type' => 'datetime', ) ); $this->addColumn('smsc', array( 'header'=>Mage::helper('magesms')->__('SMS center'), 'width' => '150px', 'index' => 'smsc', 'align' => 'right', 'renderer' => 'Topefekt_Magesms_Block_Answers_Renderer_Smsc', ) ); if (Mage::getSingleton('admin/session')->isAllowed('magesms/answers/mark_as_read') || Mage::getSingleton('admin/session')->isAllowed('magesms/answers/remove')) { $this->addColumn('action', array( 'header' => Mage::helper('magesms')->__('Action'), 'width' => '200px', 'sortable' => false, 'filter' => false, 'type' => 'action', 'is_system' => true, 'renderer' => 'Topefekt_Magesms_Block_Answers_Renderer_Actions' ) ); } $this->addExportType('*/*/exportCsv', Mage::helper('magesms')->__('CSV')); $this->addExportType('*/*/exportExcel', Mage::helper('magesms')->__('Excel XML')); return parent::_prepareColumns(); } protected function _prepareMassaction() { $this->setMassactionIdField('IDs'); $this->getMassactionBlock()->setFormFieldName('answers'); if (Mage::getSingleton('admin/session')->isAllowed('magesms/answers/mark_as_read')) { $this->getMassactionBlock()->addItem('mark_as_read', array( 'label' => Mage::helper('magesms')->__('Mark as Read'), 'url' => $this->getUrl('*/*/massMarkAsRead', array('_current'=>true)), )); } if (Mage::getSingleton('admin/session')->isAllowed('magesms/answers/remove')) { $this->getMassactionBlock()->addItem('remove', array( 'label' => Mage::helper('magesms')->__('Remove'), 'url' => $this->getUrl('*/*/massRemove'), 'confirm' => Mage::helper('magesms')->__('Are you sure?') )); } return $this; } protected function getNoFilterMassactionColumn(){ return true; } public function getRowClass(Varien_Object $iebe3a16a01f87f9a4ebbb9731163db3e3e64cc3d) { return $iebe3a16a01f87f9a4ebbb9731163db3e3e64cc3d->getProhlednuto() ? 'read' : 'unread'; } public function getRowClickCallback() { return false; } }
app/code/community/Topefekt/Magesms/Block/Customer.php ADDED
@@ -0,0 +1,16 @@
1
+ <?php
2
+ /**
3
+ * Mage SMS - SMS notification & SMS marketing
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the BSD 3-Clause License
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ * @category TOPefekt
12
+ * @package TOPefekt_Magesms
13
+ * @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
+ * @license http://opensource.org/licenses/BSD-3-Clause
15
+ */
16
+ class Topefekt_Magesms_Block_Customer extends Mage_Adminhtml_Block_Widget_Grid_Container { public function __construct() { $this->_controller = 'customer'; $this->_blockGroup = 'magesms'; parent::__construct(); $this->_removeButton('add'); } }
app/code/community/Topefekt/Magesms/Block/Customer/Grid.php ADDED
@@ -0,0 +1,16 @@
1
+ <?php
2
+ /**
3
+ * Mage SMS - SMS notification & SMS marketing
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the BSD 3-Clause License
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ * @category TOPefekt
12
+ * @package TOPefekt_Magesms
13
+ * @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
+ * @license http://opensource.org/licenses/BSD-3-Clause
15
+ */
16
+ class Topefekt_Magesms_Block_Customer_Grid extends Mage_Adminhtml_Block_Widget_Grid { public function __construct() { parent::__construct(); $this->setSaveParametersInSession(false); $this->setFilterVisibility(false); $this->setPagerVisibility(false); $this->setId('magesms_customer_grid'); } protected function _construct() { parent::_construct(); } protected function _prepareColumns() { $this->addColumn('lastname', array( 'index' => 'lastname', 'header'=>Mage::helper('magesms')->__('Last name'), 'sortable' => false, ) ); $this->addColumn('firstname', array( 'header'=>Mage::helper('magesms')->__('First name'), 'index' => 'firstname', 'sortable' => false, ) ); $this->addColumn('country_id', array( 'header'=>Mage::helper('magesms')->__('Country'), 'width' => '50', 'index' => 'country_id', 'sortable' => false, ) ); $this->addColumn('Telephone', array( 'header'=>Mage::helper('magesms')->__('Mobile number'), 'width' => '130', 'index' => 'telephone', 'sortable' => false, ) ); if (!Mage::app()->isSingleStoreMode()) { $this->addColumn('website_id', array( 'header' => Mage::helper('customer')->__('Website'), 'align' => 'center', 'width' => '100px', 'type' => 'options', 'options' => Mage::getSingleton('adminhtml/system_store')->getWebsiteOptionHash(true), 'index' => 'website_id', 'sortable' => false, )); } $this->addColumn('action', array( 'header'=>Mage::helper('magesms')->__('Action'), 'align' => 'center', 'width' => '80px', 'type' => 'action', 'getter' => 'getId', 'actions' => array( array( 'caption' => Mage::helper('magesms')->__('REMOVE customer from this list'), 'title' => Mage::helper('magesms')->__('REMOVE customer from this list'), 'url' => array('base'=> '*/*/filter/action/removeCustomer/letter/'.$this->getParam('letter')), 'field' => 'id', 'onclick' => 'removeCustomer(this); return false;', 'class' => 'action-remove', 'id' => '', ) ), 'sortable' => false, 'index' => 'store', 'is_system' => true, ) ); return parent::_prepareColumns(); } public function getRowClickCallback() { return 'openGridRowMagesms'; } }
app/code/community/Topefekt/Magesms/Block/Marketing.php CHANGED
@@ -13,4 +13,4 @@
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
- class Topefekt_Magesms_Block_Marketing extends Mage_Adminhtml_Block_Widget_Grid_Container { public function __construct() { $this->_controller = 'marketing'; $this->_blockGroup = 'magesms'; $this->_headerText = $this->__('Marketing'); parent::__construct(); $this->_removeButton('add'); $this->addButton('filter_reset_form_submit', array( 'label' => Mage::helper('magesms')->__('Reset filter'), 'onclick' => 'filterResetFormSubmit()' )); $this->addButton('filter_form_submit', array( 'label' => Mage::helper('magesms')->__('Apply filter'), 'onclick' => 'filterFormSubmit()' )); } }
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
+ class Topefekt_Magesms_Block_Marketing extends Mage_Adminhtml_Block_Widget_Grid_Container { public function __construct() { $this->_controller = 'marketing'; $this->_blockGroup = 'magesms'; parent::__construct(); $this->_removeButton('add'); } }
app/code/community/Topefekt/Magesms/Block/Marketing/Customer.php ADDED
@@ -0,0 +1,16 @@
1
+ <?php
2
+ /**
3
+ * Mage SMS - SMS notification & SMS marketing
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the BSD 3-Clause License
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ * @category TOPefekt
12
+ * @package TOPefekt_Magesms
13
+ * @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
+ * @license http://opensource.org/licenses/BSD-3-Clause
15
+ */
16
+ class Topefekt_Magesms_Block_Marketing_Customer extends Mage_Adminhtml_Block_Template { public function __construct($i4361b87b8aae0dab8305e7873d3986285df3ff3d = array()) { parent::__construct($i4361b87b8aae0dab8305e7873d3986285df3ff3d); $this->setTemplate('topefekt/magesms/marketing/customer.phtml'); $this->setWebsites(Mage::getSingleton('magesms/marketing_filter')); } protected function _toHtml() { if ($this->getId()) { return '<div id="magesms-marketing-'.$this->getId().'">'.parent::_toHtml().'</div>'; } return parent::_toHtml(); } public function displayByAlphabet() { $i39d2c3f69cb73b5684f101b504090c13c5174bc4 = array(); foreach($this->getCollection() as $i21e55df616c305955791876c1eb4da83448beba2) { $i47b2a41e4081b6f8d8381f411087dcd7042bfb53 = mb_strtoupper(mb_substr(trim($i21e55df616c305955791876c1eb4da83448beba2->lastname), 0, 1, 'utf-8')); if (!in_array($i47b2a41e4081b6f8d8381f411087dcd7042bfb53, array_keys($i39d2c3f69cb73b5684f101b504090c13c5174bc4))) { $i39d2c3f69cb73b5684f101b504090c13c5174bc4[$i47b2a41e4081b6f8d8381f411087dcd7042bfb53] = new Varien_Data_Collection(); } $i39d2c3f69cb73b5684f101b504090c13c5174bc4[$i47b2a41e4081b6f8d8381f411087dcd7042bfb53]->addItem($i21e55df616c305955791876c1eb4da83448beba2); } ksort($i39d2c3f69cb73b5684f101b504090c13c5174bc4); return $i39d2c3f69cb73b5684f101b504090c13c5174bc4; } }
app/code/community/Topefekt/Magesms/Block/Marketing/Form.php CHANGED
@@ -1,4 +1,5 @@
1
- <?php /**
2
* Mage SMS - SMS notification & SMS marketing
3
*
4
* NOTICE OF LICENSE
@@ -12,4 +13,6 @@
12
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
13
* @license http://opensource.org/licenses/BSD-3-Clause
14
*/
15
- class Topefekt_Magesms_Block_Marketing_Form extends Mage_Adminhtml_Block_Widget_Form { protected function _prepareForm() { $id7c8c8e1d1b44e9917ce2ae9b4c7d03e2a3ab683 = $this->getUrl('*/*/filter'); $i1791b2d1f89bb2bd83b34046f59125af207713db = new Varien_Data_Form( array('id' => 'marketing_filter', 'action' => $id7c8c8e1d1b44e9917ce2ae9b4c7d03e2a3ab683, 'method' => 'get') ); $i5a4070f5dbe2b3be0f175bc31d21ce8a0e2e76dd = 'magesms_marketing_'; $i1791b2d1f89bb2bd83b34046f59125af207713db->setHtmlIdPrefix($i5a4070f5dbe2b3be0f175bc31d21ce8a0e2e76dd); $i1791b2d1f89bb2bd83b34046f59125af207713db->addField('customer_not', 'hidden', array( 'name' => 'customer_not', )); $i00f9b0a11b6d8c15e9d603e29ad96b2c88140a51 = $i1791b2d1f89bb2bd83b34046f59125af207713db->addFieldset('base_fieldset', array( 'legend' => Mage::helper('magesms')->__('SMS Marketing - bulk SMS filter'), ) ); $i1d62211db8a9db72de6d5dab2047f18cbfa90e19 = $i00f9b0a11b6d8c15e9d603e29ad96b2c88140a51->addFieldset('fieldset1', array('class' => 'float-left')); $if71cbed623a99cd5a1032d4d3388bfd486053db2 = array('' => '-->'.Mage::helper('magesms')->__('All stores')); foreach (Mage::app()->getWebsites($this->_isAdminScopeAllowed) as $i9fdb3b1e2e6984ebdd1220ec199279013c5483fc) { $if71cbed623a99cd5a1032d4d3388bfd486053db2[$i9fdb3b1e2e6984ebdd1220ec199279013c5483fc->getId()] = $i9fdb3b1e2e6984ebdd1220ec199279013c5483fc->getDataUsingMethod('name'); } $i1d62211db8a9db72de6d5dab2047f18cbfa90e19->addField('website_id', 'select', array( 'name' => 'website_id', 'options' => $if71cbed623a99cd5a1032d4d3388bfd486053db2, 'label' => Mage::helper('magesms')->__('Store:'), )); $i80d5e7e038cde7aac7e5d2335ded4e7785aa29c5 = Mage::getModel('customer/group')->getCollection()->toOptionArray(); array_unshift($i80d5e7e038cde7aac7e5d2335ded4e7785aa29c5, array('label' => '-->'.Mage::helper('magesms')->__('All'), 'value' => '')); $i1d62211db8a9db72de6d5dab2047f18cbfa90e19->addField('group_id', 'select', array( 'name' => 'group_id', 'values' => $i80d5e7e038cde7aac7e5d2335ded4e7785aa29c5, 'label' => Mage::helper('magesms')->__('Groups:'), )); $i1d62211db8a9db72de6d5dab2047f18cbfa90e19->addField('type', 'select', array( 'name' => 'type', 'options' => array( '' => '-->'.Mage::helper('magesms')->__('All customers'), '1' => Mage::helper('magesms')->__('company customers'), '2' => Mage::helper('magesms')->__('private customers') ), 'label' => Mage::helper('magesms')->__('Type:'), 'title' => Mage::helper('magesms')->__('Type:'), )); $i6973b269d81f66e6ce768ea1e423d5ef438b7e44 = $i00f9b0a11b6d8c15e9d603e29ad96b2c88140a51->addFieldset('fieldset2', array('class' => 'float-left')); $ic7e041f1c0f99ab24f17177e95509393b8ba49be = Mage::getModel('eav/config')->getAttribute('customer', 'gender'); if ($ic7e041f1c0f99ab24f17177e95509393b8ba49be->getId()) { $id92fd65e479a45fd28bc877dc5d15fc219af26db = $ic7e041f1c0f99ab24f17177e95509393b8ba49be->getSource()->getAllOptions(); foreach($id92fd65e479a45fd28bc877dc5d15fc219af26db as $i670253c23c6fcba76bc4256a88fdd8fbc1041039=>$i287bcbe0c9dfb97b6c1bb92e5d892c0dea8b7ab0) $id92fd65e479a45fd28bc877dc5d15fc219af26db[$i670253c23c6fcba76bc4256a88fdd8fbc1041039]['label'] = Mage::helper('magesms')->__($id92fd65e479a45fd28bc877dc5d15fc219af26db[$i670253c23c6fcba76bc4256a88fdd8fbc1041039]['label']); $id92fd65e479a45fd28bc877dc5d15fc219af26db[0]['label'] = '-->'.Mage::helper('magesms')->__('All'); $i6973b269d81f66e6ce768ea1e423d5ef438b7e44->addField('gender', 'select', array( 'name' => 'gender', 'values' => $id92fd65e479a45fd28bc877dc5d15fc219af26db, 'label' => Mage::helper('magesms')->__('Gender:'), 'title' => Mage::helper('magesms')->__('Gender:'), )); } $i6973b269d81f66e6ce768ea1e423d5ef438b7e44->addField('firstname', 'text', array( 'name' => 'firstname', 'label' => Mage::helper('magesms')->__('First name:'), 'title' => Mage::helper('magesms')->__('First name:'), )); $i6973b269d81f66e6ce768ea1e423d5ef438b7e44->addField('lastname', 'text', array( 'name' => 'lastname', 'label' => Mage::helper('magesms')->__('Last name:'), 'title' => Mage::helper('magesms')->__('Last name:'), )); $i86c493e99cbd47d91439d76b69a8635ff7e0951b = $i00f9b0a11b6d8c15e9d603e29ad96b2c88140a51->addFieldset('fieldset3', array('class' => 'float-left clear')); $i86c493e99cbd47d91439d76b69a8635ff7e0951b->addField('newsletter', 'select', array( 'name' => 'newsletter', 'options' => array( '' => '-->'.Mage::helper('magesms')->__('All'), '1' => Mage::helper('magesms')->__('yes'), '2' => Mage::helper('magesms')->__('no') ), 'label' => Mage::helper('magesms')->__('Newsletter:'), 'title' => Mage::helper('magesms')->__('Newsletter:'), )); $i195899c9895b81b9bc75dba762c949638a6f36dd = Mage::getModel('directory/country')->getCollection()->toOptionArray(); $i195899c9895b81b9bc75dba762c949638a6f36dd[0]['label'] = '-->'.Mage::helper('magesms')->__('All countries'); $i86c493e99cbd47d91439d76b69a8635ff7e0951b->addField('country_id', 'select', array( 'name' => 'country_id', 'values' => $i195899c9895b81b9bc75dba762c949638a6f36dd, 'label' => Mage::helper('magesms')->__('Country:'), )); $i86c493e99cbd47d91439d76b69a8635ff7e0951b->addField('city', 'text', array( 'name' => 'city', 'label' => Mage::helper('magesms')->__('City:'), 'title' => Mage::helper('magesms')->__('City:'), )); $i5e2f8ae4963934ca8fbc2fff6103b6356dd52c78 = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM); $i8e6fd52df86f5295fffe5104f8db4ec6715de949 = $i00f9b0a11b6d8c15e9d603e29ad96b2c88140a51->addFieldset('reg_fieldset', array( 'class' => 'float-left', ) ); $i8e6fd52df86f5295fffe5104f8db4ec6715de949->addField('reg_from', 'date', array( 'name' => 'reg_from', 'format' => $i5e2f8ae4963934ca8fbc2fff6103b6356dd52c78, 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'label' => Mage::helper('magesms')->__('Date of registration from: '), 'title' => Mage::helper('magesms')->__('Date of registration from: '), )); $i8e6fd52df86f5295fffe5104f8db4ec6715de949->addField('reg_to', 'date', array( 'name' => 'reg_to', 'format' => $i5e2f8ae4963934ca8fbc2fff6103b6356dd52c78, 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'label' => Mage::helper('magesms')->__('to: '), 'title' => Mage::helper('magesms')->__('to: '), )); $i8e6fd52df86f5295fffe5104f8db4ec6715de949->addField('reg_allyears', 'checkbox', array( 'name' => 'reg_allyears', 'value' => 1, 'checked' => $this->getFilterData()->getRegAllyears() ? true : false, 'label' => Mage::helper('magesms')->__('All years').':', 'title' => Mage::helper('magesms')->__('All years'), )); $i94a0c73886b997f60f48f7e0bbb9bc57703a3fdd = $i00f9b0a11b6d8c15e9d603e29ad96b2c88140a51->addFieldset('birth_fieldset', array( 'class' => 'float-left', ) ); $i94a0c73886b997f60f48f7e0bbb9bc57703a3fdd->addField('birth_from', 'date', array( 'name' => 'birth_from', 'format' => $i5e2f8ae4963934ca8fbc2fff6103b6356dd52c78, 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'label' => Mage::helper('magesms')->__('Date of birth from: '), 'title' => Mage::helper('magesms')->__('Date of birth from: '), )); $i94a0c73886b997f60f48f7e0bbb9bc57703a3fdd->addField('birth_to', 'date', array( 'name' => 'birth_to', 'format' => $i5e2f8ae4963934ca8fbc2fff6103b6356dd52c78, 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'label' => Mage::helper('magesms')->__('to: '), 'title' => Mage::helper('magesms')->__('to: '), )); $i94a0c73886b997f60f48f7e0bbb9bc57703a3fdd->addField('birth_allyears', 'checkbox', array( 'name' => 'birth_allyears', 'value' => 1, 'checked' => $this->getFilterData()->getBirthAllyears() ? true : false, 'label' => Mage::helper('magesms')->__('All years').':', 'title' => Mage::helper('magesms')->__('All years'), )); $i1791b2d1f89bb2bd83b34046f59125af207713db->setUseContainer(true); $this->setForm($i1791b2d1f89bb2bd83b34046f59125af207713db); return parent::_prepareForm(); } protected function _initFormValues() { $ia61712c27ea241bd7a543dc2b02ea572274d0322 = $this->getFilterData()->getData(); foreach ($ia61712c27ea241bd7a543dc2b02ea572274d0322 as $i670253c23c6fcba76bc4256a88fdd8fbc1041039 => $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89) { if (is_array($if2eee0665f163a28f4adcfe84e3fc666bf1bcd89) && isset($if2eee0665f163a28f4adcfe84e3fc666bf1bcd89[0])) { $ia61712c27ea241bd7a543dc2b02ea572274d0322[$i670253c23c6fcba76bc4256a88fdd8fbc1041039] = explode(',', $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89[0]); } } $this->getForm()->addValues($ia61712c27ea241bd7a543dc2b02ea572274d0322); return parent::_initFormValues(); } protected function _beforeToHtml() { $id567d29153b9150b8add34bc81058cd5432e46a0 = parent::_beforeToHtml(); return $id567d29153b9150b8add34bc81058cd5432e46a0; } }
1
+ <?php
2
+ /**
3
* Mage SMS - SMS notification & SMS marketing
4
*
5
* NOTICE OF LICENSE
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
+ class Topefekt_Magesms_Block_Marketing_Form extends Mage_Adminhtml_Block_Widget_Form { protected function _prepareForm() { $id7c8c8e1d1b44e9917ce2ae9b4c7d03e2a3ab683 = $this->getUrl('*/*/filter', array('action' => 'applyFilter')); $i1791b2d1f89bb2bd83b34046f59125af207713db = new Varien_Data_Form( array('id' => 'marketing_filter', 'action' => $id7c8c8e1d1b44e9917ce2ae9b4c7d03e2a3ab683, 'method' => 'get', 'onsubmit' => 'applyFilter(\'marketing_filter\'); return false;') ); $i5a4070f5dbe2b3be0f175bc31d21ce8a0e2e76dd = 'magesms_marketing_'; $i1791b2d1f89bb2bd83b34046f59125af207713db->setHtmlIdPrefix($i5a4070f5dbe2b3be0f175bc31d21ce8a0e2e76dd); $i1791b2d1f89bb2bd83b34046f59125af207713db->setUseContainer(true); $i1791b2d1f89bb2bd83b34046f59125af207713db->addField('customer_not', 'hidden', array( 'name' => 'customer_not', )); $i00f9b0a11b6d8c15e9d603e29ad96b2c88140a51 = $i1791b2d1f89bb2bd83b34046f59125af207713db->addFieldset('base_fieldset', array( 'legend' => Mage::helper('magesms')->__('SMS Marketing - bulk SMS filter'), ) ); $i6710129c3d74d2fb5df97ccbaab2621e9e5c1bf9 = '<a onclick="resetFilter(this);return false;" title="'.$this->__('Reset Filter').'" href="'.$this->getUrl('*/*/filter', array('action' => 'reset')).'">['.$this->__('Reset Filter').']</a>
17
+ &nbsp;&nbsp;&nbsp;<a onclick="showPopup(this);return false;" title="'.$this->__('Save filter').'" href="'.$this->getUrl('*/*/filter', array('action' => 'save')).'">['.$this->__('Save filter').']</a>
18
+ &nbsp;&nbsp;&nbsp;<a onclick="showPopup(this);return false;" title="'.$this->__('Saved Filters').'" href="'.$this->getUrl('*/*/filter', array('action' => 'load')).'">['.$this->__('Saved Filters').']</a>'; $i00f9b0a11b6d8c15e9d603e29ad96b2c88140a51->setHeaderBar($i6710129c3d74d2fb5df97ccbaab2621e9e5c1bf9); $i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2 = Mage::registry('magesms_marketing_filters'); $i00f9b0a11b6d8c15e9d603e29ad96b2c88140a51->addField('filters', 'select', array( 'name' => 'filters', 'options' => $i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2->getFilters(), 'onchange' => "loadFilter(this, '".$this->getUrl('*/*/filter', array('action' => 'loadFilter'))."');", )); $i0351976a9053ff0d3893ad32bf0b51e106252b6d = $this->getButtonHtml(Mage::helper('magesms')->__('Apply filter'), "applyFilter('".$i1791b2d1f89bb2bd83b34046f59125af207713db->getId()."')"); $i00f9b0a11b6d8c15e9d603e29ad96b2c88140a51->setHtmlContent('<p id="magesms_applied_filters">'.$this->getHtmlFilters().'</p>'.$i00f9b0a11b6d8c15e9d603e29ad96b2c88140a51->getChildrenHtml().'<span id="magesms_load_filter"></span>'.$i0351976a9053ff0d3893ad32bf0b51e106252b6d); $this->setForm($i1791b2d1f89bb2bd83b34046f59125af207713db); return parent::_prepareForm(); } public function getHtmlFilters() { $i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2 = Mage::getModel('magesms/marketing_filter_collection'); $id82aaf2f437652c4b6efbd55703199f614e8e516 = ''; foreach($i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2->getAppliedFilters() as $i7d411c0cc32cdb65ec82b9e8d79aa996946f5538=>$iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a) { $ib605a096f442fa4dba073a8f5d37efb1add4650f = str_replace(':', '', $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->filter['title']); $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89 = $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->getLabel() ? $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->getLabel() : $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->getValue(); if (is_array($if2eee0665f163a28f4adcfe84e3fc666bf1bcd89)) $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89 = $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89[0].$iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->filter['glue'].$if2eee0665f163a28f4adcfe84e3fc666bf1bcd89[1]; $id82aaf2f437652c4b6efbd55703199f614e8e516 .= '<span class="badge" style="background: '.$iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->filter['color'].'">'. $ib605a096f442fa4dba073a8f5d37efb1add4650f.': '.$if2eee0665f163a28f4adcfe84e3fc666bf1bcd89. ' <a class="delete" onclick="removeFilter(this); return false;" href="'. $this->getUrl('*/*/filter', array('action' => 'removeFilter', 'id' => $i7d411c0cc32cdb65ec82b9e8d79aa996946f5538)).'">x</a></span>'; } return $id82aaf2f437652c4b6efbd55703199f614e8e516; } }
app/code/community/Topefekt/Magesms/Block/Marketing/Grid.php CHANGED
@@ -13,4 +13,4 @@
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
- class Topefekt_Magesms_Block_Marketing_Grid extends Mage_Adminhtml_Block_Widget_Grid { public function __construct() { parent::__construct(); $this->setSaveParametersInSession(false); $this->setFilterVisibility(false); $this->setFilterData($this->getRequest()->getParam('filter')); } protected function _prepareCollection() { $iff7e46827cbb6547116c592bf800f4687428abf9 = Mage::registry('magesms_marketing_collection'); $this->setCollection($iff7e46827cbb6547116c592bf800f4687428abf9); parent::_prepareCollection(); $this->setAdditionalJavaScript('countitSMS.marketingCount = '.$this->getCollection()->getSize().";\ncountitSMS.count();\n"); return $this; } public function _construct() { } protected function _prepareColumns() { $this->addColumn('entity_id', array( 'header'=>Mage::helper('magesms')->__('Customer ID'), 'width' => '50px', 'index' => 'entity_id', 'type' => 'number', ) ); $this->addColumn('lastname', array( 'index' => 'lastname', 'header'=>Mage::helper('magesms')->__('Last name'), ) ); $this->addColumn('firstname', array( 'header'=>Mage::helper('magesms')->__('First name'), 'index' => 'firstname', ) ); $this->addColumn('country_id', array( 'header'=>Mage::helper('magesms')->__('Country'), 'width' => '50', 'index' => 'country_id', 'sortable' => false, ) ); $this->addColumn('Telephone', array( 'header'=>Mage::helper('magesms')->__('Mobile number'), 'width' => '130', 'index' => 'telephone', 'sortable' => false, ) ); if (!Mage::app()->isSingleStoreMode()) { $this->addColumn('website_id', array( 'header' => Mage::helper('customer')->__('Website'), 'align' => 'center', 'width' => '100px', 'type' => 'options', 'options' => Mage::getSingleton('adminhtml/system_store')->getWebsiteOptionHash(true), 'index' => 'website_id', )); } $this->addColumn('action', array( 'header'=>Mage::helper('magesms')->__('Action'), 'align' => 'center', 'width' => '80px', 'type' => 'action', 'getter' => 'getId', 'actions' => array( array( 'caption' => Mage::helper('magesms')->__('REMOVE customer from this list'), 'title' => Mage::helper('magesms')->__('REMOVE customer from this list'), 'field' => 'id', 'onclick' => 'filterRemoveCustomerSubmit(this)', 'class' => 'action-remove', 'id' => '', ) ), 'sortable' => false, 'index' => 'store', 'is_system' => true, ) ); return parent::_prepareColumns(); } public function getRowUrl($iebe3a16a01f87f9a4ebbb9731163db3e3e64cc3d) { return $this->getUrl('*/customer/edit', array('id' => $iebe3a16a01f87f9a4ebbb9731163db3e3e64cc3d->getId())); } public function getRowClickCallback() { return 'openGridRowMagesms'; } public function getFilterData() { $iea2d876101fbc4dc03450ed5474bbd8a6fb905a2 = Mage::helper('adminhtml')->prepareFilterString($this->filter_data); $iea2d876101fbc4dc03450ed5474bbd8a6fb905a2 = Mage::helper('magesms')->filterDates($iea2d876101fbc4dc03450ed5474bbd8a6fb905a2, array('reg_from', 'reg_to', 'birth_from', 'birth_to')); $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a = new Varien_Object(); foreach ($iea2d876101fbc4dc03450ed5474bbd8a6fb905a2 as $i670253c23c6fcba76bc4256a88fdd8fbc1041039 => $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89) { if (!empty($if2eee0665f163a28f4adcfe84e3fc666bf1bcd89) || is_numeric($if2eee0665f163a28f4adcfe84e3fc666bf1bcd89)) { $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a->setData($i670253c23c6fcba76bc4256a88fdd8fbc1041039, $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89); } } return $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a; } }
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
+ class Topefekt_Magesms_Block_Marketing_Grid extends Mage_Adminhtml_Block_Widget_Grid { public function __construct() { parent::__construct(); $this->setSaveParametersInSession(false); $this->setFilterVisibility(false); } protected function _prepareCollection() { parent::_prepareCollection(); $this->setAdditionalJavaScript('countitSMS.marketingCount = '.$this->getCollection()->getSize().";\ncountitSMS.count();\n"); return $this; } protected function _construct() { parent::_construct(); } protected function _prepareColumns() { $this->addColumn('entity_id', array( 'header'=>Mage::helper('magesms')->__('Customer ID'), 'width' => '50px', 'index' => 'entity_id', 'type' => 'number', ) ); $this->addColumn('lastname', array( 'index' => 'lastname', 'header'=>Mage::helper('magesms')->__('Last name'), ) ); $this->addColumn('firstname', array( 'header'=>Mage::helper('magesms')->__('First name'), 'index' => 'firstname', ) ); $this->addColumn('country_id', array( 'header'=>Mage::helper('magesms')->__('Country'), 'width' => '50', 'index' => 'country_id', 'sortable' => false, ) ); $this->addColumn('Telephone', array( 'header'=>Mage::helper('magesms')->__('Mobile number'), 'width' => '130', 'index' => 'telephone', 'sortable' => false, ) ); if (!Mage::app()->isSingleStoreMode()) { $this->addColumn('website_id', array( 'header' => Mage::helper('customer')->__('Website'), 'align' => 'center', 'width' => '100px', 'type' => 'options', 'options' => Mage::getSingleton('adminhtml/system_store')->getWebsiteOptionHash(true), 'index' => 'website_id', )); } $this->addColumn('action', array( 'header'=>Mage::helper('magesms')->__('Action'), 'align' => 'center', 'width' => '80px', 'type' => 'action', 'getter' => 'getId', 'actions' => array( array( 'caption' => Mage::helper('magesms')->__('REMOVE customer from this list'), 'title' => Mage::helper('magesms')->__('REMOVE customer from this list'), 'field' => 'id', 'onclick' => 'filterRemoveCustomerSubmit(this)', 'class' => 'action-remove', 'id' => '', ) ), 'sortable' => false, 'index' => 'store', 'is_system' => true, ) ); return parent::_prepareColumns(); } public function getRowUrl($iebe3a16a01f87f9a4ebbb9731163db3e3e64cc3d) { return $this->getUrl('*/customer/edit', array('id' => $iebe3a16a01f87f9a4ebbb9731163db3e3e64cc3d->getId())); } public function getRowClickCallback() { return 'openGridRowMagesms'; } }
app/code/community/Topefekt/Magesms/Block/Marketing/Template.php ADDED
@@ -0,0 +1,16 @@
1
+ <?php
2
+ /**
3
+ * Mage SMS - SMS notification & SMS marketing
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the BSD 3-Clause License
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ * @category TOPefekt
12
+ * @package TOPefekt_Magesms
13
+ * @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
+ * @license http://opensource.org/licenses/BSD-3-Clause
15
+ */
16
+ class Topefekt_Magesms_Block_Marketing_Template extends Mage_Adminhtml_Block_Widget_Grid { public function __construct() { parent::__construct(); $this->setSaveParametersInSession(false); $this->setFilterVisibility(false); $this->setPagerVisibility(false); $this->setDefaultSort('date'); $this->setDefaultDir('DESC'); $this->setId('magesms_filter_template_grid'); $this->setUseAjax(true); } protected function _prepareCollection() { $iff7e46827cbb6547116c592bf800f4687428abf9 = Mage::getModel('magesms/marketing_filter')->getCollection(); $this->setCollection($iff7e46827cbb6547116c592bf800f4687428abf9); parent::_prepareCollection(); return $this; } protected function _prepareColumns() { $this->addColumn('name', array( 'header'=>Mage::helper('magesms')->__('Name'), 'index' => 'name', 'sortable' => false, ) ); $this->addColumn('date', array( 'header'=>Mage::helper('magesms')->__('Date'), 'index' => 'date', 'width' => '150px', 'type' => 'datetime', 'sortable' => false, ) ); $this->addColumn('action', array( 'header'=>Mage::helper('magesms')->__('Action'), 'align' => 'center', 'width' => '80px', 'type' => 'action', 'getter' => 'getId', 'actions' => array( array( 'caption' => Mage::helper('magesms')->__('REMOVE'), 'title' => Mage::helper('magesms')->__('REMOVE'), 'url' => array('base'=> '*/*/filter', 'params'=> array('action' => 'remove')), 'field' => 'id', 'onclick' => 'return window.submitRemoveFilter(this);', 'class' => 'action-remove', 'id' => '', ) ), 'sortable' => false, 'index' => 'store', 'is_system' => true, ) ); return parent::_prepareColumns(); } public function getRowClickCallback() { return 'submitRestoreFilter'; } public function getRowUrl($iebe3a16a01f87f9a4ebbb9731163db3e3e64cc3d) { return $this->getUrl('*/*/filter', array('action' => 'restore', 'id' => $iebe3a16a01f87f9a4ebbb9731163db3e3e64cc3d->getId())); } }
app/code/community/Topefekt/Magesms/Block/Template/Template.php ADDED
@@ -0,0 +1,16 @@
1
+ <?php
2
+ /**
3
+ * Mage SMS - SMS notification & SMS marketing
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the BSD 3-Clause License
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ * @category TOPefekt
12
+ * @package TOPefekt_Magesms
13
+ * @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
+ * @license http://opensource.org/licenses/BSD-3-Clause
15
+ */
16
+ class Topefekt_Magesms_Block_Template_Template extends Mage_Adminhtml_Block_Widget_Grid { public function __construct() { parent::__construct(); $this->setSaveParametersInSession(false); $this->setFilterVisibility(false); $this->setPagerVisibility(false); $this->setDefaultSort('date'); $this->setDefaultDir('DESC'); $this->setId('magesms_template_grid'); $this->setUseAjax(true); } protected function _prepareCollection() { $iff7e46827cbb6547116c592bf800f4687428abf9 = Mage::getModel('magesms/template')->getCollection(); $i30f20aafde612a957f7f966cb5b85e35782bc88a = ($i8082253d76e74d88c499183ff2cfde28044ae37d = Mage::app()->getRequest()->getParam('type')) ? $i8082253d76e74d88c499183ff2cfde28044ae37d : 0; $iff7e46827cbb6547116c592bf800f4687428abf9->addFieldToFilter('type', $i30f20aafde612a957f7f966cb5b85e35782bc88a); $this->setCollection($iff7e46827cbb6547116c592bf800f4687428abf9); parent::_prepareCollection(); return $this; } protected function _prepareColumns() { $this->addColumn('name', array( 'header'=>Mage::helper('magesms')->__('Name'), 'index' => 'name', 'sortable' => false, ) ); $this->addColumn('date', array( 'header'=>Mage::helper('magesms')->__('Date'), 'index' => 'date', 'width' => '150px', 'type' => 'datetime', 'sortable' => false, ) ); $this->addColumn('action', array( 'header'=>Mage::helper('magesms')->__('Action'), 'align' => 'center', 'width' => '80px', 'type' => 'action', 'getter' => 'getId', 'actions' => array( array( 'caption' => Mage::helper('magesms')->__('REMOVE'), 'title' => Mage::helper('magesms')->__('REMOVE'), 'url' => array('base'=> '*/*/template', 'params'=> array('action' => 'remove')), 'field' => 'id', 'onclick' => 'return window.submitRemoveTemplate(this);', 'class' => 'action-remove', 'id' => '', ) ), 'sortable' => false, 'index' => 'store', 'is_system' => true, ) ); return parent::_prepareColumns(); } public function getRowClickCallback() { return 'submitRestoreTemplate'; } public function getRowUrl($iebe3a16a01f87f9a4ebbb9731163db3e3e64cc3d) { return $this->getUrl('*/*/template', array('action' => 'restore', 'id' => $iebe3a16a01f87f9a4ebbb9731163db3e3e64cc3d->getId())); } }
app/code/community/Topefekt/Magesms/Controller/Action.php ADDED
@@ -0,0 +1,16 @@
1
+ <?php
2
+ /**
3
+ * Mage SMS - SMS notification & SMS marketing
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the BSD 3-Clause License
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ * @category TOPefekt
12
+ * @package TOPefekt_Magesms
13
+ * @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
+ * @license http://opensource.org/licenses/BSD-3-Clause
15
+ */
16
+ class Topefekt_Magesms_Controller_Action extends Mage_Adminhtml_Controller_Action { public $profile; protected $_filterData; protected function _construct() { $this->profile = Mage::getSingleton('magesms/smsprofile'); } public function preDispatch() { parent::preDispatch(); if (!$this->profile->user->getUser()) { $this->setFlag('', self::FLAG_NO_DISPATCH, true); if (!empty($this->profile->_error)) { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('magesms')->__($this->profile->_error)); } else { Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magesms')->__('Not registered yet? Create account now!')); } $this->_redirect('*/magesms_profile'); } else { $i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa = Mage::helper('adminhtml')->prepareFilterString($this->getRequest()->getParam('filter')); $i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa = $this->_filterDates($i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa, array('reg_from', 'reg_to', 'birth_from', 'birth_to')); $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a = new Varien_Object(); foreach ($i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa as $i670253c23c6fcba76bc4256a88fdd8fbc1041039 => $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89) { if (!empty($if2eee0665f163a28f4adcfe84e3fc666bf1bcd89) || is_numeric($if2eee0665f163a28f4adcfe84e3fc666bf1bcd89)) { $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a->setData($i670253c23c6fcba76bc4256a88fdd8fbc1041039, $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89); } } $this->_filterData = $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a; } return $this; } public function getBlockCustomer() { $i21e55df616c305955791876c1eb4da83448beba2 = $this->getLayout()->createBlock('magesms/customer_grid'); return $i21e55df616c305955791876c1eb4da83448beba2; } protected function _initAction() { $this->loadLayout() ->_title(Mage::helper('magesms')->__('MageSMS')) ; $this->getLayout()->getBlock('head') ->addCss('css/topefekt/magesms/stylesheet.css') ->addJs('topefekt/functions.js') ; if ($i458778f43fe9c6d565ec84d06bb5438f060a17d8 = $this->getLayout()->getBlock('head')) { $i458778f43fe9c6d565ec84d06bb5438f060a17d8->addItem('js', 'prototype/window.js') ->addItem('js_css', 'prototype/windows/themes/default.css') ->addCss('lib/prototype/windows/themes/magento.css') ->addItem('js', 'mage/adminhtml/variables.js'); } return $this; } }
app/code/community/Topefekt/Magesms/Controller/Template/Action.php ADDED
@@ -0,0 +1,20 @@
1
+ <?php
2
+ /**
3
+ * Mage SMS - SMS notification & SMS marketing
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the BSD 3-Clause License
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ * @category TOPefekt
12
+ * @package TOPefekt_Magesms
13
+ * @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
+ * @license http://opensource.org/licenses/BSD-3-Clause
15
+ */
16
+ class Topefekt_Magesms_Controller_Template_Action extends Topefekt_Magesms_Controller_Action { public function templateAction() { $ia1a238c1f12f3901520c7ca55efa646e471f7f6e = new Varien_Object(); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setError(false); if ($this->getRequest()->getParams()) { $i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2 = $this->getRequest(); if ($i1507c94b68f51b22087227858337782550edf618 = $i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2->getParam('action')) { try { switch ($i1507c94b68f51b22087227858337782550edf618) { case 'saveTemplate': $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setHtml($this->_saveTemplate()); break; case 'loadTemplate': $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setHtml($this->_saveTemplate(false)); break; case 'save': if ($this->getRequest()->isPost()) { $iefc930e6dfdf3023610ed7d663c73d176a7544e0 = Mage::getModel('magesms/template'); $iefc930e6dfdf3023610ed7d663c73d176a7544e0->setData(array( 'name' => $i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2->getParam('saveName'), 'template' => $i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2->getParam('text'), 'unicode' => $i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2->getParam('unicode'), 'unique' => $i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2->getParam('unique'), 'date' => date('Y-m-d H:i:s'), 'type' => $i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2->getParam('type') )); $iefc930e6dfdf3023610ed7d663c73d176a7544e0->save(); } break; case 'remove': if ($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538 = $i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2->getParam('id')) { $iefc930e6dfdf3023610ed7d663c73d176a7544e0 = Mage::getModel('magesms/template'); $iefc930e6dfdf3023610ed7d663c73d176a7544e0->load($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538); $iefc930e6dfdf3023610ed7d663c73d176a7544e0->delete(); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setHtml($this->_saveTemplate(false)); } break; case 'restore': if ($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538 = $i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2->getParam('id')) { $iefc930e6dfdf3023610ed7d663c73d176a7544e0 = Mage::getModel('magesms/template'); $iefc930e6dfdf3023610ed7d663c73d176a7544e0->load($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->addData(array('data' => $iefc930e6dfdf3023610ed7d663c73d176a7544e0->getData())); } break; } } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { Mage::getSingleton('adminhtml/session')->addError($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage()); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setError(true); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setMessage($this->getLayout()->getMessagesBlock()->getGroupedHtml()); } } } $this->getResponse()->setBody($ia1a238c1f12f3901520c7ca55efa646e471f7f6e->toJson()); } protected function _prepareText($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538fc9fbe8edf868c14fc4a3f15c7f40aabfa080aa, $i3bf172bc34c83f4a18624b192bc0bd7c4d647a66 = null, $i7a5ea366969a291381fafa1448c9a2fafd34ad5e = null) { if (preg_match_all('/{(.*?)}/', $i7d411c0cc32cdb65ec82b9e8d79aa996946f5538fc9fbe8edf868c14fc4a3f15c7f40aabfa080aa, $ia00c63b7b8f0d76f361b9bd281e5073cc0d0aa3e)) { $i0933475b5bd80561a9f50282fd9eb0b8345cec4b = array(); foreach($ia00c63b7b8f0d76f361b9bd281e5073cc0d0aa3e[1] as $iebd691e534c6cf2e84cf8a88790a5271154fca05) { $i0933475b5bd80561a9f50282fd9eb0b8345cec4b[$iebd691e534c6cf2e84cf8a88790a5271154fca05] = '{'.$iebd691e534c6cf2e84cf8a88790a5271154fca05.'}'; } if (isset($i0933475b5bd80561a9f50282fd9eb0b8345cec4b['shop_domain'])) { $i0933475b5bd80561a9f50282fd9eb0b8345cec4b['shop_domain'] = Mage::getStoreConfig('web/unsecure/base_url', $i3bf172bc34c83f4a18624b192bc0bd7c4d647a66); } if (isset($i0933475b5bd80561a9f50282fd9eb0b8345cec4b['shop_name'])) { $i0933475b5bd80561a9f50282fd9eb0b8345cec4b['shop_name'] = Mage::getStoreConfig('general/store_information/name', $i3bf172bc34c83f4a18624b192bc0bd7c4d647a66); if (empty($i0933475b5bd80561a9f50282fd9eb0b8345cec4b['shop_name'])) { if (!empty($i3bf172bc34c83f4a18624b192bc0bd7c4d647a66)) { $i0933475b5bd80561a9f50282fd9eb0b8345cec4b['shop_name'] = Mage::getModel('core/store')->load($i3bf172bc34c83f4a18624b192bc0bd7c4d647a66)->getName(); } else { $i0933475b5bd80561a9f50282fd9eb0b8345cec4b['shop_name'] = Mage::app()->getStore()->getName(); } } } if (isset($i0933475b5bd80561a9f50282fd9eb0b8345cec4b['shop_email'])) { $i0933475b5bd80561a9f50282fd9eb0b8345cec4b['shop_email'] = Mage::getStoreConfig('trans_email/ident_general/email', $i3bf172bc34c83f4a18624b192bc0bd7c4d647a66); } if (isset($i0933475b5bd80561a9f50282fd9eb0b8345cec4b['shop_phone'])) { $i0933475b5bd80561a9f50282fd9eb0b8345cec4b['shop_phone'] = Mage::getStoreConfig('general/store_information/phone', $i3bf172bc34c83f4a18624b192bc0bd7c4d647a66); } if (is_object($i7a5ea366969a291381fafa1448c9a2fafd34ad5e) && $i7a5ea366969a291381fafa1448c9a2fafd34ad5e instanceof Varien_Object) { if (isset($i0933475b5bd80561a9f50282fd9eb0b8345cec4b['customer_firstname'])) { $i0933475b5bd80561a9f50282fd9eb0b8345cec4b['customer_firstname'] = $i7a5ea366969a291381fafa1448c9a2fafd34ad5e->getFirstname(); } if (isset($i0933475b5bd80561a9f50282fd9eb0b8345cec4b['customer_lastname'])) { $i0933475b5bd80561a9f50282fd9eb0b8345cec4b['customer_lastname'] = $i7a5ea366969a291381fafa1448c9a2fafd34ad5e->getLastname(); } if (isset($i0933475b5bd80561a9f50282fd9eb0b8345cec4b['customer_email'])) { $i0933475b5bd80561a9f50282fd9eb0b8345cec4b['customer_email'] = $i7a5ea366969a291381fafa1448c9a2fafd34ad5e->getEmail(); } if (isset($i0933475b5bd80561a9f50282fd9eb0b8345cec4b['customer_phone'])) { $i0933475b5bd80561a9f50282fd9eb0b8345cec4b['customer_phone'] = $i7a5ea366969a291381fafa1448c9a2fafd34ad5e->getTelephone(); } } foreach($i0933475b5bd80561a9f50282fd9eb0b8345cec4b as $i670253c23c6fcba76bc4256a88fdd8fbc1041039=>$if2eee0665f163a28f4adcfe84e3fc666bf1bcd89) { $i7d411c0cc32cdb65ec82b9e8d79aa996946f5538fc9fbe8edf868c14fc4a3f15c7f40aabfa080aa = str_replace('{'.$i670253c23c6fcba76bc4256a88fdd8fbc1041039.'}', $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89, $i7d411c0cc32cdb65ec82b9e8d79aa996946f5538fc9fbe8edf868c14fc4a3f15c7f40aabfa080aa); } } return $i7d411c0cc32cdb65ec82b9e8d79aa996946f5538fc9fbe8edf868c14fc4a3f15c7f40aabfa080aa; } protected function _saveTemplate($iacea0d13bc5e2676192c06d68cb091dc0ce26320 = true) { $id82aaf2f437652c4b6efbd55703199f614e8e516 = ''; if ($iacea0d13bc5e2676192c06d68cb091dc0ce26320) { $i1791b2d1f89bb2bd83b34046f59125af207713db = $this->getLayout()->createBlock( 'Topefekt_Magesms_Block_Template', 'magesms_marketing_templateform', array('template' => 'topefekt/magesms/template/form.phtml') ); $id82aaf2f437652c4b6efbd55703199f614e8e516 = $i1791b2d1f89bb2bd83b34046f59125af207713db->toHtml(); } $i42cf41da37138d64d37b0778e6561aab5e1239d6 = $this->getLayout()->createBlock('magesms/template_template'); return $id82aaf2f437652c4b6efbd55703199f614e8e516.$i42cf41da37138d64d37b0778e6561aab5e1239d6->toHtml(); } protected function _initAction() { parent::_initAction(); $this->getLayout()->getBlock('head')->addJs('topefekt/template.js'); $i3358fd35282548f1f8ccafbf23d60a4ade466fd3 = '
17
+ Translator.add("Template has been loaded.", "'.$this->__('Template has been loaded.').'");
18
+ Translator.add("Template has been saved.", "'.$this->__('Template has been saved.').'");
19
+ Translator.add("Are you sure you want to remove the template?", "'.$this->__('Are you sure you want to remove the template?').'");
20
+ '; $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock('core/text', 'template') ->setText(Mage::helper('adminhtml/media_js')->getScript($i3358fd35282548f1f8ccafbf23d60a4ade466fd3)); $this->_addContent($i8ee45e0018a32fb1a855b82624506e35789cc4d2); return $this; } }
app/code/community/Topefekt/Magesms/Model/Marketing/Filter.php ADDED
@@ -0,0 +1,16 @@
1
+ <?php
2
+ /**
3
+ * Mage SMS - SMS notification & SMS marketing
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the BSD 3-Clause License
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ * @category TOPefekt
12
+ * @package TOPefekt_Magesms
13
+ * @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
+ * @license http://opensource.org/licenses/BSD-3-Clause
15
+ */
16
+ class Topefekt_Magesms_Model_Marketing_Filter extends Mage_Core_Model_Abstract { static protected $_websites; static public $colors = array( "#ed6502", "#229922", "#999922", "#229999", "#999999", "#885566", "#9933aa", "#19aba3", "#dcca00", "#96c8a3", ); protected function _construct() { $this->_init( 'magesms/marketing_filter' ); } public function getWebsites() { if (!empty(self::$_websites)) return self::$_websites; self::$_websites = Mage::app()->getWebsites(); $ibcdf76f8c9ddc330c79f805116a8bb146c43749d = 0; foreach(self::$_websites as $ibcdf76f8c9ddc330c79f805116a8bb146c43749d9fdb3b1e2e6984ebdd1220ec199279013c5483fc) { if ($ibcdf76f8c9ddc330c79f805116a8bb146c43749d == count(self::$_websites)) $ibcdf76f8c9ddc330c79f805116a8bb146c43749d = 0; $ibcdf76f8c9ddc330c79f805116a8bb146c43749d9fdb3b1e2e6984ebdd1220ec199279013c5483fc->setColorWebsite(self::$colors[$ibcdf76f8c9ddc330c79f805116a8bb146c43749d]); $ibcdf76f8c9ddc330c79f805116a8bb146c43749d++; } return self::$_websites; } public function getColorWebsite($ibcdf76f8c9ddc330c79f805116a8bb146c43749d7d411c0cc32cdb65ec82b9e8d79aa996946f5538) { foreach($this->getWebsites() as $ibcdf76f8c9ddc330c79f805116a8bb146c43749d9fdb3b1e2e6984ebdd1220ec199279013c5483fc) if ($ibcdf76f8c9ddc330c79f805116a8bb146c43749d9fdb3b1e2e6984ebdd1220ec199279013c5483fc->getId() == $ibcdf76f8c9ddc330c79f805116a8bb146c43749d7d411c0cc32cdb65ec82b9e8d79aa996946f5538) return $ibcdf76f8c9ddc330c79f805116a8bb146c43749d9fdb3b1e2e6984ebdd1220ec199279013c5483fc->getColorWebsite(); } }
app/code/community/Topefekt/Magesms/Model/Marketing/Filter/Birthday.php ADDED
@@ -0,0 +1,16 @@
1
+ <?php
2
+ /**
3
+ * Mage SMS - SMS notification & SMS marketing
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the BSD 3-Clause License
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ * @category TOPefekt
12
+ * @package TOPefekt_Magesms
13
+ * @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
+ * @license http://opensource.org/licenses/BSD-3-Clause
15
+ */
16
+ class Topefekt_Magesms_Model_Marketing_Filter_Birthday extends Varien_Object { public $filter; public function __construct() { $this->filter = array( 'title' => Mage::helper('magesms')->__('Date of birth from: '), 'type' => 'date', 'name' => 'birthday', 'color' => '#907523', 'glue' => ' / '.Mage::helper('magesms')->__('to: '), ); } public function getFilter($iff7e46827cbb6547116c592bf800f4687428abf9, $i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2) { $i62074d2d0e606cbe67bd6b024f6c2eaac2029c2e = array(); $ie2a167ef859b6a69d0dc6803ded0a2a49f59ce69 = array(); foreach($i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2 as $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a) { if ($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a instanceof $this) { $i3ca4aff6918962dee4a8054ca52f13ef3b6bab08 = $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->getValue(); if (!empty($i3ca4aff6918962dee4a8054ca52f13ef3b6bab08[0])) $i62074d2d0e606cbe67bd6b024f6c2eaac2029c2e[] = array('from' => date('Y-m-d H:i:s', strtotime($i3ca4aff6918962dee4a8054ca52f13ef3b6bab08[0]))); if (!empty($i3ca4aff6918962dee4a8054ca52f13ef3b6bab08[1])) $ie2a167ef859b6a69d0dc6803ded0a2a49f59ce69[] = array('to' => date('Y-m-d H:i:s', strtotime($i3ca4aff6918962dee4a8054ca52f13ef3b6bab08[1]))); } } if (count($i62074d2d0e606cbe67bd6b024f6c2eaac2029c2e)) $iff7e46827cbb6547116c592bf800f4687428abf9->addFieldToFilter('dob', $i62074d2d0e606cbe67bd6b024f6c2eaac2029c2e); if (count($ie2a167ef859b6a69d0dc6803ded0a2a49f59ce69)) $iff7e46827cbb6547116c592bf800f4687428abf9->addFieldToFilter('dob', $ie2a167ef859b6a69d0dc6803ded0a2a49f59ce69); return $iff7e46827cbb6547116c592bf800f4687428abf9; } }
app/code/community/Topefekt/Magesms/Model/Marketing/Filter/Birthdayall.php ADDED
@@ -0,0 +1,16 @@
1
+ <?php
2
+ /**
3
+ * Mage SMS - SMS notification & SMS marketing
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the BSD 3-Clause License
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ * @category TOPefekt
12
+ * @package TOPefekt_Magesms
13
+ * @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
+ * @license http://opensource.org/licenses/BSD-3-Clause
15
+ */
16
+ class Topefekt_Magesms_Model_Marketing_Filter_Birthdayall extends Varien_Object { public $filter; public function __construct() { $this->filter = array( 'title' => Mage::helper('magesms')->__('Date of birth from: ').'('.Mage::helper('magesms')->__('All years').')', 'type' => 'birthdayall', 'name' => 'birthdayall', 'color' => '#907090', 'glue' => ' / ', ); } public function getFilter($iff7e46827cbb6547116c592bf800f4687428abf9, $i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2) { $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e = array(); foreach($i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2 as $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a) { if ($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a instanceof $this) { $i3ca4aff6918962dee4a8054ca52f13ef3b6bab08 = $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->getValue(); $id142d81574a8d8630ffd99db7dade811d2585120 = array(); if (!empty($i3ca4aff6918962dee4a8054ca52f13ef3b6bab08[0])) $id142d81574a8d8630ffd99db7dade811d2585120[] = 'DAYOFYEAR(DATE_ADD(at_dob.value, INTERVAL (YEAR('.(int)$i3ca4aff6918962dee4a8054ca52f13ef3b6bab08[0].') - YEAR(at_dob.value)) YEAR)) >= DAYOFYEAR('.(int)$i3ca4aff6918962dee4a8054ca52f13ef3b6bab08[0].')'; if (!empty($i3ca4aff6918962dee4a8054ca52f13ef3b6bab08[1])) $id142d81574a8d8630ffd99db7dade811d2585120[] = 'DAYOFYEAR(DATE_ADD(at_dob.value, INTERVAL (YEAR('.(int)$i3ca4aff6918962dee4a8054ca52f13ef3b6bab08[1].') - YEAR(at_dob.value)) YEAR)) <= DAYOFYEAR('.(int)$i3ca4aff6918962dee4a8054ca52f13ef3b6bab08[1].')'; if ($id142d81574a8d8630ffd99db7dade811d2585120) $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e[] = implode(' AND ', $id142d81574a8d8630ffd99db7dade811d2585120); } } if (count($i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e)) { $iff7e46827cbb6547116c592bf800f4687428abf9->addFieldToFilter('dob', array('notnull' => true)); $iff7e46827cbb6547116c592bf800f4687428abf9->getSelect()->where('('.implode(' OR ', $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e).')'); } return $iff7e46827cbb6547116c592bf800f4687428abf9; } }
app/code/community/Topefekt/Magesms/Model/Marketing/Filter/City.php ADDED
@@ -0,0 +1,16 @@
1
+ <?php
2
+ /**
3
+ * Mage SMS - SMS notification & SMS marketing
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the BSD 3-Clause License
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ * @category TOPefekt
12
+ * @package TOPefekt_Magesms
13
+ * @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
+ * @license http://opensource.org/licenses/BSD-3-Clause
15
+ */
16
+ class Topefekt_Magesms_Model_Marketing_Filter_City extends Varien_Object { public $filter; public function __construct() { $this->filter = array( 'title' => Mage::helper('magesms')->__('City'), 'type' => 'input', 'name' => 'city', 'color' => '#ff8000', ); } public function getFilter($iff7e46827cbb6547116c592bf800f4687428abf9, $i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2) { $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e = array(); foreach($i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2 as $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a) { if ($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a instanceof $this) $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e[] = array('like' => '%'.$iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->getValue().'%'); } if (count($i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e)) $iff7e46827cbb6547116c592bf800f4687428abf9->addFieldToFilter('billing_city', $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e); return $iff7e46827cbb6547116c592bf800f4687428abf9; } }
app/code/community/Topefekt/Magesms/Model/Marketing/Filter/Collection.php ADDED
@@ -0,0 +1,16 @@
1
+ <?php
2
+ /**
3
+ * Mage SMS - SMS notification & SMS marketing
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the BSD 3-Clause License
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ * @category TOPefekt
12
+ * @package TOPefekt_Magesms
13
+ * @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
+ * @license http://opensource.org/licenses/BSD-3-Clause
15
+ */
16
+ class Topefekt_Magesms_Model_Marketing_Filter_Collection extends Varien_Object { private $ve713b4c10ff4c8425970eab3a4d765b3fe6fed6c; private $v148194b5b9cc653ce2e35e9709e441dc6fd4123a; private $vb3aef862e6f33bb77b0548e126396581908637bb; public function __construct() { $this->ve713b4c10ff4c8425970eab3a4d765b3fe6fed6c = new Varien_Data_Collection(); $this->v148194b5b9cc653ce2e35e9709e441dc6fd4123a = unserialize(Mage::app()->loadCache('magesms_marketing_filter')); if (empty($this->v148194b5b9cc653ce2e35e9709e441dc6fd4123a) || !$this->v148194b5b9cc653ce2e35e9709e441dc6fd4123a instanceof Varien_Object) { $this->v148194b5b9cc653ce2e35e9709e441dc6fd4123a = new Varien_Object(); $this->v148194b5b9cc653ce2e35e9709e441dc6fd4123a->setData(array( 'filters' => new Varien_Data_Collection(), 'customers' => new Varien_Object() )); } } public function setCollection($iff7e46827cbb6547116c592bf800f4687428abf9) { parent::setCollection($iff7e46827cbb6547116c592bf800f4687428abf9); if (($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538bc1a1bf6d5c2813b31ab86ea82f7ca5e65de27a = $this->v148194b5b9cc653ce2e35e9709e441dc6fd4123a->getCustomers()->getIds())) $iff7e46827cbb6547116c592bf800f4687428abf9->addFieldToFilter('entity_id', array('nin' => $i7d411c0cc32cdb65ec82b9e8d79aa996946f5538bc1a1bf6d5c2813b31ab86ea82f7ca5e65de27a)); } public function addFilter($i2bd9743336318d0e14be0600c9129730279505dd) { $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a = Mage::getModel('magesms/marketing_filter_'.$i2bd9743336318d0e14be0600c9129730279505dd); if ($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a) $this->ve713b4c10ff4c8425970eab3a4d765b3fe6fed6c->addItem($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a); else Mage::log('Magesms: Do not load marketing filter: '.$i2bd9743336318d0e14be0600c9129730279505dd); return $this; } public function addFilters(array $ie7d1f3c0ab09749c63a4d4213221b59ce80ea45c) { foreach($ie7d1f3c0ab09749c63a4d4213221b59ce80ea45c as $i2bd9743336318d0e14be0600c9129730279505dd) $this->addFilter($i2bd9743336318d0e14be0600c9129730279505dd); } public function getFilters() { $i5528ed14b056e3debe4695094269de3a98f76fe7 = array('' => '- '.Mage::helper('magesms')->__('Please Select').' -'); foreach($this->ve713b4c10ff4c8425970eab3a4d765b3fe6fed6c as $i670253c23c6fcba76bc4256a88fdd8fbc1041039=>$iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a) { $i5528ed14b056e3debe4695094269de3a98f76fe7[$iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->filter['name']] = str_replace(':', '', $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->filter['title']); } return $i5528ed14b056e3debe4695094269de3a98f76fe7; } public function setFilters($iff7e46827cbb6547116c592bf800f4687428abf9) { foreach($this->ve713b4c10ff4c8425970eab3a4d765b3fe6fed6c as $i670253c23c6fcba76bc4256a88fdd8fbc1041039=>$iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a) { if (method_exists($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a, 'getFilter')) $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->getFilter($iff7e46827cbb6547116c592bf800f4687428abf9, $this->getCache()->getFilters()); } } public function getCache() { return isset($this->v148194b5b9cc653ce2e35e9709e441dc6fd4123a) ? $this->v148194b5b9cc653ce2e35e9709e441dc6fd4123a : null; } public function getAppliedFilters() { if (!empty($this->v148194b5b9cc653ce2e35e9709e441dc6fd4123a) && $this->v148194b5b9cc653ce2e35e9709e441dc6fd4123a instanceof Varien_Object) { return $this->v148194b5b9cc653ce2e35e9709e441dc6fd4123a->getFilters(); } } public function addApplyFilter($i2bd9743336318d0e14be0600c9129730279505dd, $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89) { $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a = Mage::getModel('magesms/marketing_filter_'.$i2bd9743336318d0e14be0600c9129730279505dd); if ($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a) { $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->setValue($if2eee0665f163a28f4adcfe84e3fc666bf1bcd89); $i092fed12249a415fe47769fa9b0bb17968e798c0 = $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->getValues(); if (!empty($i092fed12249a415fe47769fa9b0bb17968e798c0[0]) && is_array($i092fed12249a415fe47769fa9b0bb17968e798c0[0])) { foreach($i092fed12249a415fe47769fa9b0bb17968e798c0 as $i7d411c0cc32cdb65ec82b9e8d79aa996946f5538fc9fbe8edf868c14fc4a3f15c7f40aabfa080aa) { if ($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538fc9fbe8edf868c14fc4a3f15c7f40aabfa080aa['value'] == $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89) { $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->setLabel($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538fc9fbe8edf868c14fc4a3f15c7f40aabfa080aa['label']); break; } } } elseif (is_array($i092fed12249a415fe47769fa9b0bb17968e798c0) && in_array($if2eee0665f163a28f4adcfe84e3fc666bf1bcd89, array_keys($i092fed12249a415fe47769fa9b0bb17968e798c0))) { $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->setLabel($i092fed12249a415fe47769fa9b0bb17968e798c0[$if2eee0665f163a28f4adcfe84e3fc666bf1bcd89]); } $ia8418ed18227005524e0f3a24e89ce5b21e9b483 = false; foreach ($this->v148194b5b9cc653ce2e35e9709e441dc6fd4123a->getFilters() as $i705fa7c9639d497e1179d7d5691c212668a8c9c8) { if ($i705fa7c9639d497e1179d7d5691c212668a8c9c8 == $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a) { $ia8418ed18227005524e0f3a24e89ce5b21e9b483 = true; break; } } if (!$ia8418ed18227005524e0f3a24e89ce5b21e9b483) { $this->v148194b5b9cc653ce2e35e9709e441dc6fd4123a->getFilters()->addItem($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a); $this->f403d2b0a9c44d21482a17bcb162aa54ccb79be64(); } } else Mage::log('Magesms: Do not load marketing filter: '.$i2bd9743336318d0e14be0600c9129730279505dd); } public function removeFilter($i670253c23c6fcba76bc4256a88fdd8fbc1041039) { $this->v148194b5b9cc653ce2e35e9709e441dc6fd4123a->getFilters()->removeItemByKey($i670253c23c6fcba76bc4256a88fdd8fbc1041039); $this->f403d2b0a9c44d21482a17bcb162aa54ccb79be64(); } public function addRemoveCustomer($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538) { $iea1c44f6137731e1b13c494f784074e6a133577a = $this->v148194b5b9cc653ce2e35e9709e441dc6fd4123a->getCustomers()->getIds(); if (!is_array($iea1c44f6137731e1b13c494f784074e6a133577a)) $iea1c44f6137731e1b13c494f784074e6a133577a = array(); if (in_array($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538, $iea1c44f6137731e1b13c494f784074e6a133577a)) $iea1c44f6137731e1b13c494f784074e6a133577a = array_diff($iea1c44f6137731e1b13c494f784074e6a133577a, array($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538)); else $iea1c44f6137731e1b13c494f784074e6a133577a = array_merge($iea1c44f6137731e1b13c494f784074e6a133577a, array($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538)); $this->v148194b5b9cc653ce2e35e9709e441dc6fd4123a->getCustomers()->setIds($iea1c44f6137731e1b13c494f784074e6a133577a); $this->f403d2b0a9c44d21482a17bcb162aa54ccb79be64(); } public function resetFilter() { $this->v148194b5b9cc653ce2e35e9709e441dc6fd4123a = new Varien_Object(); $this->v148194b5b9cc653ce2e35e9709e441dc6fd4123a->setData(array( 'filters' => new Varien_Data_Collection(), 'customers' => new Varien_Object() )); $this->f403d2b0a9c44d21482a17bcb162aa54ccb79be64(); } public function toSerialize() { $ia61712c27ea241bd7a543dc2b02ea572274d0322 = array('filters' => array(), 'customers' => array()); foreach($this->v148194b5b9cc653ce2e35e9709e441dc6fd4123a->getFilters() as $i705fa7c9639d497e1179d7d5691c212668a8c9c8) { $ia61712c27ea241bd7a543dc2b02ea572274d0322['filters'][] = array('name' => $i705fa7c9639d497e1179d7d5691c212668a8c9c8->filter['name'], 'value' => $i705fa7c9639d497e1179d7d5691c212668a8c9c8->getValue()); } $ia61712c27ea241bd7a543dc2b02ea572274d0322['customers'] = $this->v148194b5b9cc653ce2e35e9709e441dc6fd4123a->getCustomers()->getIds(); return serialize($ia61712c27ea241bd7a543dc2b02ea572274d0322); } public function fromSerialize($ia61712c27ea241bd7a543dc2b02ea572274d0322) { $ia61712c27ea241bd7a543dc2b02ea572274d0322 = unserialize($ia61712c27ea241bd7a543dc2b02ea572274d0322); $this->resetFilter(); if (!empty($ia61712c27ea241bd7a543dc2b02ea572274d0322['filters'])) { foreach($ia61712c27ea241bd7a543dc2b02ea572274d0322['filters'] as $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a) { $this->addApplyFilter($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a['name'], $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a['value']); } } if (!empty($ia61712c27ea241bd7a543dc2b02ea572274d0322['customers']) && is_array($ia61712c27ea241bd7a543dc2b02ea572274d0322['customers'])) $this->v148194b5b9cc653ce2e35e9709e441dc6fd4123a->getCustomers()->setIds($ia61712c27ea241bd7a543dc2b02ea572274d0322['customers']); $this->f403d2b0a9c44d21482a17bcb162aa54ccb79be64(); } private function f403d2b0a9c44d21482a17bcb162aa54ccb79be64() { if (!empty($this->v148194b5b9cc653ce2e35e9709e441dc6fd4123a)) Mage::app()->saveCache(serialize($this->v148194b5b9cc653ce2e35e9709e441dc6fd4123a), 'magesms_marketing_filter'); } public function __destruct() { $this->f403d2b0a9c44d21482a17bcb162aa54ccb79be64(); } }
app/code/community/Topefekt/Magesms/Model/Marketing/Filter/Country.php ADDED
@@ -0,0 +1,16 @@
1
+ <?php
2
+ /**
3
+ * Mage SMS - SMS notification & SMS marketing
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the BSD 3-Clause License
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ * @category TOPefekt
12
+ * @package TOPefekt_Magesms
13
+ * @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
+ * @license http://opensource.org/licenses/BSD-3-Clause
15
+ */
16
+ class Topefekt_Magesms_Model_Marketing_Filter_Country extends Varien_Object { public $filter; public function __construct() { $this->filter = array( 'title' => Mage::helper('magesms')->__('Country'), 'firstItem' => Mage::helper('magesms')->__('All countries'), 'type' => 'select', 'name' => 'country', 'color' => '#005784', ); } public function getValues() { return array_merge( array(array('value' => '', 'label' => $this->filter['firstItem'])), Mage::getModel('directory/country')->getCollection()->toOptionArray(false) ); } public function getFilter($iff7e46827cbb6547116c592bf800f4687428abf9, $i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2) { $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e = array(); foreach($i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2 as $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a) { if ($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a instanceof $this) $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e[] = array($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->getValue()); } if (count($i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e)) $iff7e46827cbb6547116c592bf800f4687428abf9->addFieldToFilter('billing_country_id', $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e); return $iff7e46827cbb6547116c592bf800f4687428abf9; } }
app/code/community/Topefekt/Magesms/Model/Marketing/Filter/Firstname.php ADDED
@@ -0,0 +1,16 @@
1
+ <?php
2
+ /**
3
+ * Mage SMS - SMS notification & SMS marketing
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the BSD 3-Clause License
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ * @category TOPefekt
12
+ * @package TOPefekt_Magesms
13
+ * @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
+ * @license http://opensource.org/licenses/BSD-3-Clause
15
+ */
16
+ class Topefekt_Magesms_Model_Marketing_Filter_Firstname extends Varien_Object { public $filter; public function __construct() { $this->filter = array( 'title' => Mage::helper('magesms')->__('First name'), 'type' => 'input', 'name' => 'firstname', 'color' => '#c71585', ); } public function getFilter($iff7e46827cbb6547116c592bf800f4687428abf9, $i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2) { $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e = array(); foreach($i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2 as $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a) { if ($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a instanceof $this) $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e[] = array('like' => $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->getValue().'%'); } if (count($i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e)) $iff7e46827cbb6547116c592bf800f4687428abf9->addFieldToFilter('firstname', $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e); return $iff7e46827cbb6547116c592bf800f4687428abf9; } }
app/code/community/Topefekt/Magesms/Model/Marketing/Filter/Gender.php ADDED
@@ -0,0 +1,16 @@
1
+ <?php
2
+ /**
3
+ * Mage SMS - SMS notification & SMS marketing
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the BSD 3-Clause License
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ * @category TOPefekt
12
+ * @package TOPefekt_Magesms
13
+ * @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
+ * @license http://opensource.org/licenses/BSD-3-Clause
15
+ */
16
+ class Topefekt_Magesms_Model_Marketing_Filter_Gender extends Varien_Object { public $filter; public function __construct() { $this->filter = array( 'title' => Mage::helper('magesms')->__('Gender:'), 'firstItem' => Mage::helper('magesms')->__('All'), 'type' => 'select', 'name' => 'gender', 'color' => '#eeaaaa', ); } public function getValues() { $id92fd65e479a45fd28bc877dc5d15fc219af26db = array(); $ic7e041f1c0f99ab24f17177e95509393b8ba49be = Mage::getModel('eav/config')->getAttribute('customer', 'gender'); if ($ic7e041f1c0f99ab24f17177e95509393b8ba49be->getId()) { $id92fd65e479a45fd28bc877dc5d15fc219af26db = $ic7e041f1c0f99ab24f17177e95509393b8ba49be->getSource()->getAllOptions(false); foreach($id92fd65e479a45fd28bc877dc5d15fc219af26db as $i670253c23c6fcba76bc4256a88fdd8fbc1041039=>$i287bcbe0c9dfb97b6c1bb92e5d892c0dea8b7ab0) $id92fd65e479a45fd28bc877dc5d15fc219af26db[$i670253c23c6fcba76bc4256a88fdd8fbc1041039]['label'] = Mage::helper('magesms')->__($id92fd65e479a45fd28bc877dc5d15fc219af26db[$i670253c23c6fcba76bc4256a88fdd8fbc1041039]['label']); $id92fd65e479a45fd28bc877dc5d15fc219af26db = array_merge(array(array('value' => '', 'label' => $this->filter['firstItem'])), $id92fd65e479a45fd28bc877dc5d15fc219af26db); } return $id92fd65e479a45fd28bc877dc5d15fc219af26db; } public function getFilter($iff7e46827cbb6547116c592bf800f4687428abf9, $i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2) { $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e = array(); foreach($i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2 as $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a) { if ($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a instanceof $this) $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e[] = array($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->getValue()); } if (count($i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e)) $iff7e46827cbb6547116c592bf800f4687428abf9->addFieldToFilter('gender', $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e); return $iff7e46827cbb6547116c592bf800f4687428abf9; } }
app/code/community/Topefekt/Magesms/Model/Marketing/Filter/Group.php ADDED
@@ -0,0 +1,16 @@
1
+ <?php
2
+ /**
3
+ * Mage SMS - SMS notification & SMS marketing
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the BSD 3-Clause License
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ * @category TOPefekt
12
+ * @package TOPefekt_Magesms
13
+ * @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
+ * @license http://opensource.org/licenses/BSD-3-Clause
15
+ */
16
+ class Topefekt_Magesms_Model_Marketing_Filter_Group extends Varien_Object { public $filter; public function __construct() { $this->filter = array( 'title' => Mage::helper('magesms')->__('Groups'), 'firstItem' => Mage::helper('magesms')->__('All'), 'type' => 'select', 'name' => 'group', 'color' => '#d2b48c', ); } public function getValues() { return array_merge( array(array('value' => '', 'label' => $this->filter['firstItem'])), Mage::getModel('customer/group')->getCollection()->toOptionArray(false) ); } public function getFilter($iff7e46827cbb6547116c592bf800f4687428abf9, $i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2) { $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e = array(); foreach($i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2 as $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a) { if ($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a instanceof $this) $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e[] = array($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->getValue()); } if (count($i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e)) $iff7e46827cbb6547116c592bf800f4687428abf9->addFieldToFilter('group_id', $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e); return $iff7e46827cbb6547116c592bf800f4687428abf9; } }
app/code/community/Topefekt/Magesms/Model/Marketing/Filter/Lastname.php ADDED
@@ -0,0 +1,16 @@
1
+ <?php
2
+ /**
3
+ * Mage SMS - SMS notification & SMS marketing
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the BSD 3-Clause License
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ * @category TOPefekt
12
+ * @package TOPefekt_Magesms
13
+ * @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
+ * @license http://opensource.org/licenses/BSD-3-Clause
15
+ */
16
+ class Topefekt_Magesms_Model_Marketing_Filter_Lastname extends Varien_Object { public $filter; public function __construct() { $this->filter = array( 'title' => Mage::helper('magesms')->__('Last name'), 'type' => 'input', 'name' => 'lastname', 'color' => '#006600', ); } public function getFilter($iff7e46827cbb6547116c592bf800f4687428abf9, $i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2) { $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e = array(); foreach($i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2 as $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a) { if ($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a instanceof $this) $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e[] = array('like' => $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->getValue().'%'); } if (count($i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e)) $iff7e46827cbb6547116c592bf800f4687428abf9->addFieldToFilter('lastname', $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e); return $iff7e46827cbb6547116c592bf800f4687428abf9; } }
app/code/community/Topefekt/Magesms/Model/Marketing/Filter/Newsletter.php ADDED
@@ -0,0 +1,16 @@
1
+ <?php
2
+ /**
3
+ * Mage SMS - SMS notification & SMS marketing
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the BSD 3-Clause License
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ * @category TOPefekt
12
+ * @package TOPefekt_Magesms
13
+ * @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
+ * @license http://opensource.org/licenses/BSD-3-Clause
15
+ */
16
+ class Topefekt_Magesms_Model_Marketing_Filter_Newsletter extends Varien_Object { public $filter; public function __construct() { $this->filter = array( 'title' => Mage::helper('magesms')->__('Newsletter:'), 'firstItem' => Mage::helper('magesms')->__('All'), 'type' => 'select', 'name' => 'newsletter', 'color' => '#cd1818', ); } public function getValues() { return array( '' => $this->filter['firstItem'], '1' => Mage::helper('magesms')->__('Yes'), '2' => Mage::helper('magesms')->__('No') ); } public function getFilter($iff7e46827cbb6547116c592bf800f4687428abf9, $i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2) { $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e = array(); foreach($i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2 as $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a) { if ($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a instanceof $this) { if ($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->getValue() == 1) $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e[] = 'ns.`subscriber_status` = 1'; else $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e[] = 'ns.`subscriber_status` = 0 OR ns.`subscriber_status` IS NULL'; } } if (count($i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e)) { $iff7e46827cbb6547116c592bf800f4687428abf9->getSelect() ->joinLeft( array('ns' => $iff7e46827cbb6547116c592bf800f4687428abf9->getTable('newsletter/subscriber')), 'ns.`customer_id` = e.`entity_id`' ); $iff7e46827cbb6547116c592bf800f4687428abf9->getSelect() ->where(implode(' OR ', $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e)); } return $iff7e46827cbb6547116c592bf800f4687428abf9; } }
app/code/community/Topefekt/Magesms/Model/Marketing/Filter/Register.php ADDED
@@ -0,0 +1,16 @@
1
+ <?php
2
+ /**
3
+ * Mage SMS - SMS notification & SMS marketing
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the BSD 3-Clause License
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ * @category TOPefekt
12
+ * @package TOPefekt_Magesms
13
+ * @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
+ * @license http://opensource.org/licenses/BSD-3-Clause
15
+ */
16
+ class Topefekt_Magesms_Model_Marketing_Filter_Register extends Varien_Object { public $filter; public function __construct() { $this->filter = array( 'title' => Mage::helper('magesms')->__('Date of registration from: '), 'type' => 'datetime', 'name' => 'register', 'color' => '#907523', 'glue' => ' / '.Mage::helper('magesms')->__('to: '), ); } public function getFilter($iff7e46827cbb6547116c592bf800f4687428abf9, $i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2) { $i62074d2d0e606cbe67bd6b024f6c2eaac2029c2e = array(); $ie2a167ef859b6a69d0dc6803ded0a2a49f59ce69 = array(); foreach($i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2 as $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a) { if ($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a instanceof $this) { $i3ca4aff6918962dee4a8054ca52f13ef3b6bab08 = $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->getValue(); if (!empty($i3ca4aff6918962dee4a8054ca52f13ef3b6bab08[0])) $i62074d2d0e606cbe67bd6b024f6c2eaac2029c2e[] = array('from' => date('Y-m-d H:i:s', strtotime($i3ca4aff6918962dee4a8054ca52f13ef3b6bab08[0]))); if (!empty($i3ca4aff6918962dee4a8054ca52f13ef3b6bab08[1])) $ie2a167ef859b6a69d0dc6803ded0a2a49f59ce69[] = array('to' => date('Y-m-d H:i:s', strtotime($i3ca4aff6918962dee4a8054ca52f13ef3b6bab08[1]))); } } if (count($i62074d2d0e606cbe67bd6b024f6c2eaac2029c2e)) $iff7e46827cbb6547116c592bf800f4687428abf9->addFieldToFilter('created_at', $i62074d2d0e606cbe67bd6b024f6c2eaac2029c2e); if (count($ie2a167ef859b6a69d0dc6803ded0a2a49f59ce69)) $iff7e46827cbb6547116c592bf800f4687428abf9->addFieldToFilter('created_at', $ie2a167ef859b6a69d0dc6803ded0a2a49f59ce69); return $iff7e46827cbb6547116c592bf800f4687428abf9; } }
app/code/community/Topefekt/Magesms/Model/Marketing/Filter/Type.php ADDED
@@ -0,0 +1,16 @@
1
+ <?php
2
+ /**
3
+ * Mage SMS - SMS notification & SMS marketing
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the BSD 3-Clause License
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ * @category TOPefekt
12
+ * @package TOPefekt_Magesms
13
+ * @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
+ * @license http://opensource.org/licenses/BSD-3-Clause
15
+ */
16
+ class Topefekt_Magesms_Model_Marketing_Filter_Type extends Varien_Object { public $filter; public function __construct() { $this->filter = array( 'title' => Mage::helper('magesms')->__('Type'), 'firstItem' => Mage::helper('magesms')->__('All customers'), 'type' => 'select', 'name' => 'type', 'color' => '#9acd32', ); } public function getValues() { return array( '' => $this->filter['firstItem'], '1' => Mage::helper('magesms')->__('company customers'), '2' => Mage::helper('magesms')->__('private customers') ); } public function getFilter($iff7e46827cbb6547116c592bf800f4687428abf9, $i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2) { $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e = array(); foreach($i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2 as $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a) { if ($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a instanceof $this) { if ($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->getValue() == 1) $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e[] = array(array('notnull' => true)); if ($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->getValue() == 2) $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e[] = array(array('null' => true)); } } if (count($i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e)) $iff7e46827cbb6547116c592bf800f4687428abf9->joinAttribute('billing_vat_id', 'customer_address/vat_id', 'default_billing', null, 'left') ->addFieldToFilter('billing_vat_id', $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e); return $iff7e46827cbb6547116c592bf800f4687428abf9; } }
app/code/community/Topefekt/Magesms/Model/Marketing/Filter/Website.php ADDED
@@ -0,0 +1,16 @@
1
+ <?php
2
+ /**
3
+ * Mage SMS - SMS notification & SMS marketing
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the BSD 3-Clause License
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ * @category TOPefekt
12
+ * @package TOPefekt_Magesms
13
+ * @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
+ * @license http://opensource.org/licenses/BSD-3-Clause
15
+ */
16
+ class Topefekt_Magesms_Model_Marketing_Filter_Website extends Varien_Object { public $filter; public function __construct() { $this->filter = array( 'title' => Mage::helper('magesms')->__('Store'), 'firstItem' => Mage::helper('magesms')->__('All stores'), 'type' => 'select', 'name' => 'website', 'color' => '#8880aa', ); } public function getValues() { $if71cbed623a99cd5a1032d4d3388bfd486053db2 = array('' => $this->filter['firstItem']); foreach (Mage::app()->getWebsites($this->_isAdminScopeAllowed) as $i9fdb3b1e2e6984ebdd1220ec199279013c5483fc) { $if71cbed623a99cd5a1032d4d3388bfd486053db2[$i9fdb3b1e2e6984ebdd1220ec199279013c5483fc->getId()] = $i9fdb3b1e2e6984ebdd1220ec199279013c5483fc->getDataUsingMethod('name'); } return $if71cbed623a99cd5a1032d4d3388bfd486053db2; } public function getFilter($iff7e46827cbb6547116c592bf800f4687428abf9, $i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2) { $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e = array(); foreach($i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2 as $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a) { if ($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a instanceof $this) $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e[] = array($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->getValue()); } if (count($i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e)) { $iff7e46827cbb6547116c592bf800f4687428abf9->addFieldToFilter('website_id', $i717aafa07eeca1a7c0f40cc18a0eb90e0984de3e); } return $iff7e46827cbb6547116c592bf800f4687428abf9; } }
app/code/community/Topefekt/Magesms/Model/Mysql4/Marketing/Filter.php ADDED
@@ -0,0 +1,16 @@
1
+ <?php
2
+ /**
3
+ * Mage SMS - SMS notification & SMS marketing
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the BSD 3-Clause License
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ * @category TOPefekt
12
+ * @package TOPefekt_Magesms
13
+ * @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
+ * @license http://opensource.org/licenses/BSD-3-Clause
15
+ */
16
+ class Topefekt_Magesms_Model_Mysql4_Marketing_Filter extends Mage_Core_Model_Mysql4_Abstract { public function _construct() { $this->_init('magesms/marketing_filter', 'id'); } }
app/code/community/Topefekt/Magesms/Model/Mysql4/Marketing/Filter/Collection.php ADDED
@@ -0,0 +1,16 @@
1
+ <?php
2
+ /**
3
+ * Mage SMS - SMS notification & SMS marketing
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the BSD 3-Clause License
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ * @category TOPefekt
12
+ * @package TOPefekt_Magesms
13
+ * @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
+ * @license http://opensource.org/licenses/BSD-3-Clause
15
+ */
16
+ class Topefekt_Magesms_Model_Mysql4_Marketing_Filter_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract { public function _construct() { parent::_construct(); $this->_init('magesms/marketing_filter'); } }
app/code/community/Topefekt/Magesms/Model/Mysql4/Template.php ADDED
@@ -0,0 +1,16 @@
1
+ <?php
2
+ /**
3
+ * Mage SMS - SMS notification & SMS marketing
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the BSD 3-Clause License
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ * @category TOPefekt
12
+ * @package TOPefekt_Magesms
13
+ * @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
+ * @license http://opensource.org/licenses/BSD-3-Clause
15
+ */
16
+ class Topefekt_Magesms_Model_Mysql4_Template extends Mage_Core_Model_Mysql4_Abstract { public function _construct() { $this->_init('magesms/template', 'id'); } }
app/code/community/Topefekt/Magesms/Model/Mysql4/Template/Collection.php ADDED
@@ -0,0 +1,16 @@
1
+ <?php
2
+ /**
3
+ * Mage SMS - SMS notification & SMS marketing
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the BSD 3-Clause License
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ * @category TOPefekt
12
+ * @package TOPefekt_Magesms
13
+ * @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
+ * @license http://opensource.org/licenses/BSD-3-Clause
15
+ */
16
+ class Topefekt_Magesms_Model_Mysql4_Template_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract { public function _construct() { parent::_construct(); $this->_init('magesms/template'); } }
app/code/community/Topefekt/Magesms/Model/Observer.php CHANGED
@@ -13,4 +13,4 @@
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
- class Topefekt_Magesms_Model_Observer { public function updateOrderTrackingNumber(Varien_Event_Observer $i417760717250c854293598d2ff07a66629a1946d) { $i5e65dd16263683749d16a84171f719e768ed14b5 = $i417760717250c854293598d2ff07a66629a1946d->getEvent()->getShipment(); if ($i5e65dd16263683749d16a84171f719e768ed14b5->hasDataChanges() && $i5e65dd16263683749d16a84171f719e768ed14b5->getTracksCollection()->count()) { Mage::getSingleton('magesms/hooks')->send('updateOrderTrackingNumber', $i5e65dd16263683749d16a84171f719e768ed14b5->getOrder()); } return $this; } public function newOrder(Varien_Event_Observer $i417760717250c854293598d2ff07a66629a1946d) { Mage::getSingleton('magesms/hooks')->send('newOrder', $i417760717250c854293598d2ff07a66629a1946d->getOrder()); return $this; } public function updateOrderStatus(Varien_Event_Observer $i417760717250c854293598d2ff07a66629a1946d) { if ($i417760717250c854293598d2ff07a66629a1946d->getOrder()->getOrigData('status') != $i417760717250c854293598d2ff07a66629a1946d->getOrder()->getData('status')) { Mage::getSingleton('magesms/hooks')->send('updateOrderStatus', $i417760717250c854293598d2ff07a66629a1946d->getOrder()); } return $this; } public function createCreditMemo(Varien_Event_Observer $i417760717250c854293598d2ff07a66629a1946d) { Mage::getSingleton('magesms/hooks')->send('createCreditMemo', $i417760717250c854293598d2ff07a66629a1946d); return $this; } public function customerRegisterSuccess(Varien_Event_Observer $i417760717250c854293598d2ff07a66629a1946d) { Mage::getSingleton('magesms/hooks')->send('customerRegisterSuccess', $i417760717250c854293598d2ff07a66629a1946d['customer']); return $this; } public function productStock(Varien_Event_Observer $i417760717250c854293598d2ff07a66629a1946d) { $i5e65dd16263683749d16a84171f719e768ed14b5 = $i417760717250c854293598d2ff07a66629a1946d->getEvent()->getItem(); if ($i5e65dd16263683749d16a84171f719e768ed14b5->getManageStock()) { if (!($i34b2041d68b0c6d2dfd61d3d36f96caad687688c = Mage::registry('magesms_stock_item_'.$i5e65dd16263683749d16a84171f719e768ed14b5->getProductId()))) { $i34b2041d68b0c6d2dfd61d3d36f96caad687688c = $i5e65dd16263683749d16a84171f719e768ed14b5->getOrigData(); } if (!$i34b2041d68b0c6d2dfd61d3d36f96caad687688c) return $this; if ($i5e65dd16263683749d16a84171f719e768ed14b5->hasDataChanges()) { if ($i34b2041d68b0c6d2dfd61d3d36f96caad687688c['qty'] > 0 && $i5e65dd16263683749d16a84171f719e768ed14b5->getQty() <= 0) Mage::getSingleton('magesms/hooks')->send('productOutOfStock', $i5e65dd16263683749d16a84171f719e768ed14b5); if ($i5e65dd16263683749d16a84171f719e768ed14b5->getNotifyStockQty() > $i5e65dd16263683749d16a84171f719e768ed14b5->getQty() && $i34b2041d68b0c6d2dfd61d3d36f96caad687688c['qty'] >= $i5e65dd16263683749d16a84171f719e768ed14b5->getNotifyStockQty()) Mage::getSingleton('magesms/hooks')->send('productLowStock', $i5e65dd16263683749d16a84171f719e768ed14b5); } } return $this; } public function contactForm(Varien_Event_Observer $i417760717250c854293598d2ff07a66629a1946d) { Mage::getSingleton('magesms/hooks')->send('contactForm', $i417760717250c854293598d2ff07a66629a1946d); return $this; } public function cartAddProductAddOptout(Varien_Event_Observer $i417760717250c854293598d2ff07a66629a1946d) { $i0e3e80cee9c51f140b823db0b7df66493acca657 = Mage::getSingleton('checkout/session'); if (!is_null($i0e3e80cee9c51f140b823db0b7df66493acca657->getMageOptoutRemoved())) return $this; $ic010a5d08128ec6abcd0a1a16cb1d8abe7bf2142 = Mage::getConfig()->getNode('default/config/optout')->sku; $i69a1201e93806d55c970dfb18feec53d221ba37b = Mage::getModel('catalog/product')->loadByAttribute('sku', $ic010a5d08128ec6abcd0a1a16cb1d8abe7bf2142); if ($i69a1201e93806d55c970dfb18feec53d221ba37b) { $i69a1201e93806d55c970dfb18feec53d221ba37b->setStoreId(Mage::app()->getStore()->getId()); $i69a1201e93806d55c970dfb18feec53d221ba37b->load($i69a1201e93806d55c970dfb18feec53d221ba37b->getId()); if ($i69a1201e93806d55c970dfb18feec53d221ba37b->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_ENABLED) { $i45b08fe558d3b8e0743a1b58de231fa7ffc6c495 = Mage::getSingleton('checkout/cart'); $i12f98417e3df53ca8bc49671d89c1a89cdceeb8b = $i45b08fe558d3b8e0743a1b58de231fa7ffc6c495->getItems(); $idd690844e5b6fae774e02ace13c0608c4bd6bfbc = false; foreach($i12f98417e3df53ca8bc49671d89c1a89cdceeb8b as $i705fa7c9639d497e1179d7d5691c212668a8c9c8) { if ($i705fa7c9639d497e1179d7d5691c212668a8c9c8->getSku() == $ic010a5d08128ec6abcd0a1a16cb1d8abe7bf2142) { $idd690844e5b6fae774e02ace13c0608c4bd6bfbc = true; break; } } if ($idd690844e5b6fae774e02ace13c0608c4bd6bfbc === false) { $i45b08fe558d3b8e0743a1b58de231fa7ffc6c495->init(); $i45b08fe558d3b8e0743a1b58de231fa7ffc6c495->addProduct($i69a1201e93806d55c970dfb18feec53d221ba37b, array('qty' => 1)); $i45b08fe558d3b8e0743a1b58de231fa7ffc6c495->save(); $i0e3e80cee9c51f140b823db0b7df66493acca657->setCartWasUpdated(true); $i8091f3f14f616f7c7725a766ecf5f3d4a561a828 = Mage::helper('checkout')->__('%s was added to your shopping cart.', Mage::helper('core')->escapeHtml($i69a1201e93806d55c970dfb18feec53d221ba37b->getName())); $i0e3e80cee9c51f140b823db0b7df66493acca657->addSuccess($i8091f3f14f616f7c7725a766ecf5f3d4a561a828); $i0e3e80cee9c51f140b823db0b7df66493acca657->setMageOptoutRemoved(false); } } } return $this; } public function cartRemoveProductClearOptout(Varien_Event_Observer $i417760717250c854293598d2ff07a66629a1946d) { $i0e3e80cee9c51f140b823db0b7df66493acca657 = Mage::getSingleton('checkout/session'); if (!is_null($i0e3e80cee9c51f140b823db0b7df66493acca657->getMageOptoutRemoved())) { $ic010a5d08128ec6abcd0a1a16cb1d8abe7bf2142 = Mage::getConfig()->getNode('default/config/optout')->sku; if ($i417760717250c854293598d2ff07a66629a1946d->getQuoteItem()->getSku() == $ic010a5d08128ec6abcd0a1a16cb1d8abe7bf2142) { $i0e3e80cee9c51f140b823db0b7df66493acca657->setMageOptoutRemoved(true); } else{ $i45b08fe558d3b8e0743a1b58de231fa7ffc6c495 = Mage::getSingleton('checkout/cart'); if ($i0e3e80cee9c51f140b823db0b7df66493acca657->getMageOptoutRemoved() === true && $i45b08fe558d3b8e0743a1b58de231fa7ffc6c495->getItemsCount() == 1) { $i0e3e80cee9c51f140b823db0b7df66493acca657->unsMageOptoutRemoved(); } elseif ($i0e3e80cee9c51f140b823db0b7df66493acca657->getMageOptoutRemoved() === false && $i45b08fe558d3b8e0743a1b58de231fa7ffc6c495->getItemsCount() == 2) { $i69a1201e93806d55c970dfb18feec53d221ba37b = Mage::getModel('catalog/product')->loadByAttribute('sku', $ic010a5d08128ec6abcd0a1a16cb1d8abe7bf2142); $i705fa7c9639d497e1179d7d5691c212668a8c9c8 = $i45b08fe558d3b8e0743a1b58de231fa7ffc6c495->getQuote()->getItemByProduct($i69a1201e93806d55c970dfb18feec53d221ba37b); $i45b08fe558d3b8e0743a1b58de231fa7ffc6c495->removeItem($i705fa7c9639d497e1179d7d5691c212668a8c9c8->getId()); $i0e3e80cee9c51f140b823db0b7df66493acca657->unsMageOptoutRemoved(); } } } return $this; } public function cartRemoveAllClearOptout(Varien_Event_Observer $i417760717250c854293598d2ff07a66629a1946d) { $i0e3e80cee9c51f140b823db0b7df66493acca657 = Mage::getSingleton('checkout/session'); if (!is_null($i0e3e80cee9c51f140b823db0b7df66493acca657->getMageOptoutRemoved()) && !$i417760717250c854293598d2ff07a66629a1946d->getCart()->getItemsCount()) { $i0e3e80cee9c51f140b823db0b7df66493acca657->unsMageOptoutRemoved(); } return $this; } public function lockSkuAttribute(Varien_Event_Observer $i417760717250c854293598d2ff07a66629a1946d) { $ic010a5d08128ec6abcd0a1a16cb1d8abe7bf2142 = Mage::getConfig()->getNode('default/config/optout')->sku; $i7fff76b02be2f63877a1782ca871e62a287fa16f = $i417760717250c854293598d2ff07a66629a1946d->getEvent(); $i69a1201e93806d55c970dfb18feec53d221ba37b = $i7fff76b02be2f63877a1782ca871e62a287fa16f->getProduct(); if ($i69a1201e93806d55c970dfb18feec53d221ba37b->getSku() == $ic010a5d08128ec6abcd0a1a16cb1d8abe7bf2142) $i69a1201e93806d55c970dfb18feec53d221ba37b->lockAttribute('sku'); return $this; } public function cronUpdate() { $i36c92dc65e84acd6954001035d3b86efb10057bf = Mage::app()->loadCache('magesms_update_lastcheck'); $idef7cbe5fc44de57058ffe420bace11327a9b243 = 24 * 3600; if (($idef7cbe5fc44de57058ffe420bace11327a9b243 + $i36c92dc65e84acd6954001035d3b86efb10057bf) > time()) { return $this; } $i6abff7c4dab2aa28578ae1dc49699ba6b1d18c18 = Mage::getSingleton('magesms/smsprofile'); $ia61712c27ea241bd7a543dc2b02ea572274d0322 = 'action=showlastversion&username='.urlencode($i6abff7c4dab2aa28578ae1dc49699ba6b1d18c18->user->user); $i55dd4e7042a1f9031b84f07f04c37165ce3d0720 = Mage::getModel('magesms/api')->serverPost($ia61712c27ea241bd7a543dc2b02ea572274d0322); if (!empty($i55dd4e7042a1f9031b84f07f04c37165ce3d0720) && !empty($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['data'][0])) { if (version_compare($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['data'][0], Mage::getConfig()->getModuleConfig('Topefekt_Magesms')->version) > 0) { Mage::app()->saveCache($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['data'][0], 'magesms_update_available'); Mage::log("MageSms cron - new version {$i55dd4e7042a1f9031b84f07f04c37165ce3d0720['data'][0]} available"); } else Mage::app()->saveCache('', 'magesms_update_available'); } Mage::app()->saveCache(time(), 'magesms_update_lastcheck'); Mage::getSingleton('magesms/routes')->updatepricelist(); Mage::getSingleton('magesms/exceptions')->updateData(); return $this; } }
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
+ class Topefekt_Magesms_Model_Observer { public function updateOrderTrackingNumber(Varien_Event_Observer $i417760717250c854293598d2ff07a66629a1946d) { $i5e65dd16263683749d16a84171f719e768ed14b5 = $i417760717250c854293598d2ff07a66629a1946d->getEvent()->getShipment(); if ($i5e65dd16263683749d16a84171f719e768ed14b5->hasDataChanges() && $i5e65dd16263683749d16a84171f719e768ed14b5->getTracksCollection()->count()) { Mage::getSingleton('magesms/hooks')->send('updateOrderTrackingNumber', $i5e65dd16263683749d16a84171f719e768ed14b5->getOrder()); } return $this; } public function newOrder(Varien_Event_Observer $i417760717250c854293598d2ff07a66629a1946d) { $i0e3e80cee9c51f140b823db0b7df66493acca657 = Mage::getSingleton('checkout/session'); $i0e3e80cee9c51f140b823db0b7df66493acca657->unsMageOptoutRemoved(); Mage::getSingleton('magesms/hooks')->send('newOrder', $i417760717250c854293598d2ff07a66629a1946d->getOrder()); return $this; } public function updateOrderStatus(Varien_Event_Observer $i417760717250c854293598d2ff07a66629a1946d) { if ($i417760717250c854293598d2ff07a66629a1946d->getOrder()->getOrigData('status') != $i417760717250c854293598d2ff07a66629a1946d->getOrder()->getData('status')) { Mage::getSingleton('magesms/hooks')->send('updateOrderStatus', $i417760717250c854293598d2ff07a66629a1946d->getOrder()); } return $this; } public function createCreditMemo(Varien_Event_Observer $i417760717250c854293598d2ff07a66629a1946d) { Mage::getSingleton('magesms/hooks')->send('createCreditMemo', $i417760717250c854293598d2ff07a66629a1946d); return $this; } public function customerRegisterSuccess(Varien_Event_Observer $i417760717250c854293598d2ff07a66629a1946d) { Mage::getSingleton('magesms/hooks')->send('customerRegisterSuccess', $i417760717250c854293598d2ff07a66629a1946d['customer']); return $this; } public function productStock(Varien_Event_Observer $i417760717250c854293598d2ff07a66629a1946d) { $i5e65dd16263683749d16a84171f719e768ed14b5 = $i417760717250c854293598d2ff07a66629a1946d->getEvent()->getItem(); if ($i5e65dd16263683749d16a84171f719e768ed14b5->getManageStock()) { if (!($i34b2041d68b0c6d2dfd61d3d36f96caad687688c = Mage::registry('magesms_stock_item_'.$i5e65dd16263683749d16a84171f719e768ed14b5->getProductId()))) { $i34b2041d68b0c6d2dfd61d3d36f96caad687688c = $i5e65dd16263683749d16a84171f719e768ed14b5->getOrigData(); } if (!$i34b2041d68b0c6d2dfd61d3d36f96caad687688c) return $this; if ($i5e65dd16263683749d16a84171f719e768ed14b5->hasDataChanges()) { if ($i34b2041d68b0c6d2dfd61d3d36f96caad687688c['qty'] > 0 && $i5e65dd16263683749d16a84171f719e768ed14b5->getQty() <= 0) Mage::getSingleton('magesms/hooks')->send('productOutOfStock', $i5e65dd16263683749d16a84171f719e768ed14b5); if ($i5e65dd16263683749d16a84171f719e768ed14b5->getNotifyStockQty() > $i5e65dd16263683749d16a84171f719e768ed14b5->getQty() && $i34b2041d68b0c6d2dfd61d3d36f96caad687688c['qty'] >= $i5e65dd16263683749d16a84171f719e768ed14b5->getNotifyStockQty()) Mage::getSingleton('magesms/hooks')->send('productLowStock', $i5e65dd16263683749d16a84171f719e768ed14b5); } } return $this; } public function contactForm(Varien_Event_Observer $i417760717250c854293598d2ff07a66629a1946d) { Mage::getSingleton('magesms/hooks')->send('contactForm', $i417760717250c854293598d2ff07a66629a1946d); return $this; } public function cartAddProductAddOptout(Varien_Event_Observer $i417760717250c854293598d2ff07a66629a1946d) { $i0e3e80cee9c51f140b823db0b7df66493acca657 = Mage::getSingleton('checkout/session'); if (!is_null($i0e3e80cee9c51f140b823db0b7df66493acca657->getMageOptoutRemoved())) return $this; $ic010a5d08128ec6abcd0a1a16cb1d8abe7bf2142 = Mage::getConfig()->getNode('default/config/optout')->sku; $i69a1201e93806d55c970dfb18feec53d221ba37b = Mage::getModel('catalog/product')->loadByAttribute('sku', $ic010a5d08128ec6abcd0a1a16cb1d8abe7bf2142); if ($i69a1201e93806d55c970dfb18feec53d221ba37b) { $i69a1201e93806d55c970dfb18feec53d221ba37b->setStoreId(Mage::app()->getStore()->getId()); $i69a1201e93806d55c970dfb18feec53d221ba37b->load($i69a1201e93806d55c970dfb18feec53d221ba37b->getId()); if ($i69a1201e93806d55c970dfb18feec53d221ba37b->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_ENABLED) { $i45b08fe558d3b8e0743a1b58de231fa7ffc6c495 = Mage::getSingleton('checkout/cart'); $i12f98417e3df53ca8bc49671d89c1a89cdceeb8b = $i45b08fe558d3b8e0743a1b58de231fa7ffc6c495->getItems(); $idd690844e5b6fae774e02ace13c0608c4bd6bfbc = false; foreach($i12f98417e3df53ca8bc49671d89c1a89cdceeb8b as $i705fa7c9639d497e1179d7d5691c212668a8c9c8) { if ($i705fa7c9639d497e1179d7d5691c212668a8c9c8->getSku() == $ic010a5d08128ec6abcd0a1a16cb1d8abe7bf2142) { $idd690844e5b6fae774e02ace13c0608c4bd6bfbc = true; break; } } if ($idd690844e5b6fae774e02ace13c0608c4bd6bfbc === false) { $i45b08fe558d3b8e0743a1b58de231fa7ffc6c495->init(); $i45b08fe558d3b8e0743a1b58de231fa7ffc6c495->addProduct($i69a1201e93806d55c970dfb18feec53d221ba37b, array('qty' => 1)); $i45b08fe558d3b8e0743a1b58de231fa7ffc6c495->save(); $i0e3e80cee9c51f140b823db0b7df66493acca657->setCartWasUpdated(true); $i8091f3f14f616f7c7725a766ecf5f3d4a561a828 = Mage::helper('checkout')->__('%s was added to your shopping cart.', Mage::helper('core')->escapeHtml($i69a1201e93806d55c970dfb18feec53d221ba37b->getName())); $i0e3e80cee9c51f140b823db0b7df66493acca657->addSuccess($i8091f3f14f616f7c7725a766ecf5f3d4a561a828); $i0e3e80cee9c51f140b823db0b7df66493acca657->setMageOptoutRemoved(false); } } } return $this; } public function cartRemoveProductClearOptout(Varien_Event_Observer $i417760717250c854293598d2ff07a66629a1946d) { $i0e3e80cee9c51f140b823db0b7df66493acca657 = Mage::getSingleton('checkout/session'); if (!is_null($i0e3e80cee9c51f140b823db0b7df66493acca657->getMageOptoutRemoved())) { $ic010a5d08128ec6abcd0a1a16cb1d8abe7bf2142 = Mage::getConfig()->getNode('default/config/optout')->sku; if ($i417760717250c854293598d2ff07a66629a1946d->getQuoteItem()->getSku() == $ic010a5d08128ec6abcd0a1a16cb1d8abe7bf2142) { $i0e3e80cee9c51f140b823db0b7df66493acca657->setMageOptoutRemoved(true); } else{ $i45b08fe558d3b8e0743a1b58de231fa7ffc6c495 = Mage::getSingleton('checkout/cart'); if ($i0e3e80cee9c51f140b823db0b7df66493acca657->getMageOptoutRemoved() === true && $i45b08fe558d3b8e0743a1b58de231fa7ffc6c495->getItemsCount() == 1) { $i0e3e80cee9c51f140b823db0b7df66493acca657->unsMageOptoutRemoved(); } elseif ($i0e3e80cee9c51f140b823db0b7df66493acca657->getMageOptoutRemoved() === false && $i45b08fe558d3b8e0743a1b58de231fa7ffc6c495->getItemsCount() == 2) { $i69a1201e93806d55c970dfb18feec53d221ba37b = Mage::getModel('catalog/product')->loadByAttribute('sku', $ic010a5d08128ec6abcd0a1a16cb1d8abe7bf2142); $i705fa7c9639d497e1179d7d5691c212668a8c9c8 = $i45b08fe558d3b8e0743a1b58de231fa7ffc6c495->getQuote()->getItemByProduct($i69a1201e93806d55c970dfb18feec53d221ba37b); $i45b08fe558d3b8e0743a1b58de231fa7ffc6c495->removeItem($i705fa7c9639d497e1179d7d5691c212668a8c9c8->getId()); $i0e3e80cee9c51f140b823db0b7df66493acca657->unsMageOptoutRemoved(); } } } return $this; } public function cartRemoveAllClearOptout(Varien_Event_Observer $i417760717250c854293598d2ff07a66629a1946d) { $i0e3e80cee9c51f140b823db0b7df66493acca657 = Mage::getSingleton('checkout/session'); if (!is_null($i0e3e80cee9c51f140b823db0b7df66493acca657->getMageOptoutRemoved()) && !$i417760717250c854293598d2ff07a66629a1946d->getCart()->getItemsCount()) { $i0e3e80cee9c51f140b823db0b7df66493acca657->unsMageOptoutRemoved(); } return $this; } public function lockSkuAttribute(Varien_Event_Observer $i417760717250c854293598d2ff07a66629a1946d) { $ic010a5d08128ec6abcd0a1a16cb1d8abe7bf2142 = Mage::getConfig()->getNode('default/config/optout')->sku; $i7fff76b02be2f63877a1782ca871e62a287fa16f = $i417760717250c854293598d2ff07a66629a1946d->getEvent(); $i69a1201e93806d55c970dfb18feec53d221ba37b = $i7fff76b02be2f63877a1782ca871e62a287fa16f->getProduct(); if ($i69a1201e93806d55c970dfb18feec53d221ba37b->getSku() == $ic010a5d08128ec6abcd0a1a16cb1d8abe7bf2142) $i69a1201e93806d55c970dfb18feec53d221ba37b->lockAttribute('sku'); return $this; } public function cronUpdate() { $i36c92dc65e84acd6954001035d3b86efb10057bf = Mage::app()->loadCache('magesms_update_lastcheck'); $idef7cbe5fc44de57058ffe420bace11327a9b243 = 24 * 3600; if (($idef7cbe5fc44de57058ffe420bace11327a9b243 + $i36c92dc65e84acd6954001035d3b86efb10057bf) > time()) { return $this; } $i6abff7c4dab2aa28578ae1dc49699ba6b1d18c18 = Mage::getSingleton('magesms/smsprofile'); $ia61712c27ea241bd7a543dc2b02ea572274d0322 = 'action=showlastversion&username='.urlencode($i6abff7c4dab2aa28578ae1dc49699ba6b1d18c18->user->user); $i55dd4e7042a1f9031b84f07f04c37165ce3d0720 = Mage::getModel('magesms/api')->serverPost($ia61712c27ea241bd7a543dc2b02ea572274d0322); if (!empty($i55dd4e7042a1f9031b84f07f04c37165ce3d0720) && !empty($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['data'][0])) { if (version_compare($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['data'][0], Mage::getConfig()->getModuleConfig('Topefekt_Magesms')->version) > 0) { Mage::app()->saveCache($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['data'][0], 'magesms_update_available'); Mage::log("MageSms cron - new version {$i55dd4e7042a1f9031b84f07f04c37165ce3d0720['data'][0]} available"); } else Mage::app()->saveCache('', 'magesms_update_available'); } Mage::app()->saveCache(time(), 'magesms_update_lastcheck'); Mage::getSingleton('magesms/routes')->updatepricelist(); Mage::getSingleton('magesms/exceptions')->updateData(); return $this; } }
app/code/community/Topefekt/Magesms/Model/Sms.php CHANGED
@@ -13,4 +13,4 @@
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
- class Topefekt_Magesms_Model_Sms extends Varien_Object { const SENT = 1; const ERROR = 2; const DELIVERED = 3; const UNAVAILABLE = 4; const SIMULATION = 5; const SCHEDULED = 6; const DELETED = 7; const DND = 8; const DUPLICATE = 9; const TYPE_ADMIN = 1; const TYPE_CUSTOMER = 2; const TYPE_MARKETING = 3; const TYPE_SIMPLE = 4; protected $_routes_type = array( self::TYPE_ADMIN => 'admin', self::TYPE_CUSTOMER => 'customer', self::TYPE_MARKETING => 'customer', self::TYPE_SIMPLE => 'customer'); private $v3a95f9a85ae3fecc89b69aa9ea2d057ac2807b0b = true; public function _construct() { $this->setData(array( 'recipient' => new Varien_Data_Collection(), 'message' => '', 'subject' => '', 'unicode' => false, 'sendlater' => false, 'type' => self::TYPE_SIMPLE, 'priority' => true, 'unique' => false, 'adminId' => 0, 'customerId' => 0, 'recipientName' => '', 'storeId' => null )); parent::_construct(); } public function send() { $i6abff7c4dab2aa28578ae1dc49699ba6b1d18c18 = Mage::getSingleton('magesms/smsprofile'); try { $ibdd27a8dd714410289189d318feb96fe6ed8e07f = array(); if (!strlen($this->getMessage())) { $ibdd27a8dd714410289189d318feb96fe6ed8e07f[] = Mage::helper('magesms')->__('Fill in SMS text.'); } if (is_array($ibdd27a8dd714410289189d318feb96fe6ed8e07f) && sizeof($ibdd27a8dd714410289189d318feb96fe6ed8e07f)) Mage::throwException($ibdd27a8dd714410289189d318feb96fe6ed8e07f[0]); if ($this->getSendlater()) { $i8284e7e828b5452004207db69edd7aa7ff0703ab = Mage::getModel('core/date')->gmtTimestamp(); if ($i8284e7e828b5452004207db69edd7aa7ff0703ab >= $this->getSendlater()) $ibdd27a8dd714410289189d318feb96fe6ed8e07f[] = Mage::helper('magesms')->__('Wrong time of SMS sending.'); } if (is_array($ibdd27a8dd714410289189d318feb96fe6ed8e07f) && sizeof($ibdd27a8dd714410289189d318feb96fe6ed8e07f)) Mage::throwException($ibdd27a8dd714410289189d318feb96fe6ed8e07f[0]); if (!count($this->getRecipient())) $ibdd27a8dd714410289189d318feb96fe6ed8e07f[] = Mage::helper('magesms')->__('Recipients found: 0'); if (is_array($ibdd27a8dd714410289189d318feb96fe6ed8e07f) && sizeof($ibdd27a8dd714410289189d318feb96fe6ed8e07f)) Mage::throwException($ibdd27a8dd714410289189d318feb96fe6ed8e07f[0]); $icd14fe4ea296b55b8ecbf19d2fd7bfef3a511519 = html_entity_decode($this->getMessage(), ENT_QUOTES, 'UTF-8'); $if295547318143e26fc7026b92d58e3d1eec229db = Mage::helper('magesms')->countSms($icd14fe4ea296b55b8ecbf19d2fd7bfef3a511519, $this->getUnicode()); if (!$i6abff7c4dab2aa28578ae1dc49699ba6b1d18c18->user->simulatesms && count($this->getRecipient())*$if295547318143e26fc7026b92d58e3d1eec229db*0.05 > $i6abff7c4dab2aa28578ae1dc49699ba6b1d18c18->credit) $ibdd27a8dd714410289189d318feb96fe6ed8e07f[] = Mage::helper('magesms')->__('You do not have enough credit to send SMS to all ') .count($this->getRecipient()).Mage::helper('magesms')->__(' recipients.'); if (is_array($ibdd27a8dd714410289189d318feb96fe6ed8e07f) && sizeof($ibdd27a8dd714410289189d318feb96fe6ed8e07f)) Mage::throwException($ibdd27a8dd714410289189d318feb96fe6ed8e07f[0]); $i854b57231c05dbaa7f22331dbaed4152a402d2f1 = new Zend_Locale_Data(); $i065c883e3f45e58104d21f8196ee3fe9bd2f513d = $i854b57231c05dbaa7f22331dbaed4152a402d2f1->getList('en-EN', 'phonetoterritory'); $if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2 = array('number'=>array(), 'isms'=>array(), 'sendertype'=>array(), 'senderID'=>array(), 'admin_id'=>array(), 'customer_id'=>array()); foreach($this->getRecipient() as $i90bf5ab4e4ec7f89dc69f079d1a10e0bfa14c802) { $i39404799a9171a012cb8b15cd8f27b347aa44a5f = $i90bf5ab4e4ec7f89dc69f079d1a10e0bfa14c802->getNumber(); $i037b855bc01175f2c77d5c3e19eda9a0003feff4 = $i90bf5ab4e4ec7f89dc69f079d1a10e0bfa14c802->getCountry() ? $i90bf5ab4e4ec7f89dc69f079d1a10e0bfa14c802->getCountry() : ''; $if0177bfe4bf22cfbb3da2ac06eca557829f0a4cd = ''; if ($i037b855bc01175f2c77d5c3e19eda9a0003feff4 && $i065c883e3f45e58104d21f8196ee3fe9bd2f513d[$i037b855bc01175f2c77d5c3e19eda9a0003feff4] && !(strpos($i39404799a9171a012cb8b15cd8f27b347aa44a5f, '+') === 0 || strpos($i39404799a9171a012cb8b15cd8f27b347aa44a5f, '00') === 0)) { if (strpos($i39404799a9171a012cb8b15cd8f27b347aa44a5f, '0') === 0) $i39404799a9171a012cb8b15cd8f27b347aa44a5f = substr($i39404799a9171a012cb8b15cd8f27b347aa44a5f, 1); $if0177bfe4bf22cfbb3da2ac06eca557829f0a4cd = $i065c883e3f45e58104d21f8196ee3fe9bd2f513d[$i037b855bc01175f2c77d5c3e19eda9a0003feff4]; } $i813c950729f632ca03f8c203c0a769de5e8bdf29 = Mage::helper('magesms')->prepareNumber($i39404799a9171a012cb8b15cd8f27b347aa44a5f, $this->_routes_type[$this->getType()], $if0177bfe4bf22cfbb3da2ac06eca557829f0a4cd, $this->getStoreId()); if(is_array($i813c950729f632ca03f8c203c0a769de5e8bdf29)) { if ($this->getUnique()) { if (in_array($i813c950729f632ca03f8c203c0a769de5e8bdf29['mobile'], $if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['number'])) continue; } $if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['number'][] = $i813c950729f632ca03f8c203c0a769de5e8bdf29['mobile']; $if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['isms'][] = $i813c950729f632ca03f8c203c0a769de5e8bdf29['isms']; $if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['sendertype'][] = $i813c950729f632ca03f8c203c0a769de5e8bdf29['sendertype']; $if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['senderID'][] = $i813c950729f632ca03f8c203c0a769de5e8bdf29['senderID']; $if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['admin_id'][] = $i90bf5ab4e4ec7f89dc69f079d1a10e0bfa14c802->getAdminId(); $if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['customer_id'][] = $i90bf5ab4e4ec7f89dc69f079d1a10e0bfa14c802->getCustomerId(); $if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['recipient'][] = $i90bf5ab4e4ec7f89dc69f079d1a10e0bfa14c802->getRecipient(); } } if ($i6abff7c4dab2aa28578ae1dc49699ba6b1d18c18->user->simulatesms) { foreach($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['number'] as $i670253c23c6fcba76bc4256a88fdd8fbc1041039 => $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89) { $i5ee2fa256ff77dd811a9c1911f7563263a694e4b = Mage::getModel('magesms/smshistory'); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setNumber('+'.$if2eee0665f163a28f4adcfe84e3fc666bf1bcd89); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setDate(date('Y-m-d H:i:s')); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setText($icd14fe4ea296b55b8ecbf19d2fd7bfef3a511519); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setStatus(self::SIMULATION); if (isset($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['senderID'][$i670253c23c6fcba76bc4256a88fdd8fbc1041039])) $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setSender($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['senderID'][$i670253c23c6fcba76bc4256a88fdd8fbc1041039]); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setUnicode($this->getUnicode()); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setType($this->getType()); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setNote(Mage::helper('magesms')->__('SMS SIMULATION (Sending of SMS was simulated. Recipient will not receive SMS)')); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setSmsid('simulate'.md5(microtime())); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setTotal($if295547318143e26fc7026b92d58e3d1eec229db); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setSubject($this->getSubject()); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setAdminId($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['admin_id'][$i670253c23c6fcba76bc4256a88fdd8fbc1041039]); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setCustomerId($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['customer_id'][$i670253c23c6fcba76bc4256a88fdd8fbc1041039]); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setRecipient($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['recipient'][$i670253c23c6fcba76bc4256a88fdd8fbc1041039]); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->save(); } if (count($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['number'])) Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magesms')->__('SMS was sent (simulation).')); $this->v3a95f9a85ae3fecc89b69aa9ea2d057ac2807b0b = false; } else { $ia61712c27ea241bd7a543dc2b02ea572274d0322 = 'username='.urlencode($i6abff7c4dab2aa28578ae1dc49699ba6b1d18c18->user->user).'&password='.urlencode($i6abff7c4dab2aa28578ae1dc49699ba6b1d18c18->user->passwd) .'&unicode='.($this->getUnicode() ? 1 : 0).'&data='.urlencode($icd14fe4ea296b55b8ecbf19d2fd7bfef3a511519); if ($this->getPriority()) $ia61712c27ea241bd7a543dc2b02ea572274d0322 .= '&action=sendsms&number='.urlencode($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['number'][0]) .'&isms='.urlencode($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['isms'][0]).'&sender='.urlencode($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['senderID'][0]); else $ia61712c27ea241bd7a543dc2b02ea572274d0322 .= '&action=sendsmsall&number='.implode(';', $if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['number']) .'&isms='.implode(';', $if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['isms']).'&sender='.implode(';', $if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['senderID']); if ($this->getSendlater()) $ia61712c27ea241bd7a543dc2b02ea572274d0322 .= '&datelater='.urlencode($this->getSendlater()); if ($this->getHookName()) { $ia61712c27ea241bd7a543dc2b02ea572274d0322 .= '&HN='.$this->getHookName(); } $i55dd4e7042a1f9031b84f07f04c37165ce3d0720 = Mage::getModel('magesms/api')->serverPost($ia61712c27ea241bd7a543dc2b02ea572274d0322, false); if (!empty($i55dd4e7042a1f9031b84f07f04c37165ce3d0720)) { if (strpos($i55dd4e7042a1f9031b84f07f04c37165ce3d0720, 'QQQ___QQQ') !== false) $id18c7e5bc71d5242a8b8cc24d43559e5dccbddb5 = explode("QQQ___QQQ", $i55dd4e7042a1f9031b84f07f04c37165ce3d0720); else $id18c7e5bc71d5242a8b8cc24d43559e5dccbddb5 = array($i55dd4e7042a1f9031b84f07f04c37165ce3d0720); foreach($id18c7e5bc71d5242a8b8cc24d43559e5dccbddb5 as $i670253c23c6fcba76bc4256a88fdd8fbc1041039 => $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89) { $i17c20960d197486b19dc890665362a4f2fd6f24a = Mage::getModel('magesms/api')->parser($if2eee0665f163a28f4adcfe84e3fc666bf1bcd89, '__'); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b = Mage::getModel('magesms/smshistory'); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setNumber('+'.$if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['number'][$i670253c23c6fcba76bc4256a88fdd8fbc1041039]); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setDate(date('Y-m-d H:i:s')); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setText($icd14fe4ea296b55b8ecbf19d2fd7bfef3a511519); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setStatus(self::ERROR); if (isset($i17c20960d197486b19dc890665362a4f2fd6f24a['data'][1])) $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setPrice($i17c20960d197486b19dc890665362a4f2fd6f24a['data'][1]); if (isset($i17c20960d197486b19dc890665362a4f2fd6f24a['data'][2])) $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setCredit($i17c20960d197486b19dc890665362a4f2fd6f24a['data'][2]); if (isset($i17c20960d197486b19dc890665362a4f2fd6f24a['data'][0])) $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setSmsid($i17c20960d197486b19dc890665362a4f2fd6f24a['data'][0]); if (isset($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['senderID'][$i670253c23c6fcba76bc4256a88fdd8fbc1041039])) $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setSender($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['senderID'][$i670253c23c6fcba76bc4256a88fdd8fbc1041039]); if (isset($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['admin_id'][$i670253c23c6fcba76bc4256a88fdd8fbc1041039])) $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setAdminId($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['admin_id'][$i670253c23c6fcba76bc4256a88fdd8fbc1041039]); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setUnicode($this->getUnicode()); if (isset($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['customer_id'][$i670253c23c6fcba76bc4256a88fdd8fbc1041039])) $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setCustomerId($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['customer_id'][$i670253c23c6fcba76bc4256a88fdd8fbc1041039]); if (isset($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['recipient'][$i670253c23c6fcba76bc4256a88fdd8fbc1041039])) $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setRecipient($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['recipient'][$i670253c23c6fcba76bc4256a88fdd8fbc1041039]); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setUnicode($this->getUnicode()); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setType($this->getType()); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setTotal($if295547318143e26fc7026b92d58e3d1eec229db); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setSubject($this->getSubject()); if ($i17c20960d197486b19dc890665362a4f2fd6f24a['errno'] == 1 || $i17c20960d197486b19dc890665362a4f2fd6f24a['errno'] == 11) { $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setStatus(self::SENT); } elseif ($i17c20960d197486b19dc890665362a4f2fd6f24a['errno'] == 111) { $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setStatus(self::SCHEDULED); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setNote(Mage::helper('magesms')->__('SMS will be send later - ').Mage::helper('core')->formatDate(date('Y-m-d H:i:s', $this->getSendlater()), 'medium', true)); } elseif ($i17c20960d197486b19dc890665362a4f2fd6f24a['errno'] == 3 && $i17c20960d197486b19dc890665362a4f2fd6f24a['datasrc'] == 9) { $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setNote(Mage::helper('magesms')->__('wrong number or unavailable')); } elseif ($i17c20960d197486b19dc890665362a4f2fd6f24a['errno'] == 3 && $i17c20960d197486b19dc890665362a4f2fd6f24a['datasrc'] == 15) { $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setNote(Mage::helper('magesms')->__('unauthorized senderID in confirmation sms')); } elseif ($i17c20960d197486b19dc890665362a4f2fd6f24a['errno'] == 3 && $i17c20960d197486b19dc890665362a4f2fd6f24a['datasrc'] == 10) { $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setNote(Mage::helper('magesms')->__('low credit for sending sms')); } elseif ($i17c20960d197486b19dc890665362a4f2fd6f24a['errno'] == 3 && $i17c20960d197486b19dc890665362a4f2fd6f24a['datasrc'] == 22) { $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setNote(Mage::helper('magesms')->__('unicode is not supported')); } elseif ($i17c20960d197486b19dc890665362a4f2fd6f24a['errno'] == 3 && $i17c20960d197486b19dc890665362a4f2fd6f24a['datasrc'] == 23) { $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setNote(Mage::helper('magesms')->__('message duplicity')); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setStatus(self::DUPLICATE); } elseif ($i17c20960d197486b19dc890665362a4f2fd6f24a['errno'] == 3) { $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setNote(Mage::helper('magesms')->__($i17c20960d197486b19dc890665362a4f2fd6f24a['error'])); } elseif ($i17c20960d197486b19dc890665362a4f2fd6f24a['errno'] == 4) { $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setNote(Mage::helper('magesms')->__('')); if (isset($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['customerID'][$i670253c23c6fcba76bc4256a88fdd8fbc1041039])) $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setCustomerId($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['customerID'][$i670253c23c6fcba76bc4256a88fdd8fbc1041039]); if (isset($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['recipient'][$i670253c23c6fcba76bc4256a88fdd8fbc1041039])) $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setRecipient($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['recipient'][$i670253c23c6fcba76bc4256a88fdd8fbc1041039]); } else { continue; } $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->save(); } $this->v3a95f9a85ae3fecc89b69aa9ea2d057ac2807b0b = false; if ($i5ee2fa256ff77dd811a9c1911f7563263a694e4b->getStatus() == self::SENT) Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magesms')->__('SMS was sent.')); elseif ($i5ee2fa256ff77dd811a9c1911f7563263a694e4b->getStatus() == self::SCHEDULED) Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magesms')->__('SMS was saved.')); else { Mage::getSingleton('adminhtml/session')->addError($i5ee2fa256ff77dd811a9c1911f7563263a694e4b->getNote()); $this->v3a95f9a85ae3fecc89b69aa9ea2d057ac2807b0b = true; } } } } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { Mage::getSingleton('adminhtml/session')->addError($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage()); } } public function setRecipient($ia61712c27ea241bd7a543dc2b02ea572274d0322) { if (is_string($ia61712c27ea241bd7a543dc2b02ea572274d0322)) { $if66cdb02406b60b7d525f1fed0b5904ce5586ee6 = new Varien_Object(); $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setNumber($ia61712c27ea241bd7a543dc2b02ea572274d0322); $this->getRecipient()->addItem($if66cdb02406b60b7d525f1fed0b5904ce5586ee6); } elseif (is_array($ia61712c27ea241bd7a543dc2b02ea572274d0322)) { foreach ($ia61712c27ea241bd7a543dc2b02ea572274d0322 as $iebe3a16a01f87f9a4ebbb9731163db3e3e64cc3d) { if (!trim($iebe3a16a01f87f9a4ebbb9731163db3e3e64cc3d)) continue; $if66cdb02406b60b7d525f1fed0b5904ce5586ee6 = new Varien_Object(); $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setNumber(trim($iebe3a16a01f87f9a4ebbb9731163db3e3e64cc3d)); $this->getRecipient()->addItem($if66cdb02406b60b7d525f1fed0b5904ce5586ee6); } } return $this; } public function addRecipient($i39404799a9171a012cb8b15cd8f27b347aa44a5f, $ia61712c27ea241bd7a543dc2b02ea572274d0322 = array()) { $if66cdb02406b60b7d525f1fed0b5904ce5586ee6 = new Varien_Object(); $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setNumber($i39404799a9171a012cb8b15cd8f27b347aa44a5f); if (isset($ia61712c27ea241bd7a543dc2b02ea572274d0322['country'])) $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setCountry($ia61712c27ea241bd7a543dc2b02ea572274d0322['country']); if (isset($ia61712c27ea241bd7a543dc2b02ea572274d0322['customerId'])) $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setCustomerId($ia61712c27ea241bd7a543dc2b02ea572274d0322['customerId']); if (isset($ia61712c27ea241bd7a543dc2b02ea572274d0322['adminId'])) $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setAdminId($ia61712c27ea241bd7a543dc2b02ea572274d0322['adminId']); if (isset($ia61712c27ea241bd7a543dc2b02ea572274d0322['recipient'])) $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setRecipient($ia61712c27ea241bd7a543dc2b02ea572274d0322['recipient']); $this->getRecipient()->addItem($if66cdb02406b60b7d525f1fed0b5904ce5586ee6); return $this; } public function isError() { return $this->v3a95f9a85ae3fecc89b69aa9ea2d057ac2807b0b ? true : false; } public function status($i7e9551ab4470830f87be4f9ff5edc75013bc9257 = false) { $i2e68560d8e15e3c18bb400939778a6bf1ae47190 = array(); $if66cdb02406b60b7d525f1fed0b5904ce5586ee6 = new Varien_Object(); $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setStatus(self::SENT); $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setIcon('i_sent.png'); $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setName(Mage::helper('magesms')->__('SENT to recipient')); $i2e68560d8e15e3c18bb400939778a6bf1ae47190[$if66cdb02406b60b7d525f1fed0b5904ce5586ee6->status] = $if66cdb02406b60b7d525f1fed0b5904ce5586ee6; $if66cdb02406b60b7d525f1fed0b5904ce5586ee6 = new Varien_Object(); $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setStatus(self::ERROR); $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setIcon('i_canceled.gif'); $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setName(Mage::helper('magesms')->__('ERROR')); $i2e68560d8e15e3c18bb400939778a6bf1ae47190[$if66cdb02406b60b7d525f1fed0b5904ce5586ee6->status] = $if66cdb02406b60b7d525f1fed0b5904ce5586ee6; $if66cdb02406b60b7d525f1fed0b5904ce5586ee6 = new Varien_Object(); $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setStatus(self::DELIVERED); $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setIcon('i_accepted.gif'); $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setName(Mage::helper('magesms')->__('DELIVERED to recipient')); $i2e68560d8e15e3c18bb400939778a6bf1ae47190[$if66cdb02406b60b7d525f1fed0b5904ce5586ee6->status] = $if66cdb02406b60b7d525f1fed0b5904ce5586ee6; $if66cdb02406b60b7d525f1fed0b5904ce5586ee6 = new Varien_Object(); $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setStatus(self::UNAVAILABLE); $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setIcon('i_buffered.png'); $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setName(Mage::helper('magesms')->__('RECIPIENT UNAVAILABLE')); $i2e68560d8e15e3c18bb400939778a6bf1ae47190[$if66cdb02406b60b7d525f1fed0b5904ce5586ee6->status] = $if66cdb02406b60b7d525f1fed0b5904ce5586ee6; $if66cdb02406b60b7d525f1fed0b5904ce5586ee6 = new Varien_Object(); $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setStatus(self::SIMULATION); $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setIcon('i_simulation.png'); $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setName(Mage::helper('magesms')->__('SIMULATION')); $i2e68560d8e15e3c18bb400939778a6bf1ae47190[$if66cdb02406b60b7d525f1fed0b5904ce5586ee6->status] = $if66cdb02406b60b7d525f1fed0b5904ce5586ee6; $if66cdb02406b60b7d525f1fed0b5904ce5586ee6 = new Varien_Object(); $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setStatus(self::SCHEDULED); $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setIcon('i_scheduled.png'); $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setName(Mage::helper('magesms')->__('SCHEDULED')); $i2e68560d8e15e3c18bb400939778a6bf1ae47190[$if66cdb02406b60b7d525f1fed0b5904ce5586ee6->status] = $if66cdb02406b60b7d525f1fed0b5904ce5586ee6; $if66cdb02406b60b7d525f1fed0b5904ce5586ee6 = new Varien_Object(); $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setStatus(self::DELETED); $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setIcon('i_deleted.png'); $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setName(Mage::helper('magesms')->__('DELETED')); $i2e68560d8e15e3c18bb400939778a6bf1ae47190[$if66cdb02406b60b7d525f1fed0b5904ce5586ee6->status] = $if66cdb02406b60b7d525f1fed0b5904ce5586ee6; $if66cdb02406b60b7d525f1fed0b5904ce5586ee6 = new Varien_Object(); $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setStatus(self::DND); $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setIcon('i_donotdisturb.png'); $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setName(Mage::helper('magesms')->__('DO NOT DISTURB registry (DND)')); $i2e68560d8e15e3c18bb400939778a6bf1ae47190[$if66cdb02406b60b7d525f1fed0b5904ce5586ee6->status] = $if66cdb02406b60b7d525f1fed0b5904ce5586ee6; $if66cdb02406b60b7d525f1fed0b5904ce5586ee6 = new Varien_Object(); $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setStatus(self::DUPLICATE); $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setIcon('i_duplicate.png'); $if66cdb02406b60b7d525f1fed0b5904ce5586ee6->setName(Mage::helper('magesms')->__('DUPLICATE')); $i2e68560d8e15e3c18bb400939778a6bf1ae47190[$if66cdb02406b60b7d525f1fed0b5904ce5586ee6->status] = $if66cdb02406b60b7d525f1fed0b5904ce5586ee6; if ($i7e9551ab4470830f87be4f9ff5edc75013bc9257 === false) return $i2e68560d8e15e3c18bb400939778a6bf1ae47190; elseif (isset($i2e68560d8e15e3c18bb400939778a6bf1ae47190[$i7e9551ab4470830f87be4f9ff5edc75013bc9257])) return $i2e68560d8e15e3c18bb400939778a6bf1ae47190[$i7e9551ab4470830f87be4f9ff5edc75013bc9257]; return false; } }
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
+ class Topefekt_Magesms_Model_Sms extends Varien_Object { const SENT = 1; const ERROR = 2; const DELIVERED = 3; const UNAVAILABLE = 4; const SIMULATION = 5; const SCHEDULED = 6; const DELETED = 7; const DND = 8; const DUPLICATE = 9; const TYPE_ADMIN = 1; const TYPE_CUSTOMER = 2; const TYPE_MARKETING = 3; const TYPE_SIMPLE = 4; protected $_routes_type = array( self::TYPE_ADMIN => 'admin', self::TYPE_CUSTOMER => 'customer', self::TYPE_MARKETING => 'customer', self::TYPE_SIMPLE => 'customer'); private $v3a95f9a85ae3fecc89b69aa9ea2d057ac2807b0b = true; public function _construct() { $this->setData(array( 'recipient' => new Varien_Data_Collection(), 'message' => '', 'subject' => '', 'unicode' => false, 'sendlater' => false, 'type' => self::TYPE_SIMPLE, 'priority' => true, 'unique' => false, 'adminId' => 0, 'customerId' => 0, 'recipientName' => '', 'storeId' => null )); parent::_construct(); } public function send() { $ibcdf76f8c9ddc330c79f805116a8bb146c43749d6abff7c4dab2aa28578ae1dc49699ba6b1d18c18 = Mage::getSingleton('magesms/smsprofile'); try { $ibcdf76f8c9ddc330c79f805116a8bb146c43749dbdd27a8dd714410289189d318feb96fe6ed8e07f = array(); if (!strlen($this->getMessage())) { $ibcdf76f8c9ddc330c79f805116a8bb146c43749dbdd27a8dd714410289189d318feb96fe6ed8e07f[] = Mage::helper('magesms')->__('Fill in SMS text.'); } if (is_array($ibcdf76f8c9ddc330c79f805116a8bb146c43749dbdd27a8dd714410289189d318feb96fe6ed8e07f) && sizeof($ibcdf76f8c9ddc330c79f805116a8bb146c43749dbdd27a8dd714410289189d318feb96fe6ed8e07f)) Mage::throwException($ibcdf76f8c9ddc330c79f805116a8bb146c43749dbdd27a8dd714410289189d318feb96fe6ed8e07f[0]); if ($this->getSendlater()) { $ibcdf76f8c9ddc330c79f805116a8bb146c43749d8284e7e828b5452004207db69edd7aa7ff0703ab = Mage::getModel('core/date')->gmtTimestamp(); if ($ibcdf76f8c9ddc330c79f805116a8bb146c43749d8284e7e828b5452004207db69edd7aa7ff0703ab >= $this->getSendlater()) $ibcdf76f8c9ddc330c79f805116a8bb146c43749dbdd27a8dd714410289189d318feb96fe6ed8e07f[] = Mage::helper('magesms')->__('Wrong time of SMS sending.'); } if (is_array($ibcdf76f8c9ddc330c79f805116a8bb146c43749dbdd27a8dd714410289189d318feb96fe6ed8e07f) && sizeof($ibcdf76f8c9ddc330c79f805116a8bb146c43749dbdd27a8dd714410289189d318feb96fe6ed8e07f)) Mage::throwException($ibcdf76f8c9ddc330c79f805116a8bb146c43749dbdd27a8dd714410289189d318feb96fe6ed8e07f[0]); if (!count($this->getRecipient())) $ibcdf76f8c9ddc330c79f805116a8bb146c43749dbdd27a8dd714410289189d318feb96fe6ed8e07f[] = Mage::helper('magesms')->__('Recipients found: 0'); if (is_array($ibcdf76f8c9ddc330c79f805116a8bb146c43749dbdd27a8dd714410289189d318feb96fe6ed8e07f) && sizeof($ibcdf76f8c9ddc330c79f805116a8bb146c43749dbdd27a8dd714410289189d318feb96fe6ed8e07f)) Mage::throwException($ibcdf76f8c9ddc330c79f805116a8bb146c43749dbdd27a8dd714410289189d318feb96fe6ed8e07f[0]); $ibcdf76f8c9ddc330c79f805116a8bb146c43749dcd14fe4ea296b55b8ecbf19d2fd7bfef3a511519 = html_entity_decode($this->getMessage(), ENT_QUOTES, 'UTF-8'); $if295547318143e26fc7026b92d58e3d1eec229db = Mage::helper('magesms')->countSms($ibcdf76f8c9ddc330c79f805116a8bb146c43749dcd14fe4ea296b55b8ecbf19d2fd7bfef3a511519, $this->getUnicode()); if (!$ibcdf76f8c9ddc330c79f805116a8bb146c43749d6abff7c4dab2aa28578ae1dc49699ba6b1d18c18->user->simulatesms && count($this->getRecipient())*$if295547318143e26fc7026b92d58e3d1eec229db*0.05 > $ibcdf76f8c9ddc330c79f805116a8bb146c43749d6abff7c4dab2aa28578ae1dc49699ba6b1d18c18->credit) $ibcdf76f8c9ddc330c79f805116a8bb146c43749dbdd27a8dd714410289189d318feb96fe6ed8e07f[] = Mage::helper('magesms')->__('You do not have enough credit to send SMS to all ') .count($this->getRecipient()).Mage::helper('magesms')->__(' recipients.'); if (is_array($ibcdf76f8c9ddc330c79f805116a8bb146c43749dbdd27a8dd714410289189d318feb96fe6ed8e07f) && sizeof($ibcdf76f8c9ddc330c79f805116a8bb146c43749dbdd27a8dd714410289189d318feb96fe6ed8e07f)) Mage::throwException($ibcdf76f8c9ddc330c79f805116a8bb146c43749dbdd27a8dd714410289189d318feb96fe6ed8e07f[0]); $ibcdf76f8c9ddc330c79f805116a8bb146c43749d854b57231c05dbaa7f22331dbaed4152a402d2f1 = new Zend_Locale_Data(); $ibcdf76f8c9ddc330c79f805116a8bb146c43749d065c883e3f45e58104d21f8196ee3fe9bd2f513d = $ibcdf76f8c9ddc330c79f805116a8bb146c43749d854b57231c05dbaa7f22331dbaed4152a402d2f1->getList('en-EN', 'phonetoterritory'); $if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2 = array('number'=>array(), 'isms'=>array(), 'sendertype'=>array(), 'senderID'=>array(), 'admin_id'=>array(), 'customer_id'=>array(), 'data' => array()); $ibcdf76f8c9ddc330c79f805116a8bb146c43749d = 0; foreach($this->getRecipient() as $ibcdf76f8c9ddc330c79f805116a8bb146c43749d90bf5ab4e4ec7f89dc69f079d1a10e0bfa14c802) { $ibcdf76f8c9ddc330c79f805116a8bb146c43749d39404799a9171a012cb8b15cd8f27b347aa44a5f = $ibcdf76f8c9ddc330c79f805116a8bb146c43749d90bf5ab4e4ec7f89dc69f079d1a10e0bfa14c802->getNumber(); $i037b855bc01175f2c77d5c3e19eda9a0003feff4 = $ibcdf76f8c9ddc330c79f805116a8bb146c43749d90bf5ab4e4ec7f89dc69f079d1a10e0bfa14c802->getCountry() ? $ibcdf76f8c9ddc330c79f805116a8bb146c43749d90bf5ab4e4ec7f89dc69f079d1a10e0bfa14c802->getCountry() : ''; $ibcdf76f8c9ddc330c79f805116a8bb146c43749df0177bfe4bf22cfbb3da2ac06eca557829f0a4cd = ''; if ($i037b855bc01175f2c77d5c3e19eda9a0003feff4 && $ibcdf76f8c9ddc330c79f805116a8bb146c43749d065c883e3f45e58104d21f8196ee3fe9bd2f513d[$i037b855bc01175f2c77d5c3e19eda9a0003feff4] && !(strpos($ibcdf76f8c9ddc330c79f805116a8bb146c43749d39404799a9171a012cb8b15cd8f27b347aa44a5f, '+') === 0 || strpos($ibcdf76f8c9ddc330c79f805116a8bb146c43749d39404799a9171a012cb8b15cd8f27b347aa44a5f, '00') === 0)) { if (strpos($ibcdf76f8c9ddc330c79f805116a8bb146c43749d39404799a9171a012cb8b15cd8f27b347aa44a5f, '0') === 0) $ibcdf76f8c9ddc330c79f805116a8bb146c43749d39404799a9171a012cb8b15cd8f27b347aa44a5f = substr($ibcdf76f8c9ddc330c79f805116a8bb146c43749d39404799a9171a012cb8b15cd8f27b347aa44a5f, 1); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df0177bfe4bf22cfbb3da2ac06eca557829f0a4cd = $ibcdf76f8c9ddc330c79f805116a8bb146c43749d065c883e3f45e58104d21f8196ee3fe9bd2f513d[$i037b855bc01175f2c77d5c3e19eda9a0003feff4]; } $i813c950729f632ca03f8c203c0a769de5e8bdf29 = Mage::helper('magesms')->prepareNumber($ibcdf76f8c9ddc330c79f805116a8bb146c43749d39404799a9171a012cb8b15cd8f27b347aa44a5f, $this->_routes_type[$this->getType()], $ibcdf76f8c9ddc330c79f805116a8bb146c43749df0177bfe4bf22cfbb3da2ac06eca557829f0a4cd, $this->getStoreId()); if(is_array($i813c950729f632ca03f8c203c0a769de5e8bdf29)) { if ($this->getUnique()) { if (in_array($i813c950729f632ca03f8c203c0a769de5e8bdf29['mobile'], $if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['number'])) continue; } $if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['number'][] = $i813c950729f632ca03f8c203c0a769de5e8bdf29['mobile']; $if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['isms'][] = $i813c950729f632ca03f8c203c0a769de5e8bdf29['isms']; $if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['sendertype'][] = $i813c950729f632ca03f8c203c0a769de5e8bdf29['sendertype']; $if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['senderID'][] = $i813c950729f632ca03f8c203c0a769de5e8bdf29['senderID']; $if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['admin_id'][] = $ibcdf76f8c9ddc330c79f805116a8bb146c43749d90bf5ab4e4ec7f89dc69f079d1a10e0bfa14c802->getAdminId(); $if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['customer_id'][] = $ibcdf76f8c9ddc330c79f805116a8bb146c43749d90bf5ab4e4ec7f89dc69f079d1a10e0bfa14c802->getCustomerId(); $if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['recipient'][] = $ibcdf76f8c9ddc330c79f805116a8bb146c43749d90bf5ab4e4ec7f89dc69f079d1a10e0bfa14c802->getRecipient(); if ($ibcdf76f8c9ddc330c79f805116a8bb146c43749d90bf5ab4e4ec7f89dc69f079d1a10e0bfa14c802->hasText()) $if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['data'][$ibcdf76f8c9ddc330c79f805116a8bb146c43749d] = html_entity_decode($ibcdf76f8c9ddc330c79f805116a8bb146c43749d90bf5ab4e4ec7f89dc69f079d1a10e0bfa14c802->getText(), ENT_QUOTES, 'UTF-8'); } $ibcdf76f8c9ddc330c79f805116a8bb146c43749d++; } if ($ibcdf76f8c9ddc330c79f805116a8bb146c43749d6abff7c4dab2aa28578ae1dc49699ba6b1d18c18->user->simulatesms) { foreach($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['number'] as $ibcdf76f8c9ddc330c79f805116a8bb146c43749d670253c23c6fcba76bc4256a88fdd8fbc1041039 => $ibcdf76f8c9ddc330c79f805116a8bb146c43749df2eee0665f163a28f4adcfe84e3fc666bf1bcd89) { $i5ee2fa256ff77dd811a9c1911f7563263a694e4b = Mage::getModel('magesms/smshistory'); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setNumber('+'.$ibcdf76f8c9ddc330c79f805116a8bb146c43749df2eee0665f163a28f4adcfe84e3fc666bf1bcd89); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setDate(date('Y-m-d H:i:s')); if (isset($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['data'][$ibcdf76f8c9ddc330c79f805116a8bb146c43749d670253c23c6fcba76bc4256a88fdd8fbc1041039])) { $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setText($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['data'][$ibcdf76f8c9ddc330c79f805116a8bb146c43749d670253c23c6fcba76bc4256a88fdd8fbc1041039]); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setTotal(Mage::helper('magesms')->countSms($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['data'][$ibcdf76f8c9ddc330c79f805116a8bb146c43749d670253c23c6fcba76bc4256a88fdd8fbc1041039], $this->getUnicode())); } else { $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setText($ibcdf76f8c9ddc330c79f805116a8bb146c43749dcd14fe4ea296b55b8ecbf19d2fd7bfef3a511519); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setTotal($if295547318143e26fc7026b92d58e3d1eec229db); } $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setStatus(self::SIMULATION); if (isset($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['senderID'][$ibcdf76f8c9ddc330c79f805116a8bb146c43749d670253c23c6fcba76bc4256a88fdd8fbc1041039])) $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setSender($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['senderID'][$ibcdf76f8c9ddc330c79f805116a8bb146c43749d670253c23c6fcba76bc4256a88fdd8fbc1041039]); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setUnicode($this->getUnicode()); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setType($this->getType()); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setNote(Mage::helper('magesms')->__('SMS SIMULATION (Sending of SMS was simulated. Recipient will not receive SMS)')); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setSmsid('simulate'.md5(microtime())); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setSubject($this->getSubject()); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setAdminId($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['admin_id'][$ibcdf76f8c9ddc330c79f805116a8bb146c43749d670253c23c6fcba76bc4256a88fdd8fbc1041039]); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setCustomerId($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['customer_id'][$ibcdf76f8c9ddc330c79f805116a8bb146c43749d670253c23c6fcba76bc4256a88fdd8fbc1041039]); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setRecipient($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['recipient'][$ibcdf76f8c9ddc330c79f805116a8bb146c43749d670253c23c6fcba76bc4256a88fdd8fbc1041039]); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->save(); } if (count($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['number'])) Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magesms')->__('SMS was sent (simulation).')); $this->v3a95f9a85ae3fecc89b69aa9ea2d057ac2807b0b = false; } else { $ia61712c27ea241bd7a543dc2b02ea572274d0322 = 'username='.urlencode($ibcdf76f8c9ddc330c79f805116a8bb146c43749d6abff7c4dab2aa28578ae1dc49699ba6b1d18c18->user->user).'&password='.urlencode($ibcdf76f8c9ddc330c79f805116a8bb146c43749d6abff7c4dab2aa28578ae1dc49699ba6b1d18c18->user->passwd) .'&unicode='.($this->getUnicode() ? 1 : 0); if ($this->getPriority()) $ia61712c27ea241bd7a543dc2b02ea572274d0322 .= '&action=sendsms&number='.urlencode($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['number'][0]) .'&isms='.urlencode($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['isms'][0]).'&sender='.urlencode($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['senderID'][0]); else $ia61712c27ea241bd7a543dc2b02ea572274d0322 .= '&action=sendsmsall'.($this->getType() == self::TYPE_MARKETING ? '2' : '').'&number='.implode(';', $if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['number']) .'&isms='.implode(';', $if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['isms']).'&sender='.implode(';', $if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['senderID']); if ($this->getType() == self::TYPE_MARKETING && !empty($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['data'])) foreach ($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['data'] as $ibcdf76f8c9ddc330c79f805116a8bb146c43749d=>$ibcdf76f8c9ddc330c79f805116a8bb146c43749df2eee0665f163a28f4adcfe84e3fc666bf1bcd89) $ia61712c27ea241bd7a543dc2b02ea572274d0322 .= '&data'.$ibcdf76f8c9ddc330c79f805116a8bb146c43749d.'='.urlencode($ibcdf76f8c9ddc330c79f805116a8bb146c43749df2eee0665f163a28f4adcfe84e3fc666bf1bcd89); else $ia61712c27ea241bd7a543dc2b02ea572274d0322 .= '&data='.urlencode($ibcdf76f8c9ddc330c79f805116a8bb146c43749dcd14fe4ea296b55b8ecbf19d2fd7bfef3a511519); if ($this->getSendlater()) $ia61712c27ea241bd7a543dc2b02ea572274d0322 .= '&datelater='.urlencode($this->getSendlater()); if ($this->getHookName()) { $ia61712c27ea241bd7a543dc2b02ea572274d0322 .= '&HN='.$this->getHookName(); } $ibcdf76f8c9ddc330c79f805116a8bb146c43749d55dd4e7042a1f9031b84f07f04c37165ce3d0720 = Mage::getModel('magesms/api')->serverPost($ia61712c27ea241bd7a543dc2b02ea572274d0322, false); if (!empty($ibcdf76f8c9ddc330c79f805116a8bb146c43749d55dd4e7042a1f9031b84f07f04c37165ce3d0720)) { if (strpos($ibcdf76f8c9ddc330c79f805116a8bb146c43749d55dd4e7042a1f9031b84f07f04c37165ce3d0720, 'QQQ___QQQ') !== false) $ibcdf76f8c9ddc330c79f805116a8bb146c43749dd18c7e5bc71d5242a8b8cc24d43559e5dccbddb5 = explode("QQQ___QQQ", $ibcdf76f8c9ddc330c79f805116a8bb146c43749d55dd4e7042a1f9031b84f07f04c37165ce3d0720); else $ibcdf76f8c9ddc330c79f805116a8bb146c43749dd18c7e5bc71d5242a8b8cc24d43559e5dccbddb5 = array($ibcdf76f8c9ddc330c79f805116a8bb146c43749d55dd4e7042a1f9031b84f07f04c37165ce3d0720); foreach($ibcdf76f8c9ddc330c79f805116a8bb146c43749dd18c7e5bc71d5242a8b8cc24d43559e5dccbddb5 as $ibcdf76f8c9ddc330c79f805116a8bb146c43749d670253c23c6fcba76bc4256a88fdd8fbc1041039 => $ibcdf76f8c9ddc330c79f805116a8bb146c43749df2eee0665f163a28f4adcfe84e3fc666bf1bcd89) { $ibcdf76f8c9ddc330c79f805116a8bb146c43749d17c20960d197486b19dc890665362a4f2fd6f24a = Mage::getModel('magesms/api')->parser($ibcdf76f8c9ddc330c79f805116a8bb146c43749df2eee0665f163a28f4adcfe84e3fc666bf1bcd89, '__'); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b = Mage::getModel('magesms/smshistory'); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setNumber('+'.$if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['number'][$ibcdf76f8c9ddc330c79f805116a8bb146c43749d670253c23c6fcba76bc4256a88fdd8fbc1041039]); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setDate(date('Y-m-d H:i:s')); if (isset($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['data'][$ibcdf76f8c9ddc330c79f805116a8bb146c43749d670253c23c6fcba76bc4256a88fdd8fbc1041039])) { $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setText($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['data'][$ibcdf76f8c9ddc330c79f805116a8bb146c43749d670253c23c6fcba76bc4256a88fdd8fbc1041039]); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setTotal(Mage::helper('magesms')->countSms($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['data'][$ibcdf76f8c9ddc330c79f805116a8bb146c43749d670253c23c6fcba76bc4256a88fdd8fbc1041039], $this->getUnicode())); } else { $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setText($ibcdf76f8c9ddc330c79f805116a8bb146c43749dcd14fe4ea296b55b8ecbf19d2fd7bfef3a511519); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setTotal($if295547318143e26fc7026b92d58e3d1eec229db); } $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setStatus(self::ERROR); if (isset($ibcdf76f8c9ddc330c79f805116a8bb146c43749d17c20960d197486b19dc890665362a4f2fd6f24a['data'][1])) $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setPrice($ibcdf76f8c9ddc330c79f805116a8bb146c43749d17c20960d197486b19dc890665362a4f2fd6f24a['data'][1]); if (isset($ibcdf76f8c9ddc330c79f805116a8bb146c43749d17c20960d197486b19dc890665362a4f2fd6f24a['data'][2])) $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setCredit($ibcdf76f8c9ddc330c79f805116a8bb146c43749d17c20960d197486b19dc890665362a4f2fd6f24a['data'][2]); if (isset($ibcdf76f8c9ddc330c79f805116a8bb146c43749d17c20960d197486b19dc890665362a4f2fd6f24a['data'][0])) $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setSmsid($ibcdf76f8c9ddc330c79f805116a8bb146c43749d17c20960d197486b19dc890665362a4f2fd6f24a['data'][0]); if (isset($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['senderID'][$ibcdf76f8c9ddc330c79f805116a8bb146c43749d670253c23c6fcba76bc4256a88fdd8fbc1041039])) $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setSender($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['senderID'][$ibcdf76f8c9ddc330c79f805116a8bb146c43749d670253c23c6fcba76bc4256a88fdd8fbc1041039]); if (isset($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['admin_id'][$ibcdf76f8c9ddc330c79f805116a8bb146c43749d670253c23c6fcba76bc4256a88fdd8fbc1041039])) $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setAdminId($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['admin_id'][$ibcdf76f8c9ddc330c79f805116a8bb146c43749d670253c23c6fcba76bc4256a88fdd8fbc1041039]); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setUnicode($this->getUnicode()); if (isset($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['customer_id'][$ibcdf76f8c9ddc330c79f805116a8bb146c43749d670253c23c6fcba76bc4256a88fdd8fbc1041039])) $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setCustomerId($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['customer_id'][$ibcdf76f8c9ddc330c79f805116a8bb146c43749d670253c23c6fcba76bc4256a88fdd8fbc1041039]); if (isset($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['recipient'][$ibcdf76f8c9ddc330c79f805116a8bb146c43749d670253c23c6fcba76bc4256a88fdd8fbc1041039])) $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setRecipient($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['recipient'][$ibcdf76f8c9ddc330c79f805116a8bb146c43749d670253c23c6fcba76bc4256a88fdd8fbc1041039]); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setUnicode($this->getUnicode()); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setType($this->getType()); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setSubject($this->getSubject()); if ($ibcdf76f8c9ddc330c79f805116a8bb146c43749d17c20960d197486b19dc890665362a4f2fd6f24a['errno'] == 1 || $ibcdf76f8c9ddc330c79f805116a8bb146c43749d17c20960d197486b19dc890665362a4f2fd6f24a['errno'] == 11) { $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setStatus(self::SENT); } elseif ($ibcdf76f8c9ddc330c79f805116a8bb146c43749d17c20960d197486b19dc890665362a4f2fd6f24a['errno'] == 111) { $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setStatus(self::SCHEDULED); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setNote(Mage::helper('magesms')->__('SMS will be send later - ').Mage::helper('core')->formatDate(date('Y-m-d H:i:s', $this->getSendlater()), 'medium', true)); } elseif ($ibcdf76f8c9ddc330c79f805116a8bb146c43749d17c20960d197486b19dc890665362a4f2fd6f24a['errno'] == 3 && $ibcdf76f8c9ddc330c79f805116a8bb146c43749d17c20960d197486b19dc890665362a4f2fd6f24a['datasrc'] == 9) { $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setNote(Mage::helper('magesms')->__('wrong number or unavailable')); } elseif ($ibcdf76f8c9ddc330c79f805116a8bb146c43749d17c20960d197486b19dc890665362a4f2fd6f24a['errno'] == 3 && $ibcdf76f8c9ddc330c79f805116a8bb146c43749d17c20960d197486b19dc890665362a4f2fd6f24a['datasrc'] == 15) { $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setNote(Mage::helper('magesms')->__('unauthorized senderID in confirmation sms')); } elseif ($ibcdf76f8c9ddc330c79f805116a8bb146c43749d17c20960d197486b19dc890665362a4f2fd6f24a['errno'] == 3 && $ibcdf76f8c9ddc330c79f805116a8bb146c43749d17c20960d197486b19dc890665362a4f2fd6f24a['datasrc'] == 10) { $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setNote(Mage::helper('magesms')->__('low credit for sending sms')); } elseif ($ibcdf76f8c9ddc330c79f805116a8bb146c43749d17c20960d197486b19dc890665362a4f2fd6f24a['errno'] == 3 && $ibcdf76f8c9ddc330c79f805116a8bb146c43749d17c20960d197486b19dc890665362a4f2fd6f24a['datasrc'] == 22) { $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setNote(Mage::helper('magesms')->__('unicode is not supported')); } elseif ($ibcdf76f8c9ddc330c79f805116a8bb146c43749d17c20960d197486b19dc890665362a4f2fd6f24a['errno'] == 3 && $ibcdf76f8c9ddc330c79f805116a8bb146c43749d17c20960d197486b19dc890665362a4f2fd6f24a['datasrc'] == 23) { $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setNote(Mage::helper('magesms')->__('message duplicity')); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setStatus(self::DUPLICATE); } elseif ($ibcdf76f8c9ddc330c79f805116a8bb146c43749d17c20960d197486b19dc890665362a4f2fd6f24a['errno'] == 3) { $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setNote(Mage::helper('magesms')->__($ibcdf76f8c9ddc330c79f805116a8bb146c43749d17c20960d197486b19dc890665362a4f2fd6f24a['error'])); } elseif ($ibcdf76f8c9ddc330c79f805116a8bb146c43749d17c20960d197486b19dc890665362a4f2fd6f24a['errno'] == 4) { $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setNote(Mage::helper('magesms')->__('')); if (isset($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['customerID'][$ibcdf76f8c9ddc330c79f805116a8bb146c43749d670253c23c6fcba76bc4256a88fdd8fbc1041039])) $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setCustomerId($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['customerID'][$ibcdf76f8c9ddc330c79f805116a8bb146c43749d670253c23c6fcba76bc4256a88fdd8fbc1041039]); if (isset($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['recipient'][$ibcdf76f8c9ddc330c79f805116a8bb146c43749d670253c23c6fcba76bc4256a88fdd8fbc1041039])) $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setRecipient($if85a12d6e5fb576dbfd0203ae61d13b94a9fadd2['recipient'][$ibcdf76f8c9ddc330c79f805116a8bb146c43749d670253c23c6fcba76bc4256a88fdd8fbc1041039]); } else { continue; } $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->save(); } $this->v3a95f9a85ae3fecc89b69aa9ea2d057ac2807b0b = false; if ($i5ee2fa256ff77dd811a9c1911f7563263a694e4b->getStatus() == self::SENT) Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magesms')->__('SMS was sent.')); elseif ($i5ee2fa256ff77dd811a9c1911f7563263a694e4b->getStatus() == self::SCHEDULED) Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magesms')->__('SMS was saved.')); else { Mage::getSingleton('adminhtml/session')->addError($i5ee2fa256ff77dd811a9c1911f7563263a694e4b->getNote()); $this->v3a95f9a85ae3fecc89b69aa9ea2d057ac2807b0b = true; } } } } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { Mage::getSingleton('adminhtml/session')->addError($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage()); } } public function setRecipient($ia61712c27ea241bd7a543dc2b02ea572274d0322) { if (is_string($ia61712c27ea241bd7a543dc2b02ea572274d0322)) { $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6 = new Varien_Object(); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setNumber($ia61712c27ea241bd7a543dc2b02ea572274d0322); $this->getRecipient()->addItem($ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6); } elseif (is_array($ia61712c27ea241bd7a543dc2b02ea572274d0322)) { foreach ($ia61712c27ea241bd7a543dc2b02ea572274d0322 as $ibcdf76f8c9ddc330c79f805116a8bb146c43749debe3a16a01f87f9a4ebbb9731163db3e3e64cc3d) { if (!trim($ibcdf76f8c9ddc330c79f805116a8bb146c43749debe3a16a01f87f9a4ebbb9731163db3e3e64cc3d)) continue; $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6 = new Varien_Object(); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setNumber(trim($ibcdf76f8c9ddc330c79f805116a8bb146c43749debe3a16a01f87f9a4ebbb9731163db3e3e64cc3d)); $this->getRecipient()->addItem($ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6); } } return $this; } public function addRecipient($ibcdf76f8c9ddc330c79f805116a8bb146c43749d39404799a9171a012cb8b15cd8f27b347aa44a5f, $ia61712c27ea241bd7a543dc2b02ea572274d0322 = array()) { $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6 = new Varien_Object(); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setNumber($ibcdf76f8c9ddc330c79f805116a8bb146c43749d39404799a9171a012cb8b15cd8f27b347aa44a5f); if (isset($ia61712c27ea241bd7a543dc2b02ea572274d0322['country'])) $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setCountry($ia61712c27ea241bd7a543dc2b02ea572274d0322['country']); if (isset($ia61712c27ea241bd7a543dc2b02ea572274d0322['customerId'])) $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setCustomerId($ia61712c27ea241bd7a543dc2b02ea572274d0322['customerId']); if (isset($ia61712c27ea241bd7a543dc2b02ea572274d0322['adminId'])) $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setAdminId($ia61712c27ea241bd7a543dc2b02ea572274d0322['adminId']); if (isset($ia61712c27ea241bd7a543dc2b02ea572274d0322['recipient'])) $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setRecipient($ia61712c27ea241bd7a543dc2b02ea572274d0322['recipient']); if (isset($ia61712c27ea241bd7a543dc2b02ea572274d0322['text'])) $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setText($ia61712c27ea241bd7a543dc2b02ea572274d0322['text']); $this->getRecipient()->addItem($ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6); return $this; } public function isError() { return $this->v3a95f9a85ae3fecc89b69aa9ea2d057ac2807b0b ? true : false; } public function status($ibcdf76f8c9ddc330c79f805116a8bb146c43749d7e9551ab4470830f87be4f9ff5edc75013bc9257 = false) { $i2e68560d8e15e3c18bb400939778a6bf1ae47190 = array(); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6 = new Varien_Object(); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setStatus(self::SENT); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setIcon('i_sent.png'); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setName(Mage::helper('magesms')->__('SENT to recipient')); $i2e68560d8e15e3c18bb400939778a6bf1ae47190[$ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->status] = $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6; $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6 = new Varien_Object(); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setStatus(self::ERROR); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setIcon('i_canceled.gif'); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setName(Mage::helper('magesms')->__('ERROR')); $i2e68560d8e15e3c18bb400939778a6bf1ae47190[$ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->status] = $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6; $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6 = new Varien_Object(); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setStatus(self::DELIVERED); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setIcon('i_accepted.gif'); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setName(Mage::helper('magesms')->__('DELIVERED to recipient')); $i2e68560d8e15e3c18bb400939778a6bf1ae47190[$ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->status] = $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6; $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6 = new Varien_Object(); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setStatus(self::UNAVAILABLE); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setIcon('i_buffered.png'); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setName(Mage::helper('magesms')->__('RECIPIENT UNAVAILABLE')); $i2e68560d8e15e3c18bb400939778a6bf1ae47190[$ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->status] = $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6; $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6 = new Varien_Object(); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setStatus(self::SIMULATION); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setIcon('i_simulation.png'); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setName(Mage::helper('magesms')->__('SIMULATION')); $i2e68560d8e15e3c18bb400939778a6bf1ae47190[$ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->status] = $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6; $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6 = new Varien_Object(); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setStatus(self::SCHEDULED); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setIcon('i_scheduled.png'); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setName(Mage::helper('magesms')->__('SCHEDULED')); $i2e68560d8e15e3c18bb400939778a6bf1ae47190[$ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->status] = $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6; $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6 = new Varien_Object(); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setStatus(self::DELETED); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setIcon('i_deleted.png'); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setName(Mage::helper('magesms')->__('DELETED')); $i2e68560d8e15e3c18bb400939778a6bf1ae47190[$ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->status] = $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6; $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6 = new Varien_Object(); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setStatus(self::DND); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setIcon('i_donotdisturb.png'); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setName(Mage::helper('magesms')->__('DO NOT DISTURB registry (DND)')); $i2e68560d8e15e3c18bb400939778a6bf1ae47190[$ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->status] = $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6; $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6 = new Varien_Object(); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setStatus(self::DUPLICATE); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setIcon('i_duplicate.png'); $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->setName(Mage::helper('magesms')->__('DUPLICATE')); $i2e68560d8e15e3c18bb400939778a6bf1ae47190[$ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6->status] = $ibcdf76f8c9ddc330c79f805116a8bb146c43749df66cdb02406b60b7d525f1fed0b5904ce5586ee6; if ($ibcdf76f8c9ddc330c79f805116a8bb146c43749d7e9551ab4470830f87be4f9ff5edc75013bc9257 === false) return $i2e68560d8e15e3c18bb400939778a6bf1ae47190; elseif (isset($i2e68560d8e15e3c18bb400939778a6bf1ae47190[$ibcdf76f8c9ddc330c79f805116a8bb146c43749d7e9551ab4470830f87be4f9ff5edc75013bc9257])) return $i2e68560d8e15e3c18bb400939778a6bf1ae47190[$ibcdf76f8c9ddc330c79f805116a8bb146c43749d7e9551ab4470830f87be4f9ff5edc75013bc9257]; return false; } }
app/code/community/Topefekt/Magesms/Model/Template.php ADDED
@@ -0,0 +1,16 @@
1
+ <?php
2
+ /**
3
+ * Mage SMS - SMS notification & SMS marketing
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the BSD 3-Clause License
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ * @category TOPefekt
12
+ * @package TOPefekt_Magesms
13
+ * @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
+ * @license http://opensource.org/licenses/BSD-3-Clause
15
+ */
16
+ class Topefekt_Magesms_Model_Template extends Mage_Core_Model_Abstract { protected function _construct() { $this->_init('magesms/template'); } }
app/code/community/Topefekt/Magesms/controllers/Adminhtml/Magesms/AboutController.php CHANGED
@@ -13,4 +13,4 @@
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
- class Topefekt_Magesms_Adminhtml_Magesms_AboutController extends Mage_Adminhtml_Controller_Action { private $v3a81d7d700dc6d1b4279ed33db8d01cd2cae8ed9; protected function _construct() { } public function preDispatch() { return parent::preDispatch(); } public function indexAction() { $this->loadLayout(); $this->_setActiveMenu('magesms/about'); $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock( 'Mage_Core_Block_Template', 'my_block_name_here', array('template' => 'topefekt/magesms/about.phtml') ); $this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); $this->renderLayout(); } }
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
+ class Topefekt_Magesms_Adminhtml_Magesms_AboutController extends Topefekt_Magesms_Controller_Action { public function preDispatch() { return Mage_Adminhtml_Controller_Action::preDispatch(); } public function indexAction() { $this->_initAction(); $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock( 'Mage_Core_Block_Template', 'my_block_name_here', array('template' => 'topefekt/magesms/about.phtml') ); $this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); $this->renderLayout(); } protected function _initAction() { parent::_initAction(); $this->_setActiveMenu('magesms/about') ->_title(Mage::helper('magesms')->__('About')); ; return $this; } }
app/code/community/Topefekt/Magesms/controllers/Adminhtml/Magesms/AdminsmsController.php CHANGED
@@ -13,4 +13,4 @@
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
- class Topefekt_Magesms_Adminhtml_Magesms_AdminsmsController extends Mage_Adminhtml_Controller_Action { public $profile; protected function _construct() { $this->profile = Mage::getSingleton('magesms/smsprofile'); } public function preDispatch() { parent::preDispatch(); if (!$this->profile->user->getUser()) { $this->setFlag('', self::FLAG_NO_DISPATCH, true); if (!empty($this->profile->_error)) { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('magesms')->__($this->profile->_error)); } else { Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magesms')->__('Not registered yet? Create account now!')); } $this->_redirect('*/magesms_profile'); } return $this; } public function indexAction() { $this->_initAction(); $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock( 'Topefekt_Magesms_Block_Template', 'my_block_name_here', array('template' => 'topefekt/magesms/adminsms.phtml') ); $this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); $this->renderLayout(); return $this; } public function saveunicodeAction() { $i7137e40370cf1c5ccf937060891613788203e2d6 = 'default'; $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd = Mage::getSingleton('magesms/hooks_unicode') ->getCollection() ->addFilter('area', $i7137e40370cf1c5ccf937060891613788203e2d6) ->addFilter('type', 'admin') ->getFirstItem(); if (!count($ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd->getData())) { $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd = Mage::getSingleton('magesms/hooks_unicode'); $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd->setArea($i7137e40370cf1c5ccf937060891613788203e2d6); $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd->setType('admin'); $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd->setUnicode($this->getRequest()->getParam('unicode' , 0)); } else { $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd->setUnicode($this->getRequest()->getParam('unicode' , 0)); } $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd->save(); Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magesms')->__('Unicode was saved.')); $this->_redirect('*/*/'); return $this; } public function savehookAction() { $i30f20aafde612a957f7f966cb5b85e35782bc88a = $this->getRequest()->getParam('type'); $i2bd9743336318d0e14be0600c9129730279505dd = $this->getRequest()->getParam('name'); $i24273814df383b4a6926acc1db1a788b12f5a411 = $this->getRequest()->getParam('text' , ''); if ($i30f20aafde612a957f7f966cb5b85e35782bc88a && $i2bd9743336318d0e14be0600c9129730279505dd && $i24273814df383b4a6926acc1db1a788b12f5a411) { $if739aceffec69fa2733946a3d319defaa354082d = Mage::getSingleton('magesms/hooks_'.$i30f20aafde612a957f7f966cb5b85e35782bc88a) ->getCollection() ->addFilter('name', $i2bd9743336318d0e14be0600c9129730279505dd); foreach($if739aceffec69fa2733946a3d319defaa354082d as $i42ee48f418943c9662de0976069476c7dc8f620d) { $i42ee48f418943c9662de0976069476c7dc8f620d->delete(); } foreach($this->getRequest()->getParams() as $i670253c23c6fcba76bc4256a88fdd8fbc1041039=>$iacbd1c78463510856e506611fe14b5e1173581a6) { if (strpos($i670253c23c6fcba76bc4256a88fdd8fbc1041039, 'active_') === 0) { $ia61712c27ea241bd7a543dc2b02ea572274d0322 = explode('_', $i670253c23c6fcba76bc4256a88fdd8fbc1041039); $i42ee48f418943c9662de0976069476c7dc8f620d = Mage::getModel('magesms/hooks_'.$i30f20aafde612a957f7f966cb5b85e35782bc88a) ->setName($i2bd9743336318d0e14be0600c9129730279505dd) ->setSmstext($i24273814df383b4a6926acc1db1a788b12f5a411) ->setAdminId($ia61712c27ea241bd7a543dc2b02ea572274d0322[2]) ->setStoreGroupId($ia61712c27ea241bd7a543dc2b02ea572274d0322[3]) ->save(); } else { continue; } } Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magesms')->__('Text of SMS was saved.')); } $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a = array('_fragment' => $i2bd9743336318d0e14be0600c9129730279505dd); $this->_redirect('*/*/', $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a); return $this; } protected function _initAction() { $this->loadLayout() ->_setActiveMenu('magesms/adminsms') ->_addBreadcrumb(Mage::helper('magesms')->__('Admin SMS'), Mage::helper('magesms')->__('Admin SMS')) ->_title(Mage::helper('magesms')->__('MageSMS')) ->_title(Mage::helper('magesms')->__('Admin SMS')) ; $this->getLayout()->getBlock('head')->addCss('css/topefekt/magesms/stylesheet.css') ->addJs('topefekt/functions.js'); return $this; } }
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
+ class Topefekt_Magesms_Adminhtml_Magesms_AdminsmsController extends Topefekt_Magesms_Controller_Action { public function indexAction() { $this->_initAction(); $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock( 'Topefekt_Magesms_Block_Template', 'my_block_name_here', array('template' => 'topefekt/magesms/adminsms.phtml') ); $this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); $this->renderLayout(); return $this; } public function saveunicodeAction() { $i7137e40370cf1c5ccf937060891613788203e2d6 = 'default'; $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd = Mage::getSingleton('magesms/hooks_unicode') ->getCollection() ->addFilter('area', $i7137e40370cf1c5ccf937060891613788203e2d6) ->addFilter('type', 'admin') ->getFirstItem(); if (!count($ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd->getData())) { $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd = Mage::getSingleton('magesms/hooks_unicode'); $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd->setArea($i7137e40370cf1c5ccf937060891613788203e2d6); $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd->setType('admin'); $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd->setUnicode($this->getRequest()->getParam('unicode' , 0)); } else { $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd->setUnicode($this->getRequest()->getParam('unicode' , 0)); } $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd->save(); Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magesms')->__('Unicode was saved.')); $this->_redirect('*/*/'); return $this; } public function savehookAction() { $i30f20aafde612a957f7f966cb5b85e35782bc88a = $this->getRequest()->getParam('type'); $i2bd9743336318d0e14be0600c9129730279505dd = $this->getRequest()->getParam('name'); $i24273814df383b4a6926acc1db1a788b12f5a411 = $this->getRequest()->getParam('text' , ''); if ($i30f20aafde612a957f7f966cb5b85e35782bc88a && $i2bd9743336318d0e14be0600c9129730279505dd && $i24273814df383b4a6926acc1db1a788b12f5a411) { $if739aceffec69fa2733946a3d319defaa354082d = Mage::getSingleton('magesms/hooks_'.$i30f20aafde612a957f7f966cb5b85e35782bc88a) ->getCollection() ->addFilter('name', $i2bd9743336318d0e14be0600c9129730279505dd); foreach($if739aceffec69fa2733946a3d319defaa354082d as $i42ee48f418943c9662de0976069476c7dc8f620d) { $i42ee48f418943c9662de0976069476c7dc8f620d->delete(); } foreach($this->getRequest()->getParams() as $i670253c23c6fcba76bc4256a88fdd8fbc1041039=>$iacbd1c78463510856e506611fe14b5e1173581a6) { if (strpos($i670253c23c6fcba76bc4256a88fdd8fbc1041039, 'active_') === 0) { $ia61712c27ea241bd7a543dc2b02ea572274d0322 = explode('_', $i670253c23c6fcba76bc4256a88fdd8fbc1041039); $i42ee48f418943c9662de0976069476c7dc8f620d = Mage::getModel('magesms/hooks_'.$i30f20aafde612a957f7f966cb5b85e35782bc88a) ->setName($i2bd9743336318d0e14be0600c9129730279505dd) ->setSmstext($i24273814df383b4a6926acc1db1a788b12f5a411) ->setAdminId($ia61712c27ea241bd7a543dc2b02ea572274d0322[2]) ->setStoreGroupId($ia61712c27ea241bd7a543dc2b02ea572274d0322[3]) ->save(); } else { continue; } } Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magesms')->__('Text of SMS was saved.')); } $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a = array('_fragment' => $i2bd9743336318d0e14be0600c9129730279505dd); $this->_redirect('*/*/', $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a); return $this; } protected function _initAction() { parent::_initAction(); $this->_setActiveMenu('magesms/adminsms') ->_title(Mage::helper('magesms')->__('Admin SMS')) ; return $this; } }
app/code/community/Topefekt/Magesms/controllers/Adminhtml/Magesms/AnswersController.php CHANGED
@@ -13,4 +13,4 @@
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
- class Topefekt_Magesms_Adminhtml_Magesms_AnswersController extends Mage_Adminhtml_Controller_Action { public $profile; protected function _construct() { $this->profile = Mage::getSingleton('magesms/smsprofile'); } public function preDispatch() { parent::preDispatch(); if (!$this->profile->user->getUser()) { $this->setFlag('', self::FLAG_NO_DISPATCH, true); if (!empty($this->profile->_error)) { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('magesms')->__($this->profile->_error)); } else { Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magesms')->__('Not registered yet? Create account now!')); } $this->_redirect('*/magesms_profile'); } return $this; } public function indexAction() { $this->_initAction(); $iea2d876101fbc4dc03450ed5474bbd8a6fb905a2 = Mage::helper('adminhtml')->prepareFilterString($this->getRequest()->getParam('filter')); $iea2d876101fbc4dc03450ed5474bbd8a6fb905a2 = $this->_filterDates($iea2d876101fbc4dc03450ed5474bbd8a6fb905a2, array('reg_from', 'reg_to', 'birth_from', 'birth_to')); $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a = new Varien_Object(); foreach ($iea2d876101fbc4dc03450ed5474bbd8a6fb905a2 as $i670253c23c6fcba76bc4256a88fdd8fbc1041039 => $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89) { if (!empty($if2eee0665f163a28f4adcfe84e3fc666bf1bcd89)) { $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a->setData($i670253c23c6fcba76bc4256a88fdd8fbc1041039, $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89); } } $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock('magesms/answers'); $i8ee45e0018a32fb1a855b82624506e35789cc4d2->setFilterData($ia8a35a47a8e61218e15d1a33dac64bdc2449c01a); $this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); $this->renderLayout(); return $this; } public function markAsReadAction() { if ($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538 = $this->getRequest()->getParam('id')) { $i0e3e80cee9c51f140b823db0b7df66493acca657 = Mage::getSingleton('adminhtml/session'); $i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd = Mage::getModel('magesms/answers') ->load($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538); if (!$i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd->getId()) { $i0e3e80cee9c51f140b823db0b7df66493acca657->addError(Mage::helper('magesms')->__('Unable to proceed. Please, try again.')); $this->_redirect('*/*/'); return ; } try { $i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd->setProhlednuto(1) ->save(); $i0e3e80cee9c51f140b823db0b7df66493acca657->addSuccess(Mage::helper('magesms')->__('The message has been marked as read.')); } catch (Mage_Core_Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { $i0e3e80cee9c51f140b823db0b7df66493acca657->addError($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage()); } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { $i0e3e80cee9c51f140b823db0b7df66493acca657->addException($i8c174347956f0a76258a09557543e84f88beb4a0, Mage::helper('magesms')->__('An error occurred while marking notification as read.')); } $this->_redirectReferer(); return; } $this->_redirect('*/*/'); } public function massMarkAsReadAction() { $i0e3e80cee9c51f140b823db0b7df66493acca657 = Mage::getSingleton('adminhtml/session'); $iea1c44f6137731e1b13c494f784074e6a133577a = $this->getRequest()->getParam('answers'); if (!is_array($iea1c44f6137731e1b13c494f784074e6a133577a)) { $i0e3e80cee9c51f140b823db0b7df66493acca657->addError(Mage::helper('magesms')->__('Please select messages.')); } else { try { foreach ($iea1c44f6137731e1b13c494f784074e6a133577a as $i7d411c0cc32cdb65ec82b9e8d79aa996946f5538) { $i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd = Mage::getModel('magesms/answers') ->load($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538); if ($i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd->getId()) { $i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd->setProhlednuto(1) ->save(); } } $this->_getSession()->addSuccess( Mage::helper('magesms')->__('Total of %d record(s) have been marked as read.', count($iea1c44f6137731e1b13c494f784074e6a133577a)) ); } catch (Mage_Core_Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { $i0e3e80cee9c51f140b823db0b7df66493acca657->addError($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage()); } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { $i0e3e80cee9c51f140b823db0b7df66493acca657->addException($i8c174347956f0a76258a09557543e84f88beb4a0, Mage::helper('magesms')->__('An error occurred while marking the messages as read.')); } } $this->_redirect('*/*/'); } public function removeAction() { if ($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538 = $this->getRequest()->getParam('id')) { $i0e3e80cee9c51f140b823db0b7df66493acca657 = Mage::getSingleton('adminhtml/session'); $i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd = Mage::getModel('magesms/answers') ->load($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538); if (!$i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd->getId()) { $this->_redirect('*/*/'); return ; } try { $i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd->delete(); $i0e3e80cee9c51f140b823db0b7df66493acca657->addSuccess(Mage::helper('magesms')->__('The message has been removed.')); } catch (Mage_Core_Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { $i0e3e80cee9c51f140b823db0b7df66493acca657->addError($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage()); } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { $i0e3e80cee9c51f140b823db0b7df66493acca657->addException($i8c174347956f0a76258a09557543e84f88beb4a0, Mage::helper('magesms')->__('An error occurred while removing the message.')); } $this->_redirect('*/*/'); return; } $this->_redirect('*/*/'); } public function massRemoveAction() { $i0e3e80cee9c51f140b823db0b7df66493acca657 = Mage::getSingleton('adminhtml/session'); $iea1c44f6137731e1b13c494f784074e6a133577a = $this->getRequest()->getParam('answers'); if (!is_array($iea1c44f6137731e1b13c494f784074e6a133577a)) { $i0e3e80cee9c51f140b823db0b7df66493acca657->addError(Mage::helper('magesms')->__('Please select messages.')); } else { try { foreach ($iea1c44f6137731e1b13c494f784074e6a133577a as $i7d411c0cc32cdb65ec82b9e8d79aa996946f5538) { $i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd = Mage::getModel('magesms/answers') ->load($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538); if ($i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd->getId()) { $i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd->delete(); } } $this->_getSession()->addSuccess( Mage::helper('magesms')->__('Total of %d record(s) have been removed.', count($iea1c44f6137731e1b13c494f784074e6a133577a)) ); } catch (Mage_Core_Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { $i0e3e80cee9c51f140b823db0b7df66493acca657->addError($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage()); } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { $i0e3e80cee9c51f140b823db0b7df66493acca657->addException($i8c174347956f0a76258a09557543e84f88beb4a0, Mage::helper('magesms')->__('An error occurred while removing messages.')); } } $this->_redirectReferer(); } public function exportCsvAction() { $i76341ee5d8e86027e6fa2d5f6480a85ca10cc6da = 'answers.csv'; $i42cf41da37138d64d37b0778e6561aab5e1239d6 = $this->getLayout()->createBlock('magesms/answers_grid'); $this->_prepareDownloadResponse($i76341ee5d8e86027e6fa2d5f6480a85ca10cc6da, $i42cf41da37138d64d37b0778e6561aab5e1239d6->getCsvFile()); } public function exportExcelAction() { $i76341ee5d8e86027e6fa2d5f6480a85ca10cc6da = 'answers.xml'; $i42cf41da37138d64d37b0778e6561aab5e1239d6 = $this->getLayout()->createBlock('magesms/answers_grid'); $this->_prepareDownloadResponse($i76341ee5d8e86027e6fa2d5f6480a85ca10cc6da, $i42cf41da37138d64d37b0778e6561aab5e1239d6->getExcelFile($i76341ee5d8e86027e6fa2d5f6480a85ca10cc6da)); } protected function _initAction() { $this->loadLayout() ->_setActiveMenu('magesms/answers') ->_addBreadcrumb(Mage::helper('magesms')->__('SMS Answers'), Mage::helper('magesms')->__('SMS Answers')) ->_title(Mage::helper('magesms')->__('MageSMS')) ->_title(Mage::helper('magesms')->__('SMS Answers')) ; $this->getLayout()->getBlock('head')->addCss('css/topefekt/magesms/stylesheet.css') ->addJs('topefekt/functions.js'); return $this; } protected function _isAllowed() { switch ($this->getRequest()->getActionName()) { case 'markAsRead': $i72f3c526b8abf631fb79dfaa1f2cc1e7ee90ca3e = 'magesms/answers/mark_as_read'; break; case 'massMarkAsRead': $i72f3c526b8abf631fb79dfaa1f2cc1e7ee90ca3e = 'magesms/answers/mark_as_read'; break; case 'remove': $i72f3c526b8abf631fb79dfaa1f2cc1e7ee90ca3e = 'magesms/answers/remove'; break; case 'massRemove': $i72f3c526b8abf631fb79dfaa1f2cc1e7ee90ca3e = 'magesms/answers/remove'; break; default: $i72f3c526b8abf631fb79dfaa1f2cc1e7ee90ca3e = 'magesms/answers'; } return Mage::getSingleton('admin/session')->isAllowed($i72f3c526b8abf631fb79dfaa1f2cc1e7ee90ca3e); } }
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
+ class Topefekt_Magesms_Adminhtml_Magesms_AnswersController extends Topefekt_Magesms_Controller_Action { public function indexAction() { $this->_initAction(); $iea2d876101fbc4dc03450ed5474bbd8a6fb905a2 = Mage::helper('adminhtml')->prepareFilterString($this->getRequest()->getParam('filter')); $iea2d876101fbc4dc03450ed5474bbd8a6fb905a2 = $this->_filterDates($iea2d876101fbc4dc03450ed5474bbd8a6fb905a2, array('reg_from', 'reg_to', 'birth_from', 'birth_to')); $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a = new Varien_Object(); foreach ($iea2d876101fbc4dc03450ed5474bbd8a6fb905a2 as $i670253c23c6fcba76bc4256a88fdd8fbc1041039 => $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89) { if (!empty($if2eee0665f163a28f4adcfe84e3fc666bf1bcd89)) { $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a->setData($i670253c23c6fcba76bc4256a88fdd8fbc1041039, $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89); } } $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock('magesms/answers'); $i8ee45e0018a32fb1a855b82624506e35789cc4d2->setFilterData($ia8a35a47a8e61218e15d1a33dac64bdc2449c01a); $this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); $this->renderLayout(); return $this; } public function markAsReadAction() { if ($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538 = $this->getRequest()->getParam('id')) { $i0e3e80cee9c51f140b823db0b7df66493acca657 = Mage::getSingleton('adminhtml/session'); $i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd = Mage::getModel('magesms/answers') ->load($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538); if (!$i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd->getId()) { $i0e3e80cee9c51f140b823db0b7df66493acca657->addError(Mage::helper('magesms')->__('Unable to proceed. Please, try again.')); $this->_redirect('*/*/'); return ; } try { $i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd->setProhlednuto(1) ->save(); $i0e3e80cee9c51f140b823db0b7df66493acca657->addSuccess(Mage::helper('magesms')->__('The message has been marked as read.')); } catch (Mage_Core_Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { $i0e3e80cee9c51f140b823db0b7df66493acca657->addError($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage()); } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { $i0e3e80cee9c51f140b823db0b7df66493acca657->addException($i8c174347956f0a76258a09557543e84f88beb4a0, Mage::helper('magesms')->__('An error occurred while marking notification as read.')); } $this->_redirectReferer(); return; } $this->_redirect('*/*/'); } public function massMarkAsReadAction() { $i0e3e80cee9c51f140b823db0b7df66493acca657 = Mage::getSingleton('adminhtml/session'); $iea1c44f6137731e1b13c494f784074e6a133577a = $this->getRequest()->getParam('answers'); if (!is_array($iea1c44f6137731e1b13c494f784074e6a133577a)) { $i0e3e80cee9c51f140b823db0b7df66493acca657->addError(Mage::helper('magesms')->__('Please select messages.')); } else { try { foreach ($iea1c44f6137731e1b13c494f784074e6a133577a as $i7d411c0cc32cdb65ec82b9e8d79aa996946f5538) { $i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd = Mage::getModel('magesms/answers') ->load($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538); if ($i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd->getId()) { $i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd->setProhlednuto(1) ->save(); } } $this->_getSession()->addSuccess( Mage::helper('magesms')->__('Total of %d record(s) have been marked as read.', count($iea1c44f6137731e1b13c494f784074e6a133577a)) ); } catch (Mage_Core_Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { $i0e3e80cee9c51f140b823db0b7df66493acca657->addError($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage()); } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { $i0e3e80cee9c51f140b823db0b7df66493acca657->addException($i8c174347956f0a76258a09557543e84f88beb4a0, Mage::helper('magesms')->__('An error occurred while marking the messages as read.')); } } $this->_redirect('*/*/'); } public function removeAction() { if ($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538 = $this->getRequest()->getParam('id')) { $i0e3e80cee9c51f140b823db0b7df66493acca657 = Mage::getSingleton('adminhtml/session'); $i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd = Mage::getModel('magesms/answers') ->load($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538); if (!$i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd->getId()) { $this->_redirect('*/*/'); return ; } try { $i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd->delete(); $i0e3e80cee9c51f140b823db0b7df66493acca657->addSuccess(Mage::helper('magesms')->__('The message has been removed.')); } catch (Mage_Core_Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { $i0e3e80cee9c51f140b823db0b7df66493acca657->addError($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage()); } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { $i0e3e80cee9c51f140b823db0b7df66493acca657->addException($i8c174347956f0a76258a09557543e84f88beb4a0, Mage::helper('magesms')->__('An error occurred while removing the message.')); } $this->_redirect('*/*/'); return; } $this->_redirect('*/*/'); } public function massRemoveAction() { $i0e3e80cee9c51f140b823db0b7df66493acca657 = Mage::getSingleton('adminhtml/session'); $iea1c44f6137731e1b13c494f784074e6a133577a = $this->getRequest()->getParam('answers'); if (!is_array($iea1c44f6137731e1b13c494f784074e6a133577a)) { $i0e3e80cee9c51f140b823db0b7df66493acca657->addError(Mage::helper('magesms')->__('Please select messages.')); } else { try { foreach ($iea1c44f6137731e1b13c494f784074e6a133577a as $i7d411c0cc32cdb65ec82b9e8d79aa996946f5538) { $i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd = Mage::getModel('magesms/answers') ->load($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538); if ($i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd->getId()) { $i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd->delete(); } } $this->_getSession()->addSuccess( Mage::helper('magesms')->__('Total of %d record(s) have been removed.', count($iea1c44f6137731e1b13c494f784074e6a133577a)) ); } catch (Mage_Core_Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { $i0e3e80cee9c51f140b823db0b7df66493acca657->addError($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage()); } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { $i0e3e80cee9c51f140b823db0b7df66493acca657->addException($i8c174347956f0a76258a09557543e84f88beb4a0, Mage::helper('magesms')->__('An error occurred while removing messages.')); } } $this->_redirectReferer(); } public function exportCsvAction() { $i76341ee5d8e86027e6fa2d5f6480a85ca10cc6da = 'answers.csv'; $i42cf41da37138d64d37b0778e6561aab5e1239d6 = $this->getLayout()->createBlock('magesms/answers_grid'); $this->_prepareDownloadResponse($i76341ee5d8e86027e6fa2d5f6480a85ca10cc6da, $i42cf41da37138d64d37b0778e6561aab5e1239d6->getCsvFile()); } public function exportExcelAction() { $i76341ee5d8e86027e6fa2d5f6480a85ca10cc6da = 'answers.xml'; $i42cf41da37138d64d37b0778e6561aab5e1239d6 = $this->getLayout()->createBlock('magesms/answers_grid'); $this->_prepareDownloadResponse($i76341ee5d8e86027e6fa2d5f6480a85ca10cc6da, $i42cf41da37138d64d37b0778e6561aab5e1239d6->getExcelFile($i76341ee5d8e86027e6fa2d5f6480a85ca10cc6da)); } protected function _initAction() { parent::_initAction(); $this->_setActiveMenu('magesms/answers') ->_title(Mage::helper('magesms')->__('SMS Answers')) ; return $this; } protected function _isAllowed() { switch ($this->getRequest()->getActionName()) { case 'markAsRead': $i72f3c526b8abf631fb79dfaa1f2cc1e7ee90ca3e = 'magesms/answers/mark_as_read'; break; case 'massMarkAsRead': $i72f3c526b8abf631fb79dfaa1f2cc1e7ee90ca3e = 'magesms/answers/mark_as_read'; break; case 'remove': $i72f3c526b8abf631fb79dfaa1f2cc1e7ee90ca3e = 'magesms/answers/remove'; break; case 'massRemove': $i72f3c526b8abf631fb79dfaa1f2cc1e7ee90ca3e = 'magesms/answers/remove'; break; default: $i72f3c526b8abf631fb79dfaa1f2cc1e7ee90ca3e = 'magesms/answers'; } return Mage::getSingleton('admin/session')->isAllowed($i72f3c526b8abf631fb79dfaa1f2cc1e7ee90ca3e); } }
app/code/community/Topefekt/Magesms/controllers/Adminhtml/Magesms/CustomersmsController.php CHANGED
@@ -13,4 +13,4 @@
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
- class Topefekt_Magesms_Adminhtml_Magesms_CustomersmsController extends Mage_Adminhtml_Controller_Action { public $profile; protected function _construct() { $this->profile = Mage::getSingleton('magesms/smsprofile'); } public function preDispatch() { parent::preDispatch(); if (!$this->profile->user->getUser()) { $this->setFlag('', self::FLAG_NO_DISPATCH, true); if (!empty($this->profile->_error)) { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('magesms')->__($this->profile->_error)); } else { Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magesms')->__('Not registered yet? Create account now!')); } $this->_redirect('*/magesms_profile'); } return $this; } public function indexAction() { $this->_initAction(); $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock( 'Topefekt_Magesms_Block_Template', 'my_block_name_here', array('template' => 'topefekt/magesms/customersms.phtml') ); $this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); $this->renderLayout(); return $this; } public function addmutationAction() { $i7137e40370cf1c5ccf937060891613788203e2d6 = $this->getRequest()->getParam('country', 'default'); $idb618c56be2c8abc9a54a16881dadfd5317ba624 = Mage::getSingleton('magesms/hooks_templates')->getCollection()->addFilter('area', $i7137e40370cf1c5ccf937060891613788203e2d6); if (!$idb618c56be2c8abc9a54a16881dadfd5317ba624->count()) { $i195899c9895b81b9bc75dba762c949638a6f36dd = Mage::getSingleton('magesms/country_area')->getCollection()->addFilter('area', $i7137e40370cf1c5ccf937060891613788203e2d6); $i7d716a8fdc4101e29ab8fd7002b332e962603d8c = array(); foreach($i195899c9895b81b9bc75dba762c949638a6f36dd as $i037b855bc01175f2c77d5c3e19eda9a0003feff4) { $i7d716a8fdc4101e29ab8fd7002b332e962603d8c[] = $i037b855bc01175f2c77d5c3e19eda9a0003feff4->getCountryName(); } if (count($i7d716a8fdc4101e29ab8fd7002b332e962603d8c)) { $idb618c56be2c8abc9a54a16881dadfd5317ba624 = Mage::getSingleton('magesms/hooks_templates'); $idb618c56be2c8abc9a54a16881dadfd5317ba624->setArea($i7137e40370cf1c5ccf937060891613788203e2d6); $idb618c56be2c8abc9a54a16881dadfd5317ba624->setAreaText(implode(', ', $i7d716a8fdc4101e29ab8fd7002b332e962603d8c)); $idb618c56be2c8abc9a54a16881dadfd5317ba624->save(); Mage::getSingleton('adminhtml/session')->addSuccess( Mage::helper('magesms')->__('SMS text version for ').$idb618c56be2c8abc9a54a16881dadfd5317ba624->getAreaText(). Mage::helper('magesms')->__(' was saved')); } } $this->_redirect('*/*/', array('mutation' => $i7137e40370cf1c5ccf937060891613788203e2d6)); return $this; } public function delmutationAction() { $i7137e40370cf1c5ccf937060891613788203e2d6 = $this->getRequest()->getParam('mutation'); if ($i7137e40370cf1c5ccf937060891613788203e2d6) { $idb618c56be2c8abc9a54a16881dadfd5317ba624 = Mage::getSingleton('magesms/hooks_templates') ->getCollection() ->addFilter('area', $i7137e40370cf1c5ccf937060891613788203e2d6) ->getFirstItem() ->delete(); $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd = Mage::getSingleton('magesms/hooks_unicode') ->getCollection() ->addFilter('area', $i7137e40370cf1c5ccf937060891613788203e2d6) ->addFilter('type', 'customer') ->getFirstItem() ->delete(); $ibad8f78c098260b16424eb12ceee5f8336591d56 = Mage::getSingleton('magesms/hooks_customers') ->getCollection() ->addFilter('mutation', $i7137e40370cf1c5ccf937060891613788203e2d6); foreach($ibad8f78c098260b16424eb12ceee5f8336591d56 as $i21e55df616c305955791876c1eb4da83448beba2) $i21e55df616c305955791876c1eb4da83448beba2->delete(); Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magesms')->__('SMS text version was deleted.')); } $this->_redirect('*/*/index'); return $this; } public function saveunicodeAction() { $i7137e40370cf1c5ccf937060891613788203e2d6 = $this->getRequest()->getParam('mutation'); if ($i7137e40370cf1c5ccf937060891613788203e2d6) { $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd = Mage::getSingleton('magesms/hooks_unicode') ->getCollection() ->addFilter('area', $i7137e40370cf1c5ccf937060891613788203e2d6) ->addFilter('type', 'customer') ->getFirstItem(); if (!count($ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd->getData())) { $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd = Mage::getSingleton('magesms/hooks_unicode'); $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd->setArea($i7137e40370cf1c5ccf937060891613788203e2d6); $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd->setType('customer'); $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd->setUnicode($this->getRequest()->getParam('unicode' , 0)); } else { $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd->setUnicode($this->getRequest()->getParam('unicode' , 0)); } $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd->save(); Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magesms')->__('Unicode was saved.')); } $this->_redirect('*/*/', array('mutation' => $i7137e40370cf1c5ccf937060891613788203e2d6)); return $this; } public function savehookAction() { $i7137e40370cf1c5ccf937060891613788203e2d6 = $this->getRequest()->getParam('mutation', 'default'); $i30f20aafde612a957f7f966cb5b85e35782bc88a = $this->getRequest()->getParam('type'); $i2bd9743336318d0e14be0600c9129730279505dd = $this->getRequest()->getParam('name'); $i24273814df383b4a6926acc1db1a788b12f5a411 = $this->getRequest()->getParam('text' , ''); if ($i30f20aafde612a957f7f966cb5b85e35782bc88a && $i2bd9743336318d0e14be0600c9129730279505dd && $i24273814df383b4a6926acc1db1a788b12f5a411) { $i42ee48f418943c9662de0976069476c7dc8f620d = Mage::getSingleton('magesms/hooks_'.$i30f20aafde612a957f7f966cb5b85e35782bc88a) ->getCollection() ->addFilter('name', $i2bd9743336318d0e14be0600c9129730279505dd) ->addFilter('mutation', $i7137e40370cf1c5ccf937060891613788203e2d6) ->getFirstItem(); if (!count($i42ee48f418943c9662de0976069476c7dc8f620d->getData())) { $i42ee48f418943c9662de0976069476c7dc8f620d = Mage::getSingleton('magesms/hooks_'.$i30f20aafde612a957f7f966cb5b85e35782bc88a); $i42ee48f418943c9662de0976069476c7dc8f620d->setMutation($i7137e40370cf1c5ccf937060891613788203e2d6); $i42ee48f418943c9662de0976069476c7dc8f620d->setName($i2bd9743336318d0e14be0600c9129730279505dd); } $i42ee48f418943c9662de0976069476c7dc8f620d->setActive($this->getRequest()->getParam('active' , 0)); $i42ee48f418943c9662de0976069476c7dc8f620d->setSmstext($i24273814df383b4a6926acc1db1a788b12f5a411); $i42ee48f418943c9662de0976069476c7dc8f620d->save(); Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magesms')->__('Text of SMS was saved.')); } $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a = array('_fragment' => $i2bd9743336318d0e14be0600c9129730279505dd); if ($i7137e40370cf1c5ccf937060891613788203e2d6 != 'default') $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a += array('mutation' => $i7137e40370cf1c5ccf937060891613788203e2d6); $this->_redirect('*/*/', $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a); return $this; } protected function _initAction() { $this->loadLayout() ->_setActiveMenu('magesms/customersms') ->_addBreadcrumb(Mage::helper('magesms')->__('Customer SMS'), Mage::helper('magesms')->__('Customer SMS')) ->_title(Mage::helper('magesms')->__('MageSMS')) ->_title(Mage::helper('magesms')->__('Customer SMS')) ; $this->getLayout()->getBlock('head')->addCss('css/topefekt/magesms/stylesheet.css') ->addJs('topefekt/functions.js'); return $this; } }
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
+ class Topefekt_Magesms_Adminhtml_Magesms_CustomersmsController extends Topefekt_Magesms_Controller_Action { public function indexAction() { $this->_initAction(); $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock( 'Topefekt_Magesms_Block_Template', 'my_block_name_here', array('template' => 'topefekt/magesms/customersms.phtml') ); $this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); $this->renderLayout(); return $this; } public function addmutationAction() { $i7137e40370cf1c5ccf937060891613788203e2d6 = $this->getRequest()->getParam('country', 'default'); $idb618c56be2c8abc9a54a16881dadfd5317ba624 = Mage::getSingleton('magesms/hooks_templates')->getCollection()->addFilter('area', $i7137e40370cf1c5ccf937060891613788203e2d6); if (!$idb618c56be2c8abc9a54a16881dadfd5317ba624->count()) { $i195899c9895b81b9bc75dba762c949638a6f36dd = Mage::getSingleton('magesms/country_area')->getCollection()->addFilter('area', $i7137e40370cf1c5ccf937060891613788203e2d6); $i7d716a8fdc4101e29ab8fd7002b332e962603d8c = array(); foreach($i195899c9895b81b9bc75dba762c949638a6f36dd as $i037b855bc01175f2c77d5c3e19eda9a0003feff4) { $i7d716a8fdc4101e29ab8fd7002b332e962603d8c[] = $i037b855bc01175f2c77d5c3e19eda9a0003feff4->getCountryName(); } if (count($i7d716a8fdc4101e29ab8fd7002b332e962603d8c)) { $idb618c56be2c8abc9a54a16881dadfd5317ba624 = Mage::getSingleton('magesms/hooks_templates'); $idb618c56be2c8abc9a54a16881dadfd5317ba624->setArea($i7137e40370cf1c5ccf937060891613788203e2d6); $idb618c56be2c8abc9a54a16881dadfd5317ba624->setAreaText(implode(', ', $i7d716a8fdc4101e29ab8fd7002b332e962603d8c)); $idb618c56be2c8abc9a54a16881dadfd5317ba624->save(); Mage::getSingleton('adminhtml/session')->addSuccess( Mage::helper('magesms')->__('SMS text version for ').$idb618c56be2c8abc9a54a16881dadfd5317ba624->getAreaText(). Mage::helper('magesms')->__(' was saved')); } } $this->_redirect('*/*/', array('mutation' => $i7137e40370cf1c5ccf937060891613788203e2d6)); return $this; } public function delmutationAction() { $i7137e40370cf1c5ccf937060891613788203e2d6 = $this->getRequest()->getParam('mutation'); if ($i7137e40370cf1c5ccf937060891613788203e2d6) { $idb618c56be2c8abc9a54a16881dadfd5317ba624 = Mage::getSingleton('magesms/hooks_templates') ->getCollection() ->addFilter('area', $i7137e40370cf1c5ccf937060891613788203e2d6) ->getFirstItem() ->delete(); $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd = Mage::getSingleton('magesms/hooks_unicode') ->getCollection() ->addFilter('area', $i7137e40370cf1c5ccf937060891613788203e2d6) ->addFilter('type', 'customer') ->getFirstItem() ->delete(); $ibad8f78c098260b16424eb12ceee5f8336591d56 = Mage::getSingleton('magesms/hooks_customers') ->getCollection() ->addFilter('mutation', $i7137e40370cf1c5ccf937060891613788203e2d6); foreach($ibad8f78c098260b16424eb12ceee5f8336591d56 as $i21e55df616c305955791876c1eb4da83448beba2) $i21e55df616c305955791876c1eb4da83448beba2->delete(); Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magesms')->__('SMS text version was deleted.')); } $this->_redirect('*/*/index'); return $this; } public function saveunicodeAction() { $i7137e40370cf1c5ccf937060891613788203e2d6 = $this->getRequest()->getParam('mutation'); if ($i7137e40370cf1c5ccf937060891613788203e2d6) { $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd = Mage::getSingleton('magesms/hooks_unicode') ->getCollection() ->addFilter('area', $i7137e40370cf1c5ccf937060891613788203e2d6) ->addFilter('type', 'customer') ->getFirstItem(); if (!count($ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd->getData())) { $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd = Mage::getSingleton('magesms/hooks_unicode'); $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd->setArea($i7137e40370cf1c5ccf937060891613788203e2d6); $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd->setType('customer'); $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd->setUnicode($this->getRequest()->getParam('unicode' , 0)); } else { $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd->setUnicode($this->getRequest()->getParam('unicode' , 0)); } $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd->save(); Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magesms')->__('Unicode was saved.')); } $this->_redirect('*/*/', array('mutation' => $i7137e40370cf1c5ccf937060891613788203e2d6)); return $this; } public function savehookAction() { $i7137e40370cf1c5ccf937060891613788203e2d6 = $this->getRequest()->getParam('mutation', 'default'); $i30f20aafde612a957f7f966cb5b85e35782bc88a = $this->getRequest()->getParam('type'); $i2bd9743336318d0e14be0600c9129730279505dd = $this->getRequest()->getParam('name'); $i24273814df383b4a6926acc1db1a788b12f5a411 = $this->getRequest()->getParam('text' , ''); if ($i30f20aafde612a957f7f966cb5b85e35782bc88a && $i2bd9743336318d0e14be0600c9129730279505dd && $i24273814df383b4a6926acc1db1a788b12f5a411) { $i42ee48f418943c9662de0976069476c7dc8f620d = Mage::getSingleton('magesms/hooks_'.$i30f20aafde612a957f7f966cb5b85e35782bc88a) ->getCollection() ->addFilter('name', $i2bd9743336318d0e14be0600c9129730279505dd) ->addFilter('mutation', $i7137e40370cf1c5ccf937060891613788203e2d6) ->getFirstItem(); if (!count($i42ee48f418943c9662de0976069476c7dc8f620d->getData())) { $i42ee48f418943c9662de0976069476c7dc8f620d = Mage::getSingleton('magesms/hooks_'.$i30f20aafde612a957f7f966cb5b85e35782bc88a); $i42ee48f418943c9662de0976069476c7dc8f620d->setMutation($i7137e40370cf1c5ccf937060891613788203e2d6); $i42ee48f418943c9662de0976069476c7dc8f620d->setName($i2bd9743336318d0e14be0600c9129730279505dd); } $i42ee48f418943c9662de0976069476c7dc8f620d->setActive($this->getRequest()->getParam('active' , 0)); $i42ee48f418943c9662de0976069476c7dc8f620d->setSmstext($i24273814df383b4a6926acc1db1a788b12f5a411); $i42ee48f418943c9662de0976069476c7dc8f620d->save(); Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magesms')->__('Text of SMS was saved.')); } $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a = array('_fragment' => $i2bd9743336318d0e14be0600c9129730279505dd); if ($i7137e40370cf1c5ccf937060891613788203e2d6 != 'default') $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a += array('mutation' => $i7137e40370cf1c5ccf937060891613788203e2d6); $this->_redirect('*/*/', $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a); return $this; } protected function _initAction() { parent::_initAction(); $this->_setActiveMenu('magesms/customersms') ->_title(Mage::helper('magesms')->__('Customer SMS')) ; return $this; } }
app/code/community/Topefekt/Magesms/controllers/Adminhtml/Magesms/HistoryController.php CHANGED
@@ -13,4 +13,4 @@
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
- class Topefekt_Magesms_Adminhtml_Magesms_HistoryController extends Mage_Adminhtml_Controller_Action { public $profile; protected function _construct() { $this->profile = Mage::getSingleton('magesms/smsprofile'); } public function preDispatch() { parent::preDispatch(); if (!$this->profile->user->getUser()) { $this->setFlag('', self::FLAG_NO_DISPATCH, true); if (!empty($this->profile->_error)) { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('magesms')->__($this->profile->_error)); } else { Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magesms')->__('Not registered yet? Create account now!')); } $this->_redirect('*/magesms_profile'); } return $this; } public function indexAction() { $this->_initAction(); $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock( 'Topefekt_Magesms_Block_Template', 'my_block_name_here', array('template' => 'topefekt/magesms/history.phtml') ); $this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); $this->renderLayout(); return $this; } public function filterAction() { $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a = $this->getRequest()->getParams(); unset($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a['form_key']); $this->_redirect('*/*/', $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a); } protected function _initAction() { $this->loadLayout() ->_setActiveMenu('magesms/history') ->_addBreadcrumb(Mage::helper('magesms')->__('SMS History'), Mage::helper('magesms')->__('SMS History')) ->_title(Mage::helper('magesms')->__('MageSMS')) ->_title(Mage::helper('magesms')->__('SMS History')) ; $this->getLayout()->getBlock('head')->addCss('css/topefekt/magesms/stylesheet.css') ->addJs('topefekt/functions.js'); return $this; } }
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
+ class Topefekt_Magesms_Adminhtml_Magesms_HistoryController extends Topefekt_Magesms_Controller_Action { public function indexAction() { $this->_initAction(); $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock( 'Topefekt_Magesms_Block_Template', 'my_block_name_here', array('template' => 'topefekt/magesms/history.phtml') ); $this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); $this->renderLayout(); return $this; } public function filterAction() { $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a = $this->getRequest()->getParams(); unset($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a['form_key']); $this->_redirect('*/*/', $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a); } protected function _initAction() { parent::_initAction(); $this->_setActiveMenu('magesms/history') ->_title(Mage::helper('magesms')->__('SMS History')) ; return $this; } }
app/code/community/Topefekt/Magesms/controllers/Adminhtml/Magesms/MarketingController.php CHANGED
@@ -13,4 +13,24 @@
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
- class Topefekt_Magesms_Adminhtml_Magesms_MarketingController extends Mage_Adminhtml_Controller_Action { public $profile; protected $_filterData; protected function _construct() { $this->profile = Mage::getSingleton('magesms/smsprofile'); } public function preDispatch() { parent::preDispatch(); if (!$this->profile->user->getUser()) { $this->setFlag('', self::FLAG_NO_DISPATCH, true); if (!empty($this->profile->_error)) { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('magesms')->__($this->profile->_error)); } else { Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magesms')->__('Not registered yet? Create account now!')); } $this->_redirect('*/magesms_profile'); } else { $i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa = Mage::helper('adminhtml')->prepareFilterString($this->getRequest()->getParam('filter')); $i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa = $this->_filterDates($i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa, array('reg_from', 'reg_to', 'birth_from', 'birth_to')); $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a = new Varien_Object(); foreach ($i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa as $i670253c23c6fcba76bc4256a88fdd8fbc1041039 => $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89) { if (!empty($if2eee0665f163a28f4adcfe84e3fc666bf1bcd89) || is_numeric($if2eee0665f163a28f4adcfe84e3fc666bf1bcd89)) { $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a->setData($i670253c23c6fcba76bc4256a88fdd8fbc1041039, $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89); } } $this->_filterData = $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a; $ia309f32db02d9de4490b0dcce975d0ccbce2c215 = Mage::helper('adminhtml')->prepareFilterString($this->getRequest()->getParam('sms')); $ia309f32db02d9de4490b0dcce975d0ccbce2c215 = $this->_filterDates($ia309f32db02d9de4490b0dcce975d0ccbce2c215, array('datumodesl')); $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a = new Varien_Object(); foreach ($ia309f32db02d9de4490b0dcce975d0ccbce2c215 as $i670253c23c6fcba76bc4256a88fdd8fbc1041039 => $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89) { if (!empty($if2eee0665f163a28f4adcfe84e3fc666bf1bcd89) || is_numeric($if2eee0665f163a28f4adcfe84e3fc666bf1bcd89)) { $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a->setData($i670253c23c6fcba76bc4256a88fdd8fbc1041039, $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89); } } $this->_smsData = $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a; } return $this; } public function indexAction() { $this->_initAction(); $iff7e46827cbb6547116c592bf800f4687428abf9 = $this->_getCollection(); Mage::register('magesms_marketing_collection', $iff7e46827cbb6547116c592bf800f4687428abf9); $i5509ac707290a86add15ab0ce4da982d395f4c4f = $this->getLayout()->createBlock( 'Topefekt_Magesms_Block_Template', 'my_block_name_here', array('template' => 'topefekt/magesms/marketing.phtml') ); $i5509ac707290a86add15ab0ce4da982d395f4c4f->setSmsData($this->_smsData ? $this->_smsData : $this->getRequest()->getParams()); $i5509ac707290a86add15ab0ce4da982d395f4c4f->setFilterData($this->_filterData); $this->getLayout()->getBlock('content')->append($i5509ac707290a86add15ab0ce4da982d395f4c4f); $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a = $this->getLayout()->createBlock('magesms/marketing_form'); $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->setFilterData($this->_filterData); $this->getLayout()->getBlock('content')->append($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a); $i42cf41da37138d64d37b0778e6561aab5e1239d6 = $this->getLayout()->createBlock('magesms/marketing'); $i42cf41da37138d64d37b0778e6561aab5e1239d6->setFilterData($this->_filterData); $this->getLayout()->getBlock('content')->append($i42cf41da37138d64d37b0778e6561aab5e1239d6); $this->renderLayout(); return $this; } public function sendAction() { if ( $this->getRequest()->getPost() ) { try { $iacbd1c78463510856e506611fe14b5e1173581a6 = Mage::app()->getRequest(); $idfc9fbe8edf868c14fc4a3f15c7f40aabfa080aa = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('text'); $ifc17de93671eea5715520ecfbc4dc543818685b8 = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('unique') ? true : false; $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('unicode') ? true : false; $i2012325f8714e1168a6c4fd06b9fa8eee23fcc7f = Mage::getModel('magesms/sms'); $i2012325f8714e1168a6c4fd06b9fa8eee23fcc7f->setMessage($idfc9fbe8edf868c14fc4a3f15c7f40aabfa080aa) ->setType(Topefekt_Magesms_Model_Sms::TYPE_MARKETING) ->setPriority(false) ->setUnicode($ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd) ->setUnique($ifc17de93671eea5715520ecfbc4dc543818685b8); if ($iacbd1c78463510856e506611fe14b5e1173581a6->getPost('sendlater') && $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('datumodesl')) { $i4c323947385ff52539168f26084feed4bc17e2dc = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('datumodesl'); $i6aa8d50211ad373efab0896425f6f5fa0e013c29 = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('datumodesl_hour'); $if8001c570b9f0e904df8b36797628015beb8fa80 = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('datumodesl_min'); $i836a3cd8c554d1c35cc3c6cf3e3f49052b683096 = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('datereal', 0); $i4c323947385ff52539168f26084feed4bc17e2dc = strtotime("$i4c323947385ff52539168f26084feed4bc17e2dc $i6aa8d50211ad373efab0896425f6f5fa0e013c29:$if8001c570b9f0e904df8b36797628015beb8fa80:00") + 3600*$i836a3cd8c554d1c35cc3c6cf3e3f49052b683096; $i2012325f8714e1168a6c4fd06b9fa8eee23fcc7f->setSendlater($i4c323947385ff52539168f26084feed4bc17e2dc); } foreach($this->_getCollection() as $iff7e46827cbb6547116c592bf800f4687428abf9) { $i2012325f8714e1168a6c4fd06b9fa8eee23fcc7f->addRecipient($iff7e46827cbb6547116c592bf800f4687428abf9->getTelephone(), array( 'country' => $iff7e46827cbb6547116c592bf800f4687428abf9->getCountryId(), 'customerId' => $iff7e46827cbb6547116c592bf800f4687428abf9->getId(), 'recipient' => $iff7e46827cbb6547116c592bf800f4687428abf9->getFirstname().' '.$iff7e46827cbb6547116c592bf800f4687428abf9->getLastname())); } $i2012325f8714e1168a6c4fd06b9fa8eee23fcc7f->send(); $this->_redirectReferer(); } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { Mage::getSingleton('adminhtml/session')->addError($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage()); $this->indexAction(); } } else { $this->_redirect('*/*/index'); } return $this; } protected function _getCollection() { $iff7e46827cbb6547116c592bf800f4687428abf9 = Mage::helper('magesms')->getCustomerCollection(); $i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa = $this->_filterData; if ($i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getGender()) $iff7e46827cbb6547116c592bf800f4687428abf9->addFieldToFilter('gender', $i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getGender()); if ($i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getFirstname()) $iff7e46827cbb6547116c592bf800f4687428abf9->addFieldToFilter('firstname', array('like' => $i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getFirstname().'%')); if ($i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getLastname()) $iff7e46827cbb6547116c592bf800f4687428abf9->addFieldToFilter('lastname', array('like' => $i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getLastname().'%')); if ($i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getWebsiteId()) $iff7e46827cbb6547116c592bf800f4687428abf9->addFieldToFilter('website_id', $i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getWebsiteId()); if (!is_null($i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getGroupId(null))) $iff7e46827cbb6547116c592bf800f4687428abf9->addFieldToFilter('group_id', $i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getGroupId()); if ($i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getType() == 1) $iff7e46827cbb6547116c592bf800f4687428abf9->joinAttribute('billing_vat_id', 'customer_address/vat_id', 'default_billing', null, 'left') ->addFieldToFilter('billing_vat_id', array('notnull' => true)); elseif ($i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getType() == 2) $iff7e46827cbb6547116c592bf800f4687428abf9->joinAttribute('billing_vat_id', 'customer_address/vat_id', 'default_billing', null, 'left') ->addFieldToFilter('billing_vat_id', array('null' => true)); if ($i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getNewsletter()) { $iff7e46827cbb6547116c592bf800f4687428abf9->getSelect() ->joinLeft( array('ns' => $iff7e46827cbb6547116c592bf800f4687428abf9->getTable('newsletter/subscriber')), 'ns.customer_id = e.entity_id' ); if ($i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getNewsletter() == 1) $iff7e46827cbb6547116c592bf800f4687428abf9->getSelect() ->where('ns.`subscriber_status` = 1'); else $iff7e46827cbb6547116c592bf800f4687428abf9->getSelect() ->where('ns.`subscriber_status` = 0 OR ns.`subscriber_status` IS NULL'); } if ($i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getCountryId()) $iff7e46827cbb6547116c592bf800f4687428abf9->addFieldToFilter('billing_country_id', $i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getCountryId()); if ($i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getCity()) $iff7e46827cbb6547116c592bf800f4687428abf9->addFieldToFilter('billing_city', array('like' => '%'.$i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getCity().'%')); if ($i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getRegAllyears()) { if ($i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getRegFrom()) $iff7e46827cbb6547116c592bf800f4687428abf9->getSelect() ->where('DAYOFYEAR(DATE_ADD(created_at, INTERVAL (YEAR(?) - YEAR(created_at)) YEAR)) >= DAYOFYEAR(?)', $i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getRegFrom()); if ($i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getRegTo()) $iff7e46827cbb6547116c592bf800f4687428abf9->getSelect() ->where('DAYOFYEAR(DATE_ADD(created_at, INTERVAL (YEAR(?) - YEAR(created_at)) YEAR)) <= DAYOFYEAR(?)', $i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getRegTo()); } else { if ($i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getRegFrom()) $iff7e46827cbb6547116c592bf800f4687428abf9->addFieldToFilter('created_at', array('from' => $i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getRegFrom().' 00:00:00')); if ($i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getRegTo()) $iff7e46827cbb6547116c592bf800f4687428abf9->addFieldToFilter('created_at', array('to' => $i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getRegTo().' 23:59:59')); } if ($i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getBirthAllyears()) { $iff7e46827cbb6547116c592bf800f4687428abf9->addFieldToFilter('dob', array('notnull' => true)); if ($i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getBirthFrom()) $iff7e46827cbb6547116c592bf800f4687428abf9->getSelect() ->where('DAYOFYEAR(DATE_ADD(at_dob.value, INTERVAL (YEAR(?) - YEAR(at_dob.value)) YEAR)) >= DAYOFYEAR(?)', $i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getBirthFrom()); if ($i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getBirthTo()) $iff7e46827cbb6547116c592bf800f4687428abf9->getSelect() ->where('DAYOFYEAR(DATE_ADD(at_dob.value, INTERVAL (YEAR(?) - YEAR(at_dob.value)) YEAR)) <= DAYOFYEAR(?)', $i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getBirthTo()); } else { if ($i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getBirthFrom()) $iff7e46827cbb6547116c592bf800f4687428abf9->addFieldToFilter('dob', array('from' => $i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getBirthFrom().' 00:00:00')); if ($i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getBirthTo()) $iff7e46827cbb6547116c592bf800f4687428abf9->addFieldToFilter('dob', array('to' => $i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getBirthTo().' 23:59:59')); } if ($i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getCustomerNot()) $iff7e46827cbb6547116c592bf800f4687428abf9->addFieldToFilter('entity_id', array('nin' => explode(',', $i5b3aa260bb208b1f4c5808ffd6ec3b60c98869aa->getCustomerNot()))); return $iff7e46827cbb6547116c592bf800f4687428abf9; } protected function _initAction() { $this->loadLayout() ->_setActiveMenu('magesms/marketing') ->_addBreadcrumb(Mage::helper('magesms')->__('SMS Marketing'), Mage::helper('magesms')->__('SMS Marketing')) ->_title(Mage::helper('magesms')->__('MageSMS')) ->_title(Mage::helper('magesms')->__('SMS Marketing')) ; $this->getLayout()->getBlock('head')->addCss('css/topefekt/magesms/stylesheet.css') ->addJs('topefekt/functions.js'); return $this; } }
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
+ class Topefekt_Magesms_Adminhtml_Magesms_MarketingController extends Topefekt_Magesms_Controller_Template_Action { private $vdc6442a8b0624835ef0da7b7fcc0ac1da4d6d2da = array('type', 'country', 'group', 'gender', 'newsletter', 'website', 'firstname', 'lastname', 'city', 'register', 'birthday', 'birthdayall'); protected $_filters; protected $_collection; public function preDispatch() { parent::preDispatch(); $ia309f32db02d9de4490b0dcce975d0ccbce2c215 = Mage::helper('adminhtml')->prepareFilterString($this->getRequest()->getParam('sms')); $ia309f32db02d9de4490b0dcce975d0ccbce2c215 = $this->_filterDates($ia309f32db02d9de4490b0dcce975d0ccbce2c215, array('datumodesl')); $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a = new Varien_Object(); foreach ($ia309f32db02d9de4490b0dcce975d0ccbce2c215 as $i670253c23c6fcba76bc4256a88fdd8fbc1041039 => $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89) { if (!empty($if2eee0665f163a28f4adcfe84e3fc666bf1bcd89) || is_numeric($if2eee0665f163a28f4adcfe84e3fc666bf1bcd89)) { $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a->setData($i670253c23c6fcba76bc4256a88fdd8fbc1041039, $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89); } } $this->_smsData = $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a; return $this; return $this; } private function f6d43ff809a46f71c1e634564f2b37e20a99bbb9c() { $this->_filters = Mage::getModel('magesms/marketing_filter_collection'); $this->_filters->addFilters($this->vdc6442a8b0624835ef0da7b7fcc0ac1da4d6d2da); Mage::register('magesms_marketing_filters', $this->_filters); $this->_collection = $this->_getCollection(); $this->_filters->setCollection($this->_collection); $this->_filters->setFilters($this->_collection); Mage::register('magesms_marketing_collection', $this->_collection); } public function indexAction() { $this->_initAction(); $this->f6d43ff809a46f71c1e634564f2b37e20a99bbb9c(); $i5509ac707290a86add15ab0ce4da982d395f4c4f = $this->getLayout()->createBlock( 'Topefekt_Magesms_Block_Template', 'my_block_name_here', array('template' => 'topefekt/magesms/marketing.phtml') ); $i5509ac707290a86add15ab0ce4da982d395f4c4f->setSmsData($this->_smsData ? $this->_smsData : $this->getRequest()->getParams()); $i5509ac707290a86add15ab0ce4da982d395f4c4f->setFilterData($this->_filterData); $i7d411c0cc32cdb65ec82b9e8d79aa996946f553842c5963b49dec2d3a886ec5045e3b8e035c239f = '{customer_firstname}, {customer_lastname}, {customer_email}, {customer_phone}, {shop_name}, {shop_domain}, {shop_email}, {shop_phone}'; $i5509ac707290a86add15ab0ce4da982d395f4c4f->setNotice($i7d411c0cc32cdb65ec82b9e8d79aa996946f553842c5963b49dec2d3a886ec5045e3b8e035c239f); $i5509ac707290a86add15ab0ce4da982d395f4c4f->setTranslate(Mage::helper('magesms')->hookVariablesJS($i7d411c0cc32cdb65ec82b9e8d79aa996946f553842c5963b49dec2d3a886ec5045e3b8e035c239f)); $i5509ac707290a86add15ab0ce4da982d395f4c4f->setCollection($this->_collection); $this->getLayout()->getBlock('content')->append($i5509ac707290a86add15ab0ce4da982d395f4c4f); $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a = $this->getLayout()->createBlock('magesms/marketing_form'); $this->getLayout()->getBlock('content')->append($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a); $i21e55df616c305955791876c1eb4da83448beba2 = $this->_getBlockCustomer(); $this->getLayout()->getBlock('content')->append($i21e55df616c305955791876c1eb4da83448beba2); $i2ca8461421e371a2dc8ff5b5c9a248f5fb0a6dbc = $this->_getBlockDeleted(); $this->getLayout()->getBlock('content')->append($i2ca8461421e371a2dc8ff5b5c9a248f5fb0a6dbc); $this->renderLayout(); return $this; } public function filterAction() { $ia1a238c1f12f3901520c7ca55efa646e471f7f6e = new Varien_Object(); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setError(false); if ($this->getRequest()->getParams()) { $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setType('marketing'); $i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2 = $this->getRequest(); if ($i1507c94b68f51b22087227858337782550edf618 = $i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2->getParam('action')) { try { switch ($i1507c94b68f51b22087227858337782550edf618) { case 'save': $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setHtml($this->_popup()); break; case 'load': $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setHtml($this->_popup(false)); break; case 'saveFilter': if ($this->getRequest()->isPost()) { $this->f6d43ff809a46f71c1e634564f2b37e20a99bbb9c(); $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a = Mage::getModel('magesms/marketing_filter'); $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->setData(array( 'name' => $i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2->getParam('saveName'), 'filter' => $this->_filters->toSerialize(), 'date' => date('Y-m-d H:i:s'), )); $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->save(); } break; case 'remove': if ($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538 = $i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2->getParam('id')) { $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a = Mage::getModel('magesms/marketing_filter'); $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->load($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538); $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->delete(); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setHtml($this->_popup(false)); } break; case 'restore': if ($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538 = $i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2->getParam('id')) { $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a = Mage::getModel('magesms/marketing_filter'); if ($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->load($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538)) { $i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2 = Mage::getModel('magesms/marketing_filter_collection'); $i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2->fromSerialize($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->getFilter()); $this->f6d43ff809a46f71c1e634564f2b37e20a99bbb9c(); $i21e55df616c305955791876c1eb4da83448beba2 = $this->_getBlockCustomer(); $i9e86252a333eb6c832bb895a8d1690c48b2ed3fd = $this->_getBlockDeleted(); $i1791b2d1f89bb2bd83b34046f59125af207713db = $this->getLayout()->createBlock('magesms/marketing_form'); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setHtml( array( 'appliedFilters' => $i1791b2d1f89bb2bd83b34046f59125af207713db->getHtmlFilters(), 'customers' => $i21e55df616c305955791876c1eb4da83448beba2->toHtml(), 'deleted' => $i9e86252a333eb6c832bb895a8d1690c48b2ed3fd->toHtml(), 'count' => $this->_collection->count() )); } } break; case 'loadFilter': if ($i2bd9743336318d0e14be0600c9129730279505dd = $i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2->getParam('name')) { if ($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a = Mage::getModel('magesms/marketing_filter_'.$i2bd9743336318d0e14be0600c9129730279505dd)) { $i1791b2d1f89bb2bd83b34046f59125af207713db = new Varien_Data_Form(); switch ($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->filter['type']) { case 'select': $i1791b2d1f89bb2bd83b34046f59125af207713db->addField('filter', 'select', array( 'name' => 'filter', 'values' => $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a->getValues(), )); break; case 'input': $i1791b2d1f89bb2bd83b34046f59125af207713db->addField('filter', 'text', array( 'name' => 'filter', )); break; case 'datetime': $i8114d84b871449f246242a4433e364f848daff0c = array(); $i03474abc9cad4f5c29a2f0bca70a29051a128bc9 = 'Calendar.setup({
17
+ inputField: "%s",
18
+ ifFormat: "%s",
19
+ showsTime: true,
20
+ button: "%s_trig",
21
+ align: "Bl",
22
+ singleClick : true
23
+ });'; $i5e2f8ae4963934ca8fbc2fff6103b6356dd52c78 = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM); $i376a6873d4104d44a8d8f0acacfc41b40105e11f = Varien_Date::convertZendToStrFtime($i5e2f8ae4963934ca8fbc2fff6103b6356dd52c78, true, true); $i1791b2d1f89bb2bd83b34046f59125af207713db->addField('filter1', 'date', array( 'name' => 'filter[]', 'format' => $i5e2f8ae4963934ca8fbc2fff6103b6356dd52c78, 'value' => Mage::app()->getLocale()->date()->toString(), 'image' => Mage::getDesign()->getSkinUrl('images/grid-cal.gif'), )); $i1791b2d1f89bb2bd83b34046f59125af207713db->addField('note', 'note', array( 'text' => Mage::helper('magesms')->__('to: '), )); $i1791b2d1f89bb2bd83b34046f59125af207713db->addField('filter2', 'date', array( 'name' => 'filter[]', 'format' => $i5e2f8ae4963934ca8fbc2fff6103b6356dd52c78, 'value' => Mage::app()->getLocale()->date()->toString(), 'image' => Mage::getDesign()->getSkinUrl('images/grid-cal.gif'), )); $i8114d84b871449f246242a4433e364f848daff0c[] = sprintf($i03474abc9cad4f5c29a2f0bca70a29051a128bc9, 'filter1', $i376a6873d4104d44a8d8f0acacfc41b40105e11f, 'filter1'); $i8114d84b871449f246242a4433e364f848daff0c[] = sprintf($i03474abc9cad4f5c29a2f0bca70a29051a128bc9, 'filter2', $i376a6873d4104d44a8d8f0acacfc41b40105e11f, 'filter2'); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setJs($i8114d84b871449f246242a4433e364f848daff0c); break; case 'date': $i8114d84b871449f246242a4433e364f848daff0c = array(); $i03474abc9cad4f5c29a2f0bca70a29051a128bc9 = 'Calendar.setup({
24
+ inputField: "%s",
25
+ ifFormat: "%s",
26
+ showsTime: false,
27
+ button: "%s_trig",
28
+ align: "Bl",
29
+ singleClick : true
30
+ });'; $i5e2f8ae4963934ca8fbc2fff6103b6356dd52c78 = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM); $i376a6873d4104d44a8d8f0acacfc41b40105e11f = Varien_Date::convertZendToStrFtime($i5e2f8ae4963934ca8fbc2fff6103b6356dd52c78, true, true); $i1791b2d1f89bb2bd83b34046f59125af207713db->addField('filter1', 'date', array( 'name' => 'filter[]', 'format' => $i5e2f8ae4963934ca8fbc2fff6103b6356dd52c78, 'value' => Mage::app()->getLocale()->date()->toString(), 'image' => Mage::getDesign()->getSkinUrl('images/grid-cal.gif'), )); $i1791b2d1f89bb2bd83b34046f59125af207713db->addField('note', 'note', array( 'text' => Mage::helper('magesms')->__('to: '), )); $i1791b2d1f89bb2bd83b34046f59125af207713db->addField('filter2', 'date', array( 'name' => 'filter[]', 'format' => $i5e2f8ae4963934ca8fbc2fff6103b6356dd52c78, 'value' => Mage::app()->getLocale()->date()->toString(), 'image' => Mage::getDesign()->getSkinUrl('images/grid-cal.gif'), )); $i8114d84b871449f246242a4433e364f848daff0c[] = sprintf($i03474abc9cad4f5c29a2f0bca70a29051a128bc9, 'filter1', $i376a6873d4104d44a8d8f0acacfc41b40105e11f, 'filter1'); $i8114d84b871449f246242a4433e364f848daff0c[] = sprintf($i03474abc9cad4f5c29a2f0bca70a29051a128bc9, 'filter2', $i376a6873d4104d44a8d8f0acacfc41b40105e11f, 'filter2'); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setJs($i8114d84b871449f246242a4433e364f848daff0c); break; case 'birthdayall': $i1791b2d1f89bb2bd83b34046f59125af207713db->addField('note1', 'note', array( 'text' => Mage::helper('magesms')->__('day').': ', )); $i1791b2d1f89bb2bd83b34046f59125af207713db->addField('filter1', 'select', array( 'name' => 'filter[]', 'values' => array_combine(range(1, 31), range(1, 31)), )); $i1791b2d1f89bb2bd83b34046f59125af207713db->addField('note2', 'note', array( 'text' => Mage::helper('magesms')->__('month').': ', )); $i1791b2d1f89bb2bd83b34046f59125af207713db->addField('filter2', 'select', array( 'name' => 'filter[]', 'values' => array_combine(range(1, 12), range(1, 12)), )); break; } $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setHtml($i1791b2d1f89bb2bd83b34046f59125af207713db->getHtml()); } } break; case 'applyFilter': $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89 = $i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2->getParam('value'); if (is_array($if2eee0665f163a28f4adcfe84e3fc666bf1bcd89) && count($if2eee0665f163a28f4adcfe84e3fc666bf1bcd89) == 1) $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89 = $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89[0]; if (($i2bd9743336318d0e14be0600c9129730279505dd = $i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2->getParam('name')) && $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89 !== '') { $i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2 = Mage::getModel('magesms/marketing_filter_collection'); $i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2->addApplyFilter($i2bd9743336318d0e14be0600c9129730279505dd, $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89); $this->f6d43ff809a46f71c1e634564f2b37e20a99bbb9c(); $i21e55df616c305955791876c1eb4da83448beba2 = $this->_getBlockCustomer(); $i1791b2d1f89bb2bd83b34046f59125af207713db = $this->getLayout()->createBlock('magesms/marketing_form'); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setHtml( array( 'appliedFilters' => $i1791b2d1f89bb2bd83b34046f59125af207713db->getHtmlFilters(), 'customers' => $i21e55df616c305955791876c1eb4da83448beba2->toHtml(), 'count' => $this->_collection->count() )); } break; case 'removeFilter': $i7d411c0cc32cdb65ec82b9e8d79aa996946f5538 = $i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2->getParam('id'); if (is_numeric($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538)) { $i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2 = Mage::getModel('magesms/marketing_filter_collection'); $i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2->removeFilter($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538); $this->f6d43ff809a46f71c1e634564f2b37e20a99bbb9c(); $i21e55df616c305955791876c1eb4da83448beba2 = $this->_getBlockCustomer(); $i9e86252a333eb6c832bb895a8d1690c48b2ed3fd = $this->_getBlockDeleted(); $i1791b2d1f89bb2bd83b34046f59125af207713db = $this->getLayout()->createBlock('magesms/marketing_form'); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setHtml( array( 'appliedFilters' => $i1791b2d1f89bb2bd83b34046f59125af207713db->getHtmlFilters(), 'customers' => $i21e55df616c305955791876c1eb4da83448beba2->toHtml(), 'deleted' => $i9e86252a333eb6c832bb895a8d1690c48b2ed3fd->toHtml(), 'count' => $this->_collection->count() )); } break; case 'listCustomers': if ($i47b2a41e4081b6f8d8381f411087dcd7042bfb53 = $i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2->getParam('letter')) { $i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2 = Mage::getModel('magesms/marketing_filter_collection'); $this->f6d43ff809a46f71c1e634564f2b37e20a99bbb9c(); $this->_collection->addFieldToFilter('lastname', array('like' => $i47b2a41e4081b6f8d8381f411087dcd7042bfb53.'%')); $i21e55df616c305955791876c1eb4da83448beba2 = $this->getBlockCustomer(); $i21e55df616c305955791876c1eb4da83448beba2->setCollection($this->_collection); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setHtml($i21e55df616c305955791876c1eb4da83448beba2->toHtml()); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setType('customer'); } break; case 'removeCustomer': if ($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538 = $i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2->getParam('id')) { $i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2 = Mage::getModel('magesms/marketing_filter_collection'); $i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2->addRemoveCustomer($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538); $this->f6d43ff809a46f71c1e634564f2b37e20a99bbb9c(); $ib1285cda66d7403b4e0132565b5359295c62d58c = clone $this->_collection; $i21e55df616c305955791876c1eb4da83448beba2 = $this->_getBlockCustomer(); $i9e86252a333eb6c832bb895a8d1690c48b2ed3fd = $this->_getBlockDeleted(); $id82aaf2f437652c4b6efbd55703199f614e8e516 = array( 'customers' => $i21e55df616c305955791876c1eb4da83448beba2->toHtml(), 'deleted' => $i9e86252a333eb6c832bb895a8d1690c48b2ed3fd->toHtml(), 'count' => $this->_collection->count() ); if ($i47b2a41e4081b6f8d8381f411087dcd7042bfb53 = $i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2->getParam('letter')) { $ib1285cda66d7403b4e0132565b5359295c62d58c->addFieldToFilter('lastname', array('like' => $i47b2a41e4081b6f8d8381f411087dcd7042bfb53.'%')); $i2ca8461421e371a2dc8ff5b5c9a248f5fb0a6dbc = $this->getBlockCustomer(); $i2ca8461421e371a2dc8ff5b5c9a248f5fb0a6dbc->setCollection($ib1285cda66d7403b4e0132565b5359295c62d58c); $id82aaf2f437652c4b6efbd55703199f614e8e516['customer_letter'] = $i2ca8461421e371a2dc8ff5b5c9a248f5fb0a6dbc->toHtml(); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setType('customer'); } $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setHtml($id82aaf2f437652c4b6efbd55703199f614e8e516); } break; case 'reset': $i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2 = Mage::getModel('magesms/marketing_filter_collection'); $i2d8fb6b6f17ec9aa17899ea311cc26bc493cd9a2->resetFilter(); $this->f6d43ff809a46f71c1e634564f2b37e20a99bbb9c(); $i21e55df616c305955791876c1eb4da83448beba2 = $this->_getBlockCustomer(); $i9e86252a333eb6c832bb895a8d1690c48b2ed3fd = $this->_getBlockDeleted(); $i1791b2d1f89bb2bd83b34046f59125af207713db = $this->getLayout()->createBlock('magesms/marketing_form'); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setHtml( array( 'appliedFilters' => $i1791b2d1f89bb2bd83b34046f59125af207713db->getHtmlFilters(), 'customers' => $i21e55df616c305955791876c1eb4da83448beba2->toHtml(), 'deleted' => $i9e86252a333eb6c832bb895a8d1690c48b2ed3fd->toHtml(), 'count' => $this->_collection->count() )); break; } } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { Mage::getSingleton('adminhtml/session')->addError($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage()); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setError(true); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setMessage($this->getLayout()->getMessagesBlock()->getGroupedHtml()); } } } $this->getResponse()->setBody($ia1a238c1f12f3901520c7ca55efa646e471f7f6e->toJson()); } protected function _popup($iacea0d13bc5e2676192c06d68cb091dc0ce26320 = true) { $id82aaf2f437652c4b6efbd55703199f614e8e516 = ''; if ($iacea0d13bc5e2676192c06d68cb091dc0ce26320) { $i1791b2d1f89bb2bd83b34046f59125af207713db = $this->getLayout()->createBlock( 'Topefekt_Magesms_Block_Template', 'magesms_marketing_templateform', array('template' => 'topefekt/magesms/marketing/form.phtml') ); $id82aaf2f437652c4b6efbd55703199f614e8e516 = $i1791b2d1f89bb2bd83b34046f59125af207713db->toHtml(); } $i42cf41da37138d64d37b0778e6561aab5e1239d6 = $this->getLayout()->createBlock('magesms/marketing_template'); return $id82aaf2f437652c4b6efbd55703199f614e8e516.$i42cf41da37138d64d37b0778e6561aab5e1239d6->toHtml(); } public function sendAction() { if ( $this->getRequest()->getPost() ) { try { $iacbd1c78463510856e506611fe14b5e1173581a6 = Mage::app()->getRequest(); $i7d411c0cc32cdb65ec82b9e8d79aa996946f5538fc9fbe8edf868c14fc4a3f15c7f40aabfa080aa = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('text'); $ifc17de93671eea5715520ecfbc4dc543818685b8 = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('unique') ? true : false; $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('unicode') ? true : false; $i2012325f8714e1168a6c4fd06b9fa8eee23fcc7f = Mage::getModel('magesms/sms'); $i2012325f8714e1168a6c4fd06b9fa8eee23fcc7f->setMessage($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538fc9fbe8edf868c14fc4a3f15c7f40aabfa080aa) ->setType(Topefekt_Magesms_Model_Sms::TYPE_MARKETING) ->setPriority(false) ->setUnicode($ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd) ->setUnique($ifc17de93671eea5715520ecfbc4dc543818685b8); if ($iacbd1c78463510856e506611fe14b5e1173581a6->getPost('sendlater') && $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('datumodesl')) { $i4c323947385ff52539168f26084feed4bc17e2dc = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('datumodesl'); $i6aa8d50211ad373efab0896425f6f5fa0e013c29 = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('datumodesl_hour'); $if8001c570b9f0e904df8b36797628015beb8fa80 = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('datumodesl_min'); $i836a3cd8c554d1c35cc3c6cf3e3f49052b683096 = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('datereal', 0); $i4c323947385ff52539168f26084feed4bc17e2dc = strtotime("$i4c323947385ff52539168f26084feed4bc17e2dc $i6aa8d50211ad373efab0896425f6f5fa0e013c29:$if8001c570b9f0e904df8b36797628015beb8fa80:00") + 3600*$i836a3cd8c554d1c35cc3c6cf3e3f49052b683096; $i2012325f8714e1168a6c4fd06b9fa8eee23fcc7f->setSendlater($i4c323947385ff52539168f26084feed4bc17e2dc); } $this->f6d43ff809a46f71c1e634564f2b37e20a99bbb9c(); foreach($this->_collection as $iff7e46827cbb6547116c592bf800f4687428abf9) { $i9fdb3b1e2e6984ebdd1220ec199279013c5483fc = Mage::getModel('core/website')->load($iff7e46827cbb6547116c592bf800f4687428abf9->getWebsiteId()); $i2012325f8714e1168a6c4fd06b9fa8eee23fcc7f->addRecipient($iff7e46827cbb6547116c592bf800f4687428abf9->getTelephone(), array( 'country' => $iff7e46827cbb6547116c592bf800f4687428abf9->getCountryId(), 'customerId' => $iff7e46827cbb6547116c592bf800f4687428abf9->getId(), 'recipient' => $iff7e46827cbb6547116c592bf800f4687428abf9->getFirstname().' '.$iff7e46827cbb6547116c592bf800f4687428abf9->getLastname(), 'text' => $this->_prepareText($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538fc9fbe8edf868c14fc4a3f15c7f40aabfa080aa, $i9fdb3b1e2e6984ebdd1220ec199279013c5483fc->getDefaultStore()->getId(), $iff7e46827cbb6547116c592bf800f4687428abf9), ) ); } $i2012325f8714e1168a6c4fd06b9fa8eee23fcc7f->send(); $this->_redirectReferer(); } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { Mage::getSingleton('adminhtml/session')->addError($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage()); $this->indexAction(); } } else { $this->_redirect('*/*/index'); } return $this; } protected function _getBlockCustomer() { $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock('magesms/marketing_customer'); $i8ee45e0018a32fb1a855b82624506e35789cc4d2->setCollection($this->_collection); $i8ee45e0018a32fb1a855b82624506e35789cc4d2->setTitle(Mage::helper('magesms')->__('Customers found: ')); $i8ee45e0018a32fb1a855b82624506e35789cc4d2->setId('customer'); return $i8ee45e0018a32fb1a855b82624506e35789cc4d2; } protected function _getBlockDeleted() { $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock('magesms/marketing_customer'); $i8ee45e0018a32fb1a855b82624506e35789cc4d2->setDeleteCustomer(true); $i8ee45e0018a32fb1a855b82624506e35789cc4d2->setTitle(Mage::helper('magesms')->__('Removed Customers: ')); $i8ee45e0018a32fb1a855b82624506e35789cc4d2->setId('deleted'); $iff7e46827cbb6547116c592bf800f4687428abf9 = Mage::helper('magesms')->getCustomerCollection(); $iff7e46827cbb6547116c592bf800f4687428abf9->addFieldToFilter('entity_id', array('in' => $this->_filters->getCache()->getCustomers()->getIds())); foreach($iff7e46827cbb6547116c592bf800f4687428abf9 as $i705fa7c9639d497e1179d7d5691c212668a8c9c8) { $i705fa7c9639d497e1179d7d5691c212668a8c9c8->setDetailUrl(Mage::helper("adminhtml")->getUrl('adminhtml/customer/edit', array('id' => $i705fa7c9639d497e1179d7d5691c212668a8c9c8->getId()))); $i705fa7c9639d497e1179d7d5691c212668a8c9c8->setRemoveUrl($this->getUrl('*/*/filter', array('action' => 'removeCustomer', 'id' => $i705fa7c9639d497e1179d7d5691c212668a8c9c8->getId()))); } $i8ee45e0018a32fb1a855b82624506e35789cc4d2->setCollection($iff7e46827cbb6547116c592bf800f4687428abf9); return $i8ee45e0018a32fb1a855b82624506e35789cc4d2; } protected function _getCollection() { $iff7e46827cbb6547116c592bf800f4687428abf9 = Mage::helper('magesms')->getCustomerCollection(); return $iff7e46827cbb6547116c592bf800f4687428abf9; } protected function _initAction() { parent::_initAction(); $this->_setActiveMenu('magesms/marketing') ->_title(Mage::helper('magesms')->__('SMS Marketing')) ; $i3358fd35282548f1f8ccafbf23d60a4ade466fd3 = '
31
+ Translator.add("Filter has been applied.", "'.$this->__('Filter has been applied.').'");
32
+ Translator.add("Filter has been saved.", "'.$this->__('Filter has been saved.').'");
33
+ Translator.add("Are you sure you want to reset the filter?", "'.$this->__('Are you sure you want to reset the filter?').'");
34
+ Translator.add("Are you sure you want to remove the filter?", "'.$this->__('Are you sure you want to remove the filter?').'");
35
+ Translator.add("Filter has been reset.", "'.$this->__('Filter has been reset.').'");
36
+ '; $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock('core/text', 'marketing') ->setText(Mage::helper('adminhtml/media_js')->getScript($i3358fd35282548f1f8ccafbf23d60a4ade466fd3)); $this->_addContent($i8ee45e0018a32fb1a855b82624506e35789cc4d2); return $this; } }
app/code/community/Topefekt/Magesms/controllers/Adminhtml/Magesms/OptoutController.php CHANGED
@@ -13,4 +13,4 @@
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
- class Topefekt_Magesms_Adminhtml_Magesms_OptoutController extends Mage_Adminhtml_Controller_Action { public $profile; protected function _construct() { parent::_construct(); $this->profile = Mage::getSingleton('magesms/smsprofile'); } public function preDispatch() { parent::preDispatch(); if (!$this->profile->user->getUser()) { $this->setFlag('', self::FLAG_NO_DISPATCH, true); if (!empty($this->profile->_error)) { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('magesms')->__($this->profile->_error)); } else { Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magesms')->__('Not registered yet? Create account now!')); } $this->_redirect('*/magesms_profile'); } return $this; } public function indexAction() { $this->_initAction(); $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock( 'Topefekt_Magesms_Block_Template', 'my_block_name_here2', array('template' => 'topefekt/magesms/optout.phtml') ); $this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); $this->renderLayout(); return $this; } public function saveAction() { $ic010a5d08128ec6abcd0a1a16cb1d8abe7bf2142 = Mage::getConfig()->getNode('default/config/optout')->sku; if ( $this->getRequest()->getPost() ) { $iacbd1c78463510856e506611fe14b5e1173581a6 = Mage::app()->getRequest(); Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); $i69a1201e93806d55c970dfb18feec53d221ba37b = Mage::getModel('catalog/product')->loadByAttribute('sku', $ic010a5d08128ec6abcd0a1a16cb1d8abe7bf2142); if (!$i69a1201e93806d55c970dfb18feec53d221ba37b) { $i69a1201e93806d55c970dfb18feec53d221ba37b = Mage::getModel('catalog/product') ->setStoreId(0); $i777846b49037125c3bf5873d46a33ab5976c5a42 = Mage::getModel('catalog/product')->getResource()->getEntityType()->getDefaultAttributeSetId(); $i69a1201e93806d55c970dfb18feec53d221ba37b->setAttributeSetId($i777846b49037125c3bf5873d46a33ab5976c5a42); $i69a1201e93806d55c970dfb18feec53d221ba37b->setTypeId(Mage_Catalog_Model_Product_Type::TYPE_VIRTUAL); $i69a1201e93806d55c970dfb18feec53d221ba37b->setData('_edit_mode', true); $i69a1201e93806d55c970dfb18feec53d221ba37b->setSku($ic010a5d08128ec6abcd0a1a16cb1d8abe7bf2142); $i69a1201e93806d55c970dfb18feec53d221ba37b->setStatus(Mage_Catalog_Model_Product_Status::STATUS_ENABLED); $i69a1201e93806d55c970dfb18feec53d221ba37b->setTaxClassId(0); $i69a1201e93806d55c970dfb18feec53d221ba37b->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE); $i69a1201e93806d55c970dfb18feec53d221ba37b->setStockData(array( 'use_config_manage_stock' => 0, 'manage_stock' => 0, 'use_config_min_sale_qty' => 0, 'min_sale_qty' => 0, 'use_config_max_sale_qty' => 0, 'max_sale_qty' => 1, )); $if71cbed623a99cd5a1032d4d3388bfd486053db2 = array(); foreach (Mage::app()->getWebsites() as $i9fdb3b1e2e6984ebdd1220ec199279013c5483fc) { $if71cbed623a99cd5a1032d4d3388bfd486053db2[] = $i9fdb3b1e2e6984ebdd1220ec199279013c5483fc->getId(); } $i69a1201e93806d55c970dfb18feec53d221ba37b->setWebsiteIds($if71cbed623a99cd5a1032d4d3388bfd486053db2); $i69a1201e93806d55c970dfb18feec53d221ba37b->setCreatedAt(strtotime('now')); $i69a1201e93806d55c970dfb18feec53d221ba37b->setDescription($iacbd1c78463510856e506611fe14b5e1173581a6->getPost('name')); $i69a1201e93806d55c970dfb18feec53d221ba37b->setShortDescription($iacbd1c78463510856e506611fe14b5e1173581a6->getPost('name')); $i2bd9743336318d0e14be0600c9129730279505dd = array_values($iacbd1c78463510856e506611fe14b5e1173581a6->getPost('name')); $i69a1201e93806d55c970dfb18feec53d221ba37b->setName($i2bd9743336318d0e14be0600c9129730279505dd[0]); $i69a1201e93806d55c970dfb18feec53d221ba37b->setPrice(0); $ia021b43e6045d8140052e6c3c684787a27e4bbe5 = Mage::getBaseDir('media'); if (file_exists($ia021b43e6045d8140052e6c3c684787a27e4bbe5.'/magesms/sms.png')) { $i1babd2991da6b9dfe1f546b773f6f35cec746fff = array ('thumbnail', 'small_image', 'image'); $i69a1201e93806d55c970dfb18feec53d221ba37b->addImageToMediaGallery($ia021b43e6045d8140052e6c3c684787a27e4bbe5.'/magesms/sms.png', $i1babd2991da6b9dfe1f546b773f6f35cec746fff, false, false); } $i69a1201e93806d55c970dfb18feec53d221ba37b->save(); Mage::getModel('catalogrule/rule')->applyAllRulesToProduct($i69a1201e93806d55c970dfb18feec53d221ba37b->getId()); foreach(Mage::app()->getStores(false) as $i7079b107a03c03d74ad14b853dad74b85b2d25d1) { Mage::getModel('catalog/product_status')->updateProductStatus($i69a1201e93806d55c970dfb18feec53d221ba37b->getId(), $i7079b107a03c03d74ad14b853dad74b85b2d25d1->getId(), Mage_Catalog_Model_Product_Status::STATUS_DISABLED); } } else { } $i8171218dd25ff7f2de2e1c0d8733bda70b607d79 = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('website', 0); $i712821c3a64ae4a252ded9f3deaaddb6e942d985 = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('status', 0) ? Mage_Catalog_Model_Product_Status::STATUS_ENABLED : Mage_Catalog_Model_Product_Status::STATUS_DISABLED; $ie7d1f3c0ab09749c63a4d4213221b59ce80ea45c = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('name', array()); foreach(Mage::app()->getWebsite($i8171218dd25ff7f2de2e1c0d8733bda70b607d79)->getStoreIds() as $i3bf172bc34c83f4a18624b192bc0bd7c4d647a66) { Mage::getModel('catalog/product_status')->updateProductStatus($i69a1201e93806d55c970dfb18feec53d221ba37b->getId(), $i3bf172bc34c83f4a18624b192bc0bd7c4d647a66, $i712821c3a64ae4a252ded9f3deaaddb6e942d985); $i69a1201e93806d55c970dfb18feec53d221ba37b->load($i69a1201e93806d55c970dfb18feec53d221ba37b->getId()); $i69a1201e93806d55c970dfb18feec53d221ba37b->setStoreId($i3bf172bc34c83f4a18624b192bc0bd7c4d647a66); $i69a1201e93806d55c970dfb18feec53d221ba37b->setPrice($iacbd1c78463510856e506611fe14b5e1173581a6->getPost('price')); if (isset($ie7d1f3c0ab09749c63a4d4213221b59ce80ea45c[$i3bf172bc34c83f4a18624b192bc0bd7c4d647a66])) $i69a1201e93806d55c970dfb18feec53d221ba37b->setName($ie7d1f3c0ab09749c63a4d4213221b59ce80ea45c[$i3bf172bc34c83f4a18624b192bc0bd7c4d647a66]); $i69a1201e93806d55c970dfb18feec53d221ba37b->save(); } Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magesms')->__('Setting of the SMS opt-out feature was successfully changed')); } $this->_redirect('*/*/index', array('_fragment' => $i8171218dd25ff7f2de2e1c0d8733bda70b607d79)); } protected function _initAction() { $this->loadLayout() ->_setActiveMenu('magesms/purchasecredit') ->_addBreadcrumb(Mage::helper('magesms')->__('SMS opt-out'), Mage::helper('magesms')->__('SMS opt-out')) ->_title(Mage::helper('magesms')->__('MageSMS')) ->_title(Mage::helper('magesms')->__('SMS opt-out')); ; $this->getLayout()->getBlock('head')->addCss('css/topefekt/magesms/stylesheet.css') ->addJs('topefekt/functions.js'); return $this; } }
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
+ class Topefekt_Magesms_Adminhtml_Magesms_OptoutController extends Topefekt_Magesms_Controller_Action { public function indexAction() { $this->_initAction(); $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock( 'Topefekt_Magesms_Block_Template', 'my_block_name_here2', array('template' => 'topefekt/magesms/optout.phtml') ); $this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); $this->renderLayout(); return $this; } public function saveAction() { $ic010a5d08128ec6abcd0a1a16cb1d8abe7bf2142 = Mage::getConfig()->getNode('default/config/optout')->sku; if ( $this->getRequest()->getPost() ) { $iacbd1c78463510856e506611fe14b5e1173581a6 = Mage::app()->getRequest(); Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); $i69a1201e93806d55c970dfb18feec53d221ba37b = Mage::getModel('catalog/product')->loadByAttribute('sku', $ic010a5d08128ec6abcd0a1a16cb1d8abe7bf2142); if (!$i69a1201e93806d55c970dfb18feec53d221ba37b) { $i69a1201e93806d55c970dfb18feec53d221ba37b = Mage::getModel('catalog/product') ->setStoreId(0); $i777846b49037125c3bf5873d46a33ab5976c5a42 = Mage::getModel('catalog/product')->getResource()->getEntityType()->getDefaultAttributeSetId(); $i69a1201e93806d55c970dfb18feec53d221ba37b->setAttributeSetId($i777846b49037125c3bf5873d46a33ab5976c5a42); $i69a1201e93806d55c970dfb18feec53d221ba37b->setTypeId(Mage_Catalog_Model_Product_Type::TYPE_VIRTUAL); $i69a1201e93806d55c970dfb18feec53d221ba37b->setData('_edit_mode', true); $i69a1201e93806d55c970dfb18feec53d221ba37b->setSku($ic010a5d08128ec6abcd0a1a16cb1d8abe7bf2142); $i69a1201e93806d55c970dfb18feec53d221ba37b->setStatus(Mage_Catalog_Model_Product_Status::STATUS_ENABLED); $i69a1201e93806d55c970dfb18feec53d221ba37b->setTaxClassId(0); $i69a1201e93806d55c970dfb18feec53d221ba37b->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE); $i69a1201e93806d55c970dfb18feec53d221ba37b->setStockData(array( 'use_config_manage_stock' => 0, 'manage_stock' => 0, 'use_config_min_sale_qty' => 0, 'min_sale_qty' => 0, 'use_config_max_sale_qty' => 0, 'max_sale_qty' => 1, )); $if71cbed623a99cd5a1032d4d3388bfd486053db2 = array(); foreach (Mage::app()->getWebsites() as $i9fdb3b1e2e6984ebdd1220ec199279013c5483fc) { $if71cbed623a99cd5a1032d4d3388bfd486053db2[] = $i9fdb3b1e2e6984ebdd1220ec199279013c5483fc->getId(); } $i69a1201e93806d55c970dfb18feec53d221ba37b->setWebsiteIds($if71cbed623a99cd5a1032d4d3388bfd486053db2); $i69a1201e93806d55c970dfb18feec53d221ba37b->setCreatedAt(strtotime('now')); $i69a1201e93806d55c970dfb18feec53d221ba37b->setDescription($iacbd1c78463510856e506611fe14b5e1173581a6->getPost('name')); $i69a1201e93806d55c970dfb18feec53d221ba37b->setShortDescription($iacbd1c78463510856e506611fe14b5e1173581a6->getPost('name')); $i2bd9743336318d0e14be0600c9129730279505dd = array_values($iacbd1c78463510856e506611fe14b5e1173581a6->getPost('name')); $i69a1201e93806d55c970dfb18feec53d221ba37b->setName($i2bd9743336318d0e14be0600c9129730279505dd[0]); $i69a1201e93806d55c970dfb18feec53d221ba37b->setPrice(0); $ia021b43e6045d8140052e6c3c684787a27e4bbe5 = Mage::getBaseDir('media'); if (file_exists($ia021b43e6045d8140052e6c3c684787a27e4bbe5.'/magesms/sms.png')) { $i1babd2991da6b9dfe1f546b773f6f35cec746fff = array ('thumbnail', 'small_image', 'image'); $i69a1201e93806d55c970dfb18feec53d221ba37b->addImageToMediaGallery($ia021b43e6045d8140052e6c3c684787a27e4bbe5.'/magesms/sms.png', $i1babd2991da6b9dfe1f546b773f6f35cec746fff, false, false); } $i69a1201e93806d55c970dfb18feec53d221ba37b->save(); Mage::getModel('catalogrule/rule')->applyAllRulesToProduct($i69a1201e93806d55c970dfb18feec53d221ba37b->getId()); foreach(Mage::app()->getStores(false) as $i7079b107a03c03d74ad14b853dad74b85b2d25d1) { Mage::getModel('catalog/product_status')->updateProductStatus($i69a1201e93806d55c970dfb18feec53d221ba37b->getId(), $i7079b107a03c03d74ad14b853dad74b85b2d25d1->getId(), Mage_Catalog_Model_Product_Status::STATUS_DISABLED); } } else { } $i8171218dd25ff7f2de2e1c0d8733bda70b607d79 = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('website', 0); $i712821c3a64ae4a252ded9f3deaaddb6e942d985 = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('status', 0) ? Mage_Catalog_Model_Product_Status::STATUS_ENABLED : Mage_Catalog_Model_Product_Status::STATUS_DISABLED; $ie7d1f3c0ab09749c63a4d4213221b59ce80ea45c = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('name', array()); foreach(Mage::app()->getWebsite($i8171218dd25ff7f2de2e1c0d8733bda70b607d79)->getStoreIds() as $i3bf172bc34c83f4a18624b192bc0bd7c4d647a66) { Mage::getModel('catalog/product_status')->updateProductStatus($i69a1201e93806d55c970dfb18feec53d221ba37b->getId(), $i3bf172bc34c83f4a18624b192bc0bd7c4d647a66, $i712821c3a64ae4a252ded9f3deaaddb6e942d985); $i69a1201e93806d55c970dfb18feec53d221ba37b->load($i69a1201e93806d55c970dfb18feec53d221ba37b->getId()); $i69a1201e93806d55c970dfb18feec53d221ba37b->setStoreId($i3bf172bc34c83f4a18624b192bc0bd7c4d647a66); $i69a1201e93806d55c970dfb18feec53d221ba37b->setPrice($iacbd1c78463510856e506611fe14b5e1173581a6->getPost('price')); if (isset($ie7d1f3c0ab09749c63a4d4213221b59ce80ea45c[$i3bf172bc34c83f4a18624b192bc0bd7c4d647a66])) $i69a1201e93806d55c970dfb18feec53d221ba37b->setName($ie7d1f3c0ab09749c63a4d4213221b59ce80ea45c[$i3bf172bc34c83f4a18624b192bc0bd7c4d647a66]); $i69a1201e93806d55c970dfb18feec53d221ba37b->save(); } Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magesms')->__('Setting of the SMS opt-out feature was successfully changed')); } $this->_redirect('*/*/index', array('_fragment' => $i8171218dd25ff7f2de2e1c0d8733bda70b607d79)); } protected function _initAction() { parent::_initAction(); $this->_setActiveMenu('magesms/purchasecredit') ->_title(Mage::helper('magesms')->__('SMS opt-out')); ; return $this; } }
app/code/community/Topefekt/Magesms/controllers/Adminhtml/Magesms/ProfileController.php CHANGED
@@ -13,4 +13,4 @@
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
- class Topefekt_Magesms_Adminhtml_Magesms_ProfileController extends Mage_Adminhtml_Controller_Action { public $profile; protected function _construct() { $this->profile = Mage::getSingleton('magesms/smsprofile'); } public function preDispatch() { return parent::preDispatch(); } public function indexAction() { $this->_initAction(); $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock( 'Topefekt_Magesms_Block_Template', 'my_block_name_here', array('template' => 'topefekt/magesms/profile.phtml') ); $this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); $this->renderLayout(); if ($this->profile->user->user) Mage::getModel('magesms/observer')->cronUpdate(); if (Mage::app()->loadCache('magesms_update_available')) { Mage::getSingleton('adminhtml/session')->addNotice($this->__('New version available for download:').' '.Mage::app()->loadCache('magesms_update_available')); } return $this; } public function loginAction() { $i065df39c07d6c930a4781ba0b0f312703847fa81 = Mage::app()->getRequest()->getParam('username'); $i54d1b2514929b4ead571e37199167cb71517da24 = Mage::app()->getRequest()->getParam('password'); $i451f679eaafeecb81387b150019f0d9e0fa83d16 = Mage::getModel('magesms/api'); $ia61712c27ea241bd7a543dc2b02ea572274d0322 = $i451f679eaafeecb81387b150019f0d9e0fa83d16->serverPost('action=login&username='.urlencode($i065df39c07d6c930a4781ba0b0f312703847fa81).'&password='.urlencode($i54d1b2514929b4ead571e37199167cb71517da24)); if ($ia61712c27ea241bd7a543dc2b02ea572274d0322['errno'] != 1) { Mage::getSingleton('adminhtml/session')->addError($this->__($ia61712c27ea241bd7a543dc2b02ea572274d0322['error'])); } else { $i7d411c0cc32cdb65ec82b9e8d79aa996946f5538d5406ca9a19e1687923f28236de86b1936c5757 = Mage::getModel('magesms/smsuser')->addData( array( 'user' => $i065df39c07d6c930a4781ba0b0f312703847fa81, 'passwd' => $i54d1b2514929b4ead571e37199167cb71517da24, 'email' => $ia61712c27ea241bd7a543dc2b02ea572274d0322['data'][0], 'companyname' => $ia61712c27ea241bd7a543dc2b02ea572274d0322['data'][1], 'regtype' => $ia61712c27ea241bd7a543dc2b02ea572274d0322['data'][1] ? 'firm' : 'person', 'addressstreet' => $ia61712c27ea241bd7a543dc2b02ea572274d0322['data'][2], 'addresscity' => $ia61712c27ea241bd7a543dc2b02ea572274d0322['data'][3], 'addresszip' => $ia61712c27ea241bd7a543dc2b02ea572274d0322['data'][4], 'companyid' => $ia61712c27ea241bd7a543dc2b02ea572274d0322['data'][5], 'companyvat' => $ia61712c27ea241bd7a543dc2b02ea572274d0322['data'][6], 'country0' => $ia61712c27ea241bd7a543dc2b02ea572274d0322['data'][7], 'firstname' => $ia61712c27ea241bd7a543dc2b02ea572274d0322['data'][8], 'lastname' => $ia61712c27ea241bd7a543dc2b02ea572274d0322['data'][9] ) )->save(); Mage::getSingleton('adminhtml/session')->addSuccess($this->__($ia61712c27ea241bd7a543dc2b02ea572274d0322['error'])); } $this->_redirect('*/*/'); } public function validateAction() { $ia1a238c1f12f3901520c7ca55efa646e471f7f6e = new Varien_Object(); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setError(false); if ( $this->getRequest()->getPost() ) { try { $iacbd1c78463510856e506611fe14b5e1173581a6 = Mage::app()->getRequest(); $this->profile->user->setData('email', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('email', '')); $this->profile->user->setData('addressstreet', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('addressstreet', '')); $this->profile->user->setData('addresszip', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('addresszip', '')); $this->profile->user->setData('addresscity', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('addresscity', '')); $this->profile->user->setData('country0', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('country0', '')); $this->profile->user->setData('regtype', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('regtype', '')); $this->profile->user->setData('firstname', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('firstname', '')); $this->profile->user->setData('lastname', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('lastname', '')); if ($this->profile->user->getRegtype() == 'firm') { $this->profile->user->setData('companyname', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('companyname', '')); $this->profile->user->setData('companyid', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('companyid', '')); $this->profile->user->setData('companyvat', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('companyvat', '')); } else { $this->profile->user->setData('companyname', ''); $this->profile->user->setData('companyid', ''); $this->profile->user->setData('companyvat', ''); } $this->profile->user->setData('agree', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('agree', 0)); $ibdd27a8dd714410289189d318feb96fe6ed8e07f = $this->profile->user->validate(); if (is_array($ibdd27a8dd714410289189d318feb96fe6ed8e07f) && sizeof($ibdd27a8dd714410289189d318feb96fe6ed8e07f)) { Mage::throwException(implode('<br />', $ibdd27a8dd714410289189d318feb96fe6ed8e07f)); } if ($this->profile->user->user) { $ia61712c27ea241bd7a543dc2b02ea572274d0322 = base64_decode("YWN0aW9uPWVkaXQmdXNlcm5hbWU9").urlencode($this->profile->user->user). base64_decode("JnBhc3N3b3JkPQ==").urlencode($this->profile->user->passwd); } else { $ie955ee51cd0c7df255b696081bc48b422055d462 = Mage::getConfig()->getNode('default/config/referer'); if ($ie955ee51cd0c7df255b696081bc48b422055d462) { $ie955ee51cd0c7df255b696081bc48b422055d462 = $ie955ee51cd0c7df255b696081bc48b422055d462->id; } else { $ie955ee51cd0c7df255b696081bc48b422055d462 = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('refererid', ''); } $ia61712c27ea241bd7a543dc2b02ea572274d0322 = 'action=register&refererid='.urlencode($ie955ee51cd0c7df255b696081bc48b422055d462).'&'; } $ia61712c27ea241bd7a543dc2b02ea572274d0322 .= base64_decode("JmVtYWlsPQ==").urlencode($this->profile->user->email). base64_decode("JmptZW5vPQ==").urlencode($this->profile->user->companyname). base64_decode("Jmtvc29iYT0=").urlencode($this->profile->user->firstname). base64_decode("JmtwcmlqbWVuaT0=").urlencode($this->profile->user->lastname). "&adresa_ulice=".urlencode($this->profile->user->addressstreet). "&adresa_mesto=".urlencode($this->profile->user->addresscity). "&adresa_PSC=".urlencode($this->profile->user->addresszip). "&country0=".urlencode($this->profile->user->country0). base64_decode("JklDTz0=").urlencode($this->profile->user->companyid). base64_decode("JkRJQz0=").urlencode($this->profile->user->companyvat); $i55dd4e7042a1f9031b84f07f04c37165ce3d0720 = Mage::getSingleton('magesms/api')->serverPost($ia61712c27ea241bd7a543dc2b02ea572274d0322); if ($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['errno'] != 1 || empty($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['data'])) { if (is_array($ibdd27a8dd714410289189d318feb96fe6ed8e07f) && sizeof($ibdd27a8dd714410289189d318feb96fe6ed8e07f)) { $ibdd27a8dd714410289189d318feb96fe6ed8e07f[] = Mage::helper('magesms')->__($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['error']); } else { $ibdd27a8dd714410289189d318feb96fe6ed8e07f = array(Mage::helper('magesms')->__($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['error'])); } } elseif (!$this->profile->user->user && $i55dd4e7042a1f9031b84f07f04c37165ce3d0720['errno'] == 1) { $this->profile->user->setUser($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['data'][0]); $this->profile->user->setPasswd($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['data'][1]); } if (is_array($ibdd27a8dd714410289189d318feb96fe6ed8e07f) && sizeof($ibdd27a8dd714410289189d318feb96fe6ed8e07f)) { Mage::throwException(implode('<br />', $ibdd27a8dd714410289189d318feb96fe6ed8e07f)); } else { $i5bf407a3ecf35ff195a9c7e8f546cfc606253fad = $this->profile->user->getId(); $this->profile->user->save(); if ($i5bf407a3ecf35ff195a9c7e8f546cfc606253fad) Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Account was changed.')); else { Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Account was created.')); $ie2d3c964f264968835c26fc02ee0d5f0820fe0ce = Mage::app()->getDefaultStoreView()->getBaseUrl().'magesms/delivery'; $ia61712c27ea241bd7a543dc2b02ea572274d0322 = base64_decode("YWN0aW9uPWVkaXQyJnVzZXJuYW1lPQ==").urlencode($this->profile->user->user). base64_decode("JnBhc3N3b3JkPQ==").urlencode($this->profile->user->passwd). "&shop_domain=".urlencode($ie2d3c964f264968835c26fc02ee0d5f0820fe0ce); $i55dd4e7042a1f9031b84f07f04c37165ce3d0720 = Mage::getSingleton('magesms/api')->serverPost($ia61712c27ea241bd7a543dc2b02ea572274d0322); if ($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['errno'] != 99 || !empty($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['data'])) { if ($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['errno'] == 1 || $i55dd4e7042a1f9031b84f07f04c37165ce3d0720['errno'] == 5) $this->profile->user->setData('URLreports', 1)->save(); } } } } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { Mage::getSingleton('adminhtml/session')->addError($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage()); $this->_initLayoutMessages('adminhtml/session'); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setError(true); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setMessage($this->getLayout()->getMessagesBlock()->getGroupedHtml()); } } $this->getResponse()->setBody($ia1a238c1f12f3901520c7ca55efa646e471f7f6e->toJson()); } public function saveAction() { $this->_redirect('*/*/'); } public function deleteadminAction() { if ($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538 = $this->getRequest()->getParam('id')) { try { $this->profile->admins->load($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538)->delete(); Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Admin was deleted.')); $this->_redirect('*/*/'); return; } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { Mage::getSingleton('adminhtml/session')->addError($this->__($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage())); $this->_redirect('*/*/'); return; } } Mage::getSingleton('adminhtml/session')->addError($this->__('Unable to find a Admin to delete.')); $this->_redirect('*/*/'); } public function saveadminAction() { $this->_redirect('*/*/'); } public function validateadminAction() { $ia1a238c1f12f3901520c7ca55efa646e471f7f6e = new Varien_Object(); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setError(false); if ( $this->getRequest()->getPost() ) { try { $this->profile->admins->setData(Mage::app()->getRequest()->getPost()); $i7d411c0cc32cdb65ec82b9e8d79aa996946f5538 = $this->getRequest()->getParam('id'); if ($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538 > 0) { $this->profile->admins->setId($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538); } $ibdd27a8dd714410289189d318feb96fe6ed8e07f = $this->profile->admins->validate(); if (is_array($ibdd27a8dd714410289189d318feb96fe6ed8e07f) && sizeof($ibdd27a8dd714410289189d318feb96fe6ed8e07f)) { Mage::throwException(implode('<br />', $ibdd27a8dd714410289189d318feb96fe6ed8e07f)); } else { $this->profile->admins->save(); if ($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538) Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Admin was changed.')); else Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Admin was created.')); } } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { Mage::getSingleton('adminhtml/session')->addError($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage()); $this->_initLayoutMessages('adminhtml/session'); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setError(true); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setMessage($this->getLayout()->getMessagesBlock()->getGroupedHtml()); } } $this->getResponse()->setBody($ia1a238c1f12f3901520c7ca55efa646e471f7f6e->toJson()); } public function validatesettingsAction() { $ia1a238c1f12f3901520c7ca55efa646e471f7f6e = new Varien_Object(); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setError(false); if ( $this->getRequest()->getPost() ) { try { $iacbd1c78463510856e506611fe14b5e1173581a6 = Mage::app()->getRequest(); $this->profile->user->setData('simulatesms', (int)$iacbd1c78463510856e506611fe14b5e1173581a6->getPost('simulatesms', 0)); $this->profile->user->setData('deletedb', (int)$iacbd1c78463510856e506611fe14b5e1173581a6->getPost('deletedb', 0)); $this->profile->user->setData('URLreports', (int)$iacbd1c78463510856e506611fe14b5e1173581a6->getPost('URLreports', 0)); $this->profile->user->setData('pocetkredit', (int)$iacbd1c78463510856e506611fe14b5e1173581a6->getPost('pocetkredit', 0)); $this->profile->user->setData('deliveryemail', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('deliveryemail', '')); $this->profile->user->setData('prefbilling', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('prefbilling', 0)); $ibdd27a8dd714410289189d318feb96fe6ed8e07f = $this->profile->user->validate(); $ie2d3c964f264968835c26fc02ee0d5f0820fe0ce = ''; if ($this->profile->user->getData('URLreports')) { $ie2d3c964f264968835c26fc02ee0d5f0820fe0ce = Mage::app()->getDefaultStoreView()->getBaseUrl().'magesms/delivery'; } $ia61712c27ea241bd7a543dc2b02ea572274d0322 = base64_decode("YWN0aW9uPWVkaXQyJnVzZXJuYW1lPQ==").urlencode($this->profile->user->user). base64_decode("JnBhc3N3b3JkPQ==").urlencode($this->profile->user->passwd). "&shop_domain=".urlencode($ie2d3c964f264968835c26fc02ee0d5f0820fe0ce). base64_decode("JnBvY2V0a3JlZGl0PQ==").urlencode($this->profile->user->pocetkredit). base64_decode("JmVtYWlsPQ==").urlencode($this->profile->user->deliveryemail); $i55dd4e7042a1f9031b84f07f04c37165ce3d0720 = Mage::getSingleton('magesms/api')->serverPost($ia61712c27ea241bd7a543dc2b02ea572274d0322); if ($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['errno'] != 99 || !empty($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['data'])) { if ($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['errno'] == 1 || $i55dd4e7042a1f9031b84f07f04c37165ce3d0720['errno'] == 5) { Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Account was changed.')); } elseif ($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['errno'] == 11) { Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Account was changed, but module URL for DR does not answer.')); $this->profile->user->setData('URLreports', 0); } elseif ($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['errno'] == 3) { $if3b1e2c1706de4c1bca112c669caba3a0420b880 = Mage::helper('magesms')->__('error'); } elseif ($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['errno'] == 4) { $if3b1e2c1706de4c1bca112c669caba3a0420b880 = Mage::helper('magesms')->__('you can change account after ').$i55dd4e7042a1f9031b84f07f04c37165ce3d0720['error'].Mage::helper('magesms')->__(' seconds'); } } else { $if3b1e2c1706de4c1bca112c669caba3a0420b880 = Mage::helper('magesms')->__('error'); } if (!empty($if3b1e2c1706de4c1bca112c669caba3a0420b880) && is_array($ibdd27a8dd714410289189d318feb96fe6ed8e07f) && sizeof($ibdd27a8dd714410289189d318feb96fe6ed8e07f)) { $ibdd27a8dd714410289189d318feb96fe6ed8e07f[] = $if3b1e2c1706de4c1bca112c669caba3a0420b880; } elseif (!empty($if3b1e2c1706de4c1bca112c669caba3a0420b880)) { $ibdd27a8dd714410289189d318feb96fe6ed8e07f = array($if3b1e2c1706de4c1bca112c669caba3a0420b880); } if (is_array($ibdd27a8dd714410289189d318feb96fe6ed8e07f) && sizeof($ibdd27a8dd714410289189d318feb96fe6ed8e07f)) { Mage::throwException(implode('<br />', $ibdd27a8dd714410289189d318feb96fe6ed8e07f)); } else { $this->profile->user->save(); } } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { Mage::getSingleton('adminhtml/session')->addError($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage()); $this->_initLayoutMessages('adminhtml/session'); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setError(true); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setMessage($this->getLayout()->getMessagesBlock()->getGroupedHtml()); } } $this->getResponse()->setBody($ia1a238c1f12f3901520c7ca55efa646e471f7f6e->toJson()); } public function savesettingsAction() { $this->_redirect('*/*/'); } public function vatvalidateAction() { $i4d3f3bffcd16d5910b26a4511d33ad3b5e4c61d4 = ''; if ($this->getRequest()->getParams()) { $i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2 = $this->getRequest(); if ($i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2->getParam('country') && $i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2->getParam('companyvat')) { $ia61712c27ea241bd7a543dc2b02ea572274d0322 = 'action=checkVAT&country0='.urlencode($i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2->getParam('country')).'&DIC='.urlencode($i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2->getParam('companyvat')); $i55dd4e7042a1f9031b84f07f04c37165ce3d0720 = Mage::getSingleton('magesms/api')->serverPost($ia61712c27ea241bd7a543dc2b02ea572274d0322); if ($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['errno'] == 1 && !empty($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['data'])) { $i4d3f3bffcd16d5910b26a4511d33ad3b5e4c61d4 = 'true'; } } } $this->getResponse()->clearHeaders()->setHeader('Content-Type', 'text/html')->setBody($i4d3f3bffcd16d5910b26a4511d33ad3b5e4c61d4); } protected function _initAction() { $this->loadLayout() ->_setActiveMenu('magesms/profile') ->_addBreadcrumb(Mage::helper('magesms')->__('Edit user account'), Mage::helper('magesms')->__('Edit user account')) ->_title(Mage::helper('magesms')->__('MageSMS')) ->_title(Mage::helper('magesms')->__('Edit user account')); ; $this->getLayout()->getBlock('head')->addCss('css/topefekt/magesms/stylesheet.css') ->addJs('topefekt/functions.js'); return $this; } }
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
+ class Topefekt_Magesms_Adminhtml_Magesms_ProfileController extends Topefekt_Magesms_Controller_Action { public function preDispatch() { return Mage_Adminhtml_Controller_Action::preDispatch(); } public function indexAction() { $this->_initAction(); $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock( 'Topefekt_Magesms_Block_Template', 'my_block_name_here', array('template' => 'topefekt/magesms/profile.phtml') ); $this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); $this->renderLayout(); if ($this->profile->user->user) Mage::getModel('magesms/observer')->cronUpdate(); if (Mage::app()->loadCache('magesms_update_available')) { Mage::getSingleton('adminhtml/session')->addNotice($this->__('New version available for download:').' '.Mage::app()->loadCache('magesms_update_available')); } return $this; } public function loginAction() { $i065df39c07d6c930a4781ba0b0f312703847fa81 = Mage::app()->getRequest()->getParam('username'); $i54d1b2514929b4ead571e37199167cb71517da24 = Mage::app()->getRequest()->getParam('password'); $i451f679eaafeecb81387b150019f0d9e0fa83d16 = Mage::getModel('magesms/api'); $ia61712c27ea241bd7a543dc2b02ea572274d0322 = $i451f679eaafeecb81387b150019f0d9e0fa83d16->serverPost('action=login&username='.urlencode($i065df39c07d6c930a4781ba0b0f312703847fa81).'&password='.urlencode($i54d1b2514929b4ead571e37199167cb71517da24)); if ($ia61712c27ea241bd7a543dc2b02ea572274d0322['errno'] != 1) { Mage::getSingleton('adminhtml/session')->addError($this->__($ia61712c27ea241bd7a543dc2b02ea572274d0322['error'])); } else { $i7d411c0cc32cdb65ec82b9e8d79aa996946f5538d5406ca9a19e1687923f28236de86b1936c5757 = Mage::getModel('magesms/smsuser')->addData( array( 'user' => $i065df39c07d6c930a4781ba0b0f312703847fa81, 'passwd' => $i54d1b2514929b4ead571e37199167cb71517da24, 'email' => $ia61712c27ea241bd7a543dc2b02ea572274d0322['data'][0], 'companyname' => $ia61712c27ea241bd7a543dc2b02ea572274d0322['data'][1], 'regtype' => $ia61712c27ea241bd7a543dc2b02ea572274d0322['data'][1] ? 'firm' : 'person', 'addressstreet' => $ia61712c27ea241bd7a543dc2b02ea572274d0322['data'][2], 'addresscity' => $ia61712c27ea241bd7a543dc2b02ea572274d0322['data'][3], 'addresszip' => $ia61712c27ea241bd7a543dc2b02ea572274d0322['data'][4], 'companyid' => $ia61712c27ea241bd7a543dc2b02ea572274d0322['data'][5], 'companyvat' => $ia61712c27ea241bd7a543dc2b02ea572274d0322['data'][6], 'country0' => $ia61712c27ea241bd7a543dc2b02ea572274d0322['data'][7], 'firstname' => $ia61712c27ea241bd7a543dc2b02ea572274d0322['data'][8], 'lastname' => $ia61712c27ea241bd7a543dc2b02ea572274d0322['data'][9] ) )->save(); Mage::getSingleton('adminhtml/session')->addSuccess($this->__($ia61712c27ea241bd7a543dc2b02ea572274d0322['error'])); } $this->_redirect('*/*/'); } public function validateAction() { $ia1a238c1f12f3901520c7ca55efa646e471f7f6e = new Varien_Object(); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setError(false); if ( $this->getRequest()->getPost() ) { try { $iacbd1c78463510856e506611fe14b5e1173581a6 = Mage::app()->getRequest(); $this->profile->user->setData('email', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('email', '')); $this->profile->user->setData('addressstreet', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('addressstreet', '')); $this->profile->user->setData('addresszip', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('addresszip', '')); $this->profile->user->setData('addresscity', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('addresscity', '')); $this->profile->user->setData('country0', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('country0', '')); $this->profile->user->setData('regtype', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('regtype', '')); $this->profile->user->setData('firstname', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('firstname', '')); $this->profile->user->setData('lastname', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('lastname', '')); if ($this->profile->user->getRegtype() == 'firm') { $this->profile->user->setData('companyname', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('companyname', '')); $this->profile->user->setData('companyid', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('companyid', '')); $this->profile->user->setData('companyvat', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('companyvat', '')); } else { $this->profile->user->setData('companyname', ''); $this->profile->user->setData('companyid', ''); $this->profile->user->setData('companyvat', ''); } $this->profile->user->setData('agree', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('agree', 0)); $ibdd27a8dd714410289189d318feb96fe6ed8e07f = $this->profile->user->validate(); if (is_array($ibdd27a8dd714410289189d318feb96fe6ed8e07f) && sizeof($ibdd27a8dd714410289189d318feb96fe6ed8e07f)) { Mage::throwException(implode('<br />', $ibdd27a8dd714410289189d318feb96fe6ed8e07f)); } if ($this->profile->user->user) { $ia61712c27ea241bd7a543dc2b02ea572274d0322 = base64_decode("YWN0aW9uPWVkaXQmdXNlcm5hbWU9").urlencode($this->profile->user->user). base64_decode("JnBhc3N3b3JkPQ==").urlencode($this->profile->user->passwd); } else { $ie955ee51cd0c7df255b696081bc48b422055d462 = Mage::getConfig()->getNode('default/config/referer'); if ($ie955ee51cd0c7df255b696081bc48b422055d462) { $ie955ee51cd0c7df255b696081bc48b422055d462 = $ie955ee51cd0c7df255b696081bc48b422055d462->id; } else { $ie955ee51cd0c7df255b696081bc48b422055d462 = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('refererid', ''); } $ia61712c27ea241bd7a543dc2b02ea572274d0322 = 'action=register&refererid='.urlencode($ie955ee51cd0c7df255b696081bc48b422055d462).'&'; } $ia61712c27ea241bd7a543dc2b02ea572274d0322 .= base64_decode("JmVtYWlsPQ==").urlencode($this->profile->user->email). base64_decode("JmptZW5vPQ==").urlencode($this->profile->user->companyname). base64_decode("Jmtvc29iYT0=").urlencode($this->profile->user->firstname). base64_decode("JmtwcmlqbWVuaT0=").urlencode($this->profile->user->lastname). "&adresa_ulice=".urlencode($this->profile->user->addressstreet). "&adresa_mesto=".urlencode($this->profile->user->addresscity). "&adresa_PSC=".urlencode($this->profile->user->addresszip). "&country0=".urlencode($this->profile->user->country0). base64_decode("JklDTz0=").urlencode($this->profile->user->companyid). base64_decode("JkRJQz0=").urlencode($this->profile->user->companyvat); $i55dd4e7042a1f9031b84f07f04c37165ce3d0720 = Mage::getSingleton('magesms/api')->serverPost($ia61712c27ea241bd7a543dc2b02ea572274d0322); if ($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['errno'] != 1 || empty($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['data'])) { if (is_array($ibdd27a8dd714410289189d318feb96fe6ed8e07f) && sizeof($ibdd27a8dd714410289189d318feb96fe6ed8e07f)) { $ibdd27a8dd714410289189d318feb96fe6ed8e07f[] = Mage::helper('magesms')->__($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['error']); } else { $ibdd27a8dd714410289189d318feb96fe6ed8e07f = array(Mage::helper('magesms')->__($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['error'])); } } elseif (!$this->profile->user->user && $i55dd4e7042a1f9031b84f07f04c37165ce3d0720['errno'] == 1) { $this->profile->user->setUser($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['data'][0]); $this->profile->user->setPasswd($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['data'][1]); } if (is_array($ibdd27a8dd714410289189d318feb96fe6ed8e07f) && sizeof($ibdd27a8dd714410289189d318feb96fe6ed8e07f)) { Mage::throwException(implode('<br />', $ibdd27a8dd714410289189d318feb96fe6ed8e07f)); } else { $i5bf407a3ecf35ff195a9c7e8f546cfc606253fad = $this->profile->user->getId(); $this->profile->user->save(); if ($i5bf407a3ecf35ff195a9c7e8f546cfc606253fad) Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Account was changed.')); else { Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Account was created.')); $ie2d3c964f264968835c26fc02ee0d5f0820fe0ce = Mage::app()->getDefaultStoreView()->getBaseUrl().'magesms/delivery'; $ia61712c27ea241bd7a543dc2b02ea572274d0322 = base64_decode("YWN0aW9uPWVkaXQyJnVzZXJuYW1lPQ==").urlencode($this->profile->user->user). base64_decode("JnBhc3N3b3JkPQ==").urlencode($this->profile->user->passwd). "&shop_domain=".urlencode($ie2d3c964f264968835c26fc02ee0d5f0820fe0ce); $i55dd4e7042a1f9031b84f07f04c37165ce3d0720 = Mage::getSingleton('magesms/api')->serverPost($ia61712c27ea241bd7a543dc2b02ea572274d0322); if ($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['errno'] != 99 || !empty($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['data'])) { if ($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['errno'] == 1 || $i55dd4e7042a1f9031b84f07f04c37165ce3d0720['errno'] == 5) $this->profile->user->setData('URLreports', 1)->save(); } } } } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { Mage::getSingleton('adminhtml/session')->addError($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage()); $this->_initLayoutMessages('adminhtml/session'); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setError(true); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setMessage($this->getLayout()->getMessagesBlock()->getGroupedHtml()); } } $this->getResponse()->setBody($ia1a238c1f12f3901520c7ca55efa646e471f7f6e->toJson()); } public function saveAction() { $this->_redirect('*/*/'); } public function deleteadminAction() { if ($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538 = $this->getRequest()->getParam('id')) { try { $this->profile->admins->load($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538)->delete(); Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Admin was deleted.')); $this->_redirect('*/*/'); return; } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { Mage::getSingleton('adminhtml/session')->addError($this->__($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage())); $this->_redirect('*/*/'); return; } } Mage::getSingleton('adminhtml/session')->addError($this->__('Unable to find a Admin to delete.')); $this->_redirect('*/*/'); } public function saveadminAction() { $this->_redirect('*/*/'); } public function validateadminAction() { $ia1a238c1f12f3901520c7ca55efa646e471f7f6e = new Varien_Object(); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setError(false); if ( $this->getRequest()->getPost() ) { try { $this->profile->admins->setData(Mage::app()->getRequest()->getPost()); $i7d411c0cc32cdb65ec82b9e8d79aa996946f5538 = $this->getRequest()->getParam('id'); if ($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538 > 0) { $this->profile->admins->setId($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538); } $ibdd27a8dd714410289189d318feb96fe6ed8e07f = $this->profile->admins->validate(); if (is_array($ibdd27a8dd714410289189d318feb96fe6ed8e07f) && sizeof($ibdd27a8dd714410289189d318feb96fe6ed8e07f)) { Mage::throwException(implode('<br />', $ibdd27a8dd714410289189d318feb96fe6ed8e07f)); } else { $this->profile->admins->save(); if ($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538) Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Admin was changed.')); else Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Admin was created.')); } } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { Mage::getSingleton('adminhtml/session')->addError($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage()); $this->_initLayoutMessages('adminhtml/session'); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setError(true); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setMessage($this->getLayout()->getMessagesBlock()->getGroupedHtml()); } } $this->getResponse()->setBody($ia1a238c1f12f3901520c7ca55efa646e471f7f6e->toJson()); } public function validatesettingsAction() { $ia1a238c1f12f3901520c7ca55efa646e471f7f6e = new Varien_Object(); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setError(false); if ( $this->getRequest()->getPost() ) { try { $iacbd1c78463510856e506611fe14b5e1173581a6 = Mage::app()->getRequest(); $this->profile->user->setData('simulatesms', (int)$iacbd1c78463510856e506611fe14b5e1173581a6->getPost('simulatesms', 0)); $this->profile->user->setData('deletedb', (int)$iacbd1c78463510856e506611fe14b5e1173581a6->getPost('deletedb', 0)); $this->profile->user->setData('URLreports', (int)$iacbd1c78463510856e506611fe14b5e1173581a6->getPost('URLreports', 0)); $this->profile->user->setData('pocetkredit', (int)$iacbd1c78463510856e506611fe14b5e1173581a6->getPost('pocetkredit', 0)); $this->profile->user->setData('deliveryemail', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('deliveryemail', '')); $this->profile->user->setData('prefbilling', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('prefbilling', 0)); $ibdd27a8dd714410289189d318feb96fe6ed8e07f = $this->profile->user->validate(); $ie2d3c964f264968835c26fc02ee0d5f0820fe0ce = ''; if ($this->profile->user->getData('URLreports')) { $ie2d3c964f264968835c26fc02ee0d5f0820fe0ce = Mage::app()->getDefaultStoreView()->getBaseUrl().'magesms/delivery'; } $ia61712c27ea241bd7a543dc2b02ea572274d0322 = base64_decode("YWN0aW9uPWVkaXQyJnVzZXJuYW1lPQ==").urlencode($this->profile->user->user). base64_decode("JnBhc3N3b3JkPQ==").urlencode($this->profile->user->passwd). "&shop_domain=".urlencode($ie2d3c964f264968835c26fc02ee0d5f0820fe0ce). base64_decode("JnBvY2V0a3JlZGl0PQ==").urlencode($this->profile->user->pocetkredit). base64_decode("JmVtYWlsPQ==").urlencode($this->profile->user->deliveryemail); $i55dd4e7042a1f9031b84f07f04c37165ce3d0720 = Mage::getSingleton('magesms/api')->serverPost($ia61712c27ea241bd7a543dc2b02ea572274d0322); if ($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['errno'] != 99 || !empty($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['data'])) { if ($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['errno'] == 1 || $i55dd4e7042a1f9031b84f07f04c37165ce3d0720['errno'] == 5) { Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Account was changed.')); } elseif ($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['errno'] == 11) { Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Account was changed, but module URL for DR does not answer.')); $this->profile->user->setData('URLreports', 0); } elseif ($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['errno'] == 3) { $if3b1e2c1706de4c1bca112c669caba3a0420b880 = Mage::helper('magesms')->__('error'); } elseif ($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['errno'] == 4) { $if3b1e2c1706de4c1bca112c669caba3a0420b880 = Mage::helper('magesms')->__('you can change account after ').$i55dd4e7042a1f9031b84f07f04c37165ce3d0720['error'].Mage::helper('magesms')->__(' seconds'); } } else { $if3b1e2c1706de4c1bca112c669caba3a0420b880 = Mage::helper('magesms')->__('error'); } if (!empty($if3b1e2c1706de4c1bca112c669caba3a0420b880) && is_array($ibdd27a8dd714410289189d318feb96fe6ed8e07f) && sizeof($ibdd27a8dd714410289189d318feb96fe6ed8e07f)) { $ibdd27a8dd714410289189d318feb96fe6ed8e07f[] = $if3b1e2c1706de4c1bca112c669caba3a0420b880; } elseif (!empty($if3b1e2c1706de4c1bca112c669caba3a0420b880)) { $ibdd27a8dd714410289189d318feb96fe6ed8e07f = array($if3b1e2c1706de4c1bca112c669caba3a0420b880); } if (is_array($ibdd27a8dd714410289189d318feb96fe6ed8e07f) && sizeof($ibdd27a8dd714410289189d318feb96fe6ed8e07f)) { Mage::throwException(implode('<br />', $ibdd27a8dd714410289189d318feb96fe6ed8e07f)); } else { $this->profile->user->save(); } } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { Mage::getSingleton('adminhtml/session')->addError($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage()); $this->_initLayoutMessages('adminhtml/session'); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setError(true); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setMessage($this->getLayout()->getMessagesBlock()->getGroupedHtml()); } } $this->getResponse()->setBody($ia1a238c1f12f3901520c7ca55efa646e471f7f6e->toJson()); } public function savesettingsAction() { $this->_redirect('*/*/'); } public function vatvalidateAction() { $i4d3f3bffcd16d5910b26a4511d33ad3b5e4c61d4 = ''; if ($this->getRequest()->getParams()) { $i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2 = $this->getRequest(); if ($i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2->getParam('country') && $i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2->getParam('companyvat')) { $ia61712c27ea241bd7a543dc2b02ea572274d0322 = 'action=checkVAT&country0='.urlencode($i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2->getParam('country')).'&DIC='.urlencode($i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2->getParam('companyvat')); $i55dd4e7042a1f9031b84f07f04c37165ce3d0720 = Mage::getSingleton('magesms/api')->serverPost($ia61712c27ea241bd7a543dc2b02ea572274d0322); if ($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['errno'] == 1 && !empty($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['data'])) { $i4d3f3bffcd16d5910b26a4511d33ad3b5e4c61d4 = 'true'; } } } $this->getResponse()->clearHeaders()->setHeader('Content-Type', 'text/html')->setBody($i4d3f3bffcd16d5910b26a4511d33ad3b5e4c61d4); } protected function _initAction() { parent::_initAction(); $this->_setActiveMenu('magesms/profile') ->_title(Mage::helper('magesms')->__('Edit user account')); ; return $this; } }
app/code/community/Topefekt/Magesms/controllers/Adminhtml/Magesms/PurchasecreditController.php CHANGED
@@ -13,4 +13,4 @@
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
- class Topefekt_Magesms_Adminhtml_Magesms_PurchasecreditController extends Mage_Adminhtml_Controller_Action { public $profile; protected function _construct() { parent::_construct(); $this->profile = Mage::getSingleton('magesms/smsprofile'); } public function preDispatch() { parent::preDispatch(); if (!$this->profile->user->getUser()) { $this->setFlag('', self::FLAG_NO_DISPATCH, true); if (!empty($this->profile->_error)) { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('magesms')->__($this->profile->_error)); } else { Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magesms')->__('Not registered yet? Create account now!')); } $this->_redirect('*/magesms_profile'); } return $this; } public function indexAction() { $this->_initAction(); $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock( 'Topefekt_Magesms_Block_Template', 'my_block_name_here2', array('template' => 'topefekt/magesms/purchasecredit.phtml') ); $this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); $this->renderLayout(); return $this; } protected function _initAction() { $this->loadLayout() ->_setActiveMenu('magesms/purchasecredit') ->_addBreadcrumb(Mage::helper('magesms')->__('Purchase Credit'), Mage::helper('magesms')->__('Purchase Credit')) ->_title(Mage::helper('magesms')->__('MageSMS')) ->_title(Mage::helper('magesms')->__('Purchase Credit')); ; $this->getLayout()->getBlock('head')->addCss('css/topefekt/magesms/stylesheet.css') ->addJs('topefekt/functions.js'); return $this; } }
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
+ class Topefekt_Magesms_Adminhtml_Magesms_PurchasecreditController extends Topefekt_Magesms_Controller_Action { public function indexAction() { $this->_initAction(); $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock( 'Topefekt_Magesms_Block_Template', 'my_block_name_here2', array('template' => 'topefekt/magesms/purchasecredit.phtml') ); $this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); $this->renderLayout(); return $this; } protected function _initAction() { parent::_initAction(); $this->_setActiveMenu('magesms/purchasecredit') ->_title(Mage::helper('magesms')->__('Purchase Credit')); ; return $this; } }
app/code/community/Topefekt/Magesms/controllers/Adminhtml/Magesms/SendsmsController.php CHANGED
@@ -13,4 +13,4 @@
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
- class Topefekt_Magesms_Adminhtml_Magesms_SendsmsController extends Mage_Adminhtml_Controller_Action { public $profile; protected function _construct() { $this->profile = Mage::getSingleton('magesms/smsprofile'); } public function preDispatch() { parent::preDispatch(); if (!$this->profile->user->getUser()) { $this->setFlag('', self::FLAG_NO_DISPATCH, true); if (!empty($this->profile->_error)) { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('magesms')->__($this->profile->_error)); } else { Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magesms')->__('Not registered yet? Create account now!')); } $this->_redirect('*/magesms_profile'); } return $this; } public function indexAction() { $this->_initAction(); $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock( 'Topefekt_Magesms_Block_Template', 'my_block_name_here', array('template' => 'topefekt/magesms/sendsms.phtml') ); $this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); $this->renderLayout(); return $this; } public function sendAction() { if ( $this->getRequest()->getPost() ) { try { $iacbd1c78463510856e506611fe14b5e1173581a6 = Mage::app()->getRequest(); $idfc9fbe8edf868c14fc4a3f15c7f40aabfa080aa = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('text'); $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('unicode') ? true : false; $ifc17de93671eea5715520ecfbc4dc543818685b8 = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('unique') ? true : false; $ief058b7f255db4398d193a2545513eb1c6eb5e8b = explode(',', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('recipients')); if (!empty($_FILES['sms_file']['tmp_name']) && is_uploaded_file($_FILES['sms_file']['tmp_name'])) { $ief058b7f255db4398d193a2545513eb1c6eb5e8b = array_merge($ief058b7f255db4398d193a2545513eb1c6eb5e8b, str_getcsv(file_get_contents($_FILES['sms_file']['tmp_name']), "\n")); } if (!$ief058b7f255db4398d193a2545513eb1c6eb5e8b) Mage::throwException(Mage::helper('magesms')->__('Recipients found: 0')); if (!$idfc9fbe8edf868c14fc4a3f15c7f40aabfa080aa) Mage::throwException(Mage::helper('magesms')->__('Fill in SMS text.')); $i2012325f8714e1168a6c4fd06b9fa8eee23fcc7f = Mage::getModel('magesms/sms'); $i2012325f8714e1168a6c4fd06b9fa8eee23fcc7f->setRecipient($ief058b7f255db4398d193a2545513eb1c6eb5e8b) ->setMessage($idfc9fbe8edf868c14fc4a3f15c7f40aabfa080aa) ->setType(Topefekt_Magesms_Model_Sms::TYPE_SIMPLE) ->setPriority(false) ->setUnicode($ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd) ->setUnique($ifc17de93671eea5715520ecfbc4dc543818685b8); if ($iacbd1c78463510856e506611fe14b5e1173581a6->getPost('sendlater') && $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('datumodesl')) { $i4c323947385ff52539168f26084feed4bc17e2dc = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('datumodesl'); $i6aa8d50211ad373efab0896425f6f5fa0e013c29 = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('datumodesl_hour'); $if8001c570b9f0e904df8b36797628015beb8fa80 = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('datumodesl_min'); $i836a3cd8c554d1c35cc3c6cf3e3f49052b683096 = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('datereal', 0); $i4c323947385ff52539168f26084feed4bc17e2dc = Mage::getModel('core/date')->gmtTimestamp(strtotime("$i4c323947385ff52539168f26084feed4bc17e2dc $i6aa8d50211ad373efab0896425f6f5fa0e013c29:$if8001c570b9f0e904df8b36797628015beb8fa80:00") + 3600*$i836a3cd8c554d1c35cc3c6cf3e3f49052b683096); $i2012325f8714e1168a6c4fd06b9fa8eee23fcc7f->setSendlater($i4c323947385ff52539168f26084feed4bc17e2dc); } $i2012325f8714e1168a6c4fd06b9fa8eee23fcc7f->send(); $this->_redirect('*/*/index'); } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { $this->_initAction(); $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock( 'Topefekt_Magesms_Block_Template', 'my_block_name_here', array('template' => 'topefekt/magesms/sendsms.phtml') ); $this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); Mage::getSingleton('adminhtml/session')->addError($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage()); $this->renderLayout(); } } else { $this->_redirect('*/*/index'); } return $this; } public function loadCustomersAction() { $i4d3f3bffcd16d5910b26a4511d33ad3b5e4c61d4 = ''; if ($this->getRequest()->getParams()) { $i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2 = $this->getRequest(); if ($i933cfa8bba921101c14f35998fc501e030c9db5b = $i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2->getParam('char')) { $i854b57231c05dbaa7f22331dbaed4152a402d2f1 = new Zend_Locale_Data(); $i065c883e3f45e58104d21f8196ee3fe9bd2f513d = $i854b57231c05dbaa7f22331dbaed4152a402d2f1->getList('en-EN', 'phonetoterritory'); $ibad8f78c098260b16424eb12ceee5f8336591d56 = Mage::helper('magesms')->getCustomerCollection(); $ibad8f78c098260b16424eb12ceee5f8336591d56->addFieldToFilter('lastname', array('like' => $i933cfa8bba921101c14f35998fc501e030c9db5b.'%')); $ibad8f78c098260b16424eb12ceee5f8336591d56->addAttributeToSort('lastname', 'ASC'); foreach($ibad8f78c098260b16424eb12ceee5f8336591d56 as $i21e55df616c305955791876c1eb4da83448beba2) { $i4d3f3bffcd16d5910b26a4511d33ad3b5e4c61d4 .= $i21e55df616c305955791876c1eb4da83448beba2->getLastname().', '.$i21e55df616c305955791876c1eb4da83448beba2->getFirstname().';'; $id1caa2f79c0787a3e797d6d388cd6f00ced4282f = Mage::helper('magesms')->prepareNumber($i21e55df616c305955791876c1eb4da83448beba2->getTelephone(), 'customer', empty($i065c883e3f45e58104d21f8196ee3fe9bd2f513d[$i21e55df616c305955791876c1eb4da83448beba2->getCountryId()]) ? '' : $i065c883e3f45e58104d21f8196ee3fe9bd2f513d[$i21e55df616c305955791876c1eb4da83448beba2->getCountryId()]); $i4d3f3bffcd16d5910b26a4511d33ad3b5e4c61d4 .= $id1caa2f79c0787a3e797d6d388cd6f00ced4282f['mobile']."\n"; } } } $this->getResponse()->clearHeaders()->setHeader('Content-Type', 'text/html')->setBody($i4d3f3bffcd16d5910b26a4511d33ad3b5e4c61d4); } protected function _initAction() { $this->loadLayout() ->_setActiveMenu('magesms/sendsms') ->_addBreadcrumb(Mage::helper('magesms')->__('Send SMS'), Mage::helper('magesms')->__('Send SMS')) ->_title(Mage::helper('magesms')->__('MageSMS')) ->_title(Mage::helper('magesms')->__('Send SMS')) ; $this->getLayout()->getBlock('head')->addCss('css/topefekt/magesms/stylesheet.css') ->addJs('topefekt/functions.js'); return $this; } }
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
+ class Topefekt_Magesms_Adminhtml_Magesms_SendsmsController extends Topefekt_Magesms_Controller_Template_Action { public function indexAction() { $this->_initAction(); $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock( 'Topefekt_Magesms_Block_Template', 'my_block_name_here', array('template' => 'topefekt/magesms/sendsms.phtml') ); $id42c5963b49dec2d3a886ec5045e3b8e035c239f = '{shop_name}, {shop_domain}, {shop_email}, {shop_phone}'; $i8ee45e0018a32fb1a855b82624506e35789cc4d2->setNotice($id42c5963b49dec2d3a886ec5045e3b8e035c239f); $i8ee45e0018a32fb1a855b82624506e35789cc4d2->setTranslate(Mage::helper('magesms')->hookVariablesJS($id42c5963b49dec2d3a886ec5045e3b8e035c239f)); if (!Mage::app()->isSingleStoreMode()) { $ie7d1444276fe9dee937fd96d6e0519397fdc5701 = array(0 => array('value' => 0, 'label' => Mage::helper('adminhtml')->__('Default Config'))); foreach(Mage::app()->getWebsites(false) as $i9fdb3b1e2e6984ebdd1220ec199279013c5483fc) { $ie7d1444276fe9dee937fd96d6e0519397fdc5701[$i9fdb3b1e2e6984ebdd1220ec199279013c5483fc->getId()] = array('value' => array(), 'label' => $i9fdb3b1e2e6984ebdd1220ec199279013c5483fc->getName()); foreach($i9fdb3b1e2e6984ebdd1220ec199279013c5483fc->getStores() as $i7079b107a03c03d74ad14b853dad74b85b2d25d1) { $ie7d1444276fe9dee937fd96d6e0519397fdc5701[$i9fdb3b1e2e6984ebdd1220ec199279013c5483fc->getId()]['value'][] = array('value' => $i7079b107a03c03d74ad14b853dad74b85b2d25d1->getId(), 'label' => $i7079b107a03c03d74ad14b853dad74b85b2d25d1->getName()); } } $i1791b2d1f89bb2bd83b34046f59125af207713db = new Varien_Data_Form(); $i1791b2d1f89bb2bd83b34046f59125af207713db->addField('store', 'select', array( 'label' => $this->__('Store:'), 'name' => 'store', 'values' => $ie7d1444276fe9dee937fd96d6e0519397fdc5701, )); $i8ee45e0018a32fb1a855b82624506e35789cc4d2->setSelectStore($i1791b2d1f89bb2bd83b34046f59125af207713db->getHtml()); } $this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); $this->renderLayout(); return $this; } public function sendAction() { if ( $this->getRequest()->getPost() ) { try { $iacbd1c78463510856e506611fe14b5e1173581a6 = Mage::app()->getRequest(); $idfc9fbe8edf868c14fc4a3f15c7f40aabfa080aa = $this->_prepareText($iacbd1c78463510856e506611fe14b5e1173581a6->getPost('text'), $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('store')); $ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('unicode') ? true : false; $ifc17de93671eea5715520ecfbc4dc543818685b8 = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('unique') ? true : false; $ief058b7f255db4398d193a2545513eb1c6eb5e8b = explode(',', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('recipients')); if (!empty($_FILES['sms_file']['tmp_name']) && is_uploaded_file($_FILES['sms_file']['tmp_name'])) { $i611979c78d09dff15855871978716343fa7c183e = array('application/vnd.ms-excel', 'text/plain', 'text/csv', 'text/tsv'); $i7a969aaaa6dd03b1ecdde97917a28ff6bea21d9f = array('text/vcard', 'text/x-vcard'); if(in_array($_FILES['sms_file']['type'], $i611979c78d09dff15855871978716343fa7c183e)) { $ief058b7f255db4398d193a2545513eb1c6eb5e8b = array_merge($ief058b7f255db4398d193a2545513eb1c6eb5e8b, str_getcsv(file_get_contents($_FILES['sms_file']['tmp_name']), "\n")); } elseif(in_array($_FILES['sms_file']['type'], $i7a969aaaa6dd03b1ecdde97917a28ff6bea21d9f)) { $ief058b7f255db4398d193a2545513eb1c6eb5e8b = array_merge($ief058b7f255db4398d193a2545513eb1c6eb5e8b, preg_replace('/TEL;.*:/', '', preg_grep('/TEL;/', explode("\n", file_get_contents($_FILES['sms_file']['tmp_name']))))); } } if (!$ief058b7f255db4398d193a2545513eb1c6eb5e8b) Mage::throwException(Mage::helper('magesms')->__('Recipients found: 0')); if (!$idfc9fbe8edf868c14fc4a3f15c7f40aabfa080aa) Mage::throwException(Mage::helper('magesms')->__('Fill in SMS text.')); $i2012325f8714e1168a6c4fd06b9fa8eee23fcc7f = Mage::getModel('magesms/sms'); $i2012325f8714e1168a6c4fd06b9fa8eee23fcc7f->setRecipient($ief058b7f255db4398d193a2545513eb1c6eb5e8b) ->setMessage($idfc9fbe8edf868c14fc4a3f15c7f40aabfa080aa) ->setType(Topefekt_Magesms_Model_Sms::TYPE_SIMPLE) ->setPriority(false) ->setUnicode($ie8d90f6313614fbb6564426c0b0cb59a0ca4cecd) ->setUnique($ifc17de93671eea5715520ecfbc4dc543818685b8); if ($iacbd1c78463510856e506611fe14b5e1173581a6->getPost('sendlater') && $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('datumodesl')) { $i4c323947385ff52539168f26084feed4bc17e2dc = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('datumodesl'); $i6aa8d50211ad373efab0896425f6f5fa0e013c29 = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('datumodesl_hour'); $if8001c570b9f0e904df8b36797628015beb8fa80 = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('datumodesl_min'); $i836a3cd8c554d1c35cc3c6cf3e3f49052b683096 = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('datereal', 0); $i4c323947385ff52539168f26084feed4bc17e2dc = Mage::getModel('core/date')->gmtTimestamp(strtotime("$i4c323947385ff52539168f26084feed4bc17e2dc $i6aa8d50211ad373efab0896425f6f5fa0e013c29:$if8001c570b9f0e904df8b36797628015beb8fa80:00") + 3600*$i836a3cd8c554d1c35cc3c6cf3e3f49052b683096); $i2012325f8714e1168a6c4fd06b9fa8eee23fcc7f->setSendlater($i4c323947385ff52539168f26084feed4bc17e2dc); } $i2012325f8714e1168a6c4fd06b9fa8eee23fcc7f->send(); $this->_redirect('*/*/index'); } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { $this->_initAction(); $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock( 'Topefekt_Magesms_Block_Template', 'my_block_name_here', array('template' => 'topefekt/magesms/sendsms.phtml') ); $this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); Mage::getSingleton('adminhtml/session')->addError($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage()); $this->renderLayout(); } } else { $this->_redirect('*/*/index'); } return $this; } public function loadCustomersAction() { $i4d3f3bffcd16d5910b26a4511d33ad3b5e4c61d4 = ''; if ($this->getRequest()->getParams()) { $i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2 = $this->getRequest(); if ($i933cfa8bba921101c14f35998fc501e030c9db5b = $i628d8ebfdcd1b4d13c7bb90cffb2f53678d994d2->getParam('char')) { $i854b57231c05dbaa7f22331dbaed4152a402d2f1 = new Zend_Locale_Data(); $i065c883e3f45e58104d21f8196ee3fe9bd2f513d = $i854b57231c05dbaa7f22331dbaed4152a402d2f1->getList('en-EN', 'phonetoterritory'); $ibad8f78c098260b16424eb12ceee5f8336591d56 = Mage::helper('magesms')->getCustomerCollection(); $ibad8f78c098260b16424eb12ceee5f8336591d56->addFieldToFilter('lastname', array('like' => $i933cfa8bba921101c14f35998fc501e030c9db5b.'%')); $ibad8f78c098260b16424eb12ceee5f8336591d56->addAttributeToSort('lastname', 'ASC'); foreach($ibad8f78c098260b16424eb12ceee5f8336591d56 as $i21e55df616c305955791876c1eb4da83448beba2) { $i4d3f3bffcd16d5910b26a4511d33ad3b5e4c61d4 .= $i21e55df616c305955791876c1eb4da83448beba2->getLastname().', '.$i21e55df616c305955791876c1eb4da83448beba2->getFirstname().';'; $id1caa2f79c0787a3e797d6d388cd6f00ced4282f = Mage::helper('magesms')->prepareNumber($i21e55df616c305955791876c1eb4da83448beba2->getTelephone(), 'customer', empty($i065c883e3f45e58104d21f8196ee3fe9bd2f513d[$i21e55df616c305955791876c1eb4da83448beba2->getCountryId()]) ? '' : $i065c883e3f45e58104d21f8196ee3fe9bd2f513d[$i21e55df616c305955791876c1eb4da83448beba2->getCountryId()]); $i4d3f3bffcd16d5910b26a4511d33ad3b5e4c61d4 .= $id1caa2f79c0787a3e797d6d388cd6f00ced4282f['mobile']."\n"; } } } $this->getResponse()->clearHeaders()->setHeader('Content-Type', 'text/html')->setBody($i4d3f3bffcd16d5910b26a4511d33ad3b5e4c61d4); } protected function _initAction() { parent::_initAction(); $this->_setActiveMenu('magesms/sendsms') ->_title(Mage::helper('magesms')->__('Send SMS')) ; return $this; } }
app/code/community/Topefekt/Magesms/controllers/Adminhtml/Magesms/StatisticsController.php CHANGED
@@ -13,4 +13,4 @@
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
- class Topefekt_Magesms_Adminhtml_Magesms_StatisticsController extends Mage_Adminhtml_Controller_Action { public $profile; protected function _construct() { $this->profile = Mage::getSingleton('magesms/smsprofile'); } public function preDispatch() { parent::preDispatch(); if (!$this->profile->user->getUser()) { $this->setFlag('', self::FLAG_NO_DISPATCH, true); if (!empty($this->profile->_error)) { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('magesms')->__($this->profile->_error)); } else { Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magesms')->__('Not registered yet? Create account now!')); } $this->_redirect('*/magesms_profile'); } return $this; } public function indexAction() { $this->_initAction(); $iea2d876101fbc4dc03450ed5474bbd8a6fb905a2 = $this->getRequest()->getParams(); if (!empty($iea2d876101fbc4dc03450ed5474bbd8a6fb905a2['datefrom'])) $iea2d876101fbc4dc03450ed5474bbd8a6fb905a2['datefrom'] = base64_decode($iea2d876101fbc4dc03450ed5474bbd8a6fb905a2['datefrom']); if (!empty($iea2d876101fbc4dc03450ed5474bbd8a6fb905a2['dateto'])) $iea2d876101fbc4dc03450ed5474bbd8a6fb905a2['dateto'] = base64_decode($iea2d876101fbc4dc03450ed5474bbd8a6fb905a2['dateto']); $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a = new Varien_Object(); foreach ($iea2d876101fbc4dc03450ed5474bbd8a6fb905a2 as $i670253c23c6fcba76bc4256a88fdd8fbc1041039 => $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89) { if (!empty($if2eee0665f163a28f4adcfe84e3fc666bf1bcd89)) $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a->setData($i670253c23c6fcba76bc4256a88fdd8fbc1041039, $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89); } $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock( 'Topefekt_Magesms_Block_Template', 'my_block_name_here', array('template' => 'topefekt/magesms/statistics.phtml') ); $i8ee45e0018a32fb1a855b82624506e35789cc4d2->setFilterData($ia8a35a47a8e61218e15d1a33dac64bdc2449c01a); $this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); $this->renderLayout(); return $this; } public function filterAction() { $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a = $this->getRequest()->getParams(); unset($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a['form_key']); $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a['datefrom'] = base64_encode($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a['datefrom']); $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a['dateto'] = base64_encode($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a['dateto']); $this->_redirect('*/*/', $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a); } protected function _initAction() { $this->loadLayout() ->_setActiveMenu('magesms/statistics') ->_addBreadcrumb(Mage::helper('magesms')->__('Statistics'), Mage::helper('magesms')->__('Statistics')) ->_title(Mage::helper('magesms')->__('MageSMS')) ->_title(Mage::helper('magesms')->__('Statistics')) ; $this->getLayout()->getBlock('head')->addCss('css/topefekt/magesms/stylesheet.css') ->addJs('topefekt/functions.js'); return $this; } }
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
+ class Topefekt_Magesms_Adminhtml_Magesms_StatisticsController extends Topefekt_Magesms_Controller_Action { public function indexAction() { $this->_initAction(); $iea2d876101fbc4dc03450ed5474bbd8a6fb905a2 = $this->getRequest()->getParams(); if (!empty($iea2d876101fbc4dc03450ed5474bbd8a6fb905a2['datefrom'])) $iea2d876101fbc4dc03450ed5474bbd8a6fb905a2['datefrom'] = base64_decode($iea2d876101fbc4dc03450ed5474bbd8a6fb905a2['datefrom']); if (!empty($iea2d876101fbc4dc03450ed5474bbd8a6fb905a2['dateto'])) $iea2d876101fbc4dc03450ed5474bbd8a6fb905a2['dateto'] = base64_decode($iea2d876101fbc4dc03450ed5474bbd8a6fb905a2['dateto']); $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a = new Varien_Object(); foreach ($iea2d876101fbc4dc03450ed5474bbd8a6fb905a2 as $i670253c23c6fcba76bc4256a88fdd8fbc1041039 => $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89) { if (!empty($if2eee0665f163a28f4adcfe84e3fc666bf1bcd89)) $ia8a35a47a8e61218e15d1a33dac64bdc2449c01a->setData($i670253c23c6fcba76bc4256a88fdd8fbc1041039, $if2eee0665f163a28f4adcfe84e3fc666bf1bcd89); } $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock( 'Topefekt_Magesms_Block_Template', 'my_block_name_here', array('template' => 'topefekt/magesms/statistics.phtml') ); $i8ee45e0018a32fb1a855b82624506e35789cc4d2->setFilterData($ia8a35a47a8e61218e15d1a33dac64bdc2449c01a); $this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); $this->renderLayout(); return $this; } public function filterAction() { $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a = $this->getRequest()->getParams(); unset($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a['form_key']); $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a['datefrom'] = base64_encode($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a['datefrom']); $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a['dateto'] = base64_encode($iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a['dateto']); $this->_redirect('*/*/', $iba20acc78644ac0e9cd48ea35d8ad03b058f6b5a); } protected function _initAction() { parent::_initAction(); $this->_setActiveMenu('magesms/statistics') ->_title(Mage::helper('magesms')->__('Statistics')) ; return $this; } }
app/code/community/Topefekt/Magesms/controllers/Adminhtml/Magesms/WizardController.php CHANGED
@@ -13,4 +13,4 @@
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
- class Topefekt_Magesms_Adminhtml_Magesms_WizardController extends Mage_Adminhtml_Controller_Action { public $profile; public $confirmsms; protected function _construct() { $this->profile = Mage::getSingleton('magesms/smsprofile'); $this->confirmsms = Mage::helper('magesms')->__('Confirmation code: '); } public function preDispatch() { parent::preDispatch(); if (!$this->profile->user->getUser()) { $this->setFlag('', self::FLAG_NO_DISPATCH, true); if (!empty($this->profile->_error)) { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('magesms')->__($this->profile->_error)); } else { Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('magesms')->__('Not registered yet? Create account now!')); } $this->_redirect('*/magesms_profile'); } return $this; } public function indexAction() { $this->_initAction(); $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock( 'Topefekt_Magesms_Block_Template', 'my_block_name_here', array('template' => 'topefekt/magesms/wizard.phtml') ); $this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); $this->renderLayout(); if (!Mage::app()->loadCache('magesms_pricelist_update') || Mage::app()->loadCache('magesms_pricelist_update') != date('Y-m-d')) { Mage::app()->saveCache(date('Y-m-d'), 'magesms_pricelist_update'); $this->updatepricelistAction(); } return $this; } public function editAction() { $ia118aa93019887b74fdff43dbcf59dce271cae7d = $this->getRequest()->getParam('country0'); $i30f20aafde612a957f7f966cb5b85e35782bc88a = $this->getRequest()->getParam('type'); $i4d3f3bffcd16d5910b26a4511d33ad3b5e4c61d4 = true; if ($ia118aa93019887b74fdff43dbcf59dce271cae7d && $i30f20aafde612a957f7f966cb5b85e35782bc88a) { $i037b855bc01175f2c77d5c3e19eda9a0003feff4 = Mage::getSingleton('magesms/country_area')->getCollection()->addFilter('country_name', $ia118aa93019887b74fdff43dbcf59dce271cae7d); if ($i037b855bc01175f2c77d5c3e19eda9a0003feff4->count()) { $ia61712c27ea241bd7a543dc2b02ea572274d0322 = 'action=dost&username='.urlencode($this->profile->user->user).'&password='.urlencode($this->profile->user->passwd). '&area='.urlencode($i037b855bc01175f2c77d5c3e19eda9a0003feff4->getFirstItem()->getArea()).'&currency='.urlencode($this->profile->currency); $i55dd4e7042a1f9031b84f07f04c37165ce3d0720 = Mage::getModel('magesms/api')->serverPost($ia61712c27ea241bd7a543dc2b02ea572274d0322); if ($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['errno'] == 1 && !empty($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['data'])) { $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec = Mage::getModel('magesms/routes'); $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->setInfo($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['datasrc']); $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->setArea($i037b855bc01175f2c77d5c3e19eda9a0003feff4->getFirstItem()->getArea()); $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->setType($i30f20aafde612a957f7f966cb5b85e35782bc88a); $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->setAreaText($ia118aa93019887b74fdff43dbcf59dce271cae7d); Mage::register('routes', $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec); } else { $i4d3f3bffcd16d5910b26a4511d33ad3b5e4c61d4 = false; } } else { $i4d3f3bffcd16d5910b26a4511d33ad3b5e4c61d4 = false; } } if ($i4d3f3bffcd16d5910b26a4511d33ad3b5e4c61d4) { $this->_initAction(); $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock( 'Topefekt_Magesms_Block_Template', 'my_block_name_here', array('template' => 'topefekt/magesms/wizard-edit.phtml') ); $this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); $this->renderLayout(); return $this; } Mage::getSingleton('adminhtml/session')->addError($this->__('Unable to find a Route to load.')); $this->_redirect('*/*/'); } public function deleteAction() { if ($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538 = $this->getRequest()->getParam('id')) { try { $ice10b700e3771fcda63608142bce93b608228583 = Mage::getModel('magesms/routes')->load($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538); $ice10b700e3771fcda63608142bce93b608228583->delete(); Mage::getSingleton('adminhtml/session')->addSuccess($ice10b700e3771fcda63608142bce93b608228583->getAreaText().$this->__(' was deleted.')); $this->_redirect('*/*/'); return; } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { Mage::getSingleton('adminhtml/session')->addError($this->__($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage())); $this->_redirect('*/*/'); return; } } Mage::getSingleton('adminhtml/session')->addError($this->__('Unable to find a Route to delete.')); $this->_redirect('*/*/'); } public function addcountrycustomerAction() { $this->getRequest()->setParam('type', 'customer'); $this->addcountryAction(); } public function addcountryadminAction() { $this->getRequest()->setParam('type', 'admin'); $this->addcountryAction(); } public function addcountryAction() { $ia118aa93019887b74fdff43dbcf59dce271cae7d = $this->getRequest()->getParam('country0'); $i30f20aafde612a957f7f966cb5b85e35782bc88a = $this->getRequest()->getParam('type'); if ($ia118aa93019887b74fdff43dbcf59dce271cae7d && $i30f20aafde612a957f7f966cb5b85e35782bc88a) { try { $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec = Mage::getSingleton('magesms/routes')->getCollection(); $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->addFilter('area_text', $ia118aa93019887b74fdff43dbcf59dce271cae7d)->addFilter('type', $i30f20aafde612a957f7f966cb5b85e35782bc88a); if ($ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->count()) { $i7d411c0cc32cdb65ec82b9e8d79aa996946f5538 = $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->getFirstItem()->getId(); $this->_redirect('*/*/edit', array('id'=>$i7d411c0cc32cdb65ec82b9e8d79aa996946f5538)); return; } $this->_redirect('*/*/edit', array('country0'=>$ia118aa93019887b74fdff43dbcf59dce271cae7d, 'type'=>$i30f20aafde612a957f7f966cb5b85e35782bc88a, 'id'=>0)); return; } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { Mage::getSingleton('adminhtml/session')->addError($this->__($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage())); $this->_redirect('*/*/'); return; } } Mage::getSingleton('adminhtml/session')->addError($this->__('Unable to find a Route to load.')); $this->_redirect('*/*/'); } public function addrouteAction() { if (Mage::getSingleton('adminhtml/session')->hasData('routes')) { $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec = Mage::getSingleton('adminhtml/session')->getData('routes'); $this->_redirect('*/*/addroutesender'); } else { Mage::getSingleton('adminhtml/session')->addSuccess(Mage::getSingleton('adminhtml/session')->getData('routesuccess').$this->__(' was saved.')); Mage::getSingleton('adminhtml/session')->unsetData('routesuccess'); $this->_redirect('*/*/index'); } } public function addroutesenderAction() { if (Mage::getSingleton('adminhtml/session')->hasData('routes')) { $this->_initAction(); $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock( 'Topefekt_Magesms_Block_Template', 'my_block_name_here', array('template' => 'topefekt/magesms/wizard-sender.phtml') ); $this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); $this->renderLayout(); return $this; } else { $this->_redirect('*/*/index'); } } public function validateAction($i5ba2c5364d6756af3701b475c0706df889a2545f = false) { $ia1a238c1f12f3901520c7ca55efa646e471f7f6e = new Varien_Object(); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setError(false); if ( $this->getRequest()->getPost() ) { try { $iacbd1c78463510856e506611fe14b5e1173581a6 = Mage::app()->getRequest(); $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec = Mage::getModel('magesms/routes'); if ($iacbd1c78463510856e506611fe14b5e1173581a6->getPost('id')) { $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->load($iacbd1c78463510856e506611fe14b5e1173581a6->getPost('id')); } $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->setArea($iacbd1c78463510856e506611fe14b5e1173581a6->getPost('area')); $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->setAreaText($iacbd1c78463510856e506611fe14b5e1173581a6->getPost('country0')); $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->setType($iacbd1c78463510856e506611fe14b5e1173581a6->getPost('type')); $iecc25823227283479c5811005734b6ee2bd56071 = explode(';', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('isms')); $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->setIsms($iecc25823227283479c5811005734b6ee2bd56071[0]); $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->setSendertype($iecc25823227283479c5811005734b6ee2bd56071[1]); $ibdd27a8dd714410289189d318feb96fe6ed8e07f = $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->validate(); if (is_array($ibdd27a8dd714410289189d318feb96fe6ed8e07f) && sizeof($ibdd27a8dd714410289189d318feb96fe6ed8e07f)) { Mage::throwException(implode('<br />', $ibdd27a8dd714410289189d318feb96fe6ed8e07f)); } else { if ($i5ba2c5364d6756af3701b475c0706df889a2545f === true) { $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->save(); } else { if ($ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->getSendertype() == Topefekt_Magesms_Model_Routes::SENDER_SYSTEM || $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->getSendertype() == Topefekt_Magesms_Model_Routes::SENDER_SIM) { $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->setData('senderID', ''); $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->save(); Mage::getSingleton('adminhtml/session')->unsetData('routes'); Mage::getSingleton('adminhtml/session')->setData('routesuccess', $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->getAreaText()); } else { Mage::getSingleton('adminhtml/session')->setData('routes', $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec); } } } } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { Mage::getSingleton('adminhtml/session')->addError($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage()); $this->_initLayoutMessages('adminhtml/session'); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setError(true); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setMessage($this->getLayout()->getMessagesBlock()->getGroupedHtml()); } } $this->getResponse()->setBody($ia1a238c1f12f3901520c7ca55efa646e471f7f6e->toJson()); } public function validatesenderAction() { $ia1a238c1f12f3901520c7ca55efa646e471f7f6e = new Varien_Object(); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setError(false); if ( $this->getRequest()->getPost() ) { try { $iacbd1c78463510856e506611fe14b5e1173581a6 = Mage::app()->getRequest(); $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec = Mage::getSingleton('adminhtml/session')->getData('routes'); if ($ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->displayCode !== true) { $i1b3f50fe6674f47cc7c1967f93ff153879178f04 = trim(($i51c6d8e5b3a92b4b73711680253408ec6d3d25f6 = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('sender')) ? $i51c6d8e5b3a92b4b73711680253408ec6d3d25f6 : $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('newsender')); $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->setData('senderID', $i1b3f50fe6674f47cc7c1967f93ff153879178f04); } else { $id3e549697752385571e09ffe4add9278d2d6923b = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('code'); $i1b3f50fe6674f47cc7c1967f93ff153879178f04 = $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->getData('senderID'); } $ibdd27a8dd714410289189d318feb96fe6ed8e07f = $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->validate(true); if (is_array($ibdd27a8dd714410289189d318feb96fe6ed8e07f) && sizeof($ibdd27a8dd714410289189d318feb96fe6ed8e07f)) { Mage::throwException(implode('<br />', $ibdd27a8dd714410289189d318feb96fe6ed8e07f)); } else { $i47f954bfb9dd4be93a5c46b2c8260d3fbc064235 = Mage::getModel('core/resource_transaction') ->addObject($ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec); if ($ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->getSendertype() == Topefekt_Magesms_Model_Routes::SENDER_OWN) { $i451f679eaafeecb81387b150019f0d9e0fa83d16 = Mage::getModel('magesms/api'); if ($ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->displayCode !== true) { $i74c7f58458d186850e8386ae20067ea0a7958311 = $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->getGate($i1b3f50fe6674f47cc7c1967f93ff153879178f04, 'admin'); $i9e1925546463c5a41ccbc625ed973556cc86a495 = ''; if(!$i74c7f58458d186850e8386ae20067ea0a7958311->isEmpty()): $i9e1925546463c5a41ccbc625ed973556cc86a495 = base64_decode("JmlzbXM9").urlencode($i74c7f58458d186850e8386ae20067ea0a7958311->getIsms()).base64_decode("JnNlbmRlcj0=").urlencode($i74c7f58458d186850e8386ae20067ea0a7958311->getData('senderID')); endif; $ia61712c27ea241bd7a543dc2b02ea572274d0322 = "action=checksenderID&text_sms=".urlencode($this->confirmsms).base64_decode("JnVzZXJuYW1lPQ==").urlencode($this->profile->user->user). base64_decode("JnBhc3N3b3JkPQ==").urlencode($this->profile->user->passwd).base64_decode("JnNlbmRlcklEPQ==").urlencode($i1b3f50fe6674f47cc7c1967f93ff153879178f04).$i9e1925546463c5a41ccbc625ed973556cc86a495; $ia61712c27ea241bd7a543dc2b02ea572274d0322 = $i451f679eaafeecb81387b150019f0d9e0fa83d16->serverPost($ia61712c27ea241bd7a543dc2b02ea572274d0322); if (in_array($ia61712c27ea241bd7a543dc2b02ea572274d0322['errno'], array(1, 11))) { $i5ee2fa256ff77dd811a9c1911f7563263a694e4b = Mage::getSingleton('magesms/smshistory'); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setNumber('+'.$i1b3f50fe6674f47cc7c1967f93ff153879178f04); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setDate(date('Y-m-d h:i:s', Mage::getModel('core/date')->timestamp(time()))); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setText($this->confirmsms); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setStatus(1); list($ie10d5ed46013be2962a9d08e0e1912a9c56891b4, $i58457975a91d59a84d2920953badcb7365ac1f01, $if928b7780c12c52495a2f84d8c183269cfcb7c63) = explode("__", $ia61712c27ea241bd7a543dc2b02ea572274d0322['datasrc']); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setPrice($i58457975a91d59a84d2920953badcb7365ac1f01); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setCredit($if928b7780c12c52495a2f84d8c183269cfcb7c63); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setSender($i74c7f58458d186850e8386ae20067ea0a7958311->getData('senderID')); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setUnicode(0); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setType(Topefekt_Magesms_Model_Sms::TYPE_ADMIN); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setSmsid($ie10d5ed46013be2962a9d08e0e1912a9c56891b4); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setTotal(1); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->save(); $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->displayCode = true; Mage::getSingleton('adminhtml/session')->setData('routes', $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec); } elseif ($ia61712c27ea241bd7a543dc2b02ea572274d0322['errno'] == 111) { } elseif ($ia61712c27ea241bd7a543dc2b02ea572274d0322['errno'] == 3 && $ia61712c27ea241bd7a543dc2b02ea572274d0322['error'] == 9) { Mage::throwException(Mage::helper('magesms')->__('error - wrong number or unavailable')); } elseif ($ia61712c27ea241bd7a543dc2b02ea572274d0322['errno'] == 3 && $ia61712c27ea241bd7a543dc2b02ea572274d0322['error'] == 10) { Mage::throwException(Mage::helper('magesms')->__('error - low credit for sending validation SMS')); } elseif ($ia61712c27ea241bd7a543dc2b02ea572274d0322['errno'] == 3 && $ia61712c27ea241bd7a543dc2b02ea572274d0322['error'] == 15) { Mage::throwException(Mage::helper('magesms')->__('error - unauthorized senderID in confirmation sms')); } elseif ($ia61712c27ea241bd7a543dc2b02ea572274d0322['errno'] == 3) { Mage::throwException(Mage::helper('magesms')->__('error - '.$ia61712c27ea241bd7a543dc2b02ea572274d0322['error'])); } elseif ($ia61712c27ea241bd7a543dc2b02ea572274d0322['errno'] == 4) { Mage::throwException(Mage::helper('magesms')->__('login error')); } else { Mage::throwException(Mage::helper('magesms')->__('can not connect to SMS server').' '.$ia61712c27ea241bd7a543dc2b02ea572274d0322['error']); } } else { $ia61712c27ea241bd7a543dc2b02ea572274d0322 = "action=checksenderIDcode&username=".urlencode($this->profile->user->user).base64_decode("JnBhc3N3b3JkPQ==").urlencode($this->profile->user->passwd). base64_decode("JmNvZGU9").urlencode($id3e549697752385571e09ffe4add9278d2d6923b).base64_decode("JnNlbmRlcklEPQ==").urlencode($ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->getData('senderID')); $ia61712c27ea241bd7a543dc2b02ea572274d0322 = $i451f679eaafeecb81387b150019f0d9e0fa83d16->serverPost($ia61712c27ea241bd7a543dc2b02ea572274d0322); if ($ia61712c27ea241bd7a543dc2b02ea572274d0322['errno'] == 1) { $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->displayCode = false; } elseif ($ia61712c27ea241bd7a543dc2b02ea572274d0322['errno'] == 3) { Mage::throwException(Mage::helper('magesms')->__('error - ').$ia61712c27ea241bd7a543dc2b02ea572274d0322['error']); } elseif ($ia61712c27ea241bd7a543dc2b02ea572274d0322['errno'] == 4) { Mage::throwException(Mage::helper('magesms')->__('login error')); } elseif ($ia61712c27ea241bd7a543dc2b02ea572274d0322['errno'] == 5) { Mage::throwException(Mage::helper('magesms')->__('correctly confirm sms code')); } else { Mage::throwException(Mage::helper('magesms')->__('can not connect to SMS server')); } } $i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd = 'ownnumbersender'; } else { $i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd = 'textsender'; } if ($ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->displayCode !== true) { $i5b2de9a29c087ac444f7af969b9863250e38aa27 = Mage::getSingleton('magesms/'.$i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd)->getCollection()->addFilter('val', $i1b3f50fe6674f47cc7c1967f93ff153879178f04)->getFirstItem(); $i0a2378e8d343fdb890a9c568b07c541a35a12341 = Mage::getSingleton('magesms/'.$i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd)->load($i5b2de9a29c087ac444f7af969b9863250e38aa27->getId())->setVal($i1b3f50fe6674f47cc7c1967f93ff153879178f04); $i47f954bfb9dd4be93a5c46b2c8260d3fbc064235->addObject($i0a2378e8d343fdb890a9c568b07c541a35a12341) ->save(); Mage::getSingleton('adminhtml/session')->unsetData('routes'); if ($i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd == 'textsender') { Mage::getSingleton('adminhtml/session')->setData('routesuccess', $this->__('Text sender ID for ').$ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->getAreaText().$this->__(' was saved.')); } else { Mage::getSingleton('adminhtml/session')->setData('routesuccess', $this->__('Own number sender ID for ').$ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->getAreaText().$this->__(' was saved.')); } } } } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { Mage::getSingleton('adminhtml/session')->addError($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage()); $this->_initLayoutMessages('adminhtml/session'); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setError(true); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setMessage($this->getLayout()->getMessagesBlock()->getGroupedHtml()); } } $this->getResponse()->setBody($ia1a238c1f12f3901520c7ca55efa646e471f7f6e->toJson()); } public function savesenderAction() { if (Mage::getSingleton('adminhtml/session')->hasData('routes')) { $this->_redirect('*/*/addroutesender'); } else { Mage::getSingleton('adminhtml/session')->addSuccess(Mage::getSingleton('adminhtml/session')->getData('routesuccess')); Mage::getSingleton('adminhtml/session')->unsetData('routesuccess'); $this->_redirect('*/*/index'); } } public function updatepricelistAction() { $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec = Mage::getSingleton('magesms/routes')->updatepricelist($this->profile->currency); Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Pricelist was successfully updated.')); $this->_redirect('*/*/index'); } public function alternativeAction() { $this->_initAction(); $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock( 'Topefekt_Magesms_Block_Template', 'my_block_name_here', array('template' => 'topefekt/magesms/wizard-alternative.phtml') ); $i7d411c0cc32cdb65ec82b9e8d79aa996946f5538 = $this->getRequest()->getParam('id'); $ice10b700e3771fcda63608142bce93b608228583 = Mage::getModel('magesms/routes')->load($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538); if ($ice10b700e3771fcda63608142bce93b608228583->getSendertype() == Topefekt_Magesms_Model_Routes::SENDER_TEXT) { $i8ee45e0018a32fb1a855b82624506e35789cc4d2->setRoute($ice10b700e3771fcda63608142bce93b608228583); $ie7d1444276fe9dee937fd96d6e0519397fdc5701 = Mage::getModel('core/store_group')->getCollection()->setLoadDefault(false); $i9bd2c88ca2206122845c5e189e2b6856a2409e3a = Mage::getModel('magesms/routes_alternative')->getCollection()->addFieldToFilter('route_id', $ice10b700e3771fcda63608142bce93b608228583->getId()); foreach($ie7d1444276fe9dee937fd96d6e0519397fdc5701 as $i7079b107a03c03d74ad14b853dad74b85b2d25d1) { $i7079b107a03c03d74ad14b853dad74b85b2d25d1->setTextsender($ice10b700e3771fcda63608142bce93b608228583->getData('senderID')); foreach($i9bd2c88ca2206122845c5e189e2b6856a2409e3a as $ida3b491904fb073f446bf820cd55a0ff69b347d1) { if ($ida3b491904fb073f446bf820cd55a0ff69b347d1->getStoreGroupId() == $i7079b107a03c03d74ad14b853dad74b85b2d25d1->getId()) { $i7079b107a03c03d74ad14b853dad74b85b2d25d1->setTextsenderAlternative($ida3b491904fb073f446bf820cd55a0ff69b347d1->getTextsender()); break; } } } $i8ee45e0018a32fb1a855b82624506e35789cc4d2->setStores($ie7d1444276fe9dee937fd96d6e0519397fdc5701); $this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); $this->renderLayout(); return $this; } $this->_redirect('*/*/index'); } public function validatesenderalternativeAction() { $ia1a238c1f12f3901520c7ca55efa646e471f7f6e = new Varien_Object(); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setError(false); if ( $this->getRequest()->getPost() ) { $i75cfaf6baf7d451ab67af9aeef048aecfea24a82 = Mage::getModel('core/resource_transaction'); try { $iacbd1c78463510856e506611fe14b5e1173581a6 = Mage::app()->getRequest(); $i9bd2c88ca2206122845c5e189e2b6856a2409e3a = Mage::getModel('magesms/routes_alternative')->getCollection()->addFieldToFilter('route_id', $this->getRequest()->getParam('id')); $if2edf17aeebbb7b610065024e328c82ec7b37bbe = $iacbd1c78463510856e506611fe14b5e1173581a6->getParam('store_group'); foreach($i9bd2c88ca2206122845c5e189e2b6856a2409e3a as $ida3b491904fb073f446bf820cd55a0ff69b347d1) { $if433319f9b66f967b64d332ee0b51bea06276d26 = false; foreach($if2edf17aeebbb7b610065024e328c82ec7b37bbe as $i3bf172bc34c83f4a18624b192bc0bd7c4d647a66=>$i340682ca0ed5a64e8ea449191da847abaf0aec6f) { if ($ida3b491904fb073f446bf820cd55a0ff69b347d1->getStoreGroupId() == $i3bf172bc34c83f4a18624b192bc0bd7c4d647a66) { $if433319f9b66f967b64d332ee0b51bea06276d26 = true; if ($ida3b491904fb073f446bf820cd55a0ff69b347d1->getTextsender() != $i340682ca0ed5a64e8ea449191da847abaf0aec6f) { if (!$i340682ca0ed5a64e8ea449191da847abaf0aec6f) { $ida3b491904fb073f446bf820cd55a0ff69b347d1->isDeleted(true); } else { $ida3b491904fb073f446bf820cd55a0ff69b347d1->setTextsender($i340682ca0ed5a64e8ea449191da847abaf0aec6f); } } unset($if2edf17aeebbb7b610065024e328c82ec7b37bbe[$i3bf172bc34c83f4a18624b192bc0bd7c4d647a66]); break; } } if ($if433319f9b66f967b64d332ee0b51bea06276d26 !== true) $ida3b491904fb073f446bf820cd55a0ff69b347d1->isDeleted(true); $i75cfaf6baf7d451ab67af9aeef048aecfea24a82->addObject($ida3b491904fb073f446bf820cd55a0ff69b347d1); } foreach($if2edf17aeebbb7b610065024e328c82ec7b37bbe as $i3bf172bc34c83f4a18624b192bc0bd7c4d647a66=>$i340682ca0ed5a64e8ea449191da847abaf0aec6f) { $ida3b491904fb073f446bf820cd55a0ff69b347d1 = Mage::getModel('magesms/routes_alternative'); $ida3b491904fb073f446bf820cd55a0ff69b347d1->setRouteId($this->getRequest()->getParam('id')); $ida3b491904fb073f446bf820cd55a0ff69b347d1->setStoreGroupId($i3bf172bc34c83f4a18624b192bc0bd7c4d647a66); $ida3b491904fb073f446bf820cd55a0ff69b347d1->setTextsender($i340682ca0ed5a64e8ea449191da847abaf0aec6f); $i75cfaf6baf7d451ab67af9aeef048aecfea24a82->addObject($ida3b491904fb073f446bf820cd55a0ff69b347d1); } $i75cfaf6baf7d451ab67af9aeef048aecfea24a82->save(); } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { Mage::getSingleton('adminhtml/session')->addError($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage()); $this->_initLayoutMessages('adminhtml/session'); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setError(true); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setMessage($this->getLayout()->getMessagesBlock()->getGroupedHtml()); } } $this->getResponse()->setBody($ia1a238c1f12f3901520c7ca55efa646e471f7f6e->toJson()); } public function savesenderalternativeAction() { $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec = Mage::getModel('magesms/routes')->load($this->getRequest()->getParam('id')); Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Text sender ID for ').$ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->getAreaText().$this->__(' was saved.')); $this->_redirect('*/*/index'); } protected function _initAction() { $this->loadLayout() ->_setActiveMenu('magesms/wizard') ->_addBreadcrumb(Mage::helper('magesms')->__('Wizard'), Mage::helper('magesms')->__('Wizard')) ->_title(Mage::helper('magesms')->__('MageSMS')) ->_title(Mage::helper('magesms')->__('SMS Settings')) ; $this->getLayout()->getBlock('head')->addCss('css/topefekt/magesms/stylesheet.css') ->addJs('topefekt/functions.js'); return $this; } }
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
+ class Topefekt_Magesms_Adminhtml_Magesms_WizardController extends Topefekt_Magesms_Controller_Action { public $confirmsms; protected function _construct() { parent::_construct(); $this->confirmsms = Mage::helper('magesms')->__('Confirmation code: '); } public function indexAction() { $this->_initAction(); $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock( 'Topefekt_Magesms_Block_Template', 'my_block_name_here', array('template' => 'topefekt/magesms/wizard.phtml') ); $this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); $this->renderLayout(); if (!Mage::app()->loadCache('magesms_pricelist_update') || Mage::app()->loadCache('magesms_pricelist_update') != date('Y-m-d')) { Mage::app()->saveCache(date('Y-m-d'), 'magesms_pricelist_update'); $this->updatepricelistAction(); } return $this; } public function editAction() { $ia118aa93019887b74fdff43dbcf59dce271cae7d = $this->getRequest()->getParam('country0'); $i30f20aafde612a957f7f966cb5b85e35782bc88a = $this->getRequest()->getParam('type'); $i4d3f3bffcd16d5910b26a4511d33ad3b5e4c61d4 = true; if ($ia118aa93019887b74fdff43dbcf59dce271cae7d && $i30f20aafde612a957f7f966cb5b85e35782bc88a) { $i037b855bc01175f2c77d5c3e19eda9a0003feff4 = Mage::getSingleton('magesms/country_area')->getCollection()->addFilter('country_name', $ia118aa93019887b74fdff43dbcf59dce271cae7d); if ($i037b855bc01175f2c77d5c3e19eda9a0003feff4->count()) { $ia61712c27ea241bd7a543dc2b02ea572274d0322 = 'action=dost&username='.urlencode($this->profile->user->user).'&password='.urlencode($this->profile->user->passwd). '&area='.urlencode($i037b855bc01175f2c77d5c3e19eda9a0003feff4->getFirstItem()->getArea()).'&currency='.urlencode($this->profile->currency); $i55dd4e7042a1f9031b84f07f04c37165ce3d0720 = Mage::getModel('magesms/api')->serverPost($ia61712c27ea241bd7a543dc2b02ea572274d0322); if ($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['errno'] == 1 && !empty($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['data'])) { $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec = Mage::getModel('magesms/routes'); $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->setInfo($i55dd4e7042a1f9031b84f07f04c37165ce3d0720['datasrc']); $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->setArea($i037b855bc01175f2c77d5c3e19eda9a0003feff4->getFirstItem()->getArea()); $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->setType($i30f20aafde612a957f7f966cb5b85e35782bc88a); $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->setAreaText($ia118aa93019887b74fdff43dbcf59dce271cae7d); Mage::register('routes', $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec); } else { $i4d3f3bffcd16d5910b26a4511d33ad3b5e4c61d4 = false; } } else { $i4d3f3bffcd16d5910b26a4511d33ad3b5e4c61d4 = false; } } if ($i4d3f3bffcd16d5910b26a4511d33ad3b5e4c61d4) { $this->_initAction(); $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock( 'Topefekt_Magesms_Block_Template', 'my_block_name_here', array('template' => 'topefekt/magesms/wizard-edit.phtml') ); $this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); $this->renderLayout(); return $this; } Mage::getSingleton('adminhtml/session')->addError($this->__('Unable to find a Route to load.')); $this->_redirect('*/*/'); } public function deleteAction() { if ($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538 = $this->getRequest()->getParam('id')) { try { $ice10b700e3771fcda63608142bce93b608228583 = Mage::getModel('magesms/routes')->load($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538); $ice10b700e3771fcda63608142bce93b608228583->delete(); Mage::getSingleton('adminhtml/session')->addSuccess($ice10b700e3771fcda63608142bce93b608228583->getAreaText().$this->__(' was deleted.')); $this->_redirect('*/*/'); return; } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { Mage::getSingleton('adminhtml/session')->addError($this->__($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage())); $this->_redirect('*/*/'); return; } } Mage::getSingleton('adminhtml/session')->addError($this->__('Unable to find a Route to delete.')); $this->_redirect('*/*/'); } public function addcountrycustomerAction() { $this->getRequest()->setParam('type', 'customer'); $this->addcountryAction(); } public function addcountryadminAction() { $this->getRequest()->setParam('type', 'admin'); $this->addcountryAction(); } public function addcountryAction() { $ia118aa93019887b74fdff43dbcf59dce271cae7d = $this->getRequest()->getParam('country0'); $i30f20aafde612a957f7f966cb5b85e35782bc88a = $this->getRequest()->getParam('type'); if ($ia118aa93019887b74fdff43dbcf59dce271cae7d && $i30f20aafde612a957f7f966cb5b85e35782bc88a) { try { $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec = Mage::getSingleton('magesms/routes')->getCollection(); $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->addFilter('area_text', $ia118aa93019887b74fdff43dbcf59dce271cae7d)->addFilter('type', $i30f20aafde612a957f7f966cb5b85e35782bc88a); if ($ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->count()) { $i7d411c0cc32cdb65ec82b9e8d79aa996946f5538 = $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->getFirstItem()->getId(); $this->_redirect('*/*/edit', array('id'=>$i7d411c0cc32cdb65ec82b9e8d79aa996946f5538)); return; } $this->_redirect('*/*/edit', array('country0'=>$ia118aa93019887b74fdff43dbcf59dce271cae7d, 'type'=>$i30f20aafde612a957f7f966cb5b85e35782bc88a, 'id'=>0)); return; } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { Mage::getSingleton('adminhtml/session')->addError($this->__($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage())); $this->_redirect('*/*/'); return; } } Mage::getSingleton('adminhtml/session')->addError($this->__('Unable to find a Route to load.')); $this->_redirect('*/*/'); } public function addrouteAction() { if (Mage::getSingleton('adminhtml/session')->hasData('routes')) { $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec = Mage::getSingleton('adminhtml/session')->getData('routes'); $this->_redirect('*/*/addroutesender'); } else { Mage::getSingleton('adminhtml/session')->addSuccess(Mage::getSingleton('adminhtml/session')->getData('routesuccess').$this->__(' was saved.')); Mage::getSingleton('adminhtml/session')->unsetData('routesuccess'); $this->_redirect('*/*/index'); } } public function addroutesenderAction() { if (Mage::getSingleton('adminhtml/session')->hasData('routes')) { $this->_initAction(); $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock( 'Topefekt_Magesms_Block_Template', 'my_block_name_here', array('template' => 'topefekt/magesms/wizard-sender.phtml') ); $this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); $this->renderLayout(); return $this; } else { $this->_redirect('*/*/index'); } } public function validateAction($i5ba2c5364d6756af3701b475c0706df889a2545f = false) { $ia1a238c1f12f3901520c7ca55efa646e471f7f6e = new Varien_Object(); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setError(false); if ( $this->getRequest()->getPost() ) { try { $iacbd1c78463510856e506611fe14b5e1173581a6 = Mage::app()->getRequest(); $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec = Mage::getModel('magesms/routes'); if ($iacbd1c78463510856e506611fe14b5e1173581a6->getPost('id')) { $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->load($iacbd1c78463510856e506611fe14b5e1173581a6->getPost('id')); } $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->setArea($iacbd1c78463510856e506611fe14b5e1173581a6->getPost('area')); $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->setAreaText($iacbd1c78463510856e506611fe14b5e1173581a6->getPost('country0')); $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->setType($iacbd1c78463510856e506611fe14b5e1173581a6->getPost('type')); $iecc25823227283479c5811005734b6ee2bd56071 = explode(';', $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('isms')); $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->setIsms($iecc25823227283479c5811005734b6ee2bd56071[0]); $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->setSendertype($iecc25823227283479c5811005734b6ee2bd56071[1]); $ibdd27a8dd714410289189d318feb96fe6ed8e07f = $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->validate(); if (is_array($ibdd27a8dd714410289189d318feb96fe6ed8e07f) && sizeof($ibdd27a8dd714410289189d318feb96fe6ed8e07f)) { Mage::throwException(implode('<br />', $ibdd27a8dd714410289189d318feb96fe6ed8e07f)); } else { if ($i5ba2c5364d6756af3701b475c0706df889a2545f === true) { $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->save(); } else { if ($ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->getSendertype() == Topefekt_Magesms_Model_Routes::SENDER_SYSTEM || $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->getSendertype() == Topefekt_Magesms_Model_Routes::SENDER_SIM) { $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->setData('senderID', ''); $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->save(); Mage::getSingleton('adminhtml/session')->unsetData('routes'); Mage::getSingleton('adminhtml/session')->setData('routesuccess', $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->getAreaText()); } else { Mage::getSingleton('adminhtml/session')->setData('routes', $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec); } } } } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { Mage::getSingleton('adminhtml/session')->addError($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage()); $this->_initLayoutMessages('adminhtml/session'); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setError(true); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setMessage($this->getLayout()->getMessagesBlock()->getGroupedHtml()); } } $this->getResponse()->setBody($ia1a238c1f12f3901520c7ca55efa646e471f7f6e->toJson()); } public function validatesenderAction() { $ia1a238c1f12f3901520c7ca55efa646e471f7f6e = new Varien_Object(); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setError(false); if ( $this->getRequest()->getPost() ) { try { $iacbd1c78463510856e506611fe14b5e1173581a6 = Mage::app()->getRequest(); $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec = Mage::getSingleton('adminhtml/session')->getData('routes'); if ($ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->displayCode !== true) { $i1b3f50fe6674f47cc7c1967f93ff153879178f04 = trim(($i51c6d8e5b3a92b4b73711680253408ec6d3d25f6 = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('sender')) ? $i51c6d8e5b3a92b4b73711680253408ec6d3d25f6 : $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('newsender')); $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->setData('senderID', $i1b3f50fe6674f47cc7c1967f93ff153879178f04); } else { $id3e549697752385571e09ffe4add9278d2d6923b = $iacbd1c78463510856e506611fe14b5e1173581a6->getPost('code'); $i1b3f50fe6674f47cc7c1967f93ff153879178f04 = $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->getData('senderID'); } $ibdd27a8dd714410289189d318feb96fe6ed8e07f = $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->validate(true); if (is_array($ibdd27a8dd714410289189d318feb96fe6ed8e07f) && sizeof($ibdd27a8dd714410289189d318feb96fe6ed8e07f)) { Mage::throwException(implode('<br />', $ibdd27a8dd714410289189d318feb96fe6ed8e07f)); } else { $i47f954bfb9dd4be93a5c46b2c8260d3fbc064235 = Mage::getModel('core/resource_transaction') ->addObject($ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec); if ($ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->getSendertype() == Topefekt_Magesms_Model_Routes::SENDER_OWN) { $i451f679eaafeecb81387b150019f0d9e0fa83d16 = Mage::getModel('magesms/api'); if ($ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->displayCode !== true) { $i74c7f58458d186850e8386ae20067ea0a7958311 = $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->getGate($i1b3f50fe6674f47cc7c1967f93ff153879178f04, 'admin'); $i9e1925546463c5a41ccbc625ed973556cc86a495 = ''; if(!$i74c7f58458d186850e8386ae20067ea0a7958311->isEmpty()): $i9e1925546463c5a41ccbc625ed973556cc86a495 = base64_decode("JmlzbXM9").urlencode($i74c7f58458d186850e8386ae20067ea0a7958311->getIsms()).base64_decode("JnNlbmRlcj0=").urlencode($i74c7f58458d186850e8386ae20067ea0a7958311->getData('senderID')); endif; $ia61712c27ea241bd7a543dc2b02ea572274d0322 = "action=checksenderID&text_sms=".urlencode($this->confirmsms).base64_decode("JnVzZXJuYW1lPQ==").urlencode($this->profile->user->user). base64_decode("JnBhc3N3b3JkPQ==").urlencode($this->profile->user->passwd).base64_decode("JnNlbmRlcklEPQ==").urlencode($i1b3f50fe6674f47cc7c1967f93ff153879178f04).$i9e1925546463c5a41ccbc625ed973556cc86a495; $ia61712c27ea241bd7a543dc2b02ea572274d0322 = $i451f679eaafeecb81387b150019f0d9e0fa83d16->serverPost($ia61712c27ea241bd7a543dc2b02ea572274d0322); if (in_array($ia61712c27ea241bd7a543dc2b02ea572274d0322['errno'], array(1, 11))) { $i5ee2fa256ff77dd811a9c1911f7563263a694e4b = Mage::getSingleton('magesms/smshistory'); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setNumber('+'.$i1b3f50fe6674f47cc7c1967f93ff153879178f04); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setDate(date('Y-m-d h:i:s', Mage::getModel('core/date')->timestamp(time()))); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setText($this->confirmsms); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setStatus(1); list($ie10d5ed46013be2962a9d08e0e1912a9c56891b4, $i58457975a91d59a84d2920953badcb7365ac1f01, $if928b7780c12c52495a2f84d8c183269cfcb7c63) = explode("__", $ia61712c27ea241bd7a543dc2b02ea572274d0322['datasrc']); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setPrice($i58457975a91d59a84d2920953badcb7365ac1f01); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setCredit($if928b7780c12c52495a2f84d8c183269cfcb7c63); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setSender($i74c7f58458d186850e8386ae20067ea0a7958311->getData('senderID')); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setUnicode(0); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setType(Topefekt_Magesms_Model_Sms::TYPE_ADMIN); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setSmsid($ie10d5ed46013be2962a9d08e0e1912a9c56891b4); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->setTotal(1); $i5ee2fa256ff77dd811a9c1911f7563263a694e4b->save(); $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->displayCode = true; Mage::getSingleton('adminhtml/session')->setData('routes', $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec); } elseif ($ia61712c27ea241bd7a543dc2b02ea572274d0322['errno'] == 111) { } elseif ($ia61712c27ea241bd7a543dc2b02ea572274d0322['errno'] == 3 && $ia61712c27ea241bd7a543dc2b02ea572274d0322['error'] == 9) { Mage::throwException(Mage::helper('magesms')->__('error - wrong number or unavailable')); } elseif ($ia61712c27ea241bd7a543dc2b02ea572274d0322['errno'] == 3 && $ia61712c27ea241bd7a543dc2b02ea572274d0322['error'] == 10) { Mage::throwException(Mage::helper('magesms')->__('error - low credit for sending validation SMS')); } elseif ($ia61712c27ea241bd7a543dc2b02ea572274d0322['errno'] == 3 && $ia61712c27ea241bd7a543dc2b02ea572274d0322['error'] == 15) { Mage::throwException(Mage::helper('magesms')->__('error - unauthorized senderID in confirmation sms')); } elseif ($ia61712c27ea241bd7a543dc2b02ea572274d0322['errno'] == 3) { Mage::throwException(Mage::helper('magesms')->__('error - '.$ia61712c27ea241bd7a543dc2b02ea572274d0322['error'])); } elseif ($ia61712c27ea241bd7a543dc2b02ea572274d0322['errno'] == 4) { Mage::throwException(Mage::helper('magesms')->__('login error')); } else { Mage::throwException(Mage::helper('magesms')->__('can not connect to SMS server').' '.$ia61712c27ea241bd7a543dc2b02ea572274d0322['error']); } } else { $ia61712c27ea241bd7a543dc2b02ea572274d0322 = "action=checksenderIDcode&username=".urlencode($this->profile->user->user).base64_decode("JnBhc3N3b3JkPQ==").urlencode($this->profile->user->passwd). base64_decode("JmNvZGU9").urlencode($id3e549697752385571e09ffe4add9278d2d6923b).base64_decode("JnNlbmRlcklEPQ==").urlencode($ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->getData('senderID')); $ia61712c27ea241bd7a543dc2b02ea572274d0322 = $i451f679eaafeecb81387b150019f0d9e0fa83d16->serverPost($ia61712c27ea241bd7a543dc2b02ea572274d0322); if ($ia61712c27ea241bd7a543dc2b02ea572274d0322['errno'] == 1) { $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->displayCode = false; } elseif ($ia61712c27ea241bd7a543dc2b02ea572274d0322['errno'] == 3) { Mage::throwException(Mage::helper('magesms')->__('error - ').$ia61712c27ea241bd7a543dc2b02ea572274d0322['error']); } elseif ($ia61712c27ea241bd7a543dc2b02ea572274d0322['errno'] == 4) { Mage::throwException(Mage::helper('magesms')->__('login error')); } elseif ($ia61712c27ea241bd7a543dc2b02ea572274d0322['errno'] == 5) { Mage::throwException(Mage::helper('magesms')->__('correctly confirm sms code')); } else { Mage::throwException(Mage::helper('magesms')->__('can not connect to SMS server')); } } $i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd = 'ownnumbersender'; } else { $i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd = 'textsender'; } if ($ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->displayCode !== true) { $i5b2de9a29c087ac444f7af969b9863250e38aa27 = Mage::getSingleton('magesms/'.$i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd)->getCollection()->addFilter('val', $i1b3f50fe6674f47cc7c1967f93ff153879178f04)->getFirstItem(); $i0a2378e8d343fdb890a9c568b07c541a35a12341 = Mage::getSingleton('magesms/'.$i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd)->load($i5b2de9a29c087ac444f7af969b9863250e38aa27->getId())->setVal($i1b3f50fe6674f47cc7c1967f93ff153879178f04); $i47f954bfb9dd4be93a5c46b2c8260d3fbc064235->addObject($i0a2378e8d343fdb890a9c568b07c541a35a12341) ->save(); Mage::getSingleton('adminhtml/session')->unsetData('routes'); if ($i2e5aa867ea7c6f8ed9ffffe56b63b837364669dd == 'textsender') { Mage::getSingleton('adminhtml/session')->setData('routesuccess', $this->__('Text sender ID for ').$ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->getAreaText().$this->__(' was saved.')); } else { Mage::getSingleton('adminhtml/session')->setData('routesuccess', $this->__('Own number sender ID for ').$ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->getAreaText().$this->__(' was saved.')); } } } } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { Mage::getSingleton('adminhtml/session')->addError($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage()); $this->_initLayoutMessages('adminhtml/session'); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setError(true); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setMessage($this->getLayout()->getMessagesBlock()->getGroupedHtml()); } } $this->getResponse()->setBody($ia1a238c1f12f3901520c7ca55efa646e471f7f6e->toJson()); } public function savesenderAction() { if (Mage::getSingleton('adminhtml/session')->hasData('routes')) { $this->_redirect('*/*/addroutesender'); } else { Mage::getSingleton('adminhtml/session')->addSuccess(Mage::getSingleton('adminhtml/session')->getData('routesuccess')); Mage::getSingleton('adminhtml/session')->unsetData('routesuccess'); $this->_redirect('*/*/index'); } } public function updatepricelistAction() { $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec = Mage::getSingleton('magesms/routes')->updatepricelist($this->profile->currency); Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Pricelist was successfully updated.')); $this->_redirect('*/*/index'); } public function alternativeAction() { $this->_initAction(); $i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock( 'Topefekt_Magesms_Block_Template', 'my_block_name_here', array('template' => 'topefekt/magesms/wizard-alternative.phtml') ); $i7d411c0cc32cdb65ec82b9e8d79aa996946f5538 = $this->getRequest()->getParam('id'); $ice10b700e3771fcda63608142bce93b608228583 = Mage::getModel('magesms/routes')->load($i7d411c0cc32cdb65ec82b9e8d79aa996946f5538); if ($ice10b700e3771fcda63608142bce93b608228583->getSendertype() == Topefekt_Magesms_Model_Routes::SENDER_TEXT) { $i8ee45e0018a32fb1a855b82624506e35789cc4d2->setRoute($ice10b700e3771fcda63608142bce93b608228583); $ie7d1444276fe9dee937fd96d6e0519397fdc5701 = Mage::getModel('core/store_group')->getCollection()->setLoadDefault(false); $i9bd2c88ca2206122845c5e189e2b6856a2409e3a = Mage::getModel('magesms/routes_alternative')->getCollection()->addFieldToFilter('route_id', $ice10b700e3771fcda63608142bce93b608228583->getId()); foreach($ie7d1444276fe9dee937fd96d6e0519397fdc5701 as $i7079b107a03c03d74ad14b853dad74b85b2d25d1) { $i7079b107a03c03d74ad14b853dad74b85b2d25d1->setTextsender($ice10b700e3771fcda63608142bce93b608228583->getData('senderID')); foreach($i9bd2c88ca2206122845c5e189e2b6856a2409e3a as $ida3b491904fb073f446bf820cd55a0ff69b347d1) { if ($ida3b491904fb073f446bf820cd55a0ff69b347d1->getStoreGroupId() == $i7079b107a03c03d74ad14b853dad74b85b2d25d1->getId()) { $i7079b107a03c03d74ad14b853dad74b85b2d25d1->setTextsenderAlternative($ida3b491904fb073f446bf820cd55a0ff69b347d1->getTextsender()); break; } } } $i8ee45e0018a32fb1a855b82624506e35789cc4d2->setStores($ie7d1444276fe9dee937fd96d6e0519397fdc5701); $this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); $this->renderLayout(); return $this; } $this->_redirect('*/*/index'); } public function validatesenderalternativeAction() { $ia1a238c1f12f3901520c7ca55efa646e471f7f6e = new Varien_Object(); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setError(false); if ( $this->getRequest()->getPost() ) { $i75cfaf6baf7d451ab67af9aeef048aecfea24a82 = Mage::getModel('core/resource_transaction'); try { $iacbd1c78463510856e506611fe14b5e1173581a6 = Mage::app()->getRequest(); $i9bd2c88ca2206122845c5e189e2b6856a2409e3a = Mage::getModel('magesms/routes_alternative')->getCollection()->addFieldToFilter('route_id', $this->getRequest()->getParam('id')); $if2edf17aeebbb7b610065024e328c82ec7b37bbe = $iacbd1c78463510856e506611fe14b5e1173581a6->getParam('store_group'); foreach($i9bd2c88ca2206122845c5e189e2b6856a2409e3a as $ida3b491904fb073f446bf820cd55a0ff69b347d1) { $if433319f9b66f967b64d332ee0b51bea06276d26 = false; foreach($if2edf17aeebbb7b610065024e328c82ec7b37bbe as $i3bf172bc34c83f4a18624b192bc0bd7c4d647a66=>$i340682ca0ed5a64e8ea449191da847abaf0aec6f) { if ($ida3b491904fb073f446bf820cd55a0ff69b347d1->getStoreGroupId() == $i3bf172bc34c83f4a18624b192bc0bd7c4d647a66) { $if433319f9b66f967b64d332ee0b51bea06276d26 = true; if ($ida3b491904fb073f446bf820cd55a0ff69b347d1->getTextsender() != $i340682ca0ed5a64e8ea449191da847abaf0aec6f) { if (!$i340682ca0ed5a64e8ea449191da847abaf0aec6f) { $ida3b491904fb073f446bf820cd55a0ff69b347d1->isDeleted(true); } else { $ida3b491904fb073f446bf820cd55a0ff69b347d1->setTextsender($i340682ca0ed5a64e8ea449191da847abaf0aec6f); } } unset($if2edf17aeebbb7b610065024e328c82ec7b37bbe[$i3bf172bc34c83f4a18624b192bc0bd7c4d647a66]); break; } } if ($if433319f9b66f967b64d332ee0b51bea06276d26 !== true) $ida3b491904fb073f446bf820cd55a0ff69b347d1->isDeleted(true); $i75cfaf6baf7d451ab67af9aeef048aecfea24a82->addObject($ida3b491904fb073f446bf820cd55a0ff69b347d1); } foreach($if2edf17aeebbb7b610065024e328c82ec7b37bbe as $i3bf172bc34c83f4a18624b192bc0bd7c4d647a66=>$i340682ca0ed5a64e8ea449191da847abaf0aec6f) { $ida3b491904fb073f446bf820cd55a0ff69b347d1 = Mage::getModel('magesms/routes_alternative'); $ida3b491904fb073f446bf820cd55a0ff69b347d1->setRouteId($this->getRequest()->getParam('id')); $ida3b491904fb073f446bf820cd55a0ff69b347d1->setStoreGroupId($i3bf172bc34c83f4a18624b192bc0bd7c4d647a66); $ida3b491904fb073f446bf820cd55a0ff69b347d1->setTextsender($i340682ca0ed5a64e8ea449191da847abaf0aec6f); $i75cfaf6baf7d451ab67af9aeef048aecfea24a82->addObject($ida3b491904fb073f446bf820cd55a0ff69b347d1); } $i75cfaf6baf7d451ab67af9aeef048aecfea24a82->save(); } catch (Exception $i8c174347956f0a76258a09557543e84f88beb4a0) { Mage::getSingleton('adminhtml/session')->addError($i8c174347956f0a76258a09557543e84f88beb4a0->getMessage()); $this->_initLayoutMessages('adminhtml/session'); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setError(true); $ia1a238c1f12f3901520c7ca55efa646e471f7f6e->setMessage($this->getLayout()->getMessagesBlock()->getGroupedHtml()); } } $this->getResponse()->setBody($ia1a238c1f12f3901520c7ca55efa646e471f7f6e->toJson()); } public function savesenderalternativeAction() { $ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec = Mage::getModel('magesms/routes')->load($this->getRequest()->getParam('id')); Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Text sender ID for ').$ie8b7b1b62dc29a284d794c9f11a8ee2ea7472eec->getAreaText().$this->__(' was saved.')); $this->_redirect('*/*/index'); } protected function _initAction() { parent::_initAction(); $this->_setActiveMenu('magesms/wizard') ->_title(Mage::helper('magesms')->__('SMS Settings')) ; return $this; } }
app/code/community/Topefekt/Magesms/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
<config>
3
<modules>
4
<Topefekt_Magesms>
5
- <version>1.1.5</version>
6
</Topefekt_Magesms>
7
</modules>
8
@@ -93,6 +93,12 @@
93
<routes_alternative>
94
<table>magesms_routes_alternative</table>
95
</routes_alternative>
96
</entities>
97
</magesms_mysql4>
98
<cataloginventory_resource>
2
<config>
3
<modules>
4
<Topefekt_Magesms>
5
+ <version>1.2.0</version>
6
</Topefekt_Magesms>
7
</modules>
8
93
<routes_alternative>
94
<table>magesms_routes_alternative</table>
95
</routes_alternative>
96
+ <template>
97
+ <table>magesms_template</table>
98
+ </template>
99
+ <marketing_filter>
100
+ <table>magesms_marketing_filter</table>
101
+ </marketing_filter>
102
</entities>
103
</magesms_mysql4>
104
<cataloginventory_resource>
app/code/community/Topefekt/Magesms/sql/magesms_setup/mysql4-upgrade-1.1.5-1.2.0.php ADDED
@@ -0,0 +1,38 @@
1
+ <?php
2
+ /**
3
+ * Mage SMS - SMS notification & SMS marketing
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the BSD 3-Clause License
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ * @category TOPefekt
12
+ * @package TOPefekt_Magesms
13
+ * @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
+ * @license http://opensource.org/licenses/BSD-3-Clause
15
+ */
16
+ $iddb18dc4afa6663cf07a52c741943ff87cbe3896 = $this; $iddb18dc4afa6663cf07a52c741943ff87cbe3896->startSetup(); $iddb18dc4afa6663cf07a52c741943ff87cbe3896->run("
17
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('magesms_marketing_filter')}` (
18
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
19
+ `name` varchar(200) NOT NULL,
20
+ `filter` text,
21
+ `disabled` text,
22
+ `disabled_counter` tinyint(4) NOT NULL DEFAULT '0',
23
+ `date` datetime NOT NULL,
24
+ PRIMARY KEY (`id`)
25
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
26
+
27
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('magesms_template')}` (
28
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
29
+ `name` varchar(200) NOT NULL,
30
+ `template` text,
31
+ `unicode` tinyint(1) NOT NULL DEFAULT '0',
32
+ `unique` tinyint(1) NOT NULL DEFAULT '0',
33
+ `date` datetime NOT NULL,
34
+ `type` tinyint(4) NOT NULL,
35
+ PRIMARY KEY (`id`)
36
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
37
+
38
+ ");
app/design/adminhtml/default/default/template/topefekt/magesms/about.phtml CHANGED
@@ -13,4 +13,4 @@
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
- ?><h2><?php echo Mage::helper('magesms')->__('About'); ?></h2><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/magesms-logo.png'; ?>" alt="Mage SMS" style="float: right" /><b><?php echo Mage::helper('magesms')->__('Mage SMS module 2013-%s, version ', date('Y')).Mage::getConfig()->getModuleConfig('Topefekt_Magesms')->version; ?></b><br /><?php echo Mage::helper('magesms')->__('Copyright © TOPefekt s.r.o., All rights reserved'); ?><br /><br /><b><?php echo Mage::helper('magesms')->__('Supported Magento versions:'); ?></b><?php echo Mage::getConfig()->getNode('default/config/supported')->versions; ?><br /><br /><b><?php echo Mage::helper('magesms')->__('Developer:'); ?></b><br /><?php echo Mage::helper('magesms')->__('TOPefekt s.r.o.'); ?><br /><br /><b><?php echo Mage::helper('magesms')->__('Address:'); ?></b><br /><?php echo Mage::helper('magesms')->__('B. Nemcove 767/13'); ?><br /><?php echo Mage::helper('magesms')->__('78701 Sumperk'); ?><br /><?php echo Mage::helper('magesms')->__('Czech Republic'); ?><br /><?php echo Mage::helper('magesms')->__('VAT: CZ29444268'); ?><br /><br /><b><?php echo Mage::helper('magesms')->__('Office Telephone:'); ?></b><br /><?php echo Mage::helper('magesms')->__('+420 581 110 998'); ?><br /><br /><b><?php echo Mage::helper('magesms')->__('E-mail:'); ?></b><br /><a href="mailto:<?php echo Mage::helper('magesms')->__('sales@topefekt.com'); ?>"><?php echo Mage::helper('magesms')->__('sales@topefekt.com'); ?></a><br /><a href="mailto:<?php echo Mage::helper('magesms')->__('support@topefekt.com'); ?>"><?php echo Mage::helper('magesms')->__('support@topefekt.com'); ?></a><br /><br /><b><?php echo Mage::helper('magesms')->__('Web:'); ?></b><br /><a href="http://<?php echo Mage::helper('magesms')->__('www.mage-sms.com'); ?>"><?php echo Mage::helper('magesms')->__('www.mage-sms.com'); ?></a><br /><br /><b><?php echo Mage::helper('magesms')->__('Manual:'); ?></b><br /><a href="http://<?php echo Mage::helper('magesms')->__('www.mage-sms.com/manual.html'); ?>"><?php echo Mage::helper('magesms')->__('www.mage-sms.com/manual.html'); ?></a><br /><br /><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/topefekt-logo.gif'; ?>" alt="TOPefekt" />
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
+ ?><h2><?php echo Mage::helper('magesms')->__('About'); ?></h2><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/magesms-logo.png'; ?>" alt="Mage SMS" style="float: right" /><b><?php echo Mage::helper('magesms')->__('Mage SMS module 2013-%s, version ', date('Y')).Mage::getConfig()->getModuleConfig('Topefekt_Magesms')->version; ?></b><br /><?php echo Mage::helper('magesms')->__('Copyright © TOPefekt s.r.o., All rights reserved'); ?><br /><br /><b><?php echo Mage::helper('magesms')->__('Supported Magento versions:'); ?></b><?php echo Mage::getConfig()->getNode('default/config/supported')->versions; ?><br /><br /><b><?php echo Mage::helper('magesms')->__('Developer:'); ?></b><br /><?php echo Mage::helper('magesms')->__('TOPefekt s.r.o.'); ?><br /><br /><b><?php echo Mage::helper('magesms')->__('Address:'); ?></b><br /><?php echo Mage::helper('magesms')->__('B. Nemcove 767/13'); ?><br /><?php echo Mage::helper('magesms')->__('78701 Sumperk'); ?><br /><?php echo Mage::helper('magesms')->__('Czech Republic'); ?><br /><?php echo Mage::helper('magesms')->__('VAT: CZ29444268'); ?><br /><br /><b><?php echo Mage::helper('magesms')->__('Office Telephone:'); ?></b><br /><?php echo Mage::helper('magesms')->__('+420 581 110 998'); ?><br /><br /><b><?php echo Mage::helper('magesms')->__('E-mail:'); ?></b><br /><a href="mailto:<?php echo Mage::helper('magesms')->__('sales@topefekt.com'); ?>"><?php echo Mage::helper('magesms')->__('sales@topefekt.com'); ?></a><br /><a href="mailto:<?php echo Mage::helper('magesms')->__('support@topefekt.com'); ?>"><?php echo Mage::helper('magesms')->__('support@topefekt.com'); ?></a><br /><br /><b><?php echo Mage::helper('magesms')->__('Web:'); ?></b><br /><a href="http://<?php echo Mage::helper('magesms')->__('www.mage-sms.com'); ?>"><?php echo Mage::helper('magesms')->__('www.mage-sms.com'); ?></a><br /><br /><b><?php echo Mage::helper('magesms')->__('Facebook:'); ?></b><br /><iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Fmagentosms&amp;width&amp;layout=button_count&amp;action=like&amp;show_faces=false&amp;share=true&amp;height=21&amp;appId=242281502635180" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:21px;" allowTransparency="true"></iframe><br /><br /><b><?php echo Mage::helper('magesms')->__('Manual:'); ?></b><br /><a href="http://<?php echo Mage::helper('magesms')->__('www.mage-sms.com/manual.html'); ?>"><?php echo Mage::helper('magesms')->__('www.mage-sms.com/manual.html'); ?></a><br /><br /><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/topefekt-logo.gif'; ?>" alt="TOPefekt" />
app/design/adminhtml/default/default/template/topefekt/magesms/adminsms.phtml CHANGED
@@ -13,10 +13,8 @@
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
- ?><?php $user = $this->profile->user; ?><?php $lang = $this->profile->lang; ?><?php $groups = array( array( 'group' =>0, 'name' =>Mage::helper('magesms')->__('Order status'), 'icon' => 'AdminOrders.gif' ), array( 'group' =>1, 'name' =>Mage::helper('magesms')->__('Order'), 'icon' => 'AdminOrders.gif' ), array( 'group' =>2, 'name' =>Mage::helper('magesms')->__('Account'), 'icon' => 'AdminCustomers.gif' ), array( 'group' =>3, 'name' =>Mage::helper('magesms')->__('Product'), 'icon' => 'AdminCatalog.gif' ), array( 'group' =>4, 'name' =>Mage::helper('magesms')->__('Contact form'), 'icon' => 'AdminCatalog.gif' ), ); ?><script type="text/javascript">//<![CDATA[
17
- function smsr(f){(document.readyState)!=="complete"?setTimeout(smsr,9,f):f()}
18
- //]]></script><h2><?php echo Mage::helper('magesms')->__('Admin SMS'); ?></h2><p><?php echo Mage::helper('magesms')->__('Select events during which shall be shop administrators notified via SMS and customize text of messages.'); ?></p><div id="magesms"><div class="entry-edit"><div class="entry-edit-head"><h4 class="icon-head fieldset-legend head-account"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/AdminTools.gif'; ?>" alt="" /> <?php echo Mage::helper('magesms')->__('Unicode SMS'); ?></h4></div><div class="fieldset grid"><form id="magesms_changeunicode" action="<?php echo Mage::getUrl('*/*/saveunicode') ?>" method="post"><input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" /><div class="margin-form"><p><?php echo Mage::helper('magesms')->__('Check only if you want to use Chinese, Arabic, Greek, Hebrew, Korean, Cyrillic, etc. or diacritic in the text of your SMS message (Unicode text allows you to insert characters in all fonts and various other symbols simultaneously. Number of characters in one SMS will be reduced to 70).'); ?></p><input type="checkbox" id="unicode" name="unicode" value="1" <?php echo ($unicode = Mage::getSingleton('magesms/hooks_unicode')->getCollection()->addFilter('type', 'admin')->getFirstItem()->getUnicode()) ? 'checked' : ''; ?> /><label for="unicode"><?php echo Mage::helper('magesms')->__('Unicode SMS'); ?></label><input type="submit" value="<?php echo Mage::helper('magesms')->__('Save'); ?>" class="form-button" /></div></form></div></div><?php foreach ($groups as $group): ?><div class="entry-edit"><div class="entry-edit-head"><h4 class="icon-head fieldset-legend head-account"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/'.$group['icon']; ?>" alt="" /> <?php echo $group['name']; ?></h4></div><div class="fieldset grid"><?php $hooks = Mage::helper('magesms')->getHooks($group['group'], 'admins'); ?><?php if (count($hooks)): ?><table class="data" id="gridData"><col /><col width="100px" /><?php $even = 1; foreach($hooks as $hook): if ($even) $even = 0; else $even = 1;?><tr id="hist_<?php echo $hook->getName(); ?>" class="pointer hover <?php if ($even) echo 'even'?>"><td><span class="img"><img class="toggle" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/i_plus.gif'; ?>"></span><span class="img" style="display:none"><img class="toggle" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/i_minus.gif'; ?>"></span><?php if ($group['group'] == 0): ?><?php echo $hook->getInfo(); ?> - <?php echo $statusT = Mage::helper('sales')->__($hook->getStatusName()); ?><?php if ($statusT != $hook->getStatusName()): ?> (<?php echo $hook->getStatusName(); ?>)<?php endif; ?><?php else: ?><?php echo $hook->getName(); ?> - <?php echo $hook->getInfo(); ?><?php endif; ?></td><td class="a-center"><?php $title = $hook->getActive() ? Mage::helper('magesms')->__('Sending notifications via SMS is ACTIVE') : Mage::helper('magesms')->__('Sending notifications via SMS is NOT ACTIVE. To activate SMS sending check „Active“ in desired status detail.'); $img = $hook->getActive() ? 'i_accepted.gif' : 'i_canceled.gif'; ?><span style="cursor:help;" title="<?php echo $title; ?>" onclick="popup_title(this)"><img class="toggle" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/'.$img; ?>"></span></td></tr><tr id="histd_<?php echo $hook->getName(); ?>" style="display:none"><td colspan="2"><form id="hook_<?php echo $hook->getName(); ?>" action="<?php echo Mage::getUrl('*/*/savehook') ?>" method="post"><input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" /><input type="hidden" name="type" value="admins" /><input type="hidden" name="name" value="<?php echo $hook->getName(); ?>" /><div style="display:inline-block;width:350px;"><label style="font-weight:normal;text-align:left;width:350px;"><?php echo Mage::helper('magesms')->__('SMS text'); ?></label><br><textarea id="text_<?php echo $hook->getName(); ?>" name="text" class="required-entry input-text" style="width:290px;height:100px;border:1px solid grey;"><?php echo ($text = $hook->getSmstext()) ? $text : $hook->getTemplate(); ?></textarea></div><div style="display:inline-block;width:320px;"><label style="font-weight:normal;text-align:left"><?php echo Mage::helper('magesms')->__('Preview'); ?> (<span id="label_<?php echo $hook->getName(); ?>"></span>)</label><br><textarea id="textfake_<?php echo $hook->getName(); ?>" name="textfake" disabled="disabled" style="width:290px;height:100px;border:1px solid grey;"></textarea></div><div style="display:inline-block;width:310px; padding-top: 20px;"><?php $admins = Mage::getSingleton('magesms/admins')->getCollection(); $stores = Mage::getModel('core/store_group')->getCollection()->setLoadDefault(false) ?><table class="data"><tr class="headings"><th colspan="<?php echo $stores->count()+1; ?>"><?php echo Mage::helper('magesms')->__('Administrators'); ?></th></tr><?php foreach($admins as $admin): ?><tr><td><?php echo $admin->getName(); ?></td><?php foreach($stores as $store): ?><td><input type="checkbox" name="active_<?php echo $hook->getName().'_'.$admin->getId().'_'.$store->getId(); ?>" id="active_<?php echo $hook->getName().'_'.$admin->getId().'_'.$store->getId(); ?>" value="1" <?php echo !empty($hook[$admin->getId().'_'.$store->getId()]) ? 'checked' : ''; ?> /><label for="active_<?php echo $hook->getName().'_'.$admin->getId().'_'.$store->getId(); ?>"><?php echo $store->getName(); ?></label></td><?php endforeach; ?></tr><?php endforeach; ?></table><br /><br /><br /><div style="float:left;"><input type="submit" value="<?php echo Mage::helper('magesms')->__('Save'); ?>" class="form-button" /></div><div style="float:left;padding-left:20px;"><input value="<?php echo Mage::helper('magesms')->__('Cancel'); ?>" title="Restore unsaved changes to its original state." class="form-button" type="button" onclick="this.form.reset();countitSMS_<?php echo $hook->getName(); ?>.count();" /></div></div></form><script type="text/javascript">//<![CDATA[
19
- countitSMS_<?php echo $hook->getName(); ?> = new countitSMS(document.getElementById('textfake_<?php echo $hook->getName(); ?>'), '<?php echo $unicode; ?>', document.getElementById('label_<?php echo $hook->getName(); ?>'));countitSMS_<?php echo $hook->getName(); ?>.chartext1 = '<?php echo Mage::helper('magesms')->__('Characters: '); ?>';countitSMS_<?php echo $hook->getName(); ?>.chartext2 = '<?php echo Mage::helper('magesms')->__('total sms:'); ?>';countitSMS_<?php echo $hook->getName(); ?>.alert = '';countitSMS_<?php echo $hook->getName(); ?>.translate = {<?php echo Mage::helper('magesms')->hookVariablesJS($hook->getNotice()); ?>};countitSMS_<?php echo $hook->getName(); ?>.copyFrom = document.getElementById('text_<?php echo $hook->getName(); ?>');$('text_<?php echo $hook->getName(); ?>').onkeyup = function() {countitSMS_<?php echo $hook->getName(); ?>.count();};smsr(function() {countitSMS_<?php echo $hook->getName(); ?>.count();countitSMS_<?php echo $hook->getName(); ?>.help(document.getElementById('notice_<?php echo $hook->getName(); ?>'));});
20
//]]></script><div class="clear"></div><span style="font-size:10px;"><?php echo Mage::helper('magesms')->__('Possible variables:'); ?><br /><div id="notice_<?php echo $hook->getName(); ?>"><?php echo $hook->getNotice(); ?></div></span></td></tr><?php endforeach; ?></table><?php endif; ?></div></div><?php endforeach; ?><script type="text/javascript">//<![CDATA[
21
- smsr(function(){var gridData = document.getElementById('magesms');var tr_array = gridData.getElementsByTagName('tr');for (var i=0, len=tr_array.length; i < len; i++) {if (tr_array[i].className.indexOf('hover') !== -1) {tr_array[i].onmouseover = function() {this.className = this.className + ' on-mouse';};tr_array[i].onmouseout = function() {this.className = this.className.replace(' on-mouse', '');};tr_array[i].onclick = function() {var arr = this.id.split('_');var next = document.getElementById('histd_'+arr[1]);if (next.style.display == 'none') {next.style.display = 'table-row';} else {next.style.display = 'none';}var img = this.getElementsByClassName('img');if (img[0].style.display == 'none') {img[0].style.display = 'inline';} else {img[0].style.display = 'none';}if (img[1].style.display == 'none') {img[1].style.display = 'inline';} else {img[1].style.display = 'none';}};}}if (window.location.hash.substr(1)) {$('hist_' + window.location.hash.substr(1)).click();$('hist_' + window.location.hash.substr(1)).scrollIntoView(true);var messageTo = $('hist_' + window.location.hash.substr(1)).parentNode.parentNode.parentNode;var messages = $('messages').cloneNode(true);messageTo.insertBefore(messages, messageTo.childNodes[0]);}});
22
//]]></script></div>
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
+ ?><?php $user = $this->profile->user; ?><?php $lang = $this->profile->lang; ?><?php $groups = array( array( 'group' =>0, 'name' =>Mage::helper('magesms')->__('Order status'), 'icon' => 'AdminOrders.gif' ), array( 'group' =>1, 'name' =>Mage::helper('magesms')->__('Order'), 'icon' => 'AdminOrders.gif' ), array( 'group' =>2, 'name' =>Mage::helper('magesms')->__('Account'), 'icon' => 'AdminCustomers.gif' ), array( 'group' =>3, 'name' =>Mage::helper('magesms')->__('Product'), 'icon' => 'AdminCatalog.gif' ), array( 'group' =>4, 'name' =>Mage::helper('magesms')->__('Contact form'), 'icon' => 'AdminCatalog.gif' ), ); ?><h2><?php echo Mage::helper('magesms')->__('Admin SMS'); ?></h2><p><?php echo Mage::helper('magesms')->__('Select events during which shall be shop administrators notified via SMS and customize text of messages.'); ?></p><div id="magesms"><div class="entry-edit"><div class="entry-edit-head"><h4 class="icon-head fieldset-legend head-account"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/AdminTools.gif'; ?>" alt="" /> <?php echo Mage::helper('magesms')->__('Unicode SMS'); ?></h4></div><div class="fieldset grid"><form id="magesms_changeunicode" action="<?php echo Mage::getUrl('*/*/saveunicode') ?>" method="post"><input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" /><div class="margin-form"><p><?php echo Mage::helper('magesms')->__('Check only if you want to use Chinese, Arabic, Greek, Hebrew, Korean, Cyrillic, etc. or diacritic in the text of your SMS message (Unicode text allows you to insert characters in all fonts and various other symbols simultaneously. Number of characters in one SMS will be reduced to 70).'); ?></p><input type="checkbox" id="unicode" name="unicode" value="1" <?php echo ($unicode = Mage::getSingleton('magesms/hooks_unicode')->getCollection()->addFilter('type', 'admin')->getFirstItem()->getUnicode()) ? 'checked' : ''; ?> /><label for="unicode"><?php echo Mage::helper('magesms')->__('Unicode SMS'); ?></label><input type="submit" value="<?php echo Mage::helper('magesms')->__('Save'); ?>" class="form-button" /></div></form></div></div><?php foreach ($groups as $group): ?><div class="entry-edit"><div class="entry-edit-head"><h4 class="icon-head fieldset-legend head-account"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/'.$group['icon']; ?>" alt="" /> <?php echo $group['name']; ?></h4></div><div class="fieldset grid"><?php $hooks = Mage::helper('magesms')->getHooks($group['group'], 'admins'); ?><?php if (count($hooks)): ?><table class="data" id="gridData"><col /><col width="100px" /><?php $even = 1; foreach($hooks as $hook): if ($even) $even = 0; else $even = 1;?><tr id="hist_<?php echo $hook->getName(); ?>" class="pointer hover <?php if ($even) echo 'even'?>"><td><span class="img"><img class="toggle" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/i_plus.gif'; ?>"></span><span class="img" style="display:none"><img class="toggle" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/i_minus.gif'; ?>"></span><?php if ($group['group'] == 0): ?><?php echo $hook->getInfo(); ?> - <?php echo $statusT = Mage::helper('sales')->__($hook->getStatusName()); ?><?php if ($statusT != $hook->getStatusName()): ?> (<?php echo $hook->getStatusName(); ?>)<?php endif; ?><?php else: ?><?php echo $hook->getName(); ?> - <?php echo $hook->getInfo(); ?><?php endif; ?></td><td class="a-center"><?php $title = $hook->getActive() ? Mage::helper('magesms')->__('Sending notifications via SMS is ACTIVE') : Mage::helper('magesms')->__('Sending notifications via SMS is NOT ACTIVE. To activate SMS sending check „Active“ in desired status detail.'); $img = $hook->getActive() ? 'i_accepted.gif' : 'i_canceled.gif'; ?><span style="cursor:help;" title="<?php echo $title; ?>" onclick="popup_title(this)"><img class="toggle" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/'.$img; ?>"></span></td></tr><tr id="histd_<?php echo $hook->getName(); ?>" style="display:none"><td colspan="2"><form id="hook_<?php echo $hook->getName(); ?>" action="<?php echo Mage::getUrl('*/*/savehook') ?>" method="post"><input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" /><input type="hidden" name="type" value="admins" /><input type="hidden" name="name" value="<?php echo $hook->getName(); ?>" /><div style="display:inline-block;width:350px;"><label style="font-weight:normal;text-align:left;width:350px;"><?php echo Mage::helper('magesms')->__('SMS text'); ?></label><br><textarea id="text_<?php echo $hook->getName(); ?>" name="text" class="required-entry input-text" style="width:290px;height:100px;border:1px solid grey;"><?php echo ($text = $hook->getSmstext()) ? $text : $hook->getTemplate(); ?></textarea></div><div style="display:inline-block;width:320px;"><label style="font-weight:normal;text-align:left"><?php echo Mage::helper('magesms')->__('Preview'); ?> (<span id="label_<?php echo $hook->getName(); ?>"></span>)</label><br><textarea id="textfake_<?php echo $hook->getName(); ?>" name="textfake" disabled="disabled" style="width:290px;height:100px;border:1px solid grey;"></textarea></div><div style="display:inline-block;width:310px; padding-top: 20px;"><?php $admins = Mage::getSingleton('magesms/admins')->getCollection(); $stores = Mage::getModel('core/store_group')->getCollection()->setLoadDefault(false) ?><table class="data"><tr class="headings"><th colspan="<?php echo $stores->count()+1; ?>"><?php echo Mage::helper('magesms')->__('Administrators'); ?></th></tr><?php foreach($admins as $admin): ?><tr><td><?php echo $admin->getName(); ?></td><?php foreach($stores as $store): ?><td><input type="checkbox" name="active_<?php echo $hook->getName().'_'.$admin->getId().'_'.$store->getId(); ?>" id="active_<?php echo $hook->getName().'_'.$admin->getId().'_'.$store->getId(); ?>" value="1" <?php echo !empty($hook[$admin->getId().'_'.$store->getId()]) ? 'checked' : ''; ?> /><label for="active_<?php echo $hook->getName().'_'.$admin->getId().'_'.$store->getId(); ?>"><?php echo $store->getName(); ?></label></td><?php endforeach; ?></tr><?php endforeach; ?></table><br /><br /><br /><div style="float:left;"><input type="submit" value="<?php echo Mage::helper('magesms')->__('Save'); ?>" class="form-button" /></div><div style="float:left;padding-left:20px;"><input value="<?php echo Mage::helper('magesms')->__('Cancel'); ?>" title="Restore unsaved changes to its original state." class="form-button" type="button" onclick="this.form.reset();countitSMS_<?php echo $hook->getName(); ?>.count();" /></div></div></form><script type="text/javascript">//<![CDATA[
17
+ countitSMS_<?php echo $hook->getName(); ?> = new countitSMS(document.getElementById('textfake_<?php echo $hook->getName(); ?>'), '<?php echo $unicode; ?>', document.getElementById('label_<?php echo $hook->getName(); ?>'));countitSMS_<?php echo $hook->getName(); ?>.chartext1 = '<?php echo Mage::helper('magesms')->__('Characters: '); ?>';countitSMS_<?php echo $hook->getName(); ?>.chartext2 = '<?php echo Mage::helper('magesms')->__('total sms:'); ?>';countitSMS_<?php echo $hook->getName(); ?>.alert = '';countitSMS_<?php echo $hook->getName(); ?>.translate = {<?php echo Mage::helper('magesms')->hookVariablesJS($hook->getNotice()); ?>};countitSMS_<?php echo $hook->getName(); ?>.copyFrom = document.getElementById('text_<?php echo $hook->getName(); ?>');$('text_<?php echo $hook->getName(); ?>').onkeyup = function() {countitSMS_<?php echo $hook->getName(); ?>.count();};Event.observe(window, "load", function() {countitSMS_<?php echo $hook->getName(); ?>.count();countitSMS_<?php echo $hook->getName(); ?>.help(document.getElementById('notice_<?php echo $hook->getName(); ?>'));});
18
//]]></script><div class="clear"></div><span style="font-size:10px;"><?php echo Mage::helper('magesms')->__('Possible variables:'); ?><br /><div id="notice_<?php echo $hook->getName(); ?>"><?php echo $hook->getNotice(); ?></div></span></td></tr><?php endforeach; ?></table><?php endif; ?></div></div><?php endforeach; ?><script type="text/javascript">//<![CDATA[
19
+ Event.observe(window, "load", function(){var gridData = document.getElementById('magesms');var tr_array = gridData.getElementsByTagName('tr');for (var i=0, len=tr_array.length; i < len; i++) {if (tr_array[i].className.indexOf('hover') !== -1) {tr_array[i].onmouseover = function() {this.className = this.className + ' on-mouse';};tr_array[i].onmouseout = function() {this.className = this.className.replace(' on-mouse', '');};tr_array[i].onclick = function() {var arr = this.id.split('_');var next = document.getElementById('histd_'+arr[1]);if (next.style.display == 'none') {next.style.display = 'table-row';} else {next.style.display = 'none';}var img = this.getElementsByClassName('img');if (img[0].style.display == 'none') {img[0].style.display = 'inline';} else {img[0].style.display = 'none';}if (img[1].style.display == 'none') {img[1].style.display = 'inline';} else {img[1].style.display = 'none';}};}}if (window.location.hash.substr(1)) {$('hist_' + window.location.hash.substr(1)).click();$('hist_' + window.location.hash.substr(1)).scrollIntoView(true);var messageTo = $('hist_' + window.location.hash.substr(1)).parentNode.parentNode.parentNode;var messages = $('messages').cloneNode(true);messageTo.insertBefore(messages, messageTo.childNodes[0]);}});
20
//]]></script></div>
app/design/adminhtml/default/default/template/topefekt/magesms/customersms.phtml CHANGED
@@ -13,10 +13,8 @@
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
- ?><?php $user = $this->profile->user; ?><?php $lang = $this->profile->lang; ?><?php $mutation = $this->getRequest()->getParam('mutation', 'default'); ?><?php $groups = array( array( 'group' =>0, 'name' =>Mage::helper('magesms')->__('Order status'), 'icon' => 'AdminOrders.gif' ), array( 'group' =>1, 'name' =>Mage::helper('magesms')->__('Order'), 'icon' => 'AdminOrders.gif' ), array( 'group' =>2, 'name' =>Mage::helper('magesms')->__('Account'), 'icon' => 'AdminCustomers.gif' ), ); ?><script type="text/javascript">//<![CDATA[
17
- function smsr(f){(document.readyState)!=="complete"?setTimeout(smsr,9,f):f()}
18
- //]]></script><h2><?php echo Mage::helper('magesms')->__('Customer SMS').' - '; ?><?php if ($mutation == 'default') { echo $mutation_text = Mage::helper('magesms')->__('default').' '.Mage::helper('magesms')->__(' language version'); } else { $country = Mage::getSingleton('magesms/hooks_templates')->getCollection() ->addFilter('area', $mutation)->getFirstItem(); echo $mutation_text = $country->getAreaText().' (+'.$mutation.')'; } ?></h2><p><?php echo Mage::helper('magesms')->__('Select events during which shall be customer notified via SMS and customize text of messages. You can also add a new language version of SMS messages for each country separately. In countries with undefined language version will be used default language version.'); ?></p><div id="magesms"><div class="entry-edit"><div class="entry-edit-head"><h4 class="icon-head fieldset-legend head-account"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/translation.gif'; ?>" alt="" /> <?php echo Mage::helper('magesms')->__('Add SMS text version'); ?></h4></div><div class="fieldset grid"><div style="float:right"><?php $templates = Mage::getSingleton('magesms/hooks_templates')->getCollection(); if ($templates->count()): ?><table class="data"><tr><td colspan="3"><a href="<?php echo Mage::helper("adminhtml")->getUrl('*/*/index'); ?>" style="<?php echo $mutation == 'default' ? 'font-weight:bold;' : ''; ?>"><?php echo Mage::helper('magesms')->__('default'); ?></a></td></tr><?php foreach($templates as $template): ?><tr><td><a href="<?php echo Mage::helper("adminhtml")->getUrl('*/*/index', array('mutation' => $template->getArea())); ?>" style="<?php echo $template->getArea() == $mutation ? 'font-weight:bold;' : ''; ?>"><?php echo $template->getAreaText(); ?></a></td><td>(+<?php echo $template->getArea(); ?>)</td><td><a href="<?php echo Mage::helper("adminhtml")->getUrl('*/*/delmutation', array('mutation' => $template->getArea())); ?>" onclick="return confirm('<?php echo Mage::helper('magesms')->__('Are you sure to delete').' '.$template->getAreaText().'?'; ?>')"><img title="<?php echo Mage::helper('magesms')->__('DELETE language version'). ' '.$template->getAreaText(); ?>" alt="delete <?php echo $template->getAreaText(); ?>" style="border:0px;" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/delete.gif'; ?>" /></a></td></tr><?php endforeach; ?></table><?php endif; ?></div><form id="magesms_addmutation" action="<?php echo Mage::getUrl('*/*/addmutation') ?>" method="post"><input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" /><div class="margin-form"><label for="country"><?php echo Mage::helper('magesms')->__('Select country: '); ?></label><select name="country" id="country"><?php foreach( Mage::getSingleton('magesms/country_area') ->getCollection() ->addFieldToFilter('area', array('nin'=>array(0))) ->setOrder('country_name', 'ASC') as $country ): ?><option value="<?php echo $country->getArea(); ?>" <?php echo $lang == $country->getCountryName() ? 'selected' : ''; ?>><?php echo $country->getCountryName(); ?> (+<?php echo $country->getArea(); ?>)</option><?php endforeach; ?></select><input type="submit" value="<?php echo Mage::helper('magesms')->__('Add'); ?>" class="form-button" /></div></form><div class="clear"></div></div></div><div class="entry-edit"><div class="entry-edit-head"><h4 class="icon-head fieldset-legend head-account"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/AdminTools.gif'; ?>" alt="" /> <?php echo Mage::helper('magesms')->__('Unicode SMS').' - '.$mutation_text; ?></h4></div><div class="fieldset grid"><form id="magesms_changeunicode" action="<?php echo Mage::getUrl('*/*/saveunicode') ?>" method="post"><input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" /><div class="margin-form"><p><?php echo Mage::helper('magesms')->__('Check only if you want to use Chinese, Arabic, Greek, Hebrew, Korean, Cyrillic, etc. or diacritic in the text of your SMS message (Unicode text allows you to insert characters in all fonts and various other symbols simultaneously. Number of characters in one SMS will be reduced to 70).'); ?></p><input type="checkbox" id="unicode" name="unicode" value="1" <?php echo ($unicode = Mage::getSingleton('magesms/hooks_unicode')->getCollection()->addFilter('area', $mutation)->addFilter('type', 'customer')->getFirstItem()->getUnicode()) ? 'checked' : ''; ?> /><input type="hidden" name="mutation" value="<?php echo $mutation; ?>" /><label for="unicode"><?php echo Mage::helper('magesms')->__('Unicode SMS'); ?></label><input type="submit" value="<?php echo Mage::helper('magesms')->__('Save'); ?>" class="form-button" /></div></form></div></div><?php foreach ($groups as $group): ?><div class="entry-edit"><div class="entry-edit-head"><h4 class="icon-head fieldset-legend head-account"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/'.$group['icon']; ?>" alt="" /> <?php echo $group['name']; ?></h4></div><div class="fieldset grid"><?php $hooks = Mage::helper('magesms')->getHooks($group['group'], 'customers', $mutation); ?><?php if (count($hooks)): ?><table class="data"><col /><col width="100px" /><?php $even = 1; foreach($hooks as $hook): if ($even) $even = 0; else $even = 1;?><tr id="hist_<?php echo $hook->getName(); ?>" class="hover <?php if ($even) echo 'even'?>"><td><span class="img"><img class="toggle" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/i_plus.gif'; ?>"></span><span class="img" style="display:none"><img class="toggle" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/i_minus.gif'; ?>"></span><?php if ($group['group'] == 0): ?><?php echo $hook->getInfo(); ?> - <?php echo $statusT = Mage::helper('sales')->__($hook->getStatusName()); ?><?php if ($statusT != $hook->getStatusName()): ?> (<?php echo $hook->getStatusName(); ?>)<?php endif; ?><?php else: ?><?php echo $hook->getName(); ?> - <?php echo $hook->getInfo(); ?><?php endif; ?></td><td class="a-center"><?php $title = $hook->getActive() ? Mage::helper('magesms')->__('Sending notifications via SMS is ACTIVE') : Mage::helper('magesms')->__('Sending notifications via SMS is NOT ACTIVE. To activate SMS sending check „Active“ in desired status detail.'); $img = $hook->getActive() ? 'i_accepted.gif' : 'i_canceled.gif'; ?><span style="cursor:help;" title="<?php echo $title; ?>" onclick="popup_title(this)"><img class="toggle" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/'.$img; ?>"></span></td></tr><tr id="histd_<?php echo $hook->getName(); ?>" style="display:none"><td colspan="2"><form id="hook_<?php echo $hook->getName(); ?>" action="<?php echo Mage::getUrl('*/*/savehook') ?>" method="post"><input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" /><input type="hidden" name="type" value="customers" /><input type="hidden" name="name" value="<?php echo $hook->getName(); ?>" /><input type="hidden" name="mutation" value="<?php echo $mutation; ?>" /><div style="display:inline-block;width:350px;"><label style="font-weight:normal;text-align:left;width:350px;"><?php echo Mage::helper('magesms')->__('SMS text'); ?></label><br><textarea id="text_<?php echo $hook->getName(); ?>" name="text" class="required-entry input-text" style="width:290px;height:100px;border:1px solid grey;"><?php echo ($text = $hook->getSmstext()) ? $text : $hook->getTemplate2(); ?></textarea></div><div style="display:inline-block;width:320px;"><label style="font-weight:normal;text-align:left"><?php echo Mage::helper('magesms')->__('Preview'); ?> (<span id="label_<?php echo $hook->getName(); ?>"></span>)</label><br><textarea id="textfake_<?php echo $hook->getName(); ?>" name="textfake" disabled="disabled" style="width:290px;height:100px;border:1px solid grey;"></textarea></div><div style="display:inline-block;width:310px;"><?php echo Mage::helper('magesms')->__('Active'); ?><br /><br /><input type="checkbox" name="active" id="active_<?php echo $hook->getName(); ?>" value="1" <?php echo $hook->getActive() ? 'checked' : ''; ?> /><label for="active_<?php echo $hook->getName(); ?>"><?php echo Mage::helper('magesms')->__('Active'); ?></label><br /><br /><br /><div style="float:left;"><input type="submit" value="<?php echo Mage::helper('magesms')->__('Save'); ?>" class="form-button" /></div><div style="float:left;padding-left:20px;"><input value="<?php echo Mage::helper('magesms')->__('Cancel'); ?>" title="Restore unsaved changes to its original state." class="form-button" type="button" onclick="this.form.reset();countitSMS_<?php echo $hook->getName(); ?>.count();" /></div></div></form><script type="text/javascript">//<![CDATA[
19
- countitSMS_<?php echo $hook->getName(); ?> = new countitSMS(document.getElementById('textfake_<?php echo $hook->getName(); ?>'), '<?php echo $unicode; ?>', document.getElementById('label_<?php echo $hook->getName(); ?>'));countitSMS_<?php echo $hook->getName(); ?>.chartext1 = '<?php echo Mage::helper('magesms')->__('Characters: '); ?>';countitSMS_<?php echo $hook->getName(); ?>.chartext2 = '<?php echo Mage::helper('magesms')->__('total sms:'); ?>';countitSMS_<?php echo $hook->getName(); ?>.alert = '';countitSMS_<?php echo $hook->getName(); ?>.translate = {<?php echo Mage::helper('magesms')->hookVariablesJS($hook->getNotice()); ?>};countitSMS_<?php echo $hook->getName(); ?>.copyFrom = document.getElementById('text_<?php echo $hook->getName(); ?>');$('text_<?php echo $hook->getName(); ?>').onkeyup = function() {countitSMS_<?php echo $hook->getName(); ?>.count();};smsr(function() {countitSMS_<?php echo $hook->getName(); ?>.count();countitSMS_<?php echo $hook->getName(); ?>.help(document.getElementById('notice_<?php echo $hook->getName(); ?>'));});
20
//]]></script><div class="clear"></div><span style="font-size:10px;"><?php echo Mage::helper('magesms')->__('Possible variables:'); ?><br /><div id="notice_<?php echo $hook->getName(); ?>"><?php echo $hook->getNotice(); ?></div></span></td></tr><?php endforeach; ?></table><?php endif; ?></div></div><?php endforeach; ?><script type="text/javascript">//<![CDATA[
21
- smsr(function(){var gridData = document.getElementById('magesms');var tr_array = gridData.getElementsByTagName('tr');for (var i=0, len=tr_array.length; i < len; i++) {if (tr_array[i].className.indexOf('hover') !== -1) {tr_array[i].onmouseover = function() {this.className = this.className + ' on-mouse';};tr_array[i].onmouseout = function() {this.className = this.className.replace(' on-mouse', '');};tr_array[i].onclick = function() {var arr = this.id.split('_');var next = document.getElementById('histd_'+arr[1]);if (next.style.display == 'none') {next.style.display = 'table-row';} else {next.style.display = 'none';}var img = this.getElementsByClassName('img');if (img[0].style.display == 'none') {img[0].style.display = 'inline';} else {img[0].style.display = 'none';}if (img[1].style.display == 'none') {img[1].style.display = 'inline';} else {img[1].style.display = 'none';}};}}if (window.location.hash.substr(1)) {$('hist_' + window.location.hash.substr(1)).click();$('hist_' + window.location.hash.substr(1)).scrollIntoView(true);var messageTo = $('hist_' + window.location.hash.substr(1)).parentNode.parentNode.parentNode;var messages = $('messages').cloneNode(true);messageTo.insertBefore(messages, messageTo.childNodes[0]);}});
22
//]]></script></div>
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
+ ?><?php $user = $this->profile->user; ?><?php $lang = $this->profile->lang; ?><?php $mutation = $this->getRequest()->getParam('mutation', 'default'); ?><?php $groups = array( array( 'group' =>0, 'name' =>Mage::helper('magesms')->__('Order status'), 'icon' => 'AdminOrders.gif' ), array( 'group' =>1, 'name' =>Mage::helper('magesms')->__('Order'), 'icon' => 'AdminOrders.gif' ), array( 'group' =>2, 'name' =>Mage::helper('magesms')->__('Account'), 'icon' => 'AdminCustomers.gif' ), ); ?><h2><?php echo Mage::helper('magesms')->__('Customer SMS').' - '; ?><?php if ($mutation == 'default') { echo $mutation_text = Mage::helper('magesms')->__('default').' '.Mage::helper('magesms')->__(' language version'); } else { $country = Mage::getSingleton('magesms/hooks_templates')->getCollection() ->addFilter('area', $mutation)->getFirstItem(); echo $mutation_text = $country->getAreaText().' (+'.$mutation.')'; } ?></h2><p><?php echo Mage::helper('magesms')->__('Select events during which shall be customer notified via SMS and customize text of messages. You can also add a new language version of SMS messages for each country separately. In countries with undefined language version will be used default language version.'); ?></p><div id="magesms"><div class="entry-edit"><div class="entry-edit-head"><h4 class="icon-head fieldset-legend head-account"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/translation.gif'; ?>" alt="" /> <?php echo Mage::helper('magesms')->__('Add SMS text version'); ?></h4></div><div class="fieldset grid"><div style="float:right"><?php $templates = Mage::getSingleton('magesms/hooks_templates')->getCollection(); if ($templates->count()): ?><table class="data"><tr><td colspan="3"><a href="<?php echo Mage::helper("adminhtml")->getUrl('*/*/index'); ?>" style="<?php echo $mutation == 'default' ? 'font-weight:bold;' : ''; ?>"><?php echo Mage::helper('magesms')->__('default'); ?></a></td></tr><?php foreach($templates as $template): ?><tr><td><a href="<?php echo Mage::helper("adminhtml")->getUrl('*/*/index', array('mutation' => $template->getArea())); ?>" style="<?php echo $template->getArea() == $mutation ? 'font-weight:bold;' : ''; ?>"><?php echo $template->getAreaText(); ?></a></td><td>(+<?php echo $template->getArea(); ?>)</td><td><a href="<?php echo Mage::helper("adminhtml")->getUrl('*/*/delmutation', array('mutation' => $template->getArea())); ?>" onclick="return confirm('<?php echo Mage::helper('magesms')->__('Are you sure to delete').' '.$template->getAreaText().'?'; ?>')"><img title="<?php echo Mage::helper('magesms')->__('DELETE language version'). ' '.$template->getAreaText(); ?>" alt="delete <?php echo $template->getAreaText(); ?>" style="border:0px;" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/delete.gif'; ?>" /></a></td></tr><?php endforeach; ?></table><?php endif; ?></div><form id="magesms_addmutation" action="<?php echo Mage::getUrl('*/*/addmutation') ?>" method="post"><input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" /><div class="margin-form"><label for="country"><?php echo Mage::helper('magesms')->__('Select country: '); ?></label><select name="country" id="country"><?php foreach( Mage::getSingleton('magesms/country_area') ->getCollection() ->addFieldToFilter('area', array('nin'=>array(0))) ->setOrder('country_name', 'ASC') as $country ): ?><option value="<?php echo $country->getArea(); ?>" <?php echo $lang == $country->getCountryName() ? 'selected' : ''; ?>><?php echo $country->getCountryName(); ?> (+<?php echo $country->getArea(); ?>)</option><?php endforeach; ?></select><input type="submit" value="<?php echo Mage::helper('magesms')->__('Add'); ?>" class="form-button" /></div></form><div class="clear"></div></div></div><div class="entry-edit"><div class="entry-edit-head"><h4 class="icon-head fieldset-legend head-account"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/AdminTools.gif'; ?>" alt="" /> <?php echo Mage::helper('magesms')->__('Unicode SMS').' - '.$mutation_text; ?></h4></div><div class="fieldset grid"><form id="magesms_changeunicode" action="<?php echo Mage::getUrl('*/*/saveunicode') ?>" method="post"><input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" /><div class="margin-form"><p><?php echo Mage::helper('magesms')->__('Check only if you want to use Chinese, Arabic, Greek, Hebrew, Korean, Cyrillic, etc. or diacritic in the text of your SMS message (Unicode text allows you to insert characters in all fonts and various other symbols simultaneously. Number of characters in one SMS will be reduced to 70).'); ?></p><input type="checkbox" id="unicode" name="unicode" value="1" <?php echo ($unicode = Mage::getSingleton('magesms/hooks_unicode')->getCollection()->addFilter('area', $mutation)->addFilter('type', 'customer')->getFirstItem()->getUnicode()) ? 'checked' : ''; ?> /><input type="hidden" name="mutation" value="<?php echo $mutation; ?>" /><label for="unicode"><?php echo Mage::helper('magesms')->__('Unicode SMS'); ?></label><input type="submit" value="<?php echo Mage::helper('magesms')->__('Save'); ?>" class="form-button" /></div></form></div></div><?php foreach ($groups as $group): ?><div class="entry-edit"><div class="entry-edit-head"><h4 class="icon-head fieldset-legend head-account"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/'.$group['icon']; ?>" alt="" /> <?php echo $group['name']; ?></h4></div><div class="fieldset grid"><?php $hooks = Mage::helper('magesms')->getHooks($group['group'], 'customers', $mutation); ?><?php if (count($hooks)): ?><table class="data"><col /><col width="100px" /><?php $even = 1; foreach($hooks as $hook): if ($even) $even = 0; else $even = 1;?><tr id="hist_<?php echo $hook->getName(); ?>" class="hover <?php if ($even) echo 'even'?>"><td><span class="img"><img class="toggle" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/i_plus.gif'; ?>"></span><span class="img" style="display:none"><img class="toggle" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/i_minus.gif'; ?>"></span><?php if ($group['group'] == 0): ?><?php echo $hook->getInfo(); ?> - <?php echo $statusT = Mage::helper('sales')->__($hook->getStatusName()); ?><?php if ($statusT != $hook->getStatusName()): ?> (<?php echo $hook->getStatusName(); ?>)<?php endif; ?><?php else: ?><?php echo $hook->getName(); ?> - <?php echo $hook->getInfo(); ?><?php endif; ?></td><td class="a-center"><?php $title = $hook->getActive() ? Mage::helper('magesms')->__('Sending notifications via SMS is ACTIVE') : Mage::helper('magesms')->__('Sending notifications via SMS is NOT ACTIVE. To activate SMS sending check „Active“ in desired status detail.'); $img = $hook->getActive() ? 'i_accepted.gif' : 'i_canceled.gif'; ?><span style="cursor:help;" title="<?php echo $title; ?>" onclick="popup_title(this)"><img class="toggle" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/'.$img; ?>"></span></td></tr><tr id="histd_<?php echo $hook->getName(); ?>" style="display:none"><td colspan="2"><form id="hook_<?php echo $hook->getName(); ?>" action="<?php echo Mage::getUrl('*/*/savehook') ?>" method="post"><input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" /><input type="hidden" name="type" value="customers" /><input type="hidden" name="name" value="<?php echo $hook->getName(); ?>" /><input type="hidden" name="mutation" value="<?php echo $mutation; ?>" /><div style="display:inline-block;width:350px;"><label style="font-weight:normal;text-align:left;width:350px;"><?php echo Mage::helper('magesms')->__('SMS text'); ?></label><br><textarea id="text_<?php echo $hook->getName(); ?>" name="text" class="required-entry input-text" style="width:290px;height:100px;border:1px solid grey;"><?php echo ($text = $hook->getSmstext()) ? $text : $hook->getTemplate2(); ?></textarea></div><div style="display:inline-block;width:320px;"><label style="font-weight:normal;text-align:left"><?php echo Mage::helper('magesms')->__('Preview'); ?> (<span id="label_<?php echo $hook->getName(); ?>"></span>)</label><br><textarea id="textfake_<?php echo $hook->getName(); ?>" name="textfake" disabled="disabled" style="width:290px;height:100px;border:1px solid grey;"></textarea></div><div style="display:inline-block;width:310px;"><?php echo Mage::helper('magesms')->__('Active'); ?><br /><br /><input type="checkbox" name="active" id="active_<?php echo $hook->getName(); ?>" value="1" <?php echo $hook->getActive() ? 'checked' : ''; ?> /><label for="active_<?php echo $hook->getName(); ?>"><?php echo Mage::helper('magesms')->__('Active'); ?></label><br /><br /><br /><div style="float:left;"><input type="submit" value="<?php echo Mage::helper('magesms')->__('Save'); ?>" class="form-button" /></div><div style="float:left;padding-left:20px;"><input value="<?php echo Mage::helper('magesms')->__('Cancel'); ?>" title="Restore unsaved changes to its original state." class="form-button" type="button" onclick="this.form.reset();countitSMS_<?php echo $hook->getName(); ?>.count();" /></div></div></form><script type="text/javascript">//<![CDATA[
17
+ countitSMS_<?php echo $hook->getName(); ?> = new countitSMS(document.getElementById('textfake_<?php echo $hook->getName(); ?>'), '<?php echo $unicode; ?>', document.getElementById('label_<?php echo $hook->getName(); ?>'));countitSMS_<?php echo $hook->getName(); ?>.chartext1 = '<?php echo Mage::helper('magesms')->__('Characters: '); ?>';countitSMS_<?php echo $hook->getName(); ?>.chartext2 = '<?php echo Mage::helper('magesms')->__('total sms:'); ?>';countitSMS_<?php echo $hook->getName(); ?>.alert = '';countitSMS_<?php echo $hook->getName(); ?>.translate = {<?php echo Mage::helper('magesms')->hookVariablesJS($hook->getNotice()); ?>};countitSMS_<?php echo $hook->getName(); ?>.copyFrom = document.getElementById('text_<?php echo $hook->getName(); ?>');$('text_<?php echo $hook->getName(); ?>').onkeyup = function() {countitSMS_<?php echo $hook->getName(); ?>.count();};Event.observe(window, "load", function() {countitSMS_<?php echo $hook->getName(); ?>.count();countitSMS_<?php echo $hook->getName(); ?>.help(document.getElementById('notice_<?php echo $hook->getName(); ?>'));});
18
//]]></script><div class="clear"></div><span style="font-size:10px;"><?php echo Mage::helper('magesms')->__('Possible variables:'); ?><br /><div id="notice_<?php echo $hook->getName(); ?>"><?php echo $hook->getNotice(); ?></div></span></td></tr><?php endforeach; ?></table><?php endif; ?></div></div><?php endforeach; ?><script type="text/javascript">//<![CDATA[
19
+ Event.observe(window, "load", function(){var gridData = document.getElementById('magesms');var tr_array = gridData.getElementsByTagName('tr');for (var i=0, len=tr_array.length; i < len; i++) {if (tr_array[i].className.indexOf('hover') !== -1) {tr_array[i].onmouseover = function() {this.className = this.className + ' on-mouse';};tr_array[i].onmouseout = function() {this.className = this.className.replace(' on-mouse', '');};tr_array[i].onclick = function() {var arr = this.id.split('_');var next = document.getElementById('histd_'+arr[1]);if (next.style.display == 'none') {next.style.display = 'table-row';} else {next.style.display = 'none';}var img = this.getElementsByClassName('img');if (img[0].style.display == 'none') {img[0].style.display = 'inline';} else {img[0].style.display = 'none';}if (img[1].style.display == 'none') {img[1].style.display = 'inline';} else {img[1].style.display = 'none';}};}}if (window.location.hash.substr(1)) {$('hist_' + window.location.hash.substr(1)).click();$('hist_' + window.location.hash.substr(1)).scrollIntoView(true);var messageTo = $('hist_' + window.location.hash.substr(1)).parentNode.parentNode.parentNode;var messages = $('messages').cloneNode(true);messageTo.insertBefore(messages, messageTo.childNodes[0]);}});
20
//]]></script></div>
app/design/adminhtml/default/default/template/topefekt/magesms/history.phtml CHANGED
@@ -14,5 +14,5 @@
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
?><?php $user = $this->profile->user; ?><?php $lang = $this->profile->lang; ?><?php $type = array( 1 => Mage::helper('magesms')->__(' admin sms'), 2 => Mage::helper('magesms')->__(' customer sms'), 3 => Mage::helper('magesms')->__(' marketing sms'), 4 => Mage::helper('magesms')->__(' simple sms') ); ?><h2><?php echo Mage::helper('magesms')->__('SMS History'); ?></h2><p><?php echo Mage::helper('magesms')->__('History of sent SMS from SMS module.'); ?></p><div id="magesms"><div class="entry-edit"><div class="entry-edit-head"><h4 class="icon-head fieldset-legend head-account"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/AdminTools.gif'; ?>" alt="" /> <?php echo Mage::helper('magesms')->__('SMS History'); ?></h4></div><div class="fieldset grid"><form id="magesms_filter" action="<?php echo Mage::getUrl('*/*/filter') ?>" method="post"><input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" /><?php $history = Mage::getSingleton('magesms/smshistory')->getCollection() ->setOrder('date', 'ASC'); $history->getSelect()->limit(1); if ($history->count()) $rokmin = substr($history->getFirstItem()->getDate(), 0, 4); else $rokmin = date('Y'); $roky = array(); for(; $rokmin <= date('Y'); $rokmin++) $roky[] = $rokmin; ?><div class="margin-form" style="text-align: center"><select name="rok" id="rok"><option value=""><?php echo Mage::helper('magesms')->__('year'); ?></option><?php foreach( $roky as $rok ): ?><option value="<?php echo $rok; ?>" <?php echo $rok == $this->getRequest()->getParam('rok', date('Y')) ? 'selected' : ''; ?>><?php echo $rok; ?></option><?php endforeach; ?></select><select name="mesic" id="mesic"><option value=""><?php echo Mage::helper('magesms')->__('month'); ?></option><?php for( $mesic=1; $mesic<=12; $mesic++ ): ?><option value="<?php echo $mesic; ?>" <?php echo $mesic == $this->getRequest()->getParam('mesic', date('m')) ? 'selected' : ''; ?>><?php echo $mesic; ?></option><?php endfor; ?></select><select name="den" id="den"><option value=""><?php echo Mage::helper('magesms')->__('day'); ?></option><?php for( $den=1; $den<=31; $den++ ): ?><option value="<?php echo $den; ?>" <?php echo $den == $this->getRequest()->getParam('den') ? 'selected' : ''; ?>><?php echo sprintf('%02d', $den); ?></option><?php endfor; ?></select><select name="status" id="status"><option value=""><?php echo Mage::helper('magesms')->__('Status'); ?></option><?php foreach( Mage::getSingleton('magesms/sms')->status() as $id=>$stat ): ?><option value="<?php echo $id; ?>" <?php echo $id == $this->getRequest()->getParam('status') ? 'selected' : ''; ?>><?php echo $stat->name; ?></option><?php endforeach; ?></select><input type="hidden" name="eshopsms1" value="0" />&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="eshopsms1" id="eshopsms1" value="1" <?php echo $this->getRequest()->getParam('eshopsms1') == null || $this->getRequest()->getParam('eshopsms1') == 1 ? 'checked' : ''; ?> /><label for="eshopsms1"><?php echo Mage::helper('magesms')->__(' admin sms'); ?></label><input type="hidden" name="eshopsms" value="0" />&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="eshopsms" id="eshopsms" value="1" <?php echo $this->getRequest()->getParam('eshopsms') == null || $this->getRequest()->getParam('eshopsms') == 1 ? 'checked' : ''; ?> /><label for="eshopsms"><?php echo Mage::helper('magesms')->__(' customer sms'); ?></label><input type="hidden" name="bulksms" value="0" />&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="bulksms" id="bulksms" value="1" <?php echo $this->getRequest()->getParam('bulksms') == null || $this->getRequest()->getParam('bulksms') == 1 ? 'checked' : ''; ?> /><label for="bulksms"><?php echo Mage::helper('magesms')->__(' marketing sms'); ?></label><input type="hidden" name="bulksms2" value="0" />&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="bulksms2" id="bulksms2" value="1" <?php echo $this->getRequest()->getParam('bulksms2') == null || $this->getRequest()->getParam('bulksms2') == 1 ? 'checked' : ''; ?> /><label for="bulksms2"><?php echo Mage::helper('magesms')->__(' simple sms'); ?></label>&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="<?php echo Mage::helper('magesms')->__('Show'); ?>" class="form-button" /></div></form></div></div><?php $pageSize = 50; $page = $this->getRequest()->getParam('page', 1); $format = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM); $history = Mage::getSingleton('magesms/smshistory')->getCollection()->setOrder('date', 'DESC'); $rok = $this->getRequest()->getParam('rok', date('Y')); $mesic = $this->getRequest()->getParam('mesic', date('m')); $den = $this->getRequest()->getParam('den'); if ($den) { $history->getSelect()->where("`date` LIKE ?", sprintf("%04d-%02d-%02d%%", $rok, $mesic, $den)); } else { $history->getSelect()->where("`date` LIKE ?", sprintf("%04d-%02d-%%", $rok, $mesic)); } if (($_status = $this->getRequest()->getParam('status'))) { $history->addFilter('status', $_status); } $notin = array(); if ($this->getRequest()->getParam('eshopsms', 1) != 1) $notin[] = 2; if ($this->getRequest()->getParam('eshopsms1', 1) != 1) $notin[] = 1; if ($this->getRequest()->getParam('bulksms', 1) != 1) $notin[] = 3; if ($this->getRequest()->getParam('bulksms2', 1) != 1) $notin[] = 4; if (count($notin)) { $history->getSelect()->where("`type` NOT IN (?)", $notin); } $history->setPageSize($pageSize); $history->setCurPage($page); if ($history->getSize()): $from = ($page-1) * $pageSize + 1; $to = ($page-1) * $pageSize + $pageSize; if ($to > $history->getSize()) $to = $history->getSize(); $this->getRequest()->setParam('page', null); ?><div class="entry-edit"><div class="entry-edit-head"><h4 class="icon-head fieldset-legend head-account"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/AdminCatalog.gif'; ?>" alt="" /><?php echo Mage::helper('magesms')->__('Search results ').' '.$from.' - '.$to.Mage::helper('magesms')->__(' of ').$history->getSize().' '.Mage::helper('magesms')->__('SMS'); ?></h4></div><div class="fieldset grid"><table class="actions"><tr><td class="pager"><?php echo $this->__('Page') ?><?php $_curPage = $history->getCurPage() ?><?php $_lastPage = $history->getLastPageNumber() ?><?php if($_curPage>1): ?><a href="<?php echo Mage::helper("adminhtml")->getUrl('*/*/', $this->getRequest()->getParams()+array('page' => $_curPage-1)); ?>" title="<?php echo $this->__('Previous') ?>"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_left.gif') ?>" alt="Go to Previous page" class="arrow"/></a><?php else: ?><img src="<?php echo $this->getSkinUrl('images/pager_arrow_left_off.gif') ?>" alt="Go to Previous page" class="arrow"/><?php endif; ?><input type="text" name="curPage" readonly value="<?php echo $_curPage ?>" class="input-text page" /><?php if($_curPage < $_lastPage): ?><a href="<?php echo Mage::helper("adminhtml")->getUrl('*/*/', $this->getRequest()->getParams()+array('page' => $_curPage+1)); ?>" title="<?php echo $this->__('Next') ?>"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_right.gif') ?>" alt="Go to Next page" class="arrow"/></a><?php else: ?><img src="<?php echo $this->getSkinUrl('images/pager_arrow_right_off.gif') ?>" alt="Go to Previous page" class="arrow"/><?php endif; ?></td></tr></table><table class="data"><tr class="headings"><th><?php echo Mage::helper('magesms')->__('Number'); ?></th><th><?php echo Mage::helper('magesms')->__('Recipient'); ?></th><th><?php echo Mage::helper('magesms')->__('SMS subject'); ?></th><th class="a-left"><?php echo Mage::helper('magesms')->__('Date'); ?></th><th><?php echo Mage::helper('magesms')->__('Type'); ?></th><th class="a-center"><?php echo Mage::helper('magesms')->__('Status'); ?></th></tr><?php $even = 1; foreach($history as $_obj): if ($even) $even = 0; else $even = 1;?><tr id="hist_<?php echo $_obj->getId(); ?>" class="hover <?php if ($even) echo 'even'?>"><td><span class="img"><img class="toggle" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/i_plus.gif'; ?>"></span><span class="img" style="display:none"><img class="toggle" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/i_minus.gif'; ?>"></span><?php echo $_obj->getNumber(); ?></td><td><?php if ($_obj->getCustomerId()): ?><?php $customer = Mage::getModel('customer/customer')->load($_obj->getCustomerId()); ?><?php if ($customer->getId()): ?><a href="<?php echo Mage::helper("adminhtml")->getUrl('*/customer/edit', array('id' => $_obj->getCustomerId())); ?>" target="magesms_popup_customer" title="<?php echo Mage::helper('magesms')->__('Display customer detail'); ?>"><?php echo $customer->getFirstname(); ?> <?php echo $customer->getLastname(); ?></a><?php else: ?><?php echo Mage::helper('magesms')->moreText($_obj->getRecipient(), 16, 25); ?><?php endif; ?><?php elseif ($_obj->getAdminId()): ?><?php $admin = Mage::getModel('magesms/admins')->load($_obj->getAdminId()); ?><?php if ($admin->getId()): ?><?php echo $admin->getName(); ?><?php else: ?><?php echo Mage::helper('magesms')->moreText($_obj->getRecipient(), 16, 25); ?><?php endif; ?><?php else: ?><?php echo ($recipient = Mage::helper('magesms')->moreText($_obj->getRecipient(), 16, 25)) ? $recipient: '-' ?><?php endif; ?></td><td><?php echo ($subject = Mage::helper('magesms')->moreText($_obj->getSubject(), 16, 25)) ? $subject : '-'; ?></td><td><?php echo Mage::helper('core')->formatDate($_obj->getDate(), 'medium', true); ?></td><td><?php echo $type[$_obj->getType()]; ?></td><td class="a-center"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/'.Mage::getSingleton('magesms/sms')->status($_obj->getStatus())->icon; ?>" title="<?php echo Mage::getSingleton('magesms/sms')->status($_obj->getStatus())->name.(($note=$_obj->getNote()) && ($_obj->getStatus() == Topefekt_Magesms_Model_Sms::ERROR || $_obj->getStatus() == Topefekt_Magesms_Model_Sms::SCHEDULED) ? " - $note" : '') ; ?>" /></td></tr><tr id="histd_<?php echo $_obj->getId(); ?>" class="<?php if ($even) echo 'even'?>" style="display:none"><td colspan="6"><b><?php echo Mage::helper('magesms')->__('Text:'); ?></b><br /><?php echo $_obj->getText(); ?><br /><br /><b><?php echo Mage::helper('magesms')->__('SMS price in credits:'); ?></b> <?php echo $_obj->getPrice(); ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php if ($_obj->getPrice() > 0): ?><b><?php echo Mage::helper('magesms')->__('Credit balance:'); ?></b> <?php echo $_obj->getCredit(); ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php endif; ?><b><?php echo Mage::helper('magesms')->__('Total SMS:'); ?></b> <?php echo $_obj->getTotal(); ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><?php echo Mage::helper('magesms')->__('Unicode:'); ?></b> <?php echo $_obj->getUnicode() ? Mage::helper('magesms')->__('yes') : Mage::helper('magesms')->__('no'); ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><?php echo Mage::helper('magesms')->__('senderID:'); ?></b><?php if ($_obj->getSender() && preg_match("/^([0-9])*#x2F;", $_obj->getSender(), $matches)): ?>+<?php echo $_obj->getSender(); ?><?php elseif ($_obj->getSender()): ?><?php echo $_obj->getSender(); ?><?php else: ?><?php echo Mage::helper('magesms')->__('system number'); ?><?php endif; ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php if ($_obj->getSmsid()): ?><br /><b><?php echo Mage::helper('magesms')->__('smsID:'); ?></b> <?php echo $_obj->getSmsid(); ?><?php endif; ?></td></tr><?php endforeach; ?></table><table class="actions"><tr><td class="pager"><?php echo $this->__('Page') ?><?php $_curPage = $history->getCurPage() ?><?php $_lastPage = $history->getLastPageNumber() ?><?php if($_curPage>1): ?><a href="<?php echo Mage::helper("adminhtml")->getUrl('*/*/', $this->getRequest()->getParams()+array('page' => $_curPage-1)); ?>" title="<?php echo $this->__('Previous') ?>"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_left.gif') ?>" alt="Go to Previous page" class="arrow"/></a><?php else: ?><img src="<?php echo $this->getSkinUrl('images/pager_arrow_left_off.gif') ?>" alt="Go to Previous page" class="arrow"/><?php endif; ?><input type="text" name="curPage" readonly value="<?php echo $_curPage ?>" class="input-text page" /><?php if($_curPage < $_lastPage): ?><a href="<?php echo Mage::helper("adminhtml")->getUrl('*/*/', $this->getRequest()->getParams()+array('page' => $_curPage+1)); ?>" title="<?php echo $this->__('Next') ?>"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_right.gif') ?>" alt="Go to Next page" class="arrow"/></a><?php else: ?><img src="<?php echo $this->getSkinUrl('images/pager_arrow_right_off.gif') ?>" alt="Go to Previous page" class="arrow"/><?php endif; ?></td></tr></table></div></div><script type="text/javascript">//<![CDATA[
17
- function smsr(f){(document.readyState)!=="complete"?setTimeout(smsr,9,f):f()}smsr(function(){var gridData = document.getElementById('magesms');var tr_array = gridData.getElementsByTagName('tr');for (var i=0, len=tr_array.length; i < len; i++) {if (tr_array[i].className.indexOf('hover') !== -1) {tr_array[i].onmouseover = function() {this.className = this.className + ' on-mouse';};tr_array[i].onmouseout = function() {this.className = this.className.replace(' on-mouse', '');};tr_array[i].onclick = function() {var arr = this.id.split('_');var next = document.getElementById('histd_'+arr[1]);if (next.style.display == 'none') {next.style.display = 'table-row';} else {next.style.display = 'none';}var img = this.getElementsByClassName('img');if (img[0].style.display == 'none') {img[0].style.display = 'inline';} else {img[0].style.display = 'none';}if (img[1].style.display == 'none') {img[1].style.display = 'inline';} else {img[1].style.display = 'none';}};}}});
18
//]]></script><?php else: ?><div><?php echo Mage::helper('magesms')->__('Total SMS: 0'); ?></div><?php endif; ?></div>
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
?><?php $user = $this->profile->user; ?><?php $lang = $this->profile->lang; ?><?php $type = array( 1 => Mage::helper('magesms')->__(' admin sms'), 2 => Mage::helper('magesms')->__(' customer sms'), 3 => Mage::helper('magesms')->__(' marketing sms'), 4 => Mage::helper('magesms')->__(' simple sms') ); ?><h2><?php echo Mage::helper('magesms')->__('SMS History'); ?></h2><p><?php echo Mage::helper('magesms')->__('History of sent SMS from SMS module.'); ?></p><div id="magesms"><div class="entry-edit"><div class="entry-edit-head"><h4 class="icon-head fieldset-legend head-account"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/AdminTools.gif'; ?>" alt="" /> <?php echo Mage::helper('magesms')->__('SMS History'); ?></h4></div><div class="fieldset grid"><form id="magesms_filter" action="<?php echo Mage::getUrl('*/*/filter') ?>" method="post"><input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" /><?php $history = Mage::getSingleton('magesms/smshistory')->getCollection() ->setOrder('date', 'ASC'); $history->getSelect()->limit(1); if ($history->count()) $rokmin = substr($history->getFirstItem()->getDate(), 0, 4); else $rokmin = date('Y'); $roky = array(); for(; $rokmin <= date('Y'); $rokmin++) $roky[] = $rokmin; ?><div class="margin-form" style="text-align: center"><select name="rok" id="rok"><option value=""><?php echo Mage::helper('magesms')->__('year'); ?></option><?php foreach( $roky as $rok ): ?><option value="<?php echo $rok; ?>" <?php echo $rok == $this->getRequest()->getParam('rok', date('Y')) ? 'selected' : ''; ?>><?php echo $rok; ?></option><?php endforeach; ?></select><select name="mesic" id="mesic"><option value=""><?php echo Mage::helper('magesms')->__('month'); ?></option><?php for( $mesic=1; $mesic<=12; $mesic++ ): ?><option value="<?php echo $mesic; ?>" <?php echo $mesic == $this->getRequest()->getParam('mesic', date('m')) ? 'selected' : ''; ?>><?php echo $mesic; ?></option><?php endfor; ?></select><select name="den" id="den"><option value=""><?php echo Mage::helper('magesms')->__('day'); ?></option><?php for( $den=1; $den<=31; $den++ ): ?><option value="<?php echo $den; ?>" <?php echo $den == $this->getRequest()->getParam('den') ? 'selected' : ''; ?>><?php echo sprintf('%02d', $den); ?></option><?php endfor; ?></select><select name="status" id="status"><option value=""><?php echo Mage::helper('magesms')->__('Status'); ?></option><?php foreach( Mage::getSingleton('magesms/sms')->status() as $id=>$stat ): ?><option value="<?php echo $id; ?>" <?php echo $id == $this->getRequest()->getParam('status') ? 'selected' : ''; ?>><?php echo $stat->name; ?></option><?php endforeach; ?></select><input type="hidden" name="eshopsms1" value="0" />&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="eshopsms1" id="eshopsms1" value="1" <?php echo $this->getRequest()->getParam('eshopsms1') == null || $this->getRequest()->getParam('eshopsms1') == 1 ? 'checked' : ''; ?> /><label for="eshopsms1"><?php echo Mage::helper('magesms')->__(' admin sms'); ?></label><input type="hidden" name="eshopsms" value="0" />&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="eshopsms" id="eshopsms" value="1" <?php echo $this->getRequest()->getParam('eshopsms') == null || $this->getRequest()->getParam('eshopsms') == 1 ? 'checked' : ''; ?> /><label for="eshopsms"><?php echo Mage::helper('magesms')->__(' customer sms'); ?></label><input type="hidden" name="bulksms" value="0" />&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="bulksms" id="bulksms" value="1" <?php echo $this->getRequest()->getParam('bulksms') == null || $this->getRequest()->getParam('bulksms') == 1 ? 'checked' : ''; ?> /><label for="bulksms"><?php echo Mage::helper('magesms')->__(' marketing sms'); ?></label><input type="hidden" name="bulksms2" value="0" />&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="bulksms2" id="bulksms2" value="1" <?php echo $this->getRequest()->getParam('bulksms2') == null || $this->getRequest()->getParam('bulksms2') == 1 ? 'checked' : ''; ?> /><label for="bulksms2"><?php echo Mage::helper('magesms')->__(' simple sms'); ?></label>&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="<?php echo Mage::helper('magesms')->__('Show'); ?>" class="form-button" /></div></form></div></div><?php $pageSize = 50; $page = $this->getRequest()->getParam('page', 1); $format = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM); $history = Mage::getSingleton('magesms/smshistory')->getCollection()->setOrder('date', 'DESC'); $rok = $this->getRequest()->getParam('rok', date('Y')); $mesic = $this->getRequest()->getParam('mesic', date('m')); $den = $this->getRequest()->getParam('den'); if ($den) { $history->getSelect()->where("`date` LIKE ?", sprintf("%04d-%02d-%02d%%", $rok, $mesic, $den)); } else { $history->getSelect()->where("`date` LIKE ?", sprintf("%04d-%02d-%%", $rok, $mesic)); } if (($_status = $this->getRequest()->getParam('status'))) { $history->addFilter('status', $_status); } $notin = array(); if ($this->getRequest()->getParam('eshopsms', 1) != 1) $notin[] = 2; if ($this->getRequest()->getParam('eshopsms1', 1) != 1) $notin[] = 1; if ($this->getRequest()->getParam('bulksms', 1) != 1) $notin[] = 3; if ($this->getRequest()->getParam('bulksms2', 1) != 1) $notin[] = 4; if (count($notin)) { $history->getSelect()->where("`type` NOT IN (?)", $notin); } $history->setPageSize($pageSize); $history->setCurPage($page); if ($history->getSize()): $from = ($page-1) * $pageSize + 1; $to = ($page-1) * $pageSize + $pageSize; if ($to > $history->getSize()) $to = $history->getSize(); $this->getRequest()->setParam('page', null); ?><div class="entry-edit"><div class="entry-edit-head"><h4 class="icon-head fieldset-legend head-account"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/AdminCatalog.gif'; ?>" alt="" /><?php echo Mage::helper('magesms')->__('Search results ').' '.$from.' - '.$to.Mage::helper('magesms')->__(' of ').$history->getSize().' '.Mage::helper('magesms')->__('SMS'); ?></h4></div><div class="fieldset grid"><table class="actions"><tr><td class="pager"><?php echo $this->__('Page') ?><?php $_curPage = $history->getCurPage() ?><?php $_lastPage = $history->getLastPageNumber() ?><?php if($_curPage>1): ?><a href="<?php echo Mage::helper("adminhtml")->getUrl('*/*/', $this->getRequest()->getParams()+array('page' => $_curPage-1)); ?>" title="<?php echo $this->__('Previous') ?>"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_left.gif') ?>" alt="Go to Previous page" class="arrow"/></a><?php else: ?><img src="<?php echo $this->getSkinUrl('images/pager_arrow_left_off.gif') ?>" alt="Go to Previous page" class="arrow"/><?php endif; ?><input type="text" name="curPage" readonly value="<?php echo $_curPage ?>" class="input-text page" /><?php if($_curPage < $_lastPage): ?><a href="<?php echo Mage::helper("adminhtml")->getUrl('*/*/', $this->getRequest()->getParams()+array('page' => $_curPage+1)); ?>" title="<?php echo $this->__('Next') ?>"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_right.gif') ?>" alt="Go to Next page" class="arrow"/></a><?php else: ?><img src="<?php echo $this->getSkinUrl('images/pager_arrow_right_off.gif') ?>" alt="Go to Previous page" class="arrow"/><?php endif; ?></td></tr></table><table class="data"><tr class="headings"><th><?php echo Mage::helper('magesms')->__('Number'); ?></th><th><?php echo Mage::helper('magesms')->__('Recipient'); ?></th><th><?php echo Mage::helper('magesms')->__('SMS subject'); ?></th><th class="a-left"><?php echo Mage::helper('magesms')->__('Date'); ?></th><th><?php echo Mage::helper('magesms')->__('Type'); ?></th><th class="a-center"><?php echo Mage::helper('magesms')->__('Status'); ?></th></tr><?php $even = 1; foreach($history as $_obj): if ($even) $even = 0; else $even = 1;?><tr id="hist_<?php echo $_obj->getId(); ?>" class="hover <?php if ($even) echo 'even'?>"><td><span class="img"><img class="toggle" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/i_plus.gif'; ?>"></span><span class="img" style="display:none"><img class="toggle" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/i_minus.gif'; ?>"></span><?php echo $_obj->getNumber(); ?></td><td><?php if ($_obj->getCustomerId()): ?><?php $customer = Mage::getModel('customer/customer')->load($_obj->getCustomerId()); ?><?php if ($customer->getId()): ?><a href="<?php echo Mage::helper("adminhtml")->getUrl('*/customer/edit', array('id' => $_obj->getCustomerId())); ?>" target="magesms_popup_customer" title="<?php echo Mage::helper('magesms')->__('Display customer detail'); ?>"><?php echo $customer->getFirstname(); ?> <?php echo $customer->getLastname(); ?></a><?php else: ?><?php echo Mage::helper('magesms')->moreText($_obj->getRecipient(), 16, 25); ?><?php endif; ?><?php elseif ($_obj->getAdminId()): ?><?php $admin = Mage::getModel('magesms/admins')->load($_obj->getAdminId()); ?><?php if ($admin->getId()): ?><?php echo $admin->getName(); ?><?php else: ?><?php echo Mage::helper('magesms')->moreText($_obj->getRecipient(), 16, 25); ?><?php endif; ?><?php else: ?><?php echo ($recipient = Mage::helper('magesms')->moreText($_obj->getRecipient(), 16, 25)) ? $recipient: '-' ?><?php endif; ?></td><td><?php echo ($subject = Mage::helper('magesms')->moreText($_obj->getSubject(), 16, 25)) ? $subject : '-'; ?></td><td><?php echo Mage::helper('core')->formatDate($_obj->getDate(), 'medium', true); ?></td><td><?php echo $type[$_obj->getType()]; ?></td><td class="a-center"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/'.Mage::getSingleton('magesms/sms')->status($_obj->getStatus())->icon; ?>" title="<?php echo Mage::getSingleton('magesms/sms')->status($_obj->getStatus())->name.(($note=$_obj->getNote()) && ($_obj->getStatus() == Topefekt_Magesms_Model_Sms::ERROR || $_obj->getStatus() == Topefekt_Magesms_Model_Sms::SCHEDULED) ? " - $note" : '') ; ?>" /></td></tr><tr id="histd_<?php echo $_obj->getId(); ?>" class="<?php if ($even) echo 'even'?>" style="display:none"><td colspan="6"><b><?php echo Mage::helper('magesms')->__('Text:'); ?></b><br /><?php echo $_obj->getText(); ?><br /><br /><b><?php echo Mage::helper('magesms')->__('SMS price in credits:'); ?></b> <?php echo $_obj->getPrice(); ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php if ($_obj->getPrice() > 0): ?><b><?php echo Mage::helper('magesms')->__('Credit balance:'); ?></b> <?php echo $_obj->getCredit(); ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php endif; ?><b><?php echo Mage::helper('magesms')->__('Total SMS:'); ?></b> <?php echo $_obj->getTotal(); ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><?php echo Mage::helper('magesms')->__('Unicode:'); ?></b> <?php echo $_obj->getUnicode() ? Mage::helper('magesms')->__('yes') : Mage::helper('magesms')->__('no'); ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><?php echo Mage::helper('magesms')->__('senderID:'); ?></b><?php if ($_obj->getSender() && preg_match("/^([0-9])*#x2F;", $_obj->getSender(), $matches)): ?>+<?php echo $_obj->getSender(); ?><?php elseif ($_obj->getSender()): ?><?php echo $_obj->getSender(); ?><?php else: ?><?php echo Mage::helper('magesms')->__('system number'); ?><?php endif; ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php if ($_obj->getSmsid()): ?><br /><b><?php echo Mage::helper('magesms')->__('smsID:'); ?></b> <?php echo $_obj->getSmsid(); ?><?php endif; ?></td></tr><?php endforeach; ?></table><table class="actions"><tr><td class="pager"><?php echo $this->__('Page') ?><?php $_curPage = $history->getCurPage() ?><?php $_lastPage = $history->getLastPageNumber() ?><?php if($_curPage>1): ?><a href="<?php echo Mage::helper("adminhtml")->getUrl('*/*/', $this->getRequest()->getParams()+array('page' => $_curPage-1)); ?>" title="<?php echo $this->__('Previous') ?>"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_left.gif') ?>" alt="Go to Previous page" class="arrow"/></a><?php else: ?><img src="<?php echo $this->getSkinUrl('images/pager_arrow_left_off.gif') ?>" alt="Go to Previous page" class="arrow"/><?php endif; ?><input type="text" name="curPage" readonly value="<?php echo $_curPage ?>" class="input-text page" /><?php if($_curPage < $_lastPage): ?><a href="<?php echo Mage::helper("adminhtml")->getUrl('*/*/', $this->getRequest()->getParams()+array('page' => $_curPage+1)); ?>" title="<?php echo $this->__('Next') ?>"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_right.gif') ?>" alt="Go to Next page" class="arrow"/></a><?php else: ?><img src="<?php echo $this->getSkinUrl('images/pager_arrow_right_off.gif') ?>" alt="Go to Previous page" class="arrow"/><?php endif; ?></td></tr></table></div></div><script type="text/javascript">//<![CDATA[
17
+ Event.observe(window, "load", function(){var gridData = document.getElementById('magesms');var tr_array = gridData.getElementsByTagName('tr');for (var i=0, len=tr_array.length; i < len; i++) {if (tr_array[i].className.indexOf('hover') !== -1) {tr_array[i].onmouseover = function() {this.className = this.className + ' on-mouse';};tr_array[i].onmouseout = function() {this.className = this.className.replace(' on-mouse', '');};tr_array[i].onclick = function() {var arr = this.id.split('_');var next = document.getElementById('histd_'+arr[1]);if (next.style.display == 'none') {next.style.display = 'table-row';} else {next.style.display = 'none';}var img = this.getElementsByClassName('img');if (img[0].style.display == 'none') {img[0].style.display = 'inline';} else {img[0].style.display = 'none';}if (img[1].style.display == 'none') {img[1].style.display = 'inline';} else {img[1].style.display = 'none';}};}}});
18
//]]></script><?php else: ?><div><?php echo Mage::helper('magesms')->__('Total SMS: 0'); ?></div><?php endif; ?></div>
app/design/adminhtml/default/default/template/topefekt/magesms/marketing.phtml CHANGED
@@ -13,12 +13,10 @@
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
- ?><?php $user = $this->profile->user; ?><?php $lang = $this->profile->lang; ?><h2><?php echo Mage::helper('magesms')->__('SMS Marketing'); ?></h2><p><?php echo Mage::helper('magesms')->__('Write text of message and use advanced filter to target your marketing campaign.'); ?></p><div id="magesms"><div class="entry-edit"><div class="entry-edit-head"><h4 class="icon-head fieldset-legend head-account"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/AdminTools.gif'; ?>" alt="" /> <?php echo Mage::helper('magesms')->__('SMS Marketing - bulk SMS text'); ?></h4></div><div class="fieldset"><form name="formSMS" id="magesms_sendsms" action="<?php echo Mage::helper("adminhtml")->getUrl('*/*/send') ?>" enctype="multipart/form-data" method="post"><input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" /><input name="filter" type="hidden" value="<?php echo $this->getRequest()->getParam('filter'); ?>" /><label for="text"><?php echo Mage::helper('magesms')->__('Enter SMS text'); ?></label><br /><div style="float: left;margin-right:30px;"><div class="margin-form"><textarea name="text" id="text" class="required-entry input-text" style="width:420px; height:135px;"><?php echo $this->getSmsData()->getData('text'); ?></textarea><div id="labelSMS"></div></div></div><div style="float: left; margin-top"><div class="margin-form"><input id="unicode" type="checkbox" value="1" name="unicode" <?php echo $this->getSmsData()->getData('unicode') ? 'checked' : ''; ?> /><label for="unicode"><?php echo Mage::helper('magesms')->__(' Unicode '); ?></label><span style="cursor:help;text-decoration:underline;" title="<?php echo Mage::helper('magesms')->__('Check only if you want to use Chinese, Arabic, Greek, Hebrew, Korean, Cyrillic, etc. or diacritic in the text of your SMS message (Unicode text allows you to insert characters in all fonts and various other symbols simultaneously. Number of characters in one SMS will be reduced to 70).'); ?>" onclick="popup_title(this)">?</span></div><div class="margin-form"><input type="hidden" value="0" name="unique" /><input id="unique" type="checkbox" value="1" name="unique" <?php echo $this->getSmsData()->getData('unique') === '0' ? '' : 'checked'; ?> /><label for="unique"><?php echo Mage::helper('magesms')->__('Remove duplicate numbers'); ?></label></div><div class="margin-form" style="margin-top: 10px"><input id="sendlater" type="checkbox" value="1" onchange="sendlaterx(this)" name="sendlater" <?php echo $this->getSmsData()->getData('sendlater') ? 'checked' : ''; ?> /><label for="sendlater"><?php echo Mage::helper('magesms')->__(' Send later '); ?></label></div><div class="margin-form sendlater-form" id="sendlater-form" style="display: none; padding: 5px 0 0 20px"><label for="date"><?php echo Mage::helper('magesms')->__('Date:'); ?></label><?php $datumodesl = Mage::helper('core')->formatDate( ($_x = $this->getSmsData()->getData('datumodesl')) ? $_x.date(' H:i:s', Mage::getModel('core/date')->timestamp(time())) : date('Y-m-d H:i:s', Mage::getModel('core/date')->timestamp(time())+24*60*60), 'short', false); ?><input type="text" style="width: 100px;" class="input-text validate-sendlater-datumodesl" value="<?php echo $datumodesl; ?>" id="datumodesl" name="datumodesl"/><img style="cursor:pointer" title="<?php echo Mage::helper('magesms')->__('Calendar'); ?>" id="date_select_trig" class="v-middle" alt="" src="<?php echo $this->getSkinUrl("images/grid-cal.gif");?> "/>&nbsp;&nbsp;&nbsp;&nbsp;<label for="date"><?php echo Mage::helper('magesms')->__('Time: '); ?></label><select name="datumodesl_hour"><?php for($hour=1;$hour<=24;$hour++): ?><option value="<?php echo $hour; ?>" <?php echo (($_x = $this->getSmsData()->getData('datumodesl_hour')) ? $_x : 9 ) == $hour ? 'selected' : ''; ?>><?php printf('%02d', $hour); ?></option><?php endfor; ?></select>:<select name="datumodesl_min"><?php for($min=0;$min<=59;$min++): ?><option value="<?php echo $min; ?>" <?php echo $this->getSmsData()->getData('datumodesl_min') == $min ? 'selected' : ''; ?>><?php printf('%02d', $min); ?></option><?php endfor; ?></select><script type="text/javascript">//<![CDATA[
17
function sendlaterx(obj) {if (obj.checked == true) {$('sendlater-form').show();} else {$('sendlater-form').hide();}}sendlaterx($('sendlater'));Calendar.setup({inputField: "datumodesl",ifFormat: "<?php echo Mage::app()->getLocale()->getDateStrFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT); ?>",button: "date_select_trig",align: "Bl",singleClick : true});
18
- //]]></script></div><div class="margin-form sendlater-form" style="display: none; padding: 5px 0 0 20px"><label for="datereal"><?php echo Mage::helper('magesms')->__('Your time: '); ?></label><?php $date = Mage::app()->getLocale()->date()->toString(); ?><select id="datereal" name="datereal"><option value="-1" <?php echo $this->getSmsData()->getData('datereal') == -1 ? 'selected' : ''; ?>><?php echo $date; ?> -<?php echo Mage::helper('magesms')->__('1hr'); ?></option><option value="0" <?php echo $this->getSmsData()->getData('datereal', 0) == 0 ? 'selected' : ''; ?>><?php echo $date; ?></option><option value="1" <?php echo $this->getSmsData()->getData('datereal') == 1 ? 'selected' : ''; ?>><?php echo $date; ?> +<?php echo Mage::helper('magesms')->__('1hr'); ?></option></select>&nbsp;&nbsp;&nbsp;&nbsp;(<?php echo Mage::helper('magesms')->__('time zone: '); ?><span style="cursor:help;" title="<?php echo Mage::helper('magesms')->__('time zone settings'); ?>"><a href="<?php echo Mage::helper("adminhtml")->getUrl('adminhtml/system_config/edit/section/general/', array('_fragment' => 'general_locale-head')); ?>" target="_blank"><?php echo Mage::app()->getStore()->getConfig('general/locale/timezone'); ?></a></span>)</div></div><div class="clear"></div><div class="margin-form" style="margin-left:500px"><button type="button" onclick="sendForm.submit();" title="<?php echo Mage::helper('magesms')->__('Send'); ?>" name="submitSend" class="form-button" /><span><span><span><?php echo Mage::helper('magesms')->__('Send'); ?></span></span></span></button><!--<input type="button" onclick="sendForm.submit();" value="<?php echo Mage::helper('magesms')->__('Send'); ?>" name="submitSend" class="form-button" />--></div></form><script type="text/javascript">//<![CDATA[
19
var sendForm = new varienForm('magesms_sendsms');sendForm.submit = function() {if (this.validator.validate()) {if (confirm('<?php echo Mage::helper('magesms')->__('Send').' '.Mage::helper('magesms')->__('SMS').'?'; ?>')) {varienForm.prototype.submit.bind(this)();}return false;}};Validation.add('validate-sendlater-datumodesl','Please enter a valid date.', function(v) {return !$('sendlater').checked || $('sendlater').checked && !Validation.get('IsEmpty').test(v);});
20
//]]></script></div></div><script type="text/javascript">//<![CDATA[
21
- countitSMS = new countitSMS(document.getElementById('text'), document.getElementById('unicode'), document.getElementById('labelSMS'));countitSMS.chartext1 = '<?php echo Mage::helper('magesms')->__('Characters: '); ?>';countitSMS.chartext2 = '<?php echo Mage::helper('magesms')->__('SMS: '); ?>';countitSMS.alert = '<?php echo Mage::helper('magesms')->__('Text is too long'); ?>';countitSMS.marketingCustomers = '<?php echo Mage::helper('magesms')->__('Total customers:'); ?>';countitSMS.marketingTotal = '<?php echo Mage::helper('magesms')->__('Total SMS:'); ?>';countitSMS.count();
22
- //]]></script><script type="text/javascript">//<![CDATA[
23
- function filterFormSubmit() {var filters = $('#marketing_filter input', '#marketing_filter select');var elements = [];for(var i in filters){if(filters[i].value && filters[i].value.length && !filters[i].disabled) elements.push(filters[i]);}var validator= new Validation('marketing_filter');if (validator.validate()) {ret = '';if (elements.length)ret = 'filter/' + encode_base64(Form.serializeElements(elements))+'/';setLocation('<?php echo $this->getFilterUrl(); ?>' + ret + sendFormSubmit());}}function filterResetFormSubmit() {var validator= new Validation('marketing_filter');if (validator.validate()) {setLocation('<?php echo $this->getFilterUrl(); ?>');}}function filterRemoveCustomerSubmit(obj) {var hidden = $('magesms_marketing_customer_not');hidden.value = hidden.value + ',' + obj.id;filterFormSubmit();}function sendFormSubmit() {var ret = '';var elements = [];var filters = $('#magesms_sendsms input', '#magesms_sendsms textarea', '#magesms_sendsms select');for(var i in filters){if(filters[i].value && filters[i].value.length && !filters[i].disabled) {elements.push(filters[i]);}}if (elements.length) {ret = 'sms/' + encode_base64(Form.serializeElements(elements))+'/';}return ret;}
24
//]]></script></div>
13
* @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
+ ?><?php $user = $this->profile->user; ?><?php $lang = $this->profile->lang; ?><h2><?php echo Mage::helper('magesms')->__('SMS Marketing - customers found: '); ?><span id="magesms-marketing-countit"><?php echo $this->getCollection()->count(); ?></span></h2><p><?php echo Mage::helper('magesms')->__('Write text of message and use advanced filter to target your marketing campaign.'); ?></p><div id="magesms"><div class="entry-edit"><div class="entry-edit-head"><h4 class="icon-head fieldset-legend head-account"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/AdminTools.gif'; ?>" alt="" /><?php echo Mage::helper('magesms')->__('SMS Marketing - bulk SMS text'); ?></h4><span class="right"><a href="<?php echo Mage::helper("adminhtml")->getUrl('*/*/template', array('action'=>'saveTemplate', 'type' => 1)); ?>" title="<?php echo Mage::helper('magesms')->__('Save template'); ?>" onclick="showPopup(this);return false;">[<?php echo Mage::helper('magesms')->__('Save template'); ?>]</a>&nbsp;&nbsp;&nbsp;<a href="<?php echo Mage::helper("adminhtml")->getUrl('*/*/template', array('action'=>'loadTemplate', 'type' => 1)); ?>" title="<?php echo Mage::helper('magesms')->__('Saved Templates'); ?>" onclick="showPopup(this);return false;">[<?php echo Mage::helper('magesms')->__('Saved Templates'); ?>]</a></span></div><div class="fieldset"><form name="formSMS" id="magesms_sendsms" action="<?php echo Mage::helper("adminhtml")->getUrl('*/*/send') ?>" enctype="multipart/form-data" method="post"><input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" /><input name="filter" type="hidden" value="<?php echo $this->getRequest()->getParam('filter'); ?>" /><div style="float: left;margin-right:30px;width:450px"><label for="text"><?php echo Mage::helper('magesms')->__('Enter SMS text'); ?></label><br /><div class="margin-form"><textarea name="text" id="text" class="required-entry input-text" style="width:420px; height:135px;"><?php echo $this->getSmsData()->getData('text'); ?></textarea></div><div class="clear"></div><span style="font-size:10px;"><?php echo Mage::helper('magesms')->__('Possible variables:'); ?><br /><div id="notice"><?php echo $this->getNotice(); ?></div></span></div><div style="float: left;margin-right:30px;"><label for="text"><?php echo Mage::helper('magesms')->__('Preview'); ?> (<span id="labelSMS"></span>)</label><br /><div class="margin-form"><textarea name="textfake" id="textfake" disabled="disabled" class="required-entry input-text" style="width:420px; height:135px;border:1px solid grey;"></textarea></div></div><div style="float: left;margin-top:1.5em;"><div class="margin-form"><input id="unicode" type="checkbox" value="1" name="unicode" <?php echo $this->getSmsData()->getData('unicode') ? 'checked' : ''; ?> /><label for="unicode"><?php echo Mage::helper('magesms')->__(' Unicode '); ?></label><span style="cursor:help;text-decoration:underline;" title="<?php echo Mage::helper('magesms')->__('Check only if you want to use Chinese, Arabic, Greek, Hebrew, Korean, Cyrillic, etc. or diacritic in the text of your SMS message (Unicode text allows you to insert characters in all fonts and various other symbols simultaneously. Number of characters in one SMS will be reduced to 70).'); ?>" onclick="popup_title(this)">?</span></div><div class="margin-form"><input type="hidden" value="0" name="unique" /><input id="unique" type="checkbox" value="1" name="unique" <?php echo $this->getSmsData()->getData('unique') === '0' ? '' : 'checked'; ?> /><label for="unique"><?php echo Mage::helper('magesms')->__('Remove duplicate numbers'); ?></label></div><div class="margin-form" style="margin-top: 10px"><input id="sendlater" type="checkbox" value="1" onchange="sendlaterx(this)" name="sendlater" <?php echo $this->getSmsData()->getData('sendlater') ? 'checked' : ''; ?> /><label for="sendlater"><?php echo Mage::helper('magesms')->__(' Send later '); ?></label></div><div class="margin-form sendlater-form" id="sendlater-form" style="display: none; padding: 5px 0 0 20px"><label for="date"><?php echo Mage::helper('magesms')->__('Date:'); ?></label><?php $datumodesl = Mage::helper('core')->formatDate( ($_x = $this->getSmsData()->getData('datumodesl')) ? $_x.date(' H:i:s', Mage::getModel('core/date')->timestamp(time())) : date('Y-m-d H:i:s', Mage::getModel('core/date')->timestamp(time())+24*60*60), 'short', false); ?><input type="text" style="width: 100px;" class="input-text validate-sendlater-datumodesl" value="<?php echo $datumodesl; ?>" id="datumodesl" name="datumodesl"/><img style="cursor:pointer" title="<?php echo Mage::helper('magesms')->__('Calendar'); ?>" id="date_select_trig" class="v-middle" alt="" src="<?php echo $this->getSkinUrl("images/grid-cal.gif");?> "/>&nbsp;&nbsp;&nbsp;&nbsp;<label for="date"><?php echo Mage::helper('magesms')->__('Time: '); ?></label><select name="datumodesl_hour"><?php for($hour=1;$hour<=24;$hour++): ?><option value="<?php echo $hour; ?>" <?php echo (($_x = $this->getSmsData()->getData('datumodesl_hour')) ? $_x : 9 ) == $hour ? 'selected' : ''; ?>><?php printf('%02d', $hour); ?></option><?php endfor; ?></select>:<select name="datumodesl_min"><?php for($min=0;$min<=59;$min++): ?><option value="<?php echo $min; ?>" <?php echo $this->getSmsData()->getData('datumodesl_min') == $min ? 'selected' : ''; ?>><?php printf('%02d', $min); ?></option><?php endfor; ?></select><script type="text/javascript">//<![CDATA[
17
function sendlaterx(obj) {if (obj.checked == true) {$('sendlater-form').show();} else {$('sendlater-form').hide();}}sendlaterx($('sendlater'));Calendar.setup({inputField: "datumodesl",ifFormat: "<?php echo Mage::app()->getLocale()->getDateStrFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT); ?>",button: "date_select_trig",align: "Bl",singleClick : true});
18
+ //]]></script><div class="margin-form" style="padding: 5px 0 0 0"><label for="datereal"><?php echo Mage::helper('magesms')->__('Your time: '); ?></label><?php $date = Mage::app()->getLocale()->date()->toString(); ?><select id="datereal" name="datereal"><option value="-1" <?php echo $this->getSmsData()->getData('datereal') == -1 ? 'selected' : ''; ?>><?php echo $date; ?> -<?php echo Mage::helper('magesms')->__('1hr'); ?></option><option value="0" <?php echo $this->getSmsData()->getData('datereal', 0) == 0 ? 'selected' : ''; ?>><?php echo $date; ?></option><option value="1" <?php echo $this->getSmsData()->getData('datereal') == 1 ? 'selected' : ''; ?>><?php echo $date; ?> +<?php echo Mage::helper('magesms')->__('1hr'); ?></option></select>&nbsp;&nbsp;&nbsp;&nbsp;(<?php echo Mage::helper('magesms')->__('time zone: '); ?><span style="cursor:help;" title="<?php echo Mage::helper('magesms')->__('time zone settings'); ?>"><a href="<?php echo Mage::helper("adminhtml")->getUrl('adminhtml/system_config/edit/section/general/', array('_fragment' => 'general_locale-head')); ?>" target="_blank"><?php echo Mage::app()->getStore()->getConfig('general/locale/timezone'); ?></a></span>)</div></div></div><div class="clear"></div><div class="margin-form" style="margin-left:500px"><button type="button" onclick="sendForm.submit();" title="<?php echo Mage::helper('magesms')->__('Send'); ?>" name="submitSend" class="form-button" /><span><span><span><?php echo Mage::helper('magesms')->__('Send'); ?></span></span></span></button><!--<input type="button" onclick="sendForm.submit();" value="<?php echo Mage::helper('magesms')->__('Send'); ?>" name="submitSend" class="form-button" />--></div></form><script type="text/javascript">//<![CDATA[
19
var sendForm = new varienForm('magesms_sendsms');sendForm.submit = function() {if (this.validator.validate()) {if (confirm('<?php echo Mage::helper('magesms')->__('Send').' '.Mage::helper('magesms')->__('SMS').'?'; ?>')) {varienForm.prototype.submit.bind(this)();}return false;}};Validation.add('validate-sendlater-datumodesl','Please enter a valid date.', function(v) {return !$('sendlater').checked || $('sendlater').checked && !Validation.get('IsEmpty').test(v);});
20
//]]></script></div></div><script type="text/javascript">//<![CDATA[
21
+ countitSMS = new countitSMS(document.getElementById('textfake'), document.getElementById('unicode'), document.getElementById('labelSMS'));countitSMS.chartext1 = '<?php echo Mage::helper('magesms')->__('Characters: '); ?>';countitSMS.chartext2 = '<?php echo Mage::helper('magesms')->__('total sms: '); ?>';countitSMS.alert = '';countitSMS.translate = {<?php echo $this->getTranslate(); ?>};countitSMS.copyFrom = document.getElementById('text');countitSMS.marketingCustomers = '<?php echo Mage::helper('magesms')->__('Total customers:'); ?>';countitSMS.marketingTotal = '<?php echo Mage::helper('magesms')->__('Total SMS:'); ?>';$('text').onkeyup = function() {countitSMS.count();};Event.observe(window, "load", function() {countitSMS.marketingCount = '<?php echo $this->getCollection()->count(); ?>';countitSMS.count();countitSMS.help(document.getElementById('notice'));});
22
//]]></script></div>
app/design/adminhtml/default/default/template/topefekt/magesms/marketing/customer.phtml ADDED
@@ -0,0 +1,16 @@
1
+ <?php
2
+ /**
3
+ * Mage SMS - SMS notification & SMS marketing
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the BSD 3-Clause License
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ * @category TOPefekt
12
+ * @package TOPefekt_Magesms
13
+ * @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
+ * @license http://opensource.org/licenses/BSD-3-Clause
15
+ */
16
+ ?><div class="entry-edit"><div class="entry-edit-head"><h4><?php echo $this->getTitle();?> <?php echo $this->getCollection()->count(); ?></h4></div><fieldset class="magesms-marketing-customer"><?php if ($this->getCollection()->count()): ?><?php if (!$this->getDeleteCustomer() && !Mage::app()->isSingleStoreMode()): ?><div id="magesms-stores"><?php foreach ($this->getWebsites()->getWebsites() as $website): ?><span class="badge" style="background:<?php echo $website->getColorWebsite(); ?>"><?php echo $website->getName(); ?></span><?php endforeach; ?></div><?php endif; ?><?php foreach($this->displayByAlphabet() as $letter=>$customers): ?><div><span class="bigLetter"><?php echo $letter; ?></span><?php $i=0;foreach($customers as $customer): ?><?php if ($this->getDeleteCustomer() || $i < 10): ?><span class="badge <?php echo $this->getDeleteCustomer() ? 'deleted' : '';?>"<?php echo !$this->getDeleteCustomer() ? ' style="background:'.$this->getWebsites()->getColorWebsite($customer->getWebsiteId()).'"' : ''?>><a href="<?php echo Mage::helper("adminhtml")->getUrl('adminhtml/customer/edit', array('id' => $customer->getId())); ?>" title="<?php echo $customer->getCountryId().' - '.$customer->getTelephone(); ?>" target="_blank"><?php echo $customer->lastname?> <?php echo $customer->firstname?></a><a class="delete" onclick="removeCustomer(this); return false;" href="<?php echo Mage::helper("adminhtml")->getUrl('*/*/filter', array('action' => 'removeCustomer', 'id' => $customer->getId())); ?>">x</a></span><?php elseif ($i == 10): ?><span class="badge more"><a title="<?php echo $letter; ?>" href="<?php echo Mage::helper("adminhtml")->getUrl('*/*/filter', array('action' => 'listCustomers', 'letter' => $letter)); ?>" onclick="showPopup(this);return false;"><?php echo Mage::helper('magesms')->__('More...')?></a></span><?php endif; ?><?php $i++; endforeach; ?></div><?php endforeach; ?><?php else: ?><?php echo Mage::helper('magesms')->__('Customers found: 0')?><?php endif; ?></fieldset></div>
app/design/adminhtml/default/default/template/topefekt/magesms/marketing/form.phtml ADDED
@@ -0,0 +1,16 @@
1
+ <?php
2
+ /**
3
+ * Mage SMS - SMS notification & SMS marketing
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the BSD 3-Clause License
8
+ * It is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ * @category TOPefekt
12
+ * @package TOPefekt_Magesms
13
+ * @copyright Copyright (c) 2012-2014 TOPefekt s.r.o. (http://www.mage-sms.com)
14
+ * @license http://opensource.org/licenses/BSD-3-Clause
15
+ */
16
+ ?><div class="fieldset"><form method="post" id="magesms_filter_template" action="<?php echo Mage::helper("adminhtml")->getUrl('*/*/filter', array('action' => 'saveFilter')); ?>"><div class="margin-form"><label for="name"><?php echo Mage::helper('magesms')->__('Filter Name'); ?>: </label><input class="input-text" type="text" name="saveName" id="saveName" value="" /><button type="button" onclick="window.submitSaveFilter($('magesms_filter_template'));" title="<?php echo Mage::helper('magesms')->__('Save filter'); ?>" name="submitSaveFilter" class="form-button" /><span><span><span><?php echo Mage::helper('magesms')->__('Save filter'); ?></span></span></span></button></div></form></div>
app/design/adminhtml/default/default/template/topefekt/magesms/optout.phtml CHANGED
@@ -16,5 +16,5 @@
16
?><?php $user = $this->profile->user; ?><?php $lang = $this->profile->lang; ?><h2><?php echo Mage::helper('magesms')->__('SMS opt-out - setting SMS opt-out option from the cart and SMS charging'); ?></h2><p><?php echo Mage::helper('magesms')->__('Select an online store for which you want to set in the cart option to unsubscribe SMS notifications, setup cost of SMS messages and define the text that is displayed to the customer in the cart.'); ?></p><div id="magesms"><div class="entry-edit"><div class="entry-edit-head"><h4 class="icon-head fieldset-legend head-account"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/AdminTools.gif'; ?>" alt="" /> <?php echo Mage::helper('magesms')->__('Your online stores'); ?></h4></div><div class="fieldset grid"><table class="data"><col /><col width="50" /><?php $even = 1; foreach(Mage::app()->getWebsites($this->_isAdminScopeAllowed) as $website): if ($even) $even = 0; else $even = 1;?><?php $stores = $website->getStoreIds(); $product = Mage::getResourceModel('catalog/product_collection') ->addFieldToFilter('sku', Mage::getConfig()->getNode('default/config/optout')->sku) ->addWebsiteFilter($website->getId()) ->addAttributeToSelect('name') ->addAttributeToSelect('price') ->joinAttribute( 'status', 'catalog_product/status', 'entity_id', null, 'inner', reset($stores)) ->getFirstItem(); ?><tr id="hist_<?php echo $website->getId(); ?>" class="hover <?php if ($even) echo 'even'?>"><td><span class="img"><img class="toggle" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/i_plus.gif'; ?>"></span><span class="img" style="display:none"><img class="toggle" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/i_minus.gif'; ?>"></span><?php echo $website->getName(); ?><?php echo ($_tmp = Mage::getStoreConfig('general/store_information/name', reset($stores))) ? " ($_tmp)" : ''; ?></td><td class="a-center"><?php if ($product->getId() && $product->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_ENABLED) { $img = 'i_accepted.gif'; $title = Mage::helper('magesms')->__('SMS opt-out is ACTIVE'); } else { $img = 'i_canceled.gif'; $title = Mage::helper('magesms')->__('SMS opt-out is NOT ACTIVE. To activate SMS opt-out check the checkbox „Activate displaying SMS opt-out feature in the cart“'); } ?><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/'.$img; ?>" title="<?php echo $title; ?>" /></td></tr><tr id="histd_<?php echo $website->getId(); ?>" class="<?php if ($even) echo 'even'?>" style="display:none"><td colspan="2"><form method="post" id="form_<?php echo $website->getId(); ?>" action="<?php echo Mage::getUrl('*/*/save') ?>" name="form"><input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" /><input type="hidden" value="<?php echo $website->getId(); ?>" name="website" /><div style="float:left;width:330px;"><input type="checkbox" name="status" id="status_<?php echo $website->getId(); ?>" value="1"<?php echo $product->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_ENABLED ? ' checked' : ''; ?> /><label for="status_<?php echo $website->getId(); ?>"><?php echo Mage::helper('magesms')->__('Activate displaying SMS opt-out feature in the cart'); ?></label>&nbsp;&nbsp;&nbsp;&nbsp;<br><br><br><div style="float:left;"><input type="submit" class="form-button" name="submitOptOut" value="<?php echo Mage::helper('magesms')->__('Save'); ?>" /></div><div style="float:left;padding-left:20px;"><input type="button" onclick="this.form.reset();" class="form-button" title="<?php echo Mage::helper('magesms')->__('Restore unsaved changes to its original state.'); ?>" value="<?php echo Mage::helper('magesms')->__('Cancel'); ?>" /></div></div><div style="float:left;"><table class="data"><tr class="headings"><th><?php echo Mage::helper('magesms')->__('Price of SMS'); ?></th><th<?php if (!Mage::app()->isSingleStoreMode()): ?> colspan="2"<?php endif; ?>><?php echo Mage::helper('magesms')->__('Text displayed in the cart'); ?></th></tr><?php $i=0; foreach($website->getStores() as $store): $productStore = Mage::getModel('catalog/product') ->setStoreId($store->getId()) ->load($product->getId()); ?><tr><?php if ($i++ == 0): ?><td style="vertical-align: middle;" rowspan="<?php echo count($website->getStores());?>"><span class="required">*</span><input type="text" name="price" class="required-entry validate-zero-or-greater input-text" style="width:60px" value="<?php echo $productStore->getPrice(); ?>" /><strong>[<?php echo $website->getBaseCurrency()->getCode(); ?>]</strong></td><?php endif; ?><?php if (!Mage::app()->isSingleStoreMode()): ?><td><?php echo $store->getName(); ?></td><?php endif; ?><td><span class="required">*</span><input type="text" class="required-entry input-text" name="name[<?php echo $store->getId(); ?>]" style="width:270px" value="<?php echo $this->htmlEscape($productStore->getName()); ?>" /></td></tr><?php endforeach; ?></table></div></form><script type="text/javascript">//<![CDATA[
17
var sendForm = new varienForm('form_<?php echo $website->getId(); ?>');
18
//]]></script><br><br><br><br><br><br></td></tr><?php endforeach; ?></table></div></div><script type="text/javascript">//<![CDATA[
19
- function smsr(f){(document.readyState)!=="complete"?setTimeout(smsr,9,f):f()}smsr(function() {var gridData = document.getElementById('magesms');var tr_array = gridData.getElementsByTagName('tr');for (var i=0, len=tr_array.length; i < len; i++) {if (tr_array[i].className.indexOf('hover') !== -1) {tr_array[i].onmouseover = function() {this.className = this.className + ' on-mouse';};tr_array[i].onmouseout = function() {this.className = this.className.replace(' on-mouse', '');};tr_array[i].onclick = function() {var arr = this.id.split('_');var next = document.getElementById('histd_'+arr[1]);if (next.style.display == 'none') {next.style.display = 'table-row';} else {next.style.display = 'none';}var img = this.getElementsByClassName('img');if (img[0].style.display == 'none') {img[0].style.display = 'inline';} else {img[0].style.display = 'none';}if (img[1].style.display == 'none') {img[1].style.display = 'inline';} else {img[1].style.display = 'none';}};}}<?php if (Mage::app()->isSingleStoreMode()): ?>$("tr[id*=hist_]")[0].click();<?php else: ?>$("hist_"+window.location.hash.substr(1)).click();<?php endif; ?>});
20
//]]></script></div>
16
?><?php $user = $this->profile->user; ?><?php $lang = $this->profile->lang; ?><h2><?php echo Mage::helper('magesms')->__('SMS opt-out - setting SMS opt-out option from the cart and SMS charging'); ?></h2><p><?php echo Mage::helper('magesms')->__('Select an online store for which you want to set in the cart option to unsubscribe SMS notifications, setup cost of SMS messages and define the text that is displayed to the customer in the cart.'); ?></p><div id="magesms"><div class="entry-edit"><div class="entry-edit-head"><h4 class="icon-head fieldset-legend head-account"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/AdminTools.gif'; ?>" alt="" /> <?php echo Mage::helper('magesms')->__('Your online stores'); ?></h4></div><div class="fieldset grid"><table class="data"><col /><col width="50" /><?php $even = 1; foreach(Mage::app()->getWebsites($this->_isAdminScopeAllowed) as $website): if ($even) $even = 0; else $even = 1;?><?php $stores = $website->getStoreIds(); $product = Mage::getResourceModel('catalog/product_collection') ->addFieldToFilter('sku', Mage::getConfig()->getNode('default/config/optout')->sku) ->addWebsiteFilter($website->getId()) ->addAttributeToSelect('name') ->addAttributeToSelect('price') ->joinAttribute( 'status', 'catalog_product/status', 'entity_id', null, 'inner', reset($stores)) ->getFirstItem(); ?><tr id="hist_<?php echo $website->getId(); ?>" class="hover <?php if ($even) echo 'even'?>"><td><span class="img"><img class="toggle" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/i_plus.gif'; ?>"></span><span class="img" style="display:none"><img class="toggle" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/i_minus.gif'; ?>"></span><?php echo $website->getName(); ?><?php echo ($_tmp = Mage::getStoreConfig('general/store_information/name', reset($stores))) ? " ($_tmp)" : ''; ?></td><td class="a-center"><?php if ($product->getId() && $product->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_ENABLED) { $img = 'i_accepted.gif'; $title = Mage::helper('magesms')->__('SMS opt-out is ACTIVE'); } else { $img = 'i_canceled.gif'; $title = Mage::helper('magesms')->__('SMS opt-out is NOT ACTIVE. To activate SMS opt-out check the checkbox „Activate displaying SMS opt-out feature in the cart“'); } ?><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/'.$img; ?>" title="<?php echo $title; ?>" /></td></tr><tr id="histd_<?php echo $website->getId(); ?>" class="<?php if ($even) echo 'even'?>" style="display:none"><td colspan="2"><form method="post" id="form_<?php echo $website->getId(); ?>" action="<?php echo Mage::getUrl('*/*/save') ?>" name="form"><input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" /><input type="hidden" value="<?php echo $website->getId(); ?>" name="website" /><div style="float:left;width:330px;"><input type="checkbox" name="status" id="status_<?php echo $website->getId(); ?>" value="1"<?php echo $product->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_ENABLED ? ' checked' : ''; ?> /><label for="status_<?php echo $website->getId(); ?>"><?php echo Mage::helper('magesms')->__('Activate displaying SMS opt-out feature in the cart'); ?></label>&nbsp;&nbsp;&nbsp;&nbsp;<br><br><br><div style="float:left;"><input type="submit" class="form-button" name="submitOptOut" value="<?php echo Mage::helper('magesms')->__('Save'); ?>" /></div><div style="float:left;padding-left:20px;"><input type="button" onclick="this.form.reset();" class="form-button" title="<?php echo Mage::helper('magesms')->__('Restore unsaved changes to its original state.'); ?>" value="<?php echo Mage::helper('magesms')->__('Cancel'); ?>" /></div></div><div style="float:left;"><table class="data"><tr class="headings"><th><?php echo Mage::helper('magesms')->__('Price of SMS'); ?></th><th<?php if (!Mage::app()->isSingleStoreMode()): ?> colspan="2"<?php endif; ?>><?php echo Mage::helper('magesms')->__('Text displayed in the cart'); ?></th></tr><?php $i=0; foreach($website->getStores() as $store): $productStore = Mage::getModel('catalog/product') ->setStoreId($store->getId()) ->load($product->getId()); ?><tr><?php if ($i++ == 0): ?><td style="vertical-align: middle;" rowspan="<?php echo count($website->getStores());?>"><span class="required">*</span><input type="text" name="price" class="required-entry validate-zero-or-greater input-text" style="width:60px" value="<?php echo $productStore->getPrice(); ?>" /><strong>[<?php echo $website->getBaseCurrency()->getCode(); ?>]</strong></td><?php endif; ?><?php if (!Mage::app()->isSingleStoreMode()): ?><td><?php echo $store->getName(); ?></td><?php endif; ?><td><span class="required">*</span><input type="text" class="required-entry input-text" name="name[<?php echo $store->getId(); ?>]" style="width:270px" value="<?php echo $this->htmlEscape($productStore->getName()); ?>" /></td></tr><?php endforeach; ?></table></div></form><script type="text/javascript">//<![CDATA[
17
var sendForm = new varienForm('form_<?php echo $website->getId(); ?>');
18
//]]></script><br><br><br><br><br><br></td></tr><?php endforeach; ?></table></div></div><script type="text/javascript">//<![CDATA[
19
+ Event.observe(window, "load", function() {var gridData = document.getElementById('magesms');var tr_array = gridData.getElementsByTagName('tr');for (var i=0, len=tr_array.length; i < len; i++) {if (tr_array[i].className.indexOf('hover') !== -1) {tr_array[i].onmouseover = function() {this.className = this.className + ' on-mouse';};tr_array[i].onmouseout = function() {this.className = this.className.replace(' on-mouse', '');};tr_array[i].onclick = function() {var arr = this.id.split('_');var next = document.getElementById('histd_'+arr[1]);if (next.style.display == 'none') {next.style.display = 'table-row';} else {next.style.display = 'none';}var img = this.getElementsByClassName('img');if (img[0].style.display == 'none') {img[0].style.display = 'inline';} else {img[0].style.display = 'none';}if (img[1].style.display == 'none') {img[1].style.display = 'inline';} else {img[1].style.display = 'none';}};}}<?php if (Mage::app()->isSingleStoreMode()): ?>$("tr[id*=hist_]")[0].click();<?php else: ?>$("hist_"+window.location.hash.substr(1)).click();<?php endif; ?>});
20
//]]></script></div>
app/design/adminhtml/default/default/template/topefekt/magesms/profile.phtml CHANGED
@@ -14,13 +14,13 @@
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
?><?php $user = $this->profile->user; ?><?php $lang = $this->profile->lang; ?><script type="text/javascript">//<![CDATA[
17
- function smsr(f){(document.readyState)!=="complete"?setTimeout(smsr,9,f):f()}smsr(function(){var gridData = document.getElementById('magesms-profile');var tr_array = gridData.getElementsByTagName('tr');for (var i=0, len=tr_array.length; i < len; i++) {if (tr_array[i].className.indexOf('hover') !== -1) {tr_array[i].onmouseover = function() {this.className = this.className + ' on-mouse';};tr_array[i].onmouseout = function() {this.className = this.className.replace(' on-mouse', '');};tr_array[i].onclick = function() {var arr = this.id.split('_');var next = document.getElementById('histd_'+arr[1]);if (next.style.display == 'none') {next.style.display = 'table-row';} else {next.style.display = 'none';}var img = this.getElementsByClassName('img');if (img[0].style.display == 'none') {img[0].style.display = 'inline';} else {img[0].style.display = 'none';}if (img[1].style.display == 'none') {img[1].style.display = 'inline';} else {img[1].style.display = 'none';}};}}});
18
//]]></script><div id="magesms-profile"><div class="float-right"><?php if (!$user->getUser()): ?><div class="entry-edit"><div class="entry-edit-head"><h4 class="icon-head fieldset-legend head-account"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/AdminEmployees.gif'; ?>" alt="" /> <?php echo Mage::helper('magesms')->__('Sign in'); ?></h4></div><div class="fieldset "><form id="magesms_login" action="<?php echo $this->getUrl('*/*/login') ?>" method="post"><input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" /><p><?php echo Mage::helper('magesms')->__('If You already have an account, please sign in.'); ?></p><div><div class="margin-form"><label class="form-required" for="username"><?php echo Mage::helper('magesms')->__('Username:'); ?> <span class="required">*</span></label><input class="required-entry input-text" type="text" name="username" id="username" value="" /></div><div class="margin-form"><label class="form-required" for="password"><?php echo Mage::helper('magesms')->__('Password:'); ?> <span class="required">*</span></label><input class="required-entry input-text" type="password" name="password" id="password" value="" /></div><div class="margin-form"><input type="submit" value="<?php echo Mage::helper('magesms')->__('Log in'); ?>" name="submitLogin" class="form-button" /></div><div><span class="require">*</span> <?php echo Mage::helper('magesms')->__('Required field'); ?></div></div></form></div></div><script type="text/javascript">//<![CDATA[
19
var loginForm = new varienForm('magesms_login', '<?php echo $this->getUrl('*/*/login') ?>');loginForm._processValidationResult = function(transport) {var response = transport.responseText.evalJSON();if (response.error){if (response.attribute && $(response.attribute)) {$(response.attribute).setHasError(true, productForm);Validation.ajaxError($(response.attribute), response.message);if (!Prototype.Browser.IE){$(response.attribute).focus();}}else if ($('messages')) {$('messages').innerHTML = '<ul class="messages"><li class="error-msg"><ul><li>' + response.message + '</li></ul></li></ul>';}}else{loginForm._submit();}};
20
//]]></script><?php else: ?><div class="entry-edit"><div class="entry-edit-head"><h4 class="icon-head fieldset-legend head-account"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/AdminEmployees.gif'; ?>" alt="" /> <?php echo Mage::helper('magesms')->__('User account info'); ?></h4></div><div class="fieldset "><div><div class="margin-form"><label class="form-required"><?php echo Mage::helper('magesms')->__('Username:'); ?></label><span class="required-entry input-text"><?php echo $user->user; ?></span></div><div class="margin-form"><label class="form-required"><?php echo Mage::helper('magesms')->__('Password:'); ?></label><span class="required-entry input-text"><?php echo $user->passwd; ?></span></div><div class="margin-form"><label class="form-required"><?php echo Mage::helper('magesms')->__('SMS Credit:'); ?></label><span class="required-entry input-text"><?php echo $this->profile->credit; ?></span></div></div></div></div><div class="entry-edit"><?php $admins = $this->profile->admins; ?><?php if ($adminedit = Mage::app()->getRequest()->getParam('adminedit')): ?><?php $edit = $admins->load($adminedit); ?><?php else: ?><?php $edit = Mage::getModel('magesms/admins'); ?><?php endif; ?><div class="entry-edit-head"><h4 class="icon-head fieldset-legend head-account"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/AdminEmployees.gif'; ?>" alt="" /> <?php echo Mage::helper('magesms')->__('Add administrators'); ?></h4></div><div class="fieldset "><form id="magesms_admins" action="<?php echo $this->getUrl('*/*/saveadmin') ?>" method="post"><?php echo $this->getBlockHtml('formkey')?><div><div class="margin-form"><label class="form-required" for="name"><?php echo Mage::helper('magesms')->__('Name:'); ?> <span class="required">*</span></label><input class="required-entry input-text" type="text" name="name" id="name" value="<?php echo $this->htmlEscape($edit->getName()); ?>" /></div><div class="margin-form"><label class="form-required" for="number"><?php echo Mage::helper('magesms')->__('Mobile number:'); ?> <span class="required">*</span></label><input class="required-entry input-text validate-number" type="text" name="number" id="number" value="<?php echo $this->htmlEscape($edit->getNumber()); ?>" /><div><?php echo Mage::helper('magesms')->__('in international format, no leading zeros or a “+” sign, e.g., 447971796595'); ?></div></div><div class="margin-form"><input type="hidden" name="id" value="<?php echo $adminedit; ?>" /><input type="button" onclick="adminsForm.submit();" value="<?php echo Mage::helper('magesms')->__($adminedit ? 'Edit' : 'Add'); ?>" class="form-button" /></div><?php if ($admins->getCollection()->count()): ?><div class="grid"><table class="data"><colgroup><col /><col /><col width="60" /><col width="60" /></colgroup><?php $even = 1; foreach( $admins->getCollection() as $_admins ): if ($even) $even = 0; else $even = 1; ?><tr class="hover <?php if ($even) echo 'even'?> pointer"><td><?php echo $_admins->name; ?></td><td><?php echo $_admins->number; ?></td><td class="a-center"><a href="<?php echo Mage::helper("adminhtml")->getUrl('*/*/*', array('adminedit' => $_admins->getId())) ?>" title="<?php echo Mage::helper('magesms')->__('EDIT administrator'); ?>"><?php echo Mage::helper('magesms')->__('edit'); ?></a></td><td class="a-center last"><a href="<?php echo Mage::helper("adminhtml")->getUrl('*/*/deleteadmin', array('id' => $_admins->getId())) ?>" title="<?php echo Mage::helper('magesms')->__('DELETE administrator'); ?>" onclick="return confirm('<?php echo Mage::helper('magesms')->__('Are you sure to delete').' '.$_admins->name.'?'; ?>')"><?php echo Mage::helper('magesms')->__('delete'); ?></a></td></tr><?php endforeach; ?></table></div><?php endif; ?><div><span class="require">*</span> <?php echo Mage::helper('magesms')->__('Required field'); ?></div></div></form></div><script type="text/javascript">//<![CDATA[
21
var adminsForm = new varienForm('magesms_admins', '<?php echo Mage::helper("adminhtml")->getUrl('*/*/validateadmin', array('id' => Mage::app()->getRequest()->getParam('adminedit', 0))) ?>');
22
//]]></script></div><div class="entry-edit"><div class="entry-edit-head"><h4 class="icon-head fieldset-legend head-account"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/AdminEmployees.gif'; ?>" alt="" /> <?php echo Mage::helper('magesms')->__('Other settings'); ?></h4></div><div class="fieldset "><form id="magesms_settings" action="<?php echo $this->getUrl('*/*/savesettings') ?>" method="post"><input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" /><div><div class="margin-form"><label for="simulate"><?php echo Mage::helper('magesms')->__('Simulate SMS sending:'); ?></label><input type="checkbox" name="simulatesms" id="simulatesms" value="1" <?php echo $user->getSimulatesms() ? 'checked' : ''; ?> /><span class="help" onclick="popup_title(this)" title="<?php echo Mage::helper('magesms')->__('Allows to test sending of SMS in modul and to view sent SMS in SMS history with a special status.'); ?>" style="cursor:help;text-decoration:underline;">?</span></div><div class="margin-form"><label for="URLreports"><?php echo Mage::helper('magesms')->__('Delivery reports:'); ?></label><input type="checkbox" name="URLreports" id="URLreports" value="1" <?php echo $user->getData('URLreports') ? 'checked' : ''; ?> /><span class="help" onclick="popup_title(this)" title="<?php echo Mage::helper('magesms')->__('Allows to see delivery reports of SMS in SMS history Tab.'); ?>" style="cursor:help;text-decoration:underline;">?</span></div><div class="margin-form"><label for="pocetkredit"><?php echo Mage::helper('magesms')->__('Low credit alert:'); ?></label><input type="text" class="input-text" size="3" name="pocetkredit" id="pocetkredit" value="<?php echo $user->getPocetkredit() ? $user->getPocetkredit() : 0; ?>" /><span class="help" onclick="popup_title(this)" title="<?php echo Mage::helper('magesms')->__(' Allows to receive email when your SMS credit is low.'); ?>" style="cursor:help;text-decoration:underline;">?</span><span class="help2"><?php echo Mage::helper('magesms')->__('(0 = no alert)'); ?></span></div><div class="margin-form"><label for="deliveryemail"><?php echo Mage::helper('magesms')->__('Email for delivery reports:'); ?></label><input type="text" class="input-text validate-email" name="deliveryemail" id="deliveryemail" value="<?php echo $this->htmlEscape($user->getDeliveryemail()); ?>" /><span class="help" onclick="popup_title(this)" title="<?php echo Mage::helper('magesms')->__('Allows to receive email with delivery report of SMS.'); ?>" style="cursor:help;text-decoration:underline;">?</span></div><div class="margin-form"><label style="width: 210px; margin: 0 20px 1em 0;"><?php echo Mage::helper('magesms')->__('For sending SMS prefer phone nr. from:'); ?></label><div style="white-space:nowrap"><input type="radio" class="input-text" name="prefbilling" id="prefbilling0" value="0" <?php echo !$user->getPrefbilling() ? 'checked' : ''; ?> /><label for="prefbilling0" style="width: auto; display: inline; float: none"><?php echo Mage::helper('magesms')->__('invoice address'); ?></label></div><div style="white-space:nowrap"><input type="radio" class="input-text" name="prefbilling" id="prefbilling1" value="1" <?php echo $user->getPrefbilling() ? 'checked' : ''; ?> /><label for="prefbilling1" style="width: auto; display: inline; float: none"><?php echo Mage::helper('magesms')->__('delivery address'); ?></label></div><div class="clear"></div></div><div class="margin-form"><input type="button" onclick="settingsForm.submit();" value="<?php echo Mage::helper('magesms')->__('Save'); ?>" class="form-button" /></div></div></form><script type="text/javascript">//<![CDATA[
23
var settingsForm = new varienForm('magesms_settings', '<?php echo Mage::helper("adminhtml")->getUrl('*/*/validatesettings') ?>');
24
- //]]></script></div></div><?php endif; ?></div><div class="float-left"><div class="entry-edit"><div class="entry-edit-head"><h4 class="icon-head fieldset-legend head-account"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/AdminEmployees.gif'; ?>" alt="" /> <?php echo Mage::helper('magesms')->__($user->getUser() ? 'Edit user account' : 'New user account'); ?></h4></div><div class="fieldset "><form id="magesms_profil" action="<?php echo $this->getUrl('*/*/save') ?>" method="post"><input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" /><?php if (!$user->getUser()): ?><p><?php echo Mage::helper('magesms')->__('Not registered yet? Create account now!'); ?></p><?php endif; ?><div class="margin-form"><label class="form-required" for="email"><?php echo Mage::helper('magesms')->__('Email:'); ?> <span class="required">*</span></label><input class="required-entry input-text validate-email" type="text" name="email" id="email" value="<?php echo $this->htmlEscape($user->getEmail()); ?>" /></div><div class="margin-form"><label class="form-required"><?php echo Mage::helper('magesms')->__('Registration type:'); ?></label><input type="radio" name="regtype" id="reg-type1" style="float: left" value="person" <?php echo !$user->getRegtype() || $user->getRegtype() =='person' ? 'checked' : ''; ?> /><label style="width: auto; margin: 0 15px 0 5px" for="reg-type1"><?php echo Mage::helper('magesms')->__('Personal'); ?></label><input type="radio" name="regtype" id="reg-type2" style="float: left" value="firm" <?php echo $user->getRegtype() =='firm' ? 'checked' : ''; ?> /><label style="width: auto; margin-left: 5px" for="reg-type2"><?php echo Mage::helper('magesms')->__('Business'); ?></label><div class="clear"></div></div><div class="entry-edit-head firm"><h4 class="fieldset-legend head-account"><?php echo Mage::helper('magesms')->__('Billing information'); ?></h4></div><div class="fieldset firm"><div class="margin-form"><label class="" for="companyname"><?php echo Mage::helper('magesms')->__('Company name:'); ?> <span class="required">*</span></label><input class="input-text" type="text" name="companyname" id="companyname" value="<?php echo $this->htmlEscape($user->getCompanyname()); ?>" /></div><div class="margin-form firm czech" style="display: none;"><label for="companyid"><?php echo Mage::helper('magesms')->__('Company ID:'); ?></label><input class="input-text" type="text" name="companyid" id="companyid" value="<?php echo $this->htmlEscape($user->getCompanyid()); ?>" /></div><div class="margin-form firm vat" style="display: none;"><label for="companyvat"><?php echo Mage::helper('magesms')->__('Company VAT:'); ?></label><input class="input-text" type="text" name="companyvat" id="companyvat" value="<?php echo $this->htmlEscape($user->getCompanyvat()); ?>" /><span class="error" style="display: none"><?php echo Mage::helper('magesms')->__('Invalid VAT'); ?></span></div></div><div class="entry-edit-head"><h4 class="fieldset-legend head-account"><?php echo Mage::helper('magesms')->__('Contact person'); ?></h4></div><div class="fieldset "><div class="margin-form"><label for="firstname"><?php echo Mage::helper('magesms')->__('First name:'); ?></label><input class="input-text" type="text" name="firstname" id="firstname" value="<?php echo $this->htmlEscape($user->getFirstname()); ?>" /></div><div class="margin-form"><label for="lastname"><?php echo Mage::helper('magesms')->__('Last name:'); ?></label><input class="input-text" type="text" name="lastname" id="lastname" value="<?php echo $this->htmlEscape($user->getLastname()); ?>" /></div></div><div class="entry-edit-head"><h4 class="fieldset-legend head-account"><?php echo Mage::helper('magesms')->__('Address'); ?></h4></div><div class="fieldset "><div class="margin-form"><label for="addressstreet"><?php echo Mage::helper('magesms')->__('Street:'); ?></label><input class="input-text" type="text" name="addressstreet" id="addressstreet" value="<?php echo $this->htmlEscape($user->getAddressstreet()); ?>" /></div><div class="margin-form"><label for="addresszip"><?php echo Mage::helper('magesms')->__('ZIP:'); ?></label><input class="input-text" type="text" name="addresszip" id="addresszip" value="<?php echo $this->htmlEscape($user->getAddresszip()); ?>" /></div><div class="margin-form"><label for="addresscity"><?php echo Mage::helper('magesms')->__('City:'); ?></label><input class="input-text" type="text" name="addresscity" id="addresscity" value="<?php echo $this->htmlEscape($user->getAddresscity()); ?>" /></div><div class="margin-form"><label for="country"><?php echo Mage::helper('magesms')->__('Country:'); ?></label><select name="country0" id="country" onchange="vatfield();"></select></div></div><?php if (!$user->getId()): ?><?php if (empty(Mage::getConfig()->getNode('default/config/referer')->id)): ?><div class="margin-form"><label for="refererid"><?php echo Mage::helper('magesms')->__('Referer ID:'); ?></label><input class="input-text" type="text" name="refererid" id="refererid" value="<?php echo $this->htmlEscape($user->getRefererid()); ?>" /></div><?php endif; ?><div class="margin-form"><?php $agree_url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/licence_'; if (in_array(Mage::getStoreConfig('magesms/template/language'), array('cz', 'sk'))) $agree_url .= 'cz.pdf'; else $agree_url .= 'en.pdf'; ?><label class="form-required"><a href="<?php echo $agree_url; ?>"><?php echo Mage::helper('magesms')->__('View licence terms:'); ?></a></label><input type="radio" class="validate-agree" name="agree" id="agree1" style="float: left" value="1" /><label style="width: auto; margin: 0 15px 0 5px" class="form-required" for="agree1"><?php echo Mage::helper('magesms')->__('I agree'); ?></label><input type="radio" name="agree" id="agree2" style="float: left" value="2" checked /><label style="width: auto; margin-left: 5px" for="agree2"><?php echo Mage::helper('magesms')->__('I dont agree'); ?></label><div class="clear"></div></div><?php endif; ?><div class="margin-form"><input type="button" onclick="profilForm.submit();" value="<?php echo Mage::helper('magesms')->__($user->getId() ? 'Save' : 'Register'); ?>" class="form-button" /></div><div><span class="require">*</span> <?php echo Mage::helper('magesms')->__('Required field'); ?></div></form><script type="text/javascript">function changeProfile(elm) {var type = elm.target.value;$("#magesms-profile div[id^='advice-required-entry-']").each(function(el) {el.remove()});if (type == "firm") {$("#magesms-profile #companyname").each(function(el) {el.addClassName("required-entry")});$("#magesms-profile label[for=companyname]").each(function(el) {el.addClassName("form-required")});$('#magesms-profile .firm').each(function (element) {element.show();});vatfield();} else {$("#magesms-profile #companyname").each(function(el) {el.removeClassName("required-entry")});$("#magesms-profile label[for=companyname]").each(function(el) {el.removeClassName("form-required")});$('#magesms-profile .firm').each(function (element) {element.hide();});}}smsr(function() {country = {<?php foreach( $this->profile->country as $country ): ?>"<?php echo $this->htmlEscape($country->getData('name')); ?>": <?php echo $country->getData('vat'); ?>,<?php endforeach; ?>};for(var name in country) {var option = document.createElement('option');option.value = name;option.text = name;if (name == "<?php echo $user->country0 ? $user->country0 : $lang; ?>") {option.selected = true;}$('country').appendChild(option);}$("#magesms-profile input[name=regtype]:checked")[0].click();$("#magesms-profile select#country").each(function(el) {el.onchange(vatfield)});$("#magesms-profile #companyvat").each(function(el) {Event.observe(el, 'blur', vatcheck)});vatfield();});function vatfield() {var selected = $("#magesms-profile select#country")[0].value;if ( selected == "Czech Republic") {$("#magesms-profile div.czech").each(function(element) {element.show()});} else {$("#magesms-profile div.czech").each(function(element) {element.hide()});}if (country[selected] == 1) {$("#magesms-profile div.vat").each(function(element) {element.show()});} else {$("#magesms-profile div.vat").each(function(element) {element.hide()});}vatcheck();}function vatcheck() {if ($("#magesms-profile input[name=regtype]:checked")[0].value == "firm") {var selected = $("#magesms-profile select#country")[0].value;var vat = $("#magesms-profile #companyvat")[0].value;if (country[selected] && vat) {new Ajax.Request("<?php echo Mage::helper("adminhtml")->getUrl('*/*/vatvalidate') ?>", {method: 'get',parameters: {country:selected, companyvat:vat},onSuccess: function(transport) {if (transport.responseText != "true") {$("#magesms-profile .vat input")[0].addClassName("invalidvat").removeClassName("validvat");$("#magesms-profile .vat .error")[0].style.display = "inline";} else {$("#magesms-profile .vat input")[0].removeClassName("invalidvat").addClassName("validvat");$("#magesms-profile .vat .error")[0].style.display = "none";}}});}}}$("reg-type1").addEventListener('click', changeProfile);$("reg-type2").addEventListener('click', changeProfile);</script></div><script type="text/javascript">//<![CDATA[
25
var profilForm = new varienForm('magesms_profil', '<?php echo Mage::helper("adminhtml")->getUrl('*/*/validate') ?>');profilForm._processValidationResult = function(transport) {var response = transport.responseText.evalJSON();if (response.error){if (response.attribute && $(response.attribute)) {$(response.attribute).setHasError(true, productForm);Validation.ajaxError($(response.attribute), response.message);if (!Prototype.Browser.IE){$(response.attribute).focus();}}else if ($('messages')) {$('messages').innerHTML = '' + response.message + '';}}else{profilForm._submit();}};Validation.add('validate-agree','You have to agree with licence terms.', function(v) {return $('agree1').checked && !$('agree2').checked;});Translator.add('You have to agree with licence terms.','<?php echo Mage::helper('magesms')->__('You have to agree with licence terms.')?>');
26
//]]></script></div></div><div class="clear"></div><br /><br /></div>
14
* @license http://opensource.org/licenses/BSD-3-Clause
15
*/
16
?><?php $user = $this->profile->user; ?><?php $lang = $this->profile->lang; ?><script type="text/javascript">//<![CDATA[
17
+ Event.observe(window, "load", function(){var gridData = document.getElementById('magesms-profile');var tr_array = gridData.getElementsByTagName('tr');for (var i=0, len=tr_array.length; i < len; i++) {if (tr_array[i].className.indexOf('hover') !== -1) {tr_array[i].onmouseover = function() {this.className = this.className + ' on-mouse';};tr_array[i].onmouseout = function() {this.className = this.className.replace(' on-mouse', '');};tr_array[i].onclick = function() {var arr = this.id.split('_');var next = document.getElementById('histd_'+arr[1]);if (next.style.display == 'none') {next.style.display = 'table-row';} else {next.style.display = 'none';}var img = this.getElementsByClassName('img');if (img[0].style.display == 'none') {img[0].style.display = 'inline';} else {img[0].style.display = 'none';}if (img[1].style.display == 'none') {img[1].style.display = 'inline';} else {img[1].style.display = 'none';}};}}});
18
//]]></script><div id="magesms-profile"><div class="float-right"><?php if (!$user->getUser()): ?><div class="entry-edit"><div class="entry-edit-head"><h4 class="icon-head fieldset-legend head-account"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/AdminEmployees.gif'; ?>" alt="" /> <?php echo Mage::helper('magesms')->__('Sign in'); ?></h4></div><div class="fieldset "><form id="magesms_login" action="<?php echo $this->getUrl('*/*/login') ?>" method="post"><input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" /><p><?php echo Mage::helper('magesms')->__('If You already have an account, please sign in.'); ?></p><div><div class="margin-form"><label class="form-required" for="username"><?php echo Mage::helper('magesms')->__('Username:'); ?> <span class="required">*</span></label><input class="required-entry input-text" type="text" name="username" id="username" value="" /></div><div class="margin-form"><label class="form-required" for="password"><?php echo Mage::helper('magesms')->__('Password:'); ?> <span class="required">*</span></label><input class="required-entry input-text" type="password" name="password" id="password" value="" /></div><div class="margin-form"><input type="submit" value="<?php echo Mage::helper('magesms')->__('Log in'); ?>" name="submitLogin" class="form-button" /></div><div><span class="require">*</span> <?php echo Mage::helper('magesms')->__('Required field'); ?></div></div></form></div></div><script type="text/javascript">//<![CDATA[
19
var loginForm = new varienForm('magesms_login', '<?php echo $this->getUrl('*/*/login') ?>');loginForm._processValidationResult = function(transport) {var response = transport.responseText.evalJSON();if (response.error){if (response.attribute && $(response.attribute)) {$(response.attribute).setHasError(true, productForm);Validation.ajaxError($(response.attribute), response.message);if (!Prototype.Browser.IE){$(response.attribute).focus();}}else if ($('messages')) {$('messages').innerHTML = '<ul class="messages"><li class="error-msg"><ul><li>' + response.message + '</li></ul></li></ul>';}}else{loginForm._submit();}};
20
//]]></script><?php else: ?><div class="entry-edit"><div class="entry-edit-head"><h4 class="icon-head fieldset-legend head-account"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/AdminEmployees.gif'; ?>" alt="" /> <?php echo Mage::helper('magesms')->__('User account info'); ?></h4></div><div class="fieldset "><div><div class="margin-form"><label class="form-required"><?php echo Mage::helper('magesms')->__('Username:'); ?></label><span class="required-entry input-text"><?php echo $user->user; ?></span></div><div class="margin-form"><label class="form-required"><?php echo Mage::helper('magesms')->__('Password:'); ?></label><span class="required-entry input-text"><?php echo $user->passwd; ?></span></div><div class="margin-form"><label class="form-required"><?php echo Mage::helper('magesms')->__('SMS Credit:'); ?></label><span class="required-entry input-text"><?php echo $this->profile->credit; ?></span></div></div></div></div><div class="entry-edit"><?php $admins = $this->profile->admins; ?><?php if ($adminedit = Mage::app()->getRequest()->getParam('adminedit')): ?><?php $edit = $admins->load($adminedit); ?><?php else: ?><?php $edit = Mage::getModel('magesms/admins'); ?><?php endif; ?><div class="entry-edit-head"><h4 class="icon-head fieldset-legend head-account"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/AdminEmployees.gif'; ?>" alt="" /> <?php echo Mage::helper('magesms')->__('Add administrators'); ?></h4></div><div class="fieldset "><form id="magesms_admins" action="<?php echo $this->getUrl('*/*/saveadmin') ?>" method="post"><?php echo $this->getBlockHtml('formkey')?><div><div class="margin-form"><label class="form-required" for="name"><?php echo Mage::helper('magesms')->__('Name:'); ?> <span class="required">*</span></label><input class="required-entry input-text" type="text" name="name" id="name" value="<?php echo $this->htmlEscape($edit->getName()); ?>" /></div><div class="margin-form"><label class="form-required" for="number"><?php echo Mage::helper('magesms')->__('Mobile number:'); ?> <span class="required">*</span></label><input class="required-entry input-text validate-number" type="text" name="number" id="number" value="<?php echo $this->htmlEscape($edit->getNumber()); ?>" /><div><?php echo Mage::helper('magesms')->__('in international format, no leading zeros or a “+” sign, e.g., 447971796595'); ?></div></div><div class="margin-form"><input type="hidden" name="id" value="<?php echo $adminedit; ?>" /><input type="button" onclick="adminsForm.submit();" value="<?php echo Mage::helper('magesms')->__($adminedit ? 'Edit' : 'Add'); ?>" class="form-button" /></div><?php if ($admins->getCollection()->count()): ?><div class="grid"><table class="data"><colgroup><col /><col /><col width="60" /><col width="60" /></colgroup><?php $even = 1; foreach( $admins->getCollection() as $_admins ): if ($even) $even = 0; else $even = 1; ?><tr class="hover <?php if ($even) echo 'even'?> pointer"><td><?php echo $_admins->name; ?></td><td><?php echo $_admins->number; ?></td><td class="a-center"><a href="<?php echo Mage::helper("adminhtml")->getUrl('*/*/*', array('adminedit' => $_admins->getId())) ?>" title="<?php echo Mage::helper('magesms')->__('EDIT administrator'); ?>"><?php echo Mage::helper('magesms')->__('edit'); ?></a></td><td class="a-center last"><a href="<?php echo Mage::helper("adminhtml")->getUrl('*/*/deleteadmin', array('id' => $_admins->getId())) ?>" title="<?php echo Mage::helper('magesms')->__('DELETE administrator'); ?>" onclick="return confirm('<?php echo Mage::helper('magesms')->__('Are you sure to delete').' '.$_admins->name.'?'; ?>')"><?php echo Mage::helper('magesms')->__('delete'); ?></a></td></tr><?php endforeach; ?></table></div><?php endif; ?><div><span class="require">*</span> <?php echo Mage::helper('magesms')->__('Required field'); ?></div></div></form></div><script type="text/javascript">//<![CDATA[
21
var adminsForm = new varienForm('magesms_admins', '<?php echo Mage::helper("adminhtml")->getUrl('*/*/validateadmin', array('id' => Mage::app()->getRequest()->getParam('adminedit', 0))) ?>');
22
//]]></script></div><div class="entry-edit"><div class="entry-edit-head"><h4 class="icon-head fieldset-legend head-account"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/AdminEmployees.gif'; ?>" alt="" /> <?php echo Mage::helper('magesms')->__('Other settings'); ?></h4></div><div class="fieldset "><form id="magesms_settings" action="<?php echo $this->getUrl('*/*/savesettings') ?>" method="post"><input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" /><div><div class="margin-form"><label for="simulate"><?php echo Mage::helper('magesms')->__('Simulate SMS sending:'); ?></label><input type="checkbox" name="simulatesms" id="simulatesms" value="1" <?php echo $user->getSimulatesms() ? 'checked' : ''; ?> /><span class="help" onclick="popup_title(this)" title="<?php echo Mage::helper('magesms')->__('Allows to test sending of SMS in modul and to view sent SMS in SMS history with a special status.'); ?>" style="cursor:help;text-decoration:underline;">?</span></div><div class="margin-form"><label for="URLreports"><?php echo Mage::helper('magesms')->__('Delivery reports:'); ?></label><input type="checkbox" name="URLreports" id="URLreports" value="1" <?php echo $user->getData('URLreports') ? 'checked' : ''; ?> /><span class="help" onclick="popup_title(this)" title="<?php echo Mage::helper('magesms')->__('Allows to see delivery reports of SMS in SMS history Tab.'); ?>" style="cursor:help;text-decoration:underline;">?</span></div><div class="margin-form"><label for="pocetkredit"><?php echo Mage::helper('magesms')->__('Low credit alert:'); ?></label><input type="text" class="input-text" size="3" name="pocetkredit" id="pocetkredit" value="<?php echo $user->getPocetkredit() ? $user->getPocetkredit() : 0; ?>" /><span class="help" onclick="popup_title(this)" title="<?php echo Mage::helper('magesms')->__(' Allows to receive email when your SMS credit is low.'); ?>" style="cursor:help;text-decoration:underline;">?</span><span class="help2"><?php echo Mage::helper('magesms')->__('(0 = no alert)'); ?></span></div><div class="margin-form"><label for="deliveryemail"><?php echo Mage::helper('magesms')->__('Email for delivery reports:'); ?></label><input type="text" class="input-text validate-email" name="deliveryemail" id="deliveryemail" value="<?php echo $this->htmlEscape($user->getDeliveryemail()); ?>" /><span class="help" onclick="popup_title(this)" title="<?php echo Mage::helper('magesms')->__('Allows to receive email with delivery report of SMS.'); ?>" style="cursor:help;text-decoration:underline;">?</span></div><div class="margin-form"><label style="width: 210px; margin: 0 20px 1em 0;"><?php echo Mage::helper('magesms')->__('For sending SMS prefer phone nr. from:'); ?></label><div style="white-space:nowrap"><input type="radio" class="input-text" name="prefbilling" id="prefbilling0" value="0" <?php echo !$user->getPrefbilling() ? 'checked' : ''; ?> /><label for="prefbilling0" style="width: auto; display: inline; float: none"><?php echo Mage::helper('magesms')->__('invoice address'); ?></label></div><div style="white-space:nowrap"><input type="radio" class="input-text" name="prefbilling" id="prefbilling1" value="1" <?php echo $user->getPrefbilling() ? 'checked' : ''; ?> /><label for="prefbilling1" style="width: auto; display: inline; float: none"><?php echo Mage::helper('magesms')->__('delivery address'); ?></label></div><div class="clear"></div></div><div class="margin-form"><input type="button" onclick="settingsForm.submit();" value="<?php echo Mage::helper('magesms')->__('Save'); ?>" class="form-button" /></div></div></form><script type="text/javascript">//<![CDATA[
23
var settingsForm = new varienForm('magesms_settings', '<?php echo Mage::helper("adminhtml")->getUrl('*/*/validatesettings') ?>');
24
+ //]]></script></div></div><?php endif; ?></div><div class="float-left"><div class="entry-edit"><div class="entry-edit-head"><h4 class="icon-head fieldset-legend head-account"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/AdminEmployees.gif'; ?>" alt="" /> <?php echo Mage::helper('magesms')->__($user->getUser() ? 'Edit user account' : 'New user account'); ?></h4></div><div class="fieldset "><form id="magesms_profil" action="<?php echo $this->getUrl('*/*/save') ?>" method="post"><input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" /><?php if (!$user->getUser()): ?><p><?php echo Mage::helper('magesms')->__('Not registered yet? Create account now!'); ?></p><?php endif; ?><div class="margin-form"><label class="form-required" for="email"><?php echo Mage::helper('magesms')->__('Email:'); ?> <span class="required">*</span></label><input class="required-entry input-text validate-email" type="text" name="email" id="email" value="<?php echo $this->htmlEscape($user->getEmail()); ?>" /></div><div class="margin-form"><label class="form-required"><?php echo Mage::helper('magesms')->__('Registration type:'); ?></label><input type="radio" name="regtype" id="reg-type1" style="float: left" value="person" <?php echo !$user->getRegtype() || $user->getRegtype() =='person' ? 'checked' : ''; ?> /><label style="width: auto; margin: 0 15px 0 5px" for="reg-type1"><?php echo Mage::helper('magesms')->__('Personal'); ?></label><input type="radio" name="regtype" id="reg-type2" style="float: left" value="firm" <?php echo $user->getRegtype() =='firm' ? 'checked' : ''; ?> /><label style="width: auto; margin-left: 5px" for="reg-type2"><?php echo Mage::helper('magesms')->__('Business'); ?></label><div class="clear"></div></div><div class="entry-edit-head firm"><h4 class="fieldset-legend head-account"><?php echo Mage::helper('magesms')->__('Billing information'); ?></h4></div><div class="fieldset firm"><div class="margin-form"><label class="" for="companyname"><?php echo Mage::helper('magesms')->__('Company name:'); ?> <span class="required">*</span></label><input class="input-text" type="text" name="companyname" id="companyname" value="<?php echo $this->htmlEscape($user->getCompanyname()); ?>" /></div><div class="margin-form firm czech" style="display: none;"><label for="companyid"><?php echo Mage::helper('magesms')->__('Company ID:'); ?></label><input class="input-text" type="text" name="companyid" id="companyid" value="<?php echo $this->htmlEscape($user->getCompanyid()); ?>" /></div><div class="margin-form firm vat" style="display: none;"><label for="companyvat"><?php echo Mage::helper('magesms')->__('Company VAT:'); ?></label><input class="input-text" type="text" name="companyvat" id="companyvat" value="<?php echo $this->htmlEscape($user->getCompanyvat()); ?>" /><span class="error" style="display: none"><?php echo Mage::helper('magesms')->__('Invalid VAT'); ?></span></div></div><div class="entry-edit-head"><h4 class="fieldset-legend head-account"><?php echo Mage::helper('magesms')->__('Contact person'); ?></h4></div><div class="fieldset "><div class="margin-form"><label for="firstname"><?php echo Mage::helper('magesms')->__('First name:'); ?></label><input class="input-text" type="text" name="firstname" id="firstname" value="<?php echo $this->htmlEscape($user->getFirstname()); ?>" /></div><div class="margin-form"><label for="lastname"><?php echo Mage::helper('magesms')->__('Last name:'); ?></label><input class="input-text" type="text" name="lastname" id="lastname" value="<?php echo $this->htmlEscape($user->getLastname()); ?>" /></div></div><div class="entry-edit-head"><h4 class="fieldset-legend head-account"><?php echo Mage::helper('magesms')->__('Address'); ?></h4></div><div class="fieldset "><div class="margin-form"><label for="addressstreet"><?php echo Mage::helper('magesms')->__('Street:'); ?></label><input class="input-text" type="text" name="addressstreet" id="addressstreet" value="<?php echo $this->htmlEscape($user->getAddressstreet()); ?>" /></div><div class="margin-form"><label for="addresszip"><?php echo Mage::helper('magesms')->__('ZIP:'); ?></label><input class="input-text" type="text" name="addresszip" id="addresszip" value="<?php echo $this->htmlEscape($user->getAddresszip()); ?>" /></div><div class="margin-form"><label for="addresscity"><?php echo Mage::helper('magesms')->__('City:'); ?></label><input class="input-text" type="text" name="addresscity" id="addresscity" value="<?php echo $this->htmlEscape($user->getAddresscity()); ?>" /></div><div class="margin-form"><label for="country"><?php echo Mage::helper('magesms')->__('Country:'); ?></label><select name="country0" id="country" onchange="vatfield();"></select></div></div><?php if (!$user->getId()): ?><?php if (empty(Mage::getConfig()->getNode('default/config/referer')->id)): ?><div class="margin-form"><label for="refererid"><?php echo Mage::helper('magesms')->__('Referer ID:'); ?></label><input class="input-text" type="text" name="refererid" id="refererid" value="<?php echo $this->htmlEscape($user->getRefererid()); ?>" /></div><?php endif; ?><div class="margin-form"><?php $agree_url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'magesms/licence_'; if (in_array(Mage::getStoreConfig('magesms/template/language'), array('cz', 'sk'))) $agree_url .= 'cz.pdf'; else $agree_url .= 'en.pdf'; ?><label class="form-required"><a href="<?php echo $agree_url; ?>"><?php echo Mage::helper('magesms')->__('View licence terms:'); ?></a></label><input type="radio" class="validate-agree" name="agree" id="agree1" style="float: left" value="1" /><label style="width: auto; margin: 0 15px 0 5px" class="form-required" for="agree1"><?php echo Mage::helper('magesms')->__('I agree'); ?></label><input type="radio" name="agree" id="agree2" style="float: left" value="2" checked /><label style="width: auto; margin-left: 5px" for="agree2"><?php echo Mage::helper('magesms')->__('I dont agree'); ?></label><div class="clear"></div></div><?php endif; ?><div class="margin-form"><input type="button" onclick="profilForm.submit();" value="<?php echo Mage::helper('magesms')->__($user->getId() ? 'Save' : 'Register'); ?>" class="form-button" /></div><div><span class="require">*</span> <?php echo Mage::helper('magesms')->__('Required field'); ?></div></form><script type="text/javascript">function changeProfile(elm) {var type = elm.target.value;$("#magesms-profile div[id^='advice-required-entry-']").each(function(el) {el.remove()});if (type == "firm") {$("#magesms-profile #companyname").each(function(el) {el.addClassName("required-entry")});$("#magesms-profile label[for=companyname]").each(function(el) {el.addClassName("form-required")});$('#magesms-profile .firm').each(function (element) {element.show();});vatfield();} else {$("#magesms-profile #companyname").each(function(el) {el.removeClassName("required-entry")});$("#magesms-profile label[for=companyname]").each(function(el) {el.removeClassName("form-required")});$('#magesms-profile .firm').each(function (element) {element.hide();});}}Event.observe(window, "load", function() {country = {<?php foreach( $this->profile->country as $country ): ?>"<?php echo $this->htmlEscape($country->getData('name')); ?>": <?php echo $country->getData('vat'); ?>,<?php endforeach; ?>};for(var name in country) {var option = document.createElement('option');option.value = name;option.text = name;if (name == "<?php echo $user->country0 ? $user->country0 : $lang; ?>") {option.selected = true;}$('country').appendChild(option);}$("#magesms-profile input[name=regtype]:checked")[0].click();$("#magesms-profile select#country").ea