Sumankcdotcom_Faq - Version 1.0.0

Version Notes

Initial release

Download this release

Release Info

Developer Suman K.C
Extension Sumankcdotcom_Faq
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (46) hide show
  1. app/code/community/Sumankcdotcom/Faq/Block/Adminhtml/Category.php +42 -0
  2. app/code/community/Sumankcdotcom/Faq/Block/Adminhtml/Category/Edit.php +82 -0
  3. app/code/community/Sumankcdotcom/Faq/Block/Adminhtml/Category/Edit/Form.php +52 -0
  4. app/code/community/Sumankcdotcom/Faq/Block/Adminhtml/Category/Edit/Tab/Form.php +106 -0
  5. app/code/community/Sumankcdotcom/Faq/Block/Adminhtml/Category/Edit/Tab/Stores.php +58 -0
  6. app/code/community/Sumankcdotcom/Faq/Block/Adminhtml/Category/Edit/Tabs.php +87 -0
  7. app/code/community/Sumankcdotcom/Faq/Block/Adminhtml/Category/Grid.php +256 -0
  8. app/code/community/Sumankcdotcom/Faq/Block/Adminhtml/Faq.php +42 -0
  9. app/code/community/Sumankcdotcom/Faq/Block/Adminhtml/Faq/Edit.php +82 -0
  10. app/code/community/Sumankcdotcom/Faq/Block/Adminhtml/Faq/Edit/Form.php +52 -0
  11. app/code/community/Sumankcdotcom/Faq/Block/Adminhtml/Faq/Edit/Tab/Form.php +142 -0
  12. app/code/community/Sumankcdotcom/Faq/Block/Adminhtml/Faq/Edit/Tabs.php +74 -0
  13. app/code/community/Sumankcdotcom/Faq/Block/Adminhtml/Faq/Grid.php +259 -0
  14. app/code/community/Sumankcdotcom/Faq/Block/Adminhtml/Helper/Column/Renderer/Parent.php +83 -0
  15. app/code/community/Sumankcdotcom/Faq/Block/Category/Faq/List.php +64 -0
  16. app/code/community/Sumankcdotcom/Faq/Block/Category/List.php +62 -0
  17. app/code/community/Sumankcdotcom/Faq/Block/Category/View.php +37 -0
  18. app/code/community/Sumankcdotcom/Faq/Block/Faq/List.php +72 -0
  19. app/code/community/Sumankcdotcom/Faq/Block/Faq/View.php +37 -0
  20. app/code/community/Sumankcdotcom/Faq/Controller/Adminhtml/Faq.php +60 -0
  21. app/code/community/Sumankcdotcom/Faq/Controller/Router.php +127 -0
  22. app/code/community/Sumankcdotcom/Faq/Helper/Category.php +53 -0
  23. app/code/community/Sumankcdotcom/Faq/Helper/Data.php +45 -0
  24. app/code/community/Sumankcdotcom/Faq/Helper/Faq.php +53 -0
  25. app/code/community/Sumankcdotcom/Faq/Model/Adminhtml/Search/Category.php +60 -0
  26. app/code/community/Sumankcdotcom/Faq/Model/Category.php +162 -0
  27. app/code/community/Sumankcdotcom/Faq/Model/Category/Source.php +119 -0
  28. app/code/community/Sumankcdotcom/Faq/Model/Faq.php +182 -0
  29. app/code/community/Sumankcdotcom/Faq/Model/Resource/Category.php +283 -0
  30. app/code/community/Sumankcdotcom/Faq/Model/Resource/Category/Collection.php +136 -0
  31. app/code/community/Sumankcdotcom/Faq/Model/Resource/Faq.php +181 -0
  32. app/code/community/Sumankcdotcom/Faq/Model/Resource/Faq/Collection.php +84 -0
  33. app/code/community/Sumankcdotcom/Faq/Model/Resource/Setup.php +26 -0
  34. app/code/community/Sumankcdotcom/Faq/controllers/Adminhtml/Faq/CategoryController.php +328 -0
  35. app/code/community/Sumankcdotcom/Faq/controllers/Adminhtml/Faq/FaqController.php +365 -0
  36. app/code/community/Sumankcdotcom/Faq/controllers/CategoryController.php +139 -0
  37. app/code/community/Sumankcdotcom/Faq/controllers/FaqController.php +139 -0
  38. app/code/community/Sumankcdotcom/Faq/etc/adminhtml.xml +79 -0
  39. app/code/community/Sumankcdotcom/Faq/etc/config.xml +147 -0
  40. app/code/community/Sumankcdotcom/Faq/etc/system.xml +86 -0
  41. app/code/community/Sumankcdotcom/Faq/sql/sumankcdotcom_faq_setup/install-1.0.0.php +197 -0
  42. app/design/frontend/base/default/layout/sumankcdotcom_faq.xml +27 -0
  43. app/design/frontend/base/default/template/sumankcdotcom_faq/list.phtml +79 -0
  44. app/etc/modules/Sumankcdotcom_Faq.xml +29 -0
  45. app/locale/en_US/Sumankcdotcom_Faq.csv +90 -0
  46. package.xml +18 -0
app/code/community/Sumankcdotcom/Faq/Block/Adminhtml/Category.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Category admin block
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_Block_Adminhtml_Category extends Mage_Adminhtml_Block_Widget_Grid_Container
25
+ {
26
+ /**
27
+ * constructor
28
+ *
29
+ * @access public
30
+ * @return void
31
+ * @author Suman K.C [WWW.SUMANKC.COM]
32
+ */
33
+ public function __construct()
34
+ {
35
+ $this->_controller = 'adminhtml_category';
36
+ $this->_blockGroup = 'sumankcdotcom_faq';
37
+ parent::__construct();
38
+ $this->_headerText = Mage::helper('sumankcdotcom_faq')->__('Category');
39
+ $this->_updateButton('add', 'label', Mage::helper('sumankcdotcom_faq')->__('Add Category'));
40
+
41
+ }
42
+ }
app/code/community/Sumankcdotcom/Faq/Block/Adminhtml/Category/Edit.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Category admin edit form
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_Block_Adminhtml_Category_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
25
+ {
26
+ /**
27
+ * constructor
28
+ *
29
+ * @access public
30
+ * @return void
31
+ * @author Suman K.C [WWW.SUMANKC.COM]
32
+ */
33
+ public function __construct()
34
+ {
35
+ parent::__construct();
36
+ $this->_blockGroup = 'sumankcdotcom_faq';
37
+ $this->_controller = 'adminhtml_category';
38
+ $this->_updateButton(
39
+ 'save',
40
+ 'label',
41
+ Mage::helper('sumankcdotcom_faq')->__('Save Category')
42
+ );
43
+ $this->_updateButton(
44
+ 'delete',
45
+ 'label',
46
+ Mage::helper('sumankcdotcom_faq')->__('Delete Category')
47
+ );
48
+ $this->_addButton(
49
+ 'saveandcontinue',
50
+ array(
51
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('Save And Continue Edit'),
52
+ 'onclick' => 'saveAndContinueEdit()',
53
+ 'class' => 'save',
54
+ ),
55
+ -100
56
+ );
57
+ $this->_formScripts[] = "
58
+ function saveAndContinueEdit() {
59
+ editForm.submit($('edit_form').action+'back/edit/');
60
+ }
61
+ ";
62
+ }
63
+
64
+ /**
65
+ * get the edit form header
66
+ *
67
+ * @access public
68
+ * @return string
69
+ * @author Suman K.C [WWW.SUMANKC.COM]
70
+ */
71
+ public function getHeaderText()
72
+ {
73
+ if (Mage::registry('current_category') && Mage::registry('current_category')->getId()) {
74
+ return Mage::helper('sumankcdotcom_faq')->__(
75
+ "Edit Category '%s'",
76
+ $this->escapeHtml(Mage::registry('current_category')->getCategories())
77
+ );
78
+ } else {
79
+ return Mage::helper('sumankcdotcom_faq')->__('Add Category');
80
+ }
81
+ }
82
+ }
app/code/community/Sumankcdotcom/Faq/Block/Adminhtml/Category/Edit/Form.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Category edit form
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Ultimate Module Creator
23
+ */
24
+ class Sumankcdotcom_Faq_Block_Adminhtml_Category_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
25
+ {
26
+ /**
27
+ * prepare form
28
+ *
29
+ * @access protected
30
+ * @return Sumankcdotcom_Faq_Block_Adminhtml_Category_Edit_Form
31
+ * @author Ultimate Module Creator
32
+ */
33
+ protected function _prepareForm()
34
+ {
35
+ $form = new Varien_Data_Form(
36
+ array(
37
+ 'id' => 'edit_form',
38
+ 'action' => $this->getUrl(
39
+ '*/*/save',
40
+ array(
41
+ 'id' => $this->getRequest()->getParam('id')
42
+ )
43
+ ),
44
+ 'method' => 'post',
45
+ 'enctype' => 'multipart/form-data'
46
+ )
47
+ );
48
+ $form->setUseContainer(true);
49
+ $this->setForm($form);
50
+ return parent::_prepareForm();
51
+ }
52
+ }
app/code/community/Sumankcdotcom/Faq/Block/Adminhtml/Category/Edit/Tab/Form.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Category edit form tab
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_Block_Adminhtml_Category_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
25
+ {
26
+ /**
27
+ * prepare the form
28
+ *
29
+ * @access protected
30
+ * @return Sumankcdotcom_Faq_Block_Adminhtml_Category_Edit_Tab_Form
31
+ * @author Suman K.C [WWW.SUMANKC.COM]
32
+ */
33
+ protected function _prepareForm()
34
+ {
35
+ $form = new Varien_Data_Form();
36
+ $form->setHtmlIdPrefix('category_');
37
+ $form->setFieldNameSuffix('category');
38
+ $this->setForm($form);
39
+ $fieldset = $form->addFieldset(
40
+ 'category_form',
41
+ array('legend' => Mage::helper('sumankcdotcom_faq')->__('Category'))
42
+ );
43
+
44
+ $fieldset->addField(
45
+ 'categories',
46
+ 'text',
47
+ array(
48
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('category Name'),
49
+ 'name' => 'categories',
50
+ 'required' => true,
51
+ 'class' => 'required-entry',
52
+
53
+ )
54
+ );
55
+ $fieldset->addField(
56
+ 'url_key',
57
+ 'text',
58
+ array(
59
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('Url key'),
60
+ 'name' => 'url_key',
61
+ 'note' => Mage::helper('sumankcdotcom_faq')->__('Relative to Website Base URL')
62
+ )
63
+ );
64
+ $fieldset->addField(
65
+ 'status',
66
+ 'select',
67
+ array(
68
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('Status'),
69
+ 'name' => 'status',
70
+ 'values' => array(
71
+ array(
72
+ 'value' => 1,
73
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('Enabled'),
74
+ ),
75
+ array(
76
+ 'value' => 0,
77
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('Disabled'),
78
+ ),
79
+ ),
80
+ )
81
+ );
82
+ if (Mage::app()->isSingleStoreMode()) {
83
+ $fieldset->addField(
84
+ 'store_id',
85
+ 'hidden',
86
+ array(
87
+ 'name' => 'stores[]',
88
+ 'value' => Mage::app()->getStore(true)->getId()
89
+ )
90
+ );
91
+ Mage::registry('current_category')->setStoreId(Mage::app()->getStore(true)->getId());
92
+ }
93
+ $formValues = Mage::registry('current_category')->getDefaultValues();
94
+ if (!is_array($formValues)) {
95
+ $formValues = array();
96
+ }
97
+ if (Mage::getSingleton('adminhtml/session')->getCategoryData()) {
98
+ $formValues = array_merge($formValues, Mage::getSingleton('adminhtml/session')->getCategoryData());
99
+ Mage::getSingleton('adminhtml/session')->setCategoryData(null);
100
+ } elseif (Mage::registry('current_category')) {
101
+ $formValues = array_merge($formValues, Mage::registry('current_category')->getData());
102
+ }
103
+ $form->setValues($formValues);
104
+ return parent::_prepareForm();
105
+ }
106
+ }
app/code/community/Sumankcdotcom/Faq/Block/Adminhtml/Category/Edit/Tab/Stores.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * store selection tab
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Ultimate Module Creator
23
+ */
24
+ class Sumankcdotcom_Faq_Block_Adminhtml_Category_Edit_Tab_Stores extends Mage_Adminhtml_Block_Widget_Form
25
+ {
26
+ /**
27
+ * prepare the form
28
+ *
29
+ * @access protected
30
+ * @return Sumankcdotcom_Faq_Block_Adminhtml_Category_Edit_Tab_Stores
31
+ * @author Ultimate Module Creator
32
+ */
33
+ protected function _prepareForm()
34
+ {
35
+ $form = new Varien_Data_Form();
36
+ $form->setFieldNameSuffix('category');
37
+ $this->setForm($form);
38
+ $fieldset = $form->addFieldset(
39
+ 'category_stores_form',
40
+ array('legend' => Mage::helper('sumankcdotcom_faq')->__('Store views'))
41
+ );
42
+ $field = $fieldset->addField(
43
+ 'store_id',
44
+ 'multiselect',
45
+ array(
46
+ 'name' => 'stores[]',
47
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('Store Views'),
48
+ 'title' => Mage::helper('sumankcdotcom_faq')->__('Store Views'),
49
+ 'required' => true,
50
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
51
+ )
52
+ );
53
+ $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
54
+ $field->setRenderer($renderer);
55
+ $form->addValues(Mage::registry('current_category')->getData());
56
+ return parent::_prepareForm();
57
+ }
58
+ }
app/code/community/Sumankcdotcom/Faq/Block/Adminhtml/Category/Edit/Tabs.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Category admin edit tabs
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Ultimate Module Creator
23
+ */
24
+ class Sumankcdotcom_Faq_Block_Adminhtml_Category_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
25
+ {
26
+ /**
27
+ * Initialize Tabs
28
+ *
29
+ * @access public
30
+ * @author Ultimate Module Creator
31
+ */
32
+ public function __construct()
33
+ {
34
+ parent::__construct();
35
+ $this->setId('category_tabs');
36
+ $this->setDestElementId('edit_form');
37
+ $this->setTitle(Mage::helper('sumankcdotcom_faq')->__('Category'));
38
+ }
39
+
40
+ /**
41
+ * before render html
42
+ *
43
+ * @access protected
44
+ * @return Sumankcdotcom_Faq_Block_Adminhtml_Category_Edit_Tabs
45
+ * @author Ultimate Module Creator
46
+ */
47
+ protected function _beforeToHtml()
48
+ {
49
+ $this->addTab(
50
+ 'form_category',
51
+ array(
52
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('Category'),
53
+ 'title' => Mage::helper('sumankcdotcom_faq')->__('Category'),
54
+ 'content' => $this->getLayout()->createBlock(
55
+ 'sumankcdotcom_faq/adminhtml_category_edit_tab_form'
56
+ )
57
+ ->toHtml(),
58
+ )
59
+ );
60
+ if (!Mage::app()->isSingleStoreMode()) {
61
+ $this->addTab(
62
+ 'form_store_category',
63
+ array(
64
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('Store views'),
65
+ 'title' => Mage::helper('sumankcdotcom_faq')->__('Store views'),
66
+ 'content' => $this->getLayout()->createBlock(
67
+ 'sumankcdotcom_faq/adminhtml_category_edit_tab_stores'
68
+ )
69
+ ->toHtml(),
70
+ )
71
+ );
72
+ }
73
+ return parent::_beforeToHtml();
74
+ }
75
+
76
+ /**
77
+ * Retrieve category entity
78
+ *
79
+ * @access public
80
+ * @return Sumankcdotcom_Faq_Model_Category
81
+ * @author Ultimate Module Creator
82
+ */
83
+ public function getCategory()
84
+ {
85
+ return Mage::registry('current_category');
86
+ }
87
+ }
app/code/community/Sumankcdotcom/Faq/Block/Adminhtml/Category/Grid.php ADDED
@@ -0,0 +1,256 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Category admin grid block
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_Block_Adminhtml_Category_Grid extends Mage_Adminhtml_Block_Widget_Grid
25
+ {
26
+ /**
27
+ * constructor
28
+ *
29
+ * @access public
30
+ * @author Suman K.C [WWW.SUMANKC.COM]
31
+ */
32
+ public function __construct()
33
+ {
34
+ parent::__construct();
35
+ $this->setId('categoryGrid');
36
+ $this->setDefaultSort('entity_id');
37
+ $this->setDefaultDir('ASC');
38
+ $this->setSaveParametersInSession(true);
39
+ $this->setUseAjax(true);
40
+ }
41
+
42
+ /**
43
+ * prepare collection
44
+ *
45
+ * @access protected
46
+ * @return Sumankcdotcom_Faq_Block_Adminhtml_Category_Grid
47
+ * @author Suman K.C [WWW.SUMANKC.COM]
48
+ */
49
+ protected function _prepareCollection()
50
+ {
51
+ $collection = Mage::getModel('sumankcdotcom_faq/category')
52
+ ->getCollection();
53
+
54
+ $this->setCollection($collection);
55
+ return parent::_prepareCollection();
56
+ }
57
+
58
+ /**
59
+ * prepare grid collection
60
+ *
61
+ * @access protected
62
+ * @return Sumankcdotcom_Faq_Block_Adminhtml_Category_Grid
63
+ * @author Suman K.C [WWW.SUMANKC.COM]
64
+ */
65
+ protected function _prepareColumns()
66
+ {
67
+ $this->addColumn(
68
+ 'entity_id',
69
+ array(
70
+ 'header' => Mage::helper('sumankcdotcom_faq')->__('Id'),
71
+ 'index' => 'entity_id',
72
+ 'type' => 'number'
73
+ )
74
+ );
75
+ $this->addColumn(
76
+ 'categories',
77
+ array(
78
+ 'header' => Mage::helper('sumankcdotcom_faq')->__('category Name'),
79
+ 'align' => 'left',
80
+ 'index' => 'categories',
81
+ )
82
+ );
83
+
84
+ $this->addColumn(
85
+ 'status',
86
+ array(
87
+ 'header' => Mage::helper('sumankcdotcom_faq')->__('Status'),
88
+ 'index' => 'status',
89
+ 'type' => 'options',
90
+ 'options' => array(
91
+ '1' => Mage::helper('sumankcdotcom_faq')->__('Enabled'),
92
+ '0' => Mage::helper('sumankcdotcom_faq')->__('Disabled'),
93
+ )
94
+ )
95
+ );
96
+ $this->addColumn(
97
+ 'url_key',
98
+ array(
99
+ 'header' => Mage::helper('sumankcdotcom_faq')->__('URL key'),
100
+ 'index' => 'url_key',
101
+ )
102
+ );
103
+ if (!Mage::app()->isSingleStoreMode() && !$this->_isExport) {
104
+ $this->addColumn(
105
+ 'store_id',
106
+ array(
107
+ 'header' => Mage::helper('sumankcdotcom_faq')->__('Store Views'),
108
+ 'index' => 'store_id',
109
+ 'type' => 'store',
110
+ 'store_all' => true,
111
+ 'store_view' => true,
112
+ 'sortable' => false,
113
+ 'filter_condition_callback'=> array($this, '_filterStoreCondition'),
114
+ )
115
+ );
116
+ }
117
+ $this->addColumn(
118
+ 'created_at',
119
+ array(
120
+ 'header' => Mage::helper('sumankcdotcom_faq')->__('Created at'),
121
+ 'index' => 'created_at',
122
+ 'width' => '120px',
123
+ 'type' => 'datetime',
124
+ )
125
+ );
126
+ $this->addColumn(
127
+ 'updated_at',
128
+ array(
129
+ 'header' => Mage::helper('sumankcdotcom_faq')->__('Updated at'),
130
+ 'index' => 'updated_at',
131
+ 'width' => '120px',
132
+ 'type' => 'datetime',
133
+ )
134
+ );
135
+ $this->addColumn(
136
+ 'action',
137
+ array(
138
+ 'header' => Mage::helper('sumankcdotcom_faq')->__('Action'),
139
+ 'width' => '100',
140
+ 'type' => 'action',
141
+ 'getter' => 'getId',
142
+ 'actions' => array(
143
+ array(
144
+ 'caption' => Mage::helper('sumankcdotcom_faq')->__('Edit'),
145
+ 'url' => array('base'=> '*/*/edit'),
146
+ 'field' => 'id'
147
+ )
148
+ ),
149
+ 'filter' => false,
150
+ 'is_system' => true,
151
+ 'sortable' => false,
152
+ )
153
+ );
154
+ $this->addExportType('*/*/exportCsv', Mage::helper('sumankcdotcom_faq')->__('CSV'));
155
+ $this->addExportType('*/*/exportExcel', Mage::helper('sumankcdotcom_faq')->__('Excel'));
156
+ $this->addExportType('*/*/exportXml', Mage::helper('sumankcdotcom_faq')->__('XML'));
157
+ return parent::_prepareColumns();
158
+ }
159
+
160
+ /**
161
+ * prepare mass action
162
+ *
163
+ * @access protected
164
+ * @return Sumankcdotcom_Faq_Block_Adminhtml_Category_Grid
165
+ * @author Suman K.C [WWW.SUMANKC.COM]
166
+ */
167
+ protected function _prepareMassaction()
168
+ {
169
+ $this->setMassactionIdField('entity_id');
170
+ $this->getMassactionBlock()->setFormFieldName('category');
171
+ $this->getMassactionBlock()->addItem(
172
+ 'delete',
173
+ array(
174
+ 'label'=> Mage::helper('sumankcdotcom_faq')->__('Delete'),
175
+ 'url' => $this->getUrl('*/*/massDelete'),
176
+ 'confirm' => Mage::helper('sumankcdotcom_faq')->__('Are you sure?')
177
+ )
178
+ );
179
+ $this->getMassactionBlock()->addItem(
180
+ 'status',
181
+ array(
182
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('Change status'),
183
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
184
+ 'additional' => array(
185
+ 'status' => array(
186
+ 'name' => 'status',
187
+ 'type' => 'select',
188
+ 'class' => 'required-entry',
189
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('Status'),
190
+ 'values' => array(
191
+ '1' => Mage::helper('sumankcdotcom_faq')->__('Enabled'),
192
+ '0' => Mage::helper('sumankcdotcom_faq')->__('Disabled'),
193
+ )
194
+ )
195
+ )
196
+ )
197
+ );
198
+ return $this;
199
+ }
200
+
201
+ /**
202
+ * get the row url
203
+ *
204
+ * @access public
205
+ * @param Sumankcdotcom_Faq_Model_Category
206
+ * @return string
207
+ * @author Suman K.C [WWW.SUMANKC.COM]
208
+ */
209
+ public function getRowUrl($row)
210
+ {
211
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
212
+ }
213
+
214
+ /**
215
+ * get the grid url
216
+ *
217
+ * @access public
218
+ * @return string
219
+ * @author Suman K.C [WWW.SUMANKC.COM]
220
+ */
221
+ public function getGridUrl()
222
+ {
223
+ return $this->getUrl('*/*/grid', array('_current'=>true));
224
+ }
225
+
226
+ /**
227
+ * after collection load
228
+ *
229
+ * @access protected
230
+ * @return Sumankcdotcom_Faq_Block_Adminhtml_Category_Grid
231
+ * @author Suman K.C [WWW.SUMANKC.COM]
232
+ */
233
+ protected function _afterLoadCollection()
234
+ {
235
+ $this->getCollection()->walk('afterLoad');
236
+ parent::_afterLoadCollection();
237
+ }
238
+
239
+ /**
240
+ * filter store column
241
+ *
242
+ * @access protected
243
+ * @param Sumankcdotcom_Faq_Model_Resource_Category_Collection $collection
244
+ * @param Mage_Adminhtml_Block_Widget_Grid_Column $column
245
+ * @return Sumankcdotcom_Faq_Block_Adminhtml_Category_Grid
246
+ * @author Suman K.C [WWW.SUMANKC.COM]
247
+ */
248
+ protected function _filterStoreCondition($collection, $column)
249
+ {
250
+ if (!$value = $column->getFilter()->getValue()) {
251
+ return;
252
+ }
253
+ $collection->addStoreFilter($value);
254
+ return $this;
255
+ }
256
+ }
app/code/community/Sumankcdotcom/Faq/Block/Adminhtml/Faq.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Faq admin block
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_Block_Adminhtml_Faq extends Mage_Adminhtml_Block_Widget_Grid_Container
25
+ {
26
+ /**
27
+ * constructor
28
+ *
29
+ * @access public
30
+ * @return void
31
+ * @author Suman K.C [WWW.SUMANKC.COM]
32
+ */
33
+ public function __construct()
34
+ {
35
+ $this->_controller = 'adminhtml_faq';
36
+ $this->_blockGroup = 'sumankcdotcom_faq';
37
+ parent::__construct();
38
+ $this->_headerText = Mage::helper('sumankcdotcom_faq')->__('Faq');
39
+ $this->_updateButton('add', 'label', Mage::helper('sumankcdotcom_faq')->__('Add Faq'));
40
+
41
+ }
42
+ }
app/code/community/Sumankcdotcom/Faq/Block/Adminhtml/Faq/Edit.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Faq admin edit form
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_Block_Adminhtml_Faq_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
25
+ {
26
+ /**
27
+ * constructor
28
+ *
29
+ * @access public
30
+ * @return void
31
+ * @author Suman K.C [WWW.SUMANKC.COM]
32
+ */
33
+ public function __construct()
34
+ {
35
+ parent::__construct();
36
+ $this->_blockGroup = 'sumankcdotcom_faq';
37
+ $this->_controller = 'adminhtml_faq';
38
+ $this->_updateButton(
39
+ 'save',
40
+ 'label',
41
+ Mage::helper('sumankcdotcom_faq')->__('Save Faq')
42
+ );
43
+ $this->_updateButton(
44
+ 'delete',
45
+ 'label',
46
+ Mage::helper('sumankcdotcom_faq')->__('Delete Faq')
47
+ );
48
+ $this->_addButton(
49
+ 'saveandcontinue',
50
+ array(
51
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('Save And Continue Edit'),
52
+ 'onclick' => 'saveAndContinueEdit()',
53
+ 'class' => 'save',
54
+ ),
55
+ -100
56
+ );
57
+ $this->_formScripts[] = "
58
+ function saveAndContinueEdit() {
59
+ editForm.submit($('edit_form').action+'back/edit/');
60
+ }
61
+ ";
62
+ }
63
+
64
+ /**
65
+ * get the edit form header
66
+ *
67
+ * @access public
68
+ * @return string
69
+ * @author Suman K.C [WWW.SUMANKC.COM]
70
+ */
71
+ public function getHeaderText()
72
+ {
73
+ if (Mage::registry('current_faq') && Mage::registry('current_faq')->getId()) {
74
+ return Mage::helper('sumankcdotcom_faq')->__(
75
+ "Edit Faq '%s'",
76
+ $this->escapeHtml(Mage::registry('current_faq')->getQuestion())
77
+ );
78
+ } else {
79
+ return Mage::helper('sumankcdotcom_faq')->__('Add Faq');
80
+ }
81
+ }
82
+ }
app/code/community/Sumankcdotcom/Faq/Block/Adminhtml/Faq/Edit/Form.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Faq edit form
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_Block_Adminhtml_Faq_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
25
+ {
26
+ /**
27
+ * prepare form
28
+ *
29
+ * @access protected
30
+ * @return Sumankcdotcom_Faq_Block_Adminhtml_Faq_Edit_Form
31
+ * @author Suman K.C [WWW.SUMANKC.COM]
32
+ */
33
+ protected function _prepareForm()
34
+ {
35
+ $form = new Varien_Data_Form(
36
+ array(
37
+ 'id' => 'edit_form',
38
+ 'action' => $this->getUrl(
39
+ '*/*/save',
40
+ array(
41
+ 'id' => $this->getRequest()->getParam('id')
42
+ )
43
+ ),
44
+ 'method' => 'post',
45
+ 'enctype' => 'multipart/form-data'
46
+ )
47
+ );
48
+ $form->setUseContainer(true);
49
+ $this->setForm($form);
50
+ return parent::_prepareForm();
51
+ }
52
+ }
app/code/community/Sumankcdotcom/Faq/Block/Adminhtml/Faq/Edit/Tab/Form.php ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Faq edit form tab
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_Block_Adminhtml_Faq_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
25
+ {
26
+ /**
27
+ * prepare the form
28
+ *
29
+ * @access protected
30
+ * @return Sumankcdotcom_Faq_Block_Adminhtml_Faq_Edit_Tab_Form
31
+ * @author Suman K.C [WWW.SUMANKC.COM]
32
+ */
33
+ protected function _prepareForm()
34
+ {
35
+ $form = new Varien_Data_Form();
36
+ $form->setHtmlIdPrefix('faq_');
37
+ $form->setFieldNameSuffix('faq');
38
+ $this->setForm($form);
39
+ $fieldset = $form->addFieldset(
40
+ 'faq_form',
41
+ array('legend' => Mage::helper('sumankcdotcom_faq')->__('Faq'))
42
+ );
43
+ $wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig();
44
+ $values = Mage::getResourceModel('sumankcdotcom_faq/category_collection')
45
+ ->toOptionArray();
46
+ array_unshift($values, array('label' => '', 'value' => ''));
47
+
48
+ $html = '<a href="{#url}" id="faq_category_id_link" target="_blank"></a>';
49
+ $html .= '<script type="text/javascript">
50
+ function changeCategoryIdLink() {
51
+ if ($(\'faq_category_id\').value == \'\') {
52
+ $(\'faq_category_id_link\').hide();
53
+ } else {
54
+ $(\'faq_category_id_link\').show();
55
+ var url = \''.$this->getUrl('adminhtml/faq_category/edit', array('id'=>'{#id}', 'clear'=>1)).'\';
56
+ var text = \''.Mage::helper('core')->escapeHtml($this->__('View {#name}')).'\';
57
+ var realUrl = url.replace(\'{#id}\', $(\'faq_category_id\').value);
58
+ $(\'faq_category_id_link\').href = realUrl;
59
+ $(\'faq_category_id_link\').innerHTML = text.replace(\'{#name}\', $(\'faq_category_id\').options[$(\'faq_category_id\').selectedIndex].innerHTML);
60
+ }
61
+ }
62
+ $(\'faq_category_id\').observe(\'change\', changeCategoryIdLink);
63
+ changeCategoryIdLink();
64
+ </script>';
65
+
66
+ $fieldset->addField(
67
+ 'category_id',
68
+ 'select',
69
+ array(
70
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('Category'),
71
+ 'name' => 'category_id',
72
+ 'required' => false,
73
+ 'values' => $values,
74
+ 'after_element_html' => $html
75
+ )
76
+ );
77
+
78
+ $fieldset->addField(
79
+ 'question',
80
+ 'text',
81
+ array(
82
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('Question'),
83
+ 'name' => 'question',
84
+ 'required' => true,
85
+ 'class' => 'required-entry',
86
+
87
+ )
88
+ );
89
+
90
+ $fieldset->addField(
91
+ 'answer',
92
+ 'editor',
93
+ array(
94
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('Answer'),
95
+ 'name' => 'answer',
96
+ 'config' => $wysiwygConfig,
97
+ 'required' => true,
98
+ 'class' => 'required-entry',
99
+
100
+ )
101
+ );
102
+ $fieldset->addField(
103
+ 'url_key',
104
+ 'text',
105
+ array(
106
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('Url key'),
107
+ 'name' => 'url_key',
108
+ 'note' => Mage::helper('sumankcdotcom_faq')->__('Relative to Website Base URL')
109
+ )
110
+ );
111
+ $fieldset->addField(
112
+ 'status',
113
+ 'select',
114
+ array(
115
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('Status'),
116
+ 'name' => 'status',
117
+ 'values' => array(
118
+ array(
119
+ 'value' => 1,
120
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('Enabled'),
121
+ ),
122
+ array(
123
+ 'value' => 0,
124
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('Disabled'),
125
+ ),
126
+ ),
127
+ )
128
+ );
129
+ $formValues = Mage::registry('current_faq')->getDefaultValues();
130
+ if (!is_array($formValues)) {
131
+ $formValues = array();
132
+ }
133
+ if (Mage::getSingleton('adminhtml/session')->getFaqData()) {
134
+ $formValues = array_merge($formValues, Mage::getSingleton('adminhtml/session')->getFaqData());
135
+ Mage::getSingleton('adminhtml/session')->setFaqData(null);
136
+ } elseif (Mage::registry('current_faq')) {
137
+ $formValues = array_merge($formValues, Mage::registry('current_faq')->getData());
138
+ }
139
+ $form->setValues($formValues);
140
+ return parent::_prepareForm();
141
+ }
142
+ }
app/code/community/Sumankcdotcom/Faq/Block/Adminhtml/Faq/Edit/Tabs.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Faq admin edit tabs
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_Block_Adminhtml_Faq_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
25
+ {
26
+ /**
27
+ * Initialize Tabs
28
+ *
29
+ * @access public
30
+ * @author Suman K.C [WWW.SUMANKC.COM]
31
+ */
32
+ public function __construct()
33
+ {
34
+ parent::__construct();
35
+ $this->setId('faq_tabs');
36
+ $this->setDestElementId('edit_form');
37
+ $this->setTitle(Mage::helper('sumankcdotcom_faq')->__('Faq'));
38
+ }
39
+
40
+ /**
41
+ * before render html
42
+ *
43
+ * @access protected
44
+ * @return Sumankcdotcom_Faq_Block_Adminhtml_Faq_Edit_Tabs
45
+ * @author Suman K.C [WWW.SUMANKC.COM]
46
+ */
47
+ protected function _beforeToHtml()
48
+ {
49
+ $this->addTab(
50
+ 'form_faq',
51
+ array(
52
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('Faq'),
53
+ 'title' => Mage::helper('sumankcdotcom_faq')->__('Faq'),
54
+ 'content' => $this->getLayout()->createBlock(
55
+ 'sumankcdotcom_faq/adminhtml_faq_edit_tab_form'
56
+ )
57
+ ->toHtml(),
58
+ )
59
+ );
60
+ return parent::_beforeToHtml();
61
+ }
62
+
63
+ /**
64
+ * Retrieve faq entity
65
+ *
66
+ * @access public
67
+ * @return Sumankcdotcom_Faq_Model_Faq
68
+ * @author Suman K.C [WWW.SUMANKC.COM]
69
+ */
70
+ public function getFaq()
71
+ {
72
+ return Mage::registry('current_faq');
73
+ }
74
+ }
app/code/community/Sumankcdotcom/Faq/Block/Adminhtml/Faq/Grid.php ADDED
@@ -0,0 +1,259 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Faq admin grid block
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_Block_Adminhtml_Faq_Grid extends Mage_Adminhtml_Block_Widget_Grid
25
+ {
26
+ /**
27
+ * constructor
28
+ *
29
+ * @access public
30
+ * @author Suman K.C [WWW.SUMANKC.COM]
31
+ */
32
+ public function __construct()
33
+ {
34
+ parent::__construct();
35
+ $this->setId('faqGrid');
36
+ $this->setDefaultSort('entity_id');
37
+ $this->setDefaultDir('ASC');
38
+ $this->setSaveParametersInSession(true);
39
+ $this->setUseAjax(true);
40
+ }
41
+
42
+ /**
43
+ * prepare collection
44
+ *
45
+ * @access protected
46
+ * @return Sumankcdotcom_Faq_Block_Adminhtml_Faq_Grid
47
+ * @author Suman K.C [WWW.SUMANKC.COM]
48
+ */
49
+ protected function _prepareCollection()
50
+ {
51
+ $collection = Mage::getModel('sumankcdotcom_faq/faq')
52
+ ->getCollection();
53
+
54
+ $this->setCollection($collection);
55
+ return parent::_prepareCollection();
56
+ }
57
+
58
+ /**
59
+ * prepare grid collection
60
+ *
61
+ * @access protected
62
+ * @return Sumankcdotcom_Faq_Block_Adminhtml_Faq_Grid
63
+ * @author Suman K.C [WWW.SUMANKC.COM]
64
+ */
65
+ protected function _prepareColumns()
66
+ {
67
+ $this->addColumn(
68
+ 'entity_id',
69
+ array(
70
+ 'header' => Mage::helper('sumankcdotcom_faq')->__('Id'),
71
+ 'index' => 'entity_id',
72
+ 'type' => 'number'
73
+ )
74
+ );
75
+ $this->addColumn(
76
+ 'category_id',
77
+ array(
78
+ 'header' => Mage::helper('sumankcdotcom_faq')->__('Category'),
79
+ 'index' => 'category_id',
80
+ 'type' => 'options',
81
+ 'options' => Mage::getResourceModel('sumankcdotcom_faq/category_collection')
82
+ ->toOptionHash(),
83
+ 'renderer' => 'sumankcdotcom_faq/adminhtml_helper_column_renderer_parent',
84
+ 'params' => array(
85
+ 'id' => 'getCategoryId'
86
+ ),
87
+ 'base_link' => 'adminhtml/faq_category/edit'
88
+ )
89
+ );
90
+ $this->addColumn(
91
+ 'question',
92
+ array(
93
+ 'header' => Mage::helper('sumankcdotcom_faq')->__('Question'),
94
+ 'align' => 'left',
95
+ 'index' => 'question',
96
+ )
97
+ );
98
+
99
+ $this->addColumn(
100
+ 'status',
101
+ array(
102
+ 'header' => Mage::helper('sumankcdotcom_faq')->__('Status'),
103
+ 'index' => 'status',
104
+ 'type' => 'options',
105
+ 'options' => array(
106
+ '1' => Mage::helper('sumankcdotcom_faq')->__('Enabled'),
107
+ '0' => Mage::helper('sumankcdotcom_faq')->__('Disabled'),
108
+ )
109
+ )
110
+ );
111
+ $this->addColumn(
112
+ 'url_key',
113
+ array(
114
+ 'header' => Mage::helper('sumankcdotcom_faq')->__('URL key'),
115
+ 'index' => 'url_key',
116
+ )
117
+ );
118
+ $this->addColumn(
119
+ 'created_at',
120
+ array(
121
+ 'header' => Mage::helper('sumankcdotcom_faq')->__('Created at'),
122
+ 'index' => 'created_at',
123
+ 'width' => '120px',
124
+ 'type' => 'datetime',
125
+ )
126
+ );
127
+ $this->addColumn(
128
+ 'updated_at',
129
+ array(
130
+ 'header' => Mage::helper('sumankcdotcom_faq')->__('Updated at'),
131
+ 'index' => 'updated_at',
132
+ 'width' => '120px',
133
+ 'type' => 'datetime',
134
+ )
135
+ );
136
+ $this->addColumn(
137
+ 'action',
138
+ array(
139
+ 'header' => Mage::helper('sumankcdotcom_faq')->__('Action'),
140
+ 'width' => '100',
141
+ 'type' => 'action',
142
+ 'getter' => 'getId',
143
+ 'actions' => array(
144
+ array(
145
+ 'caption' => Mage::helper('sumankcdotcom_faq')->__('Edit'),
146
+ 'url' => array('base'=> '*/*/edit'),
147
+ 'field' => 'id'
148
+ )
149
+ ),
150
+ 'filter' => false,
151
+ 'is_system' => true,
152
+ 'sortable' => false,
153
+ )
154
+ );
155
+ $this->addExportType('*/*/exportCsv', Mage::helper('sumankcdotcom_faq')->__('CSV'));
156
+ $this->addExportType('*/*/exportExcel', Mage::helper('sumankcdotcom_faq')->__('Excel'));
157
+ $this->addExportType('*/*/exportXml', Mage::helper('sumankcdotcom_faq')->__('XML'));
158
+ return parent::_prepareColumns();
159
+ }
160
+
161
+ /**
162
+ * prepare mass action
163
+ *
164
+ * @access protected
165
+ * @return Sumankcdotcom_Faq_Block_Adminhtml_Faq_Grid
166
+ * @author Suman K.C [WWW.SUMANKC.COM]
167
+ */
168
+ protected function _prepareMassaction()
169
+ {
170
+ $this->setMassactionIdField('entity_id');
171
+ $this->getMassactionBlock()->setFormFieldName('faq');
172
+ $this->getMassactionBlock()->addItem(
173
+ 'delete',
174
+ array(
175
+ 'label'=> Mage::helper('sumankcdotcom_faq')->__('Delete'),
176
+ 'url' => $this->getUrl('*/*/massDelete'),
177
+ 'confirm' => Mage::helper('sumankcdotcom_faq')->__('Are you sure?')
178
+ )
179
+ );
180
+ $this->getMassactionBlock()->addItem(
181
+ 'status',
182
+ array(
183
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('Change status'),
184
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
185
+ 'additional' => array(
186
+ 'status' => array(
187
+ 'name' => 'status',
188
+ 'type' => 'select',
189
+ 'class' => 'required-entry',
190
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('Status'),
191
+ 'values' => array(
192
+ '1' => Mage::helper('sumankcdotcom_faq')->__('Enabled'),
193
+ '0' => Mage::helper('sumankcdotcom_faq')->__('Disabled'),
194
+ )
195
+ )
196
+ )
197
+ )
198
+ );
199
+ $values = Mage::getResourceModel('sumankcdotcom_faq/category_collection')->toOptionHash();
200
+ $values = array_reverse($values, true);
201
+ $values[''] = '';
202
+ $values = array_reverse($values, true);
203
+ $this->getMassactionBlock()->addItem(
204
+ 'category_id',
205
+ array(
206
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('Change Category'),
207
+ 'url' => $this->getUrl('*/*/massCategoryId', array('_current'=>true)),
208
+ 'additional' => array(
209
+ 'flag_category_id' => array(
210
+ 'name' => 'flag_category_id',
211
+ 'type' => 'select',
212
+ 'class' => 'required-entry',
213
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('Category'),
214
+ 'values' => $values
215
+ )
216
+ )
217
+ )
218
+ );
219
+ return $this;
220
+ }
221
+
222
+ /**
223
+ * get the row url
224
+ *
225
+ * @access public
226
+ * @param Sumankcdotcom_Faq_Model_Faq
227
+ * @return string
228
+ * @author Suman K.C [WWW.SUMANKC.COM]
229
+ */
230
+ public function getRowUrl($row)
231
+ {
232
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
233
+ }
234
+
235
+ /**
236
+ * get the grid url
237
+ *
238
+ * @access public
239
+ * @return string
240
+ * @author Suman K.C [WWW.SUMANKC.COM]
241
+ */
242
+ public function getGridUrl()
243
+ {
244
+ return $this->getUrl('*/*/grid', array('_current'=>true));
245
+ }
246
+
247
+ /**
248
+ * after collection load
249
+ *
250
+ * @access protected
251
+ * @return Sumankcdotcom_Faq_Block_Adminhtml_Faq_Grid
252
+ * @author Suman K.C [WWW.SUMANKC.COM]
253
+ */
254
+ protected function _afterLoadCollection()
255
+ {
256
+ $this->getCollection()->walk('afterLoad');
257
+ parent::_afterLoadCollection();
258
+ }
259
+ }
app/code/community/Sumankcdotcom/Faq/Block/Adminhtml/Helper/Column/Renderer/Parent.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * parent entities column renderer
19
+ * @category Sumankcdotcom
20
+ * @package Sumankcdotcom_Faq
21
+ * @author Suman K.C [WWW.SUMANKC.COM]
22
+ */
23
+ class Sumankcdotcom_Faq_Block_Adminhtml_Helper_Column_Renderer_Parent extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Options
24
+ {
25
+ /**
26
+ * render the column
27
+ *
28
+ * @access public
29
+ * @param Varien_Object $row
30
+ * @return string
31
+ * @author Suman K.C [WWW.SUMANKC.COM]
32
+ */
33
+ public function render(Varien_Object $row)
34
+ {
35
+ $base = $this->getColumn()->getBaseLink();
36
+ if (!$base) {
37
+ return parent::render($row);
38
+ }
39
+ $paramsData = $this->getColumn()->getData('params');
40
+ $params = array();
41
+ if (is_array($paramsData)) {
42
+ foreach ($paramsData as $name=>$getter) {
43
+ if (is_callable(array($row, $getter))) {
44
+ $params[$name] = call_user_func(array($row, $getter));
45
+ }
46
+ }
47
+ }
48
+ $staticParamsData = $this->getColumn()->getData('static');
49
+ if (is_array($staticParamsData)) {
50
+ foreach ($staticParamsData as $key=>$value) {
51
+ $params[$key] = $value;
52
+ }
53
+ }
54
+ $options = $this->getColumn()->getOptions();
55
+ $showMissingOptionValues = (bool)$this->getColumn()->getShowMissingOptionValues();
56
+ if (!empty($options) && is_array($options)) {
57
+ $value = $row->getData($this->getColumn()->getIndex());
58
+ if (is_array($value)) {
59
+ $res = array();
60
+ foreach ($value as $item) {
61
+ if (isset($options[$item])) {
62
+ $res[] = '<a href="'.$this->getUrl($base, $params).'" target="_blank">'.
63
+ $this->escapeHtml($options[$item]).
64
+ '</a>';
65
+ } elseif ($showMissingOptionValues) {
66
+ $res[] = '<a href="'.$this->getUrl($base, $params).'" target="_blank">'.
67
+ $this->escapeHtml($item).
68
+ '</a>';
69
+ }
70
+ }
71
+ return implode('<br />', $res);
72
+ } elseif (isset($options[$value])) {
73
+ return '<a href="'.$this->getUrl($base, $params).'" target="_blank">'.
74
+ $this->escapeHtml($options[$value]).
75
+ '</a>';
76
+ } elseif (in_array($value, $options)) {
77
+ return '<a href="'.$this->getUrl($base, $params).'" target="_blank">'.
78
+ $this->escapeHtml($value).
79
+ '</a>';
80
+ }
81
+ }
82
+ }
83
+ }
app/code/community/Sumankcdotcom/Faq/Block/Category/Faq/List.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Category Faqs list block
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_Block_Category_Faq_List extends Sumankcdotcom_Faq_Block_Faq_List
25
+ {
26
+ /**
27
+ * initialize
28
+ *
29
+ * @access public
30
+ * @author Suman K.C [WWW.SUMANKC.COM]
31
+ */
32
+ public function __construct()
33
+ {
34
+ parent::__construct();
35
+ $category = $this->getCategory();
36
+ if ($category) {
37
+ $this->getFaqs()->addFieldToFilter('category_id', $category->getId());
38
+ }
39
+ }
40
+
41
+ /**
42
+ * prepare the layout - actually do nothing
43
+ *
44
+ * @access protected
45
+ * @return Sumankcdotcom_Faq_Block_Category_Faq_List
46
+ * @author Suman K.C [WWW.SUMANKC.COM]
47
+ */
48
+ protected function _prepareLayout()
49
+ {
50
+ return $this;
51
+ }
52
+
53
+ /**
54
+ * get the current category
55
+ *
56
+ * @access public
57
+ * @return Sumankcdotcom_Faq_Model_Category
58
+ * @author Suman K.C [WWW.SUMANKC.COM]
59
+ */
60
+ public function getCategory()
61
+ {
62
+ return Mage::registry('current_category');
63
+ }
64
+ }
app/code/community/Sumankcdotcom/Faq/Block/Category/List.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Category list block
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_Block_Category_List extends Mage_Core_Block_Template
25
+ {
26
+ /**
27
+ * initialize
28
+ *
29
+ * @access public
30
+ * @author Suman K.C [WWW.SUMANKC.COM]
31
+ */
32
+ public function _construct()
33
+ {
34
+ parent::_construct();
35
+ $categories = Mage::getResourceModel('sumankcdotcom_faq/category_collection')
36
+ ->addStoreFilter(Mage::app()->getStore())
37
+ ->addFieldToFilter('status', 1);
38
+ $categories->setOrder('categories', 'asc');
39
+ $this->setCategories($categories);
40
+ }
41
+
42
+ public function getfaqs($catid){
43
+ $faqs = Mage::getResourceModel('sumankcdotcom_faq/faq_collection')
44
+ ->addFieldToFilter('status', 1);
45
+ $faqs->setOrder('question', 'asc');
46
+ return $faqs->addFieldToFilter('category_id', $catid);
47
+ }
48
+
49
+ /**
50
+ * prepare the layout
51
+ *
52
+ * @access protected
53
+ * @return Sumankcdotcom_Faq_Block_Category_List
54
+ * @author Suman K.C [WWW.SUMANKC.COM]
55
+ */
56
+ protected function _prepareLayout()
57
+ {
58
+ parent::_prepareLayout();
59
+ $this->getCategories()->load();
60
+ return $this;
61
+ }
62
+ }
app/code/community/Sumankcdotcom/Faq/Block/Category/View.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Category view block
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_Block_Category_View extends Mage_Core_Block_Template
25
+ {
26
+ /**
27
+ * get the current category
28
+ *
29
+ * @access public
30
+ * @return mixed (Sumankcdotcom_Faq_Model_Category|null)
31
+ * @author Suman K.C [WWW.SUMANKC.COM]
32
+ */
33
+ public function getCurrentCategory()
34
+ {
35
+ return Mage::registry('current_category');
36
+ }
37
+ }
app/code/community/Sumankcdotcom/Faq/Block/Faq/List.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Faq list block
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_Block_Faq_List extends Mage_Core_Block_Template
25
+ {
26
+ /**
27
+ * initialize
28
+ *
29
+ * @access public
30
+ * @author Suman K.C [WWW.SUMANKC.COM]
31
+ */
32
+ public function _construct()
33
+ {
34
+ parent::_construct();
35
+ $faqs = Mage::getResourceModel('sumankcdotcom_faq/faq_collection')
36
+ ->addFieldToFilter('status', 1);
37
+ $faqs->setOrder('question', 'asc');
38
+ $this->setFaqs($faqs);
39
+ }
40
+
41
+ /**
42
+ * prepare the layout
43
+ *
44
+ * @access protected
45
+ * @return Sumankcdotcom_Faq_Block_Faq_List
46
+ * @author Suman K.C [WWW.SUMANKC.COM]
47
+ */
48
+ protected function _prepareLayout()
49
+ {
50
+ parent::_prepareLayout();
51
+ $pager = $this->getLayout()->createBlock(
52
+ 'page/html_pager',
53
+ 'sumankcdotcom_faq.faq.html.pager'
54
+ )
55
+ ->setCollection($this->getFaqs());
56
+ $this->setChild('pager', $pager);
57
+ $this->getFaqs()->load();
58
+ return $this;
59
+ }
60
+
61
+ /**
62
+ * get the pager html
63
+ *
64
+ * @access public
65
+ * @return string
66
+ * @author Suman K.C [WWW.SUMANKC.COM]
67
+ */
68
+ public function getPagerHtml()
69
+ {
70
+ return $this->getChildHtml('pager');
71
+ }
72
+ }
app/code/community/Sumankcdotcom/Faq/Block/Faq/View.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Faq view block
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_Block_Faq_View extends Mage_Core_Block_Template
25
+ {
26
+ /**
27
+ * get the current faq
28
+ *
29
+ * @access public
30
+ * @return mixed (Sumankcdotcom_Faq_Model_Faq|null)
31
+ * @author Suman K.C [WWW.SUMANKC.COM]
32
+ */
33
+ public function getCurrentFaq()
34
+ {
35
+ return Mage::registry('current_faq');
36
+ }
37
+ }
app/code/community/Sumankcdotcom/Faq/Controller/Adminhtml/Faq.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * module base admin controller
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_Controller_Adminhtml_Faq extends Mage_Adminhtml_Controller_Action
25
+ {
26
+ /**
27
+ * upload file and get the uploaded name
28
+ *
29
+ * @access public
30
+ * @param string $input
31
+ * @param string $destinationFolder
32
+ * @param array $data
33
+ * @return string
34
+ * @author Suman K.C [WWW.SUMANKC.COM]
35
+ */
36
+ protected function _uploadAndGetName($input, $destinationFolder, $data)
37
+ {
38
+ try {
39
+ if (isset($data[$input]['delete'])) {
40
+ return '';
41
+ } else {
42
+ $uploader = new Varien_File_Uploader($input);
43
+ $uploader->setAllowRenameFiles(true);
44
+ $uploader->setFilesDispersion(true);
45
+ $uploader->setAllowCreateFolders(true);
46
+ $result = $uploader->save($destinationFolder);
47
+ return $result['file'];
48
+ }
49
+ } catch (Exception $e) {
50
+ if ($e->getCode() != Varien_File_Uploader::TMP_NAME_EMPTY) {
51
+ throw $e;
52
+ } else {
53
+ if (isset($data[$input]['value'])) {
54
+ return $data[$input]['value'];
55
+ }
56
+ }
57
+ }
58
+ return '';
59
+ }
60
+ }
app/code/community/Sumankcdotcom/Faq/Controller/Router.php ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Router
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_Controller_Router extends Mage_Core_Controller_Varien_Router_Abstract
25
+ {
26
+ /**
27
+ * init routes
28
+ *
29
+ * @access public
30
+ * @param Varien_Event_Observer $observer
31
+ * @return Sumankcdotcom_Faq_Controller_Router
32
+ * @author Suman K.C [WWW.SUMANKC.COM]
33
+ */
34
+ public function initControllerRouters($observer)
35
+ {
36
+ $front = $observer->getEvent()->getFront();
37
+ $front->addRouter('sumankcdotcom_faq', $this);
38
+ return $this;
39
+ }
40
+
41
+ /**
42
+ * Validate and match entities and modify request
43
+ *
44
+ * @access public
45
+ * @param Zend_Controller_Request_Http $request
46
+ * @return bool
47
+ * @author Suman K.C [WWW.SUMANKC.COM]
48
+ */
49
+ public function match(Zend_Controller_Request_Http $request)
50
+ {
51
+ if (!Mage::isInstalled()) {
52
+ Mage::app()->getFrontController()->getResponse()
53
+ ->setRedirect(Mage::getUrl('install'))
54
+ ->sendResponse();
55
+ exit;
56
+ }
57
+ $urlKey = trim($request->getPathInfo(), '/');
58
+ $check = array();
59
+ $check['faq'] = new Varien_Object(
60
+ array(
61
+ 'prefix' => Mage::getStoreConfig('sumankcdotcom_faq/faq/url_prefix'),
62
+ 'suffix' => Mage::getStoreConfig('sumankcdotcom_faq/faq/url_suffix'),
63
+ 'list_key' => Mage::getStoreConfig('sumankcdotcom_faq/faq/url_rewrite_list'),
64
+ 'list_action' => 'index',
65
+ 'model' =>'sumankcdotcom_faq/faq',
66
+ 'controller' => 'faq',
67
+ 'action' => 'view',
68
+ 'param' => 'id',
69
+ 'check_path' => 0
70
+ )
71
+ );
72
+ $check['category'] = new Varien_Object(
73
+ array(
74
+ 'prefix' => Mage::getStoreConfig('sumankcdotcom_faq/category/url_prefix'),
75
+ 'suffix' => Mage::getStoreConfig('sumankcdotcom_faq/category/url_suffix'),
76
+ 'list_key' => Mage::getStoreConfig('sumankcdotcom_faq/category/url_rewrite_list'),
77
+ 'list_action' => 'index',
78
+ 'model' =>'sumankcdotcom_faq/category',
79
+ 'controller' => 'category',
80
+ 'action' => 'view',
81
+ 'param' => 'id',
82
+ 'check_path' => 0
83
+ )
84
+ );
85
+ foreach ($check as $key=>$settings) {
86
+ if ($settings->getListKey()) {
87
+ if ($urlKey == $settings->getListKey()) {
88
+ $request->setModuleName('faq')
89
+ ->setControllerName($settings->getController())
90
+ ->setActionName($settings->getListAction());
91
+ $request->setAlias(
92
+ Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS,
93
+ $urlKey
94
+ );
95
+ return true;
96
+ }
97
+ }
98
+ if ($settings['prefix']) {
99
+ $parts = explode('/', $urlKey);
100
+ if ($parts[0] != $settings['prefix'] || count($parts) != 2) {
101
+ continue;
102
+ }
103
+ $urlKey = $parts[1];
104
+ }
105
+ if ($settings['suffix']) {
106
+ $urlKey = substr($urlKey, 0, -strlen($settings['suffix']) - 1);
107
+ }
108
+ $model = Mage::getModel($settings->getModel());
109
+ $id = $model->checkUrlKey($urlKey, Mage::app()->getStore()->getId());
110
+ if ($id) {
111
+ if ($settings->getCheckPath() && !$model->load($id)->getStatusPath()) {
112
+ continue;
113
+ }
114
+ $request->setModuleName('faq')
115
+ ->setControllerName($settings->getController())
116
+ ->setActionName($settings->getAction())
117
+ ->setParam($settings->getParam(), $id);
118
+ $request->setAlias(
119
+ Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS,
120
+ $urlKey
121
+ );
122
+ return true;
123
+ }
124
+ }
125
+ return false;
126
+ }
127
+ }
app/code/community/Sumankcdotcom/Faq/Helper/Category.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Category helper
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_Helper_Category extends Mage_Core_Helper_Abstract
25
+ {
26
+
27
+ /**
28
+ * get the url to the categories list page
29
+ *
30
+ * @access public
31
+ * @return string
32
+ * @author Suman K.C [WWW.SUMANKC.COM]
33
+ */
34
+ public function getCategoriesUrl()
35
+ {
36
+ if ($listKey = Mage::getStoreConfig('sumankcdotcom_faq/category/url_rewrite_list')) {
37
+ return Mage::getUrl('', array('_direct'=>$listKey));
38
+ }
39
+ return Mage::getUrl('sumankcdotcom_faq/category/index');
40
+ }
41
+
42
+ /**
43
+ * check if breadcrumbs can be used
44
+ *
45
+ * @access public
46
+ * @return bool
47
+ * @author Suman K.C [WWW.SUMANKC.COM]
48
+ */
49
+ public function getUseBreadcrumbs()
50
+ {
51
+ return Mage::getStoreConfigFlag('sumankcdotcom_faq/category/breadcrumbs');
52
+ }
53
+ }
app/code/community/Sumankcdotcom/Faq/Helper/Data.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Faq default helper
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_Helper_Data extends Mage_Core_Helper_Abstract
25
+ {
26
+ /**
27
+ * convert array to options
28
+ *
29
+ * @access public
30
+ * @param $options
31
+ * @return array
32
+ * @author Suman K.C [WWW.SUMANKC.COM]
33
+ */
34
+ public function convertOptions($options)
35
+ {
36
+ $converted = array();
37
+ foreach ($options as $option) {
38
+ if (isset($option['value']) && !is_array($option['value']) &&
39
+ isset($option['label']) && !is_array($option['label'])) {
40
+ $converted[$option['value']] = $option['label'];
41
+ }
42
+ }
43
+ return $converted;
44
+ }
45
+ }
app/code/community/Sumankcdotcom/Faq/Helper/Faq.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Faq helper
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_Helper_Faq extends Mage_Core_Helper_Abstract
25
+ {
26
+
27
+ /**
28
+ * get the url to the faqs list page
29
+ *
30
+ * @access public
31
+ * @return string
32
+ * @author Suman K.C [WWW.SUMANKC.COM]
33
+ */
34
+ public function getFaqsUrl()
35
+ {
36
+ if ($listKey = Mage::getStoreConfig('sumankcdotcom_faq/faq/url_rewrite_list')) {
37
+ return Mage::getUrl('', array('_direct'=>$listKey));
38
+ }
39
+ return Mage::getUrl('sumankcdotcom_faq/faq/index');
40
+ }
41
+
42
+ /**
43
+ * check if breadcrumbs can be used
44
+ *
45
+ * @access public
46
+ * @return bool
47
+ * @author Suman K.C [WWW.SUMANKC.COM]
48
+ */
49
+ public function getUseBreadcrumbs()
50
+ {
51
+ return Mage::getStoreConfigFlag('sumankcdotcom_faq/faq/breadcrumbs');
52
+ }
53
+ }
app/code/community/Sumankcdotcom/Faq/Model/Adminhtml/Search/Category.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Admin search model
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_Model_Adminhtml_Search_Category extends Varien_Object
25
+ {
26
+ /**
27
+ * Load search results
28
+ *
29
+ * @access public
30
+ * @return Sumankcdotcom_Faq_Model_Adminhtml_Search_Category
31
+ * @author Suman K.C [WWW.SUMANKC.COM]
32
+ */
33
+ public function load()
34
+ {
35
+ $arr = array();
36
+ if (!$this->hasStart() || !$this->hasLimit() || !$this->hasQuery()) {
37
+ $this->setResults($arr);
38
+ return $this;
39
+ }
40
+ $collection = Mage::getResourceModel('sumankcdotcom_faq/category_collection')
41
+ ->addFieldToFilter('categories', array('like' => $this->getQuery().'%'))
42
+ ->setCurPage($this->getStart())
43
+ ->setPageSize($this->getLimit())
44
+ ->load();
45
+ foreach ($collection->getItems() as $category) {
46
+ $arr[] = array(
47
+ 'id' => 'category/1/'.$category->getId(),
48
+ 'type' => Mage::helper('sumankcdotcom_faq')->__('Category'),
49
+ 'name' => $category->getCategories(),
50
+ 'description' => $category->getCategories(),
51
+ 'url' => Mage::helper('adminhtml')->getUrl(
52
+ '*/faq_category/edit',
53
+ array('id'=>$category->getId())
54
+ ),
55
+ );
56
+ }
57
+ $this->setResults($arr);
58
+ return $this;
59
+ }
60
+ }
app/code/community/Sumankcdotcom/Faq/Model/Category.php ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Category model
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_Model_Category extends Mage_Core_Model_Abstract
25
+ {
26
+ /**
27
+ * Entity code.
28
+ * Can be used as part of method name for entity processing
29
+ */
30
+ const ENTITY = 'sumankcdotcom_faq_category';
31
+ const CACHE_TAG = 'sumankcdotcom_faq_category';
32
+
33
+ /**
34
+ * Prefix of model events names
35
+ *
36
+ * @var string
37
+ */
38
+ protected $_eventPrefix = 'sumankcdotcom_faq_category';
39
+
40
+ /**
41
+ * Parameter name in event
42
+ *
43
+ * @var string
44
+ */
45
+ protected $_eventObject = 'category';
46
+
47
+ /**
48
+ * constructor
49
+ *
50
+ * @access public
51
+ * @return void
52
+ * @author Suman K.C [WWW.SUMANKC.COM]
53
+ */
54
+ public function _construct()
55
+ {
56
+ parent::_construct();
57
+ $this->_init('sumankcdotcom_faq/category');
58
+ }
59
+
60
+ /**
61
+ * before save category
62
+ *
63
+ * @access protected
64
+ * @return Sumankcdotcom_Faq_Model_Category
65
+ * @author Suman K.C [WWW.SUMANKC.COM]
66
+ */
67
+ protected function _beforeSave()
68
+ {
69
+ parent::_beforeSave();
70
+ $now = Mage::getSingleton('core/date')->gmtDate();
71
+ if ($this->isObjectNew()) {
72
+ $this->setCreatedAt($now);
73
+ }
74
+ $this->setUpdatedAt($now);
75
+ return $this;
76
+ }
77
+
78
+ /**
79
+ * get the url to the category details page
80
+ *
81
+ * @access public
82
+ * @return string
83
+ * @author Suman K.C [WWW.SUMANKC.COM]
84
+ */
85
+ public function getCategoryUrl()
86
+ {
87
+ if ($this->getUrlKey()) {
88
+ $urlKey = '';
89
+ if ($prefix = Mage::getStoreConfig('sumankcdotcom_faq/category/url_prefix')) {
90
+ $urlKey .= $prefix.'/';
91
+ }
92
+ $urlKey .= $this->getUrlKey();
93
+ if ($suffix = Mage::getStoreConfig('sumankcdotcom_faq/category/url_suffix')) {
94
+ $urlKey .= '.'.$suffix;
95
+ }
96
+ return Mage::getUrl('', array('_direct'=>$urlKey));
97
+ }
98
+ return Mage::getUrl('sumankcdotcom_faq/category/view', array('id'=>$this->getId()));
99
+ }
100
+
101
+ /**
102
+ * check URL key
103
+ *
104
+ * @access public
105
+ * @param string $urlKey
106
+ * @param bool $active
107
+ * @return mixed
108
+ * @author Suman K.C [WWW.SUMANKC.COM]
109
+ */
110
+ public function checkUrlKey($urlKey, $active = true)
111
+ {
112
+ return $this->_getResource()->checkUrlKey($urlKey, $active);
113
+ }
114
+
115
+ /**
116
+ * save category relation
117
+ *
118
+ * @access public
119
+ * @return Sumankcdotcom_Faq_Model_Category
120
+ * @author Suman K.C [WWW.SUMANKC.COM]
121
+ */
122
+ protected function _afterSave()
123
+ {
124
+ return parent::_afterSave();
125
+ }
126
+
127
+ /**
128
+ * Retrieve collection
129
+ *
130
+ * @access public
131
+ * @return Sumankcdotcom_Faq_Model_Faq_Collection
132
+ * @author Suman K.C [WWW.SUMANKC.COM]
133
+ */
134
+ public function getSelectedFaqsCollection()
135
+ {
136
+ if (!$this->hasData('_faq_collection')) {
137
+ if (!$this->getId()) {
138
+ return new Varien_Data_Collection();
139
+ } else {
140
+ $collection = Mage::getResourceModel('sumankcdotcom_faq/faq_collection')
141
+ ->addFieldToFilter('category_id', $this->getId());
142
+ $this->setData('_faq_collection', $collection);
143
+ }
144
+ }
145
+ return $this->getData('_faq_collection');
146
+ }
147
+
148
+ /**
149
+ * get default values
150
+ *
151
+ * @access public
152
+ * @return array
153
+ * @author Suman K.C [WWW.SUMANKC.COM]
154
+ */
155
+ public function getDefaultValues()
156
+ {
157
+ $values = array();
158
+ $values['status'] = 1;
159
+ return $values;
160
+ }
161
+
162
+ }
app/code/community/Sumankcdotcom/Faq/Model/Category/Source.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Category source model
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_Model_Category_Source extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
25
+ {
26
+ /**
27
+ * Get all options
28
+ *
29
+ * @access public
30
+ * @param bool $withEmpty
31
+ * @return array
32
+ * @author Suman K.C [WWW.SUMANKC.COM]
33
+ */
34
+ public function getAllOptions($withEmpty = false)
35
+ {
36
+ if (is_null($this->_options)) {
37
+ $this->_options = Mage::getResourceModel('sumankcdotcom_faq/category_collection')
38
+
39
+ ->load()
40
+ ->toOptionArray();
41
+ }
42
+ $options = $this->_options;
43
+ if ($withEmpty) {
44
+ array_unshift($options, array('value'=>'', 'label'=>''));
45
+ }
46
+ return $options;
47
+ }
48
+
49
+ /**
50
+ * Get a text for option value
51
+ *
52
+ * @access public
53
+ * @param string|integer $value
54
+ * @return string
55
+ * @author Suman K.C [WWW.SUMANKC.COM]
56
+ */
57
+ public function getOptionText($value)
58
+ {
59
+ $options = $this->getAllOptions(false);
60
+ foreach ($options as $item) {
61
+ if ($item['value'] == $value) {
62
+ return $item['label'];
63
+ }
64
+ }
65
+ return false;
66
+ }
67
+
68
+ /**
69
+ * Convert to options array
70
+ *
71
+ * @access public
72
+ * @return array
73
+ * @author Suman K.C [WWW.SUMANKC.COM]
74
+ */
75
+ public function toOptionArray()
76
+ {
77
+ return $this->getAllOptions();
78
+ }
79
+
80
+ /**
81
+ * Retrieve flat column definition
82
+ *
83
+ * @access public
84
+ * @return array
85
+ * @author Suman K.C [WWW.SUMANKC.COM]
86
+ */
87
+ public function getFlatColums()
88
+ {
89
+ $attributeCode = $this->getAttribute()->getAttributeCode();
90
+ $column = array(
91
+ 'unsigned' => true,
92
+ 'default' => null,
93
+ 'extra' => null
94
+ );
95
+ if (Mage::helper('core')->useDbCompatibleMode()) {
96
+ $column['type'] = 'int';
97
+ $column['is_null'] = true;
98
+ } else {
99
+ $column['type'] = Varien_Db_Ddl_Table::TYPE_INTEGER;
100
+ $column['nullable'] = true;
101
+ $column['comment'] = $attributeCode . ' Category column';
102
+ }
103
+ return array($attributeCode => $column);
104
+ }
105
+
106
+ /**
107
+ * Retrieve Select for update attribute value in flat table
108
+ *
109
+ * @access public
110
+ * @param int $store
111
+ * @return Varien_Db_Select|null
112
+ * @author Suman K.C [WWW.SUMANKC.COM]
113
+ */
114
+ public function getFlatUpdateSelect($store)
115
+ {
116
+ return Mage::getResourceModel('eav/entity_attribute_option')
117
+ ->getFlatUpdateSelect($this->getAttribute(), $store, false);
118
+ }
119
+ }
app/code/community/Sumankcdotcom/Faq/Model/Faq.php ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Faq model
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Ultimate Module Creator
23
+ */
24
+ class Sumankcdotcom_Faq_Model_Faq extends Mage_Core_Model_Abstract
25
+ {
26
+ /**
27
+ * Entity code.
28
+ * Can be used as part of method name for entity processing
29
+ */
30
+ const ENTITY = 'sumankcdotcom_faq_faq';
31
+ const CACHE_TAG = 'sumankcdotcom_faq_faq';
32
+
33
+ /**
34
+ * Prefix of model events names
35
+ *
36
+ * @var string
37
+ */
38
+ protected $_eventPrefix = 'sumankcdotcom_faq_faq';
39
+
40
+ /**
41
+ * Parameter name in event
42
+ *
43
+ * @var string
44
+ */
45
+ protected $_eventObject = 'faq';
46
+
47
+ /**
48
+ * constructor
49
+ *
50
+ * @access public
51
+ * @return void
52
+ * @author Suman K.C [WWW.SUMANKC.COM]
53
+ */
54
+ public function _construct()
55
+ {
56
+ parent::_construct();
57
+ $this->_init('sumankcdotcom_faq/faq');
58
+ }
59
+
60
+ /**
61
+ * before save faq
62
+ *
63
+ * @access protected
64
+ * @return Sumankcdotcom_Faq_Model_Faq
65
+ * @author Suman K.C [WWW.SUMANKC.COM]
66
+ */
67
+ protected function _beforeSave()
68
+ {
69
+ parent::_beforeSave();
70
+ $now = Mage::getSingleton('core/date')->gmtDate();
71
+ if ($this->isObjectNew()) {
72
+ $this->setCreatedAt($now);
73
+ }
74
+ $this->setUpdatedAt($now);
75
+ return $this;
76
+ }
77
+
78
+ /**
79
+ * get the url to the faq details page
80
+ *
81
+ * @access public
82
+ * @return string
83
+ * @author Suman K.C [WWW.SUMANKC.COM]
84
+ */
85
+ public function getFaqUrl()
86
+ {
87
+ if ($this->getUrlKey()) {
88
+ $urlKey = '';
89
+ if ($prefix = Mage::getStoreConfig('sumankcdotcom_faq/faq/url_prefix')) {
90
+ $urlKey .= $prefix.'/';
91
+ }
92
+ $urlKey .= $this->getUrlKey();
93
+ if ($suffix = Mage::getStoreConfig('sumankcdotcom_faq/faq/url_suffix')) {
94
+ $urlKey .= '.'.$suffix;
95
+ }
96
+ return Mage::getUrl('', array('_direct'=>$urlKey));
97
+ }
98
+ return Mage::getUrl('sumankcdotcom_faq/faq/view', array('id'=>$this->getId()));
99
+ }
100
+
101
+ /**
102
+ * check URL key
103
+ *
104
+ * @access public
105
+ * @param string $urlKey
106
+ * @param bool $active
107
+ * @return mixed
108
+ * @author Suman K.C [WWW.SUMANKC.COM]
109
+ */
110
+ public function checkUrlKey($urlKey, $active = true)
111
+ {
112
+ return $this->_getResource()->checkUrlKey($urlKey, $active);
113
+ }
114
+
115
+ /**
116
+ * get the faq Answer
117
+ *
118
+ * @access public
119
+ * @return string
120
+ * @author Suman K.C [WWW.SUMANKC.COM]
121
+ */
122
+ public function getAnswer()
123
+ {
124
+ $answer = $this->getData('answer');
125
+ $helper = Mage::helper('cms');
126
+ $processor = $helper->getBlockTemplateProcessor();
127
+ $html = $processor->filter($answer);
128
+ return $html;
129
+ }
130
+
131
+ /**
132
+ * save faq relation
133
+ *
134
+ * @access public
135
+ * @return Sumankcdotcom_Faq_Model_Faq
136
+ * @author Suman K.C [WWW.SUMANKC.COM]
137
+ */
138
+ protected function _afterSave()
139
+ {
140
+ return parent::_afterSave();
141
+ }
142
+
143
+ /**
144
+ * Retrieve parent
145
+ *
146
+ * @access public
147
+ * @return null|Sumankcdotcom_Faq_Model_Category
148
+ * @author Suman K.C [WWW.SUMANKC.COM]
149
+ */
150
+ public function getParentCategory()
151
+ {
152
+ if (!$this->hasData('_parent_category')) {
153
+ if (!$this->getCategoryId()) {
154
+ return null;
155
+ } else {
156
+ $category = Mage::getModel('sumankcdotcom_faq/category')
157
+ ->load($this->getCategoryId());
158
+ if ($category->getId()) {
159
+ $this->setData('_parent_category', $category);
160
+ } else {
161
+ $this->setData('_parent_category', null);
162
+ }
163
+ }
164
+ }
165
+ return $this->getData('_parent_category');
166
+ }
167
+
168
+ /**
169
+ * get default values
170
+ *
171
+ * @access public
172
+ * @return array
173
+ * @author Suman K.C [WWW.SUMANKC.COM]
174
+ */
175
+ public function getDefaultValues()
176
+ {
177
+ $values = array();
178
+ $values['status'] = 1;
179
+ return $values;
180
+ }
181
+
182
+ }
app/code/community/Sumankcdotcom/Faq/Model/Resource/Category.php ADDED
@@ -0,0 +1,283 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Category resource model
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_Model_Resource_Category extends Mage_Core_Model_Resource_Db_Abstract
25
+ {
26
+
27
+ /**
28
+ * constructor
29
+ *
30
+ * @access public
31
+ * @author Suman K.C [WWW.SUMANKC.COM]
32
+ */
33
+ public function _construct()
34
+ {
35
+ $this->_init('sumankcdotcom_faq/category', 'entity_id');
36
+ }
37
+
38
+ /**
39
+ * Get store ids to which specified item is assigned
40
+ *
41
+ * @access public
42
+ * @param int $categoryId
43
+ * @return array
44
+ * @author Suman K.C [WWW.SUMANKC.COM]
45
+ */
46
+ public function lookupStoreIds($categoryId)
47
+ {
48
+ $adapter = $this->_getReadAdapter();
49
+ $select = $adapter->select()
50
+ ->from($this->getTable('sumankcdotcom_faq/category_store'), 'store_id')
51
+ ->where('category_id = ?', (int)$categoryId);
52
+ return $adapter->fetchCol($select);
53
+ }
54
+
55
+ /**
56
+ * Perform operations after object load
57
+ *
58
+ * @access public
59
+ * @param Mage_Core_Model_Abstract $object
60
+ * @return Sumankcdotcom_Faq_Model_Resource_Category
61
+ * @author Suman K.C [WWW.SUMANKC.COM]
62
+ */
63
+ protected function _afterLoad(Mage_Core_Model_Abstract $object)
64
+ {
65
+ if ($object->getId()) {
66
+ $stores = $this->lookupStoreIds($object->getId());
67
+ $object->setData('store_id', $stores);
68
+ }
69
+ return parent::_afterLoad($object);
70
+ }
71
+
72
+ /**
73
+ * Retrieve select object for load object data
74
+ *
75
+ * @param string $field
76
+ * @param mixed $value
77
+ * @param Sumankcdotcom_Faq_Model_Category $object
78
+ * @return Zend_Db_Select
79
+ */
80
+ protected function _getLoadSelect($field, $value, $object)
81
+ {
82
+ $select = parent::_getLoadSelect($field, $value, $object);
83
+ if ($object->getStoreId()) {
84
+ $storeIds = array(Mage_Core_Model_App::ADMIN_STORE_ID, (int)$object->getStoreId());
85
+ $select->join(
86
+ array('faq_category_store' => $this->getTable('sumankcdotcom_faq/category_store')),
87
+ $this->getMainTable() . '.entity_id = faq_category_store.category_id',
88
+ array()
89
+ )
90
+ ->where('faq_category_store.store_id IN (?)', $storeIds)
91
+ ->order('faq_category_store.store_id DESC')
92
+ ->limit(1);
93
+ }
94
+ return $select;
95
+ }
96
+
97
+ /**
98
+ * Assign category to store views
99
+ *
100
+ * @access protected
101
+ * @param Mage_Core_Model_Abstract $object
102
+ * @return Sumankcdotcom_Faq_Model_Resource_Category
103
+ * @author Suman K.C [WWW.SUMANKC.COM]
104
+ */
105
+ protected function _afterSave(Mage_Core_Model_Abstract $object)
106
+ {
107
+ $oldStores = $this->lookupStoreIds($object->getId());
108
+ $newStores = (array)$object->getStores();
109
+ if (empty($newStores)) {
110
+ $newStores = (array)$object->getStoreId();
111
+ }
112
+ $table = $this->getTable('sumankcdotcom_faq/category_store');
113
+ $insert = array_diff($newStores, $oldStores);
114
+ $delete = array_diff($oldStores, $newStores);
115
+ if ($delete) {
116
+ $where = array(
117
+ 'category_id = ?' => (int) $object->getId(),
118
+ 'store_id IN (?)' => $delete
119
+ );
120
+ $this->_getWriteAdapter()->delete($table, $where);
121
+ }
122
+ if ($insert) {
123
+ $data = array();
124
+ foreach ($insert as $storeId) {
125
+ $data[] = array(
126
+ 'category_id' => (int) $object->getId(),
127
+ 'store_id' => (int) $storeId
128
+ );
129
+ }
130
+ $this->_getWriteAdapter()->insertMultiple($table, $data);
131
+ }
132
+ return parent::_afterSave($object);
133
+ }
134
+
135
+ /**
136
+ * check url key
137
+ *
138
+ * @access public
139
+ * @param string $urlKey
140
+ * @param int $storeId
141
+ * @param bool $active
142
+ * @return mixed
143
+ * @author Suman K.C [WWW.SUMANKC.COM]
144
+ */
145
+ public function checkUrlKey($urlKey, $storeId, $active = true)
146
+ {
147
+ $stores = array(Mage_Core_Model_App::ADMIN_STORE_ID, $storeId);
148
+ $select = $this->_initCheckUrlKeySelect($urlKey, $stores);
149
+ if ($active) {
150
+ $select->where('e.status = ?', $active);
151
+ }
152
+ $select->reset(Zend_Db_Select::COLUMNS)
153
+ ->columns('e.entity_id')
154
+ ->limit(1);
155
+
156
+ return $this->_getReadAdapter()->fetchOne($select);
157
+ }
158
+
159
+ /**
160
+ * Check for unique URL key
161
+ *
162
+ * @access public
163
+ * @param Mage_Core_Model_Abstract $object
164
+ * @return bool
165
+ * @author Suman K.C [WWW.SUMANKC.COM]
166
+ */
167
+ public function getIsUniqueUrlKey(Mage_Core_Model_Abstract $object)
168
+ {
169
+ if (Mage::app()->isSingleStoreMode() || !$object->hasStores()) {
170
+ $stores = array(Mage_Core_Model_App::ADMIN_STORE_ID);
171
+ } else {
172
+ $stores = (array)$object->getData('stores');
173
+ }
174
+ $select = $this->_initCheckUrlKeySelect($object->getData('url_key'), $stores);
175
+ if ($object->getId()) {
176
+ $select->where('e.entity_id <> ?', $object->getId());
177
+ }
178
+ if ($this->_getWriteAdapter()->fetchRow($select)) {
179
+ return false;
180
+ }
181
+ return true;
182
+ }
183
+
184
+ /**
185
+ * Check if the URL key is numeric
186
+ *
187
+ * @access public
188
+ * @param Mage_Core_Model_Abstract $object
189
+ * @return bool
190
+ * @author Suman K.C [WWW.SUMANKC.COM]
191
+ */
192
+ protected function isNumericUrlKey(Mage_Core_Model_Abstract $object)
193
+ {
194
+ return preg_match('/^[0-9]+$/', $object->getData('url_key'));
195
+ }
196
+
197
+ /**
198
+ * Check if the URL key is valid
199
+ *
200
+ * @access public
201
+ * @param Mage_Core_Model_Abstract $object
202
+ * @return bool
203
+ * @author Suman K.C [WWW.SUMANKC.COM]
204
+ */
205
+ protected function isValidUrlKey(Mage_Core_Model_Abstract $object)
206
+ {
207
+ return preg_match('/^[a-z0-9][a-z0-9_\/-]+(\.[a-z0-9_-]+)?$/', $object->getData('url_key'));
208
+ }
209
+
210
+ /**
211
+ * format string as url key
212
+ *
213
+ * @access public
214
+ * @param string $str
215
+ * @return string
216
+ * @author Suman K.C [WWW.SUMANKC.COM]
217
+ */
218
+ public function formatUrlKey($str)
219
+ {
220
+ $urlKey = preg_replace('#[^0-9a-z]+#i', '-', Mage::helper('catalog/product_url')->format($str));
221
+ $urlKey = strtolower($urlKey);
222
+ $urlKey = trim($urlKey, '-');
223
+ return $urlKey;
224
+ }
225
+
226
+ /**
227
+ * init the check select
228
+ *
229
+ * @access protected
230
+ * @param string $urlKey
231
+ * @param array $store
232
+ * @return Zend_Db_Select
233
+ * @author Suman K.C [WWW.SUMANKC.COM]
234
+ */
235
+ protected function _initCheckUrlKeySelect($urlKey, $store)
236
+ {
237
+ $select = $this->_getReadAdapter()->select()
238
+ ->from(array('e' => $this->getMainTable()))
239
+ ->join(
240
+ array('es' => $this->getTable('sumankcdotcom_faq/category_store')),
241
+ 'e.entity_id = es.category_id',
242
+ array())
243
+ ->where('e.url_key = ?', $urlKey)
244
+ ->where('es.store_id IN (?)', $store);
245
+ return $select;
246
+ }
247
+
248
+ /**
249
+ * validate before saving
250
+ *
251
+ * @access protected
252
+ * @param $object
253
+ * @return Sumankcdotcom_Faq_Model_Resource_Category
254
+ * @author Suman K.C [WWW.SUMANKC.COM]
255
+ */
256
+ protected function _beforeSave(Mage_Core_Model_Abstract $object)
257
+ {
258
+ $urlKey = $object->getData('url_key');
259
+ if ($urlKey == '') {
260
+ $urlKey = $object->getCategories();
261
+ }
262
+ $urlKey = $this->formatUrlKey($urlKey);
263
+ $validKey = false;
264
+ while (!$validKey) {
265
+ $entityId = $this->checkUrlKey($urlKey, $object->getStoreId(), false);
266
+ if ($entityId == $object->getId() || empty($entityId)) {
267
+ $validKey = true;
268
+ } else {
269
+ $parts = explode('-', $urlKey);
270
+ $last = $parts[count($parts) - 1];
271
+ if (!is_numeric($last)) {
272
+ $urlKey = $urlKey.'-1';
273
+ } else {
274
+ $suffix = '-'.($last + 1);
275
+ unset($parts[count($parts) - 1]);
276
+ $urlKey = implode('-', $parts).$suffix;
277
+ }
278
+ }
279
+ }
280
+ $object->setData('url_key', $urlKey);
281
+ return parent::_beforeSave($object);
282
+ }
283
+ }
app/code/community/Sumankcdotcom/Faq/Model/Resource/Category/Collection.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Category collection resource model
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_Model_Resource_Category_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
25
+ {
26
+ protected $_joinedFields = array();
27
+
28
+ /**
29
+ * constructor
30
+ *
31
+ * @access public
32
+ * @return void
33
+ * @author Suman K.C [WWW.SUMANKC.COM]
34
+ */
35
+ protected function _construct()
36
+ {
37
+ parent::_construct();
38
+ $this->_init('sumankcdotcom_faq/category');
39
+ $this->_map['fields']['store'] = 'store_table.store_id';
40
+ }
41
+
42
+ /**
43
+ * Add filter by store
44
+ *
45
+ * @access public
46
+ * @param int|Mage_Core_Model_Store $store
47
+ * @param bool $withAdmin
48
+ * @return Sumankcdotcom_Faq_Model_Resource_Category_Collection
49
+ * @author Suman K.C [WWW.SUMANKC.COM]
50
+ */
51
+ public function addStoreFilter($store, $withAdmin = true)
52
+ {
53
+ if (!isset($this->_joinedFields['store'])) {
54
+ if ($store instanceof Mage_Core_Model_Store) {
55
+ $store = array($store->getId());
56
+ }
57
+ if (!is_array($store)) {
58
+ $store = array($store);
59
+ }
60
+ if ($withAdmin) {
61
+ $store[] = Mage_Core_Model_App::ADMIN_STORE_ID;
62
+ }
63
+ $this->addFilter('store', array('in' => $store), 'public');
64
+ $this->_joinedFields['store'] = true;
65
+ }
66
+ return $this;
67
+ }
68
+
69
+ /**
70
+ * Join store relation table if there is store filter
71
+ *
72
+ * @access protected
73
+ * @return Sumankcdotcom_Faq_Model_Resource_Category_Collection
74
+ * @author Suman K.C [WWW.SUMANKC.COM]
75
+ */
76
+ protected function _renderFiltersBefore()
77
+ {
78
+ if ($this->getFilter('store')) {
79
+ $this->getSelect()->join(
80
+ array('store_table' => $this->getTable('sumankcdotcom_faq/category_store')),
81
+ 'main_table.entity_id = store_table.category_id',
82
+ array()
83
+ )
84
+ ->group('main_table.entity_id');
85
+ /*
86
+ * Allow analytic functions usage because of one field grouping
87
+ */
88
+ $this->_useAnalyticFunction = true;
89
+ }
90
+ return parent::_renderFiltersBefore();
91
+ }
92
+
93
+ /**
94
+ * get categories as array
95
+ *
96
+ * @access protected
97
+ * @param string $valueField
98
+ * @param string $labelField
99
+ * @param array $additional
100
+ * @return array
101
+ * @author Suman K.C [WWW.SUMANKC.COM]
102
+ */
103
+ protected function _toOptionArray($valueField='entity_id', $labelField='categories', $additional=array())
104
+ {
105
+ return parent::_toOptionArray($valueField, $labelField, $additional);
106
+ }
107
+
108
+ /**
109
+ * get options hash
110
+ *
111
+ * @access protected
112
+ * @param string $valueField
113
+ * @param string $labelField
114
+ * @return array
115
+ * @author Suman K.C [WWW.SUMANKC.COM]
116
+ */
117
+ protected function _toOptionHash($valueField='entity_id', $labelField='categories')
118
+ {
119
+ return parent::_toOptionHash($valueField, $labelField);
120
+ }
121
+
122
+ /**
123
+ * Get SQL for get record count.
124
+ * Extra GROUP BY strip added.
125
+ *
126
+ * @access public
127
+ * @return Varien_Db_Select
128
+ * @author Suman K.C [WWW.SUMANKC.COM]
129
+ */
130
+ public function getSelectCountSql()
131
+ {
132
+ $countSelect = parent::getSelectCountSql();
133
+ $countSelect->reset(Zend_Db_Select::GROUP);
134
+ return $countSelect;
135
+ }
136
+ }
app/code/community/Sumankcdotcom/Faq/Model/Resource/Faq.php ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Faq resource model
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_Model_Resource_Faq extends Mage_Core_Model_Resource_Db_Abstract
25
+ {
26
+
27
+ /**
28
+ * constructor
29
+ *
30
+ * @access public
31
+ * @author Suman K.C [WWW.SUMANKC.COM]
32
+ */
33
+ public function _construct()
34
+ {
35
+ $this->_init('sumankcdotcom_faq/faq', 'entity_id');
36
+ }
37
+
38
+ /**
39
+ * check url key
40
+ *
41
+ * @access public
42
+ * @param string $urlKey
43
+ * @param int $storeId
44
+ * @param bool $active
45
+ * @return mixed
46
+ * @author Suman K.C [WWW.SUMANKC.COM]
47
+ */
48
+ public function checkUrlKey($urlKey, $storeId, $active = true)
49
+ {
50
+ $stores = array(Mage_Core_Model_App::ADMIN_STORE_ID, $storeId);
51
+ $select = $this->_initCheckUrlKeySelect($urlKey, $stores);
52
+ if ($active) {
53
+ $select->where('e.status = ?', $active);
54
+ }
55
+ $select->reset(Zend_Db_Select::COLUMNS)
56
+ ->columns('e.entity_id')
57
+ ->limit(1);
58
+
59
+ return $this->_getReadAdapter()->fetchOne($select);
60
+ }
61
+
62
+ /**
63
+ * Check for unique URL key
64
+ *
65
+ * @access public
66
+ * @param Mage_Core_Model_Abstract $object
67
+ * @return bool
68
+ * @author Suman K.C [WWW.SUMANKC.COM]
69
+ */
70
+ public function getIsUniqueUrlKey(Mage_Core_Model_Abstract $object)
71
+ {
72
+ if (Mage::app()->isSingleStoreMode() || !$object->hasStores()) {
73
+ $stores = array(Mage_Core_Model_App::ADMIN_STORE_ID);
74
+ } else {
75
+ $stores = (array)$object->getData('stores');
76
+ }
77
+ $select = $this->_initCheckUrlKeySelect($object->getData('url_key'), $stores);
78
+ if ($object->getId()) {
79
+ $select->where('e.entity_id <> ?', $object->getId());
80
+ }
81
+ if ($this->_getWriteAdapter()->fetchRow($select)) {
82
+ return false;
83
+ }
84
+ return true;
85
+ }
86
+
87
+ /**
88
+ * Check if the URL key is numeric
89
+ *
90
+ * @access public
91
+ * @param Mage_Core_Model_Abstract $object
92
+ * @return bool
93
+ * @author Suman K.C [WWW.SUMANKC.COM]
94
+ */
95
+ protected function isNumericUrlKey(Mage_Core_Model_Abstract $object)
96
+ {
97
+ return preg_match('/^[0-9]+$/', $object->getData('url_key'));
98
+ }
99
+
100
+ /**
101
+ * Check if the URL key is valid
102
+ *
103
+ * @access public
104
+ * @param Mage_Core_Model_Abstract $object
105
+ * @return bool
106
+ * @author Suman K.C [WWW.SUMANKC.COM]
107
+ */
108
+ protected function isValidUrlKey(Mage_Core_Model_Abstract $object)
109
+ {
110
+ return preg_match('/^[a-z0-9][a-z0-9_\/-]+(\.[a-z0-9_-]+)?$/', $object->getData('url_key'));
111
+ }
112
+
113
+ /**
114
+ * format string as url key
115
+ *
116
+ * @access public
117
+ * @param string $str
118
+ * @return string
119
+ * @author Suman K.C [WWW.SUMANKC.COM]
120
+ */
121
+ public function formatUrlKey($str)
122
+ {
123
+ $urlKey = preg_replace('#[^0-9a-z]+#i', '-', Mage::helper('catalog/product_url')->format($str));
124
+ $urlKey = strtolower($urlKey);
125
+ $urlKey = trim($urlKey, '-');
126
+ return $urlKey;
127
+ }
128
+
129
+ /**
130
+ * init the check select
131
+ *
132
+ * @access protected
133
+ * @param string $urlKey
134
+ * @param array $store
135
+ * @return Zend_Db_Select
136
+ * @author Suman K.C [WWW.SUMANKC.COM]
137
+ */
138
+ protected function _initCheckUrlKeySelect($urlKey, $store)
139
+ {
140
+ $select = $this->_getReadAdapter()->select()
141
+ ->from(array('e' => $this->getMainTable()))
142
+ ->where('e.url_key = ?', $urlKey);
143
+ return $select;
144
+ }
145
+
146
+ /**
147
+ * validate before saving
148
+ *
149
+ * @access protected
150
+ * @param $object
151
+ * @return Sumankcdotcom_Faq_Model_Resource_Faq
152
+ * @author Suman K.C [WWW.SUMANKC.COM]
153
+ */
154
+ protected function _beforeSave(Mage_Core_Model_Abstract $object)
155
+ {
156
+ $urlKey = $object->getData('url_key');
157
+ if ($urlKey == '') {
158
+ $urlKey = $object->getQuestion();
159
+ }
160
+ $urlKey = $this->formatUrlKey($urlKey);
161
+ $validKey = false;
162
+ while (!$validKey) {
163
+ $entityId = $this->checkUrlKey($urlKey, $object->getStoreId(), false);
164
+ if ($entityId == $object->getId() || empty($entityId)) {
165
+ $validKey = true;
166
+ } else {
167
+ $parts = explode('-', $urlKey);
168
+ $last = $parts[count($parts) - 1];
169
+ if (!is_numeric($last)) {
170
+ $urlKey = $urlKey.'-1';
171
+ } else {
172
+ $suffix = '-'.($last + 1);
173
+ unset($parts[count($parts) - 1]);
174
+ $urlKey = implode('-', $parts).$suffix;
175
+ }
176
+ }
177
+ }
178
+ $object->setData('url_key', $urlKey);
179
+ return parent::_beforeSave($object);
180
+ }
181
+ }
app/code/community/Sumankcdotcom/Faq/Model/Resource/Faq/Collection.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Faq collection resource model
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_Model_Resource_Faq_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
25
+ {
26
+ protected $_joinedFields = array();
27
+
28
+ /**
29
+ * constructor
30
+ *
31
+ * @access public
32
+ * @return void
33
+ * @author Suman K.C [WWW.SUMANKC.COM]
34
+ */
35
+ protected function _construct()
36
+ {
37
+ parent::_construct();
38
+ $this->_init('sumankcdotcom_faq/faq');
39
+ }
40
+
41
+ /**
42
+ * get faqs as array
43
+ *
44
+ * @access protected
45
+ * @param string $valueField
46
+ * @param string $labelField
47
+ * @param array $additional
48
+ * @return array
49
+ * @author Suman K.C [WWW.SUMANKC.COM]
50
+ */
51
+ protected function _toOptionArray($valueField='entity_id', $labelField='question', $additional=array())
52
+ {
53
+ return parent::_toOptionArray($valueField, $labelField, $additional);
54
+ }
55
+
56
+ /**
57
+ * get options hash
58
+ *
59
+ * @access protected
60
+ * @param string $valueField
61
+ * @param string $labelField
62
+ * @return array
63
+ * @author Suman K.C [WWW.SUMANKC.COM]
64
+ */
65
+ protected function _toOptionHash($valueField='entity_id', $labelField='question')
66
+ {
67
+ return parent::_toOptionHash($valueField, $labelField);
68
+ }
69
+
70
+ /**
71
+ * Get SQL for get record count.
72
+ * Extra GROUP BY strip added.
73
+ *
74
+ * @access public
75
+ * @return Varien_Db_Select
76
+ * @author Suman K.C [WWW.SUMANKC.COM]
77
+ */
78
+ public function getSelectCountSql()
79
+ {
80
+ $countSelect = parent::getSelectCountSql();
81
+ $countSelect->reset(Zend_Db_Select::GROUP);
82
+ return $countSelect;
83
+ }
84
+ }
app/code/community/Sumankcdotcom/Faq/Model/Resource/Setup.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Faq setup
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
25
+ {
26
+ }
app/code/community/Sumankcdotcom/Faq/controllers/Adminhtml/Faq/CategoryController.php ADDED
@@ -0,0 +1,328 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Category admin controller
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_Adminhtml_Faq_CategoryController extends Sumankcdotcom_Faq_Controller_Adminhtml_Faq
25
+ {
26
+ /**
27
+ * init the category
28
+ *
29
+ * @access protected
30
+ * @return Sumankcdotcom_Faq_Model_Category
31
+ */
32
+ protected function _initCategory()
33
+ {
34
+ $categoryId = (int) $this->getRequest()->getParam('id');
35
+ $category = Mage::getModel('sumankcdotcom_faq/category');
36
+ if ($categoryId) {
37
+ $category->load($categoryId);
38
+ }
39
+ Mage::register('current_category', $category);
40
+ return $category;
41
+ }
42
+
43
+ /**
44
+ * default action
45
+ *
46
+ * @access public
47
+ * @return void
48
+ * @author Suman K.C [WWW.SUMANKC.COM]
49
+ */
50
+ public function indexAction()
51
+ {
52
+ $this->loadLayout();
53
+ $this->_title(Mage::helper('sumankcdotcom_faq')->__('FAQ'))
54
+ ->_title(Mage::helper('sumankcdotcom_faq')->__('Categories'));
55
+ $this->renderLayout();
56
+ }
57
+
58
+ /**
59
+ * grid action
60
+ *
61
+ * @access public
62
+ * @return void
63
+ * @author Suman K.C [WWW.SUMANKC.COM]
64
+ */
65
+ public function gridAction()
66
+ {
67
+ $this->loadLayout()->renderLayout();
68
+ }
69
+
70
+ /**
71
+ * edit category - action
72
+ *
73
+ * @access public
74
+ * @return void
75
+ * @author Suman K.C [WWW.SUMANKC.COM]
76
+ */
77
+ public function editAction()
78
+ {
79
+ $categoryId = $this->getRequest()->getParam('id');
80
+ $category = $this->_initCategory();
81
+ if ($categoryId && !$category->getId()) {
82
+ $this->_getSession()->addError(
83
+ Mage::helper('sumankcdotcom_faq')->__('This category no longer exists.')
84
+ );
85
+ $this->_redirect('*/*/');
86
+ return;
87
+ }
88
+ $data = Mage::getSingleton('adminhtml/session')->getCategoryData(true);
89
+ if (!empty($data)) {
90
+ $category->setData($data);
91
+ }
92
+ Mage::register('category_data', $category);
93
+ $this->loadLayout();
94
+ $this->_title(Mage::helper('sumankcdotcom_faq')->__('FAQ'))
95
+ ->_title(Mage::helper('sumankcdotcom_faq')->__('Categories'));
96
+ if ($category->getId()) {
97
+ $this->_title($category->getCategories());
98
+ } else {
99
+ $this->_title(Mage::helper('sumankcdotcom_faq')->__('Add category'));
100
+ }
101
+ if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
102
+ $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
103
+ }
104
+ $this->renderLayout();
105
+ }
106
+
107
+ /**
108
+ * new category action
109
+ *
110
+ * @access public
111
+ * @return void
112
+ * @author Suman K.C [WWW.SUMANKC.COM]
113
+ */
114
+ public function newAction()
115
+ {
116
+ $this->_forward('edit');
117
+ }
118
+
119
+ /**
120
+ * save category - action
121
+ *
122
+ * @access public
123
+ * @return void
124
+ * @author Suman K.C [WWW.SUMANKC.COM]
125
+ */
126
+ public function saveAction()
127
+ {
128
+ if ($data = $this->getRequest()->getPost('category')) {
129
+ try {
130
+ $category = $this->_initCategory();
131
+ $category->addData($data);
132
+ $category->save();
133
+ Mage::getSingleton('adminhtml/session')->addSuccess(
134
+ Mage::helper('sumankcdotcom_faq')->__('Category was successfully saved')
135
+ );
136
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
137
+ if ($this->getRequest()->getParam('back')) {
138
+ $this->_redirect('*/*/edit', array('id' => $category->getId()));
139
+ return;
140
+ }
141
+ $this->_redirect('*/*/');
142
+ return;
143
+ } catch (Mage_Core_Exception $e) {
144
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
145
+ Mage::getSingleton('adminhtml/session')->setCategoryData($data);
146
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
147
+ return;
148
+ } catch (Exception $e) {
149
+ Mage::logException($e);
150
+ Mage::getSingleton('adminhtml/session')->addError(
151
+ Mage::helper('sumankcdotcom_faq')->__('There was a problem saving the category.')
152
+ );
153
+ Mage::getSingleton('adminhtml/session')->setCategoryData($data);
154
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
155
+ return;
156
+ }
157
+ }
158
+ Mage::getSingleton('adminhtml/session')->addError(
159
+ Mage::helper('sumankcdotcom_faq')->__('Unable to find category to save.')
160
+ );
161
+ $this->_redirect('*/*/');
162
+ }
163
+
164
+ /**
165
+ * delete category - action
166
+ *
167
+ * @access public
168
+ * @return void
169
+ * @author Suman K.C [WWW.SUMANKC.COM]
170
+ */
171
+ public function deleteAction()
172
+ {
173
+ if ( $this->getRequest()->getParam('id') > 0) {
174
+ try {
175
+ $category = Mage::getModel('sumankcdotcom_faq/category');
176
+ $category->setId($this->getRequest()->getParam('id'))->delete();
177
+ Mage::getSingleton('adminhtml/session')->addSuccess(
178
+ Mage::helper('sumankcdotcom_faq')->__('Category was successfully deleted.')
179
+ );
180
+ $this->_redirect('*/*/');
181
+ return;
182
+ } catch (Mage_Core_Exception $e) {
183
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
184
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
185
+ } catch (Exception $e) {
186
+ Mage::getSingleton('adminhtml/session')->addError(
187
+ Mage::helper('sumankcdotcom_faq')->__('There was an error deleting category.')
188
+ );
189
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
190
+ Mage::logException($e);
191
+ return;
192
+ }
193
+ }
194
+ Mage::getSingleton('adminhtml/session')->addError(
195
+ Mage::helper('sumankcdotcom_faq')->__('Could not find category to delete.')
196
+ );
197
+ $this->_redirect('*/*/');
198
+ }
199
+
200
+ /**
201
+ * mass delete category - action
202
+ *
203
+ * @access public
204
+ * @return void
205
+ * @author Suman K.C [WWW.SUMANKC.COM]
206
+ */
207
+ public function massDeleteAction()
208
+ {
209
+ $categoryIds = $this->getRequest()->getParam('category');
210
+ if (!is_array($categoryIds)) {
211
+ Mage::getSingleton('adminhtml/session')->addError(
212
+ Mage::helper('sumankcdotcom_faq')->__('Please select categories to delete.')
213
+ );
214
+ } else {
215
+ try {
216
+ foreach ($categoryIds as $categoryId) {
217
+ $category = Mage::getModel('sumankcdotcom_faq/category');
218
+ $category->setId($categoryId)->delete();
219
+ }
220
+ Mage::getSingleton('adminhtml/session')->addSuccess(
221
+ Mage::helper('sumankcdotcom_faq')->__('Total of %d categories were successfully deleted.', count($categoryIds))
222
+ );
223
+ } catch (Mage_Core_Exception $e) {
224
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
225
+ } catch (Exception $e) {
226
+ Mage::getSingleton('adminhtml/session')->addError(
227
+ Mage::helper('sumankcdotcom_faq')->__('There was an error deleting categories.')
228
+ );
229
+ Mage::logException($e);
230
+ }
231
+ }
232
+ $this->_redirect('*/*/index');
233
+ }
234
+
235
+ /**
236
+ * mass status change - action
237
+ *
238
+ * @access public
239
+ * @return void
240
+ * @author Suman K.C [WWW.SUMANKC.COM]
241
+ */
242
+ public function massStatusAction()
243
+ {
244
+ $categoryIds = $this->getRequest()->getParam('category');
245
+ if (!is_array($categoryIds)) {
246
+ Mage::getSingleton('adminhtml/session')->addError(
247
+ Mage::helper('sumankcdotcom_faq')->__('Please select categories.')
248
+ );
249
+ } else {
250
+ try {
251
+ foreach ($categoryIds as $categoryId) {
252
+ $category = Mage::getSingleton('sumankcdotcom_faq/category')->load($categoryId)
253
+ ->setStatus($this->getRequest()->getParam('status'))
254
+ ->setIsMassupdate(true)
255
+ ->save();
256
+ }
257
+ $this->_getSession()->addSuccess(
258
+ $this->__('Total of %d categories were successfully updated.', count($categoryIds))
259
+ );
260
+ } catch (Mage_Core_Exception $e) {
261
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
262
+ } catch (Exception $e) {
263
+ Mage::getSingleton('adminhtml/session')->addError(
264
+ Mage::helper('sumankcdotcom_faq')->__('There was an error updating categories.')
265
+ );
266
+ Mage::logException($e);
267
+ }
268
+ }
269
+ $this->_redirect('*/*/index');
270
+ }
271
+
272
+ /**
273
+ * export as csv - action
274
+ *
275
+ * @access public
276
+ * @return void
277
+ * @author Suman K.C [WWW.SUMANKC.COM]
278
+ */
279
+ public function exportCsvAction()
280
+ {
281
+ $fileName = 'category.csv';
282
+ $content = $this->getLayout()->createBlock('sumankcdotcom_faq/adminhtml_category_grid')
283
+ ->getCsv();
284
+ $this->_prepareDownloadResponse($fileName, $content);
285
+ }
286
+
287
+ /**
288
+ * export as MsExcel - action
289
+ *
290
+ * @access public
291
+ * @return void
292
+ * @author Suman K.C [WWW.SUMANKC.COM]
293
+ */
294
+ public function exportExcelAction()
295
+ {
296
+ $fileName = 'category.xls';
297
+ $content = $this->getLayout()->createBlock('sumankcdotcom_faq/adminhtml_category_grid')
298
+ ->getExcelFile();
299
+ $this->_prepareDownloadResponse($fileName, $content);
300
+ }
301
+
302
+ /**
303
+ * export as xml - action
304
+ *
305
+ * @access public
306
+ * @return void
307
+ * @author Suman K.C [WWW.SUMANKC.COM]
308
+ */
309
+ public function exportXmlAction()
310
+ {
311
+ $fileName = 'category.xml';
312
+ $content = $this->getLayout()->createBlock('sumankcdotcom_faq/adminhtml_category_grid')
313
+ ->getXml();
314
+ $this->_prepareDownloadResponse($fileName, $content);
315
+ }
316
+
317
+ /**
318
+ * Check if admin has permissions to visit related pages
319
+ *
320
+ * @access protected
321
+ * @return boolean
322
+ * @author Suman K.C [WWW.SUMANKC.COM]
323
+ */
324
+ protected function _isAllowed()
325
+ {
326
+ return Mage::getSingleton('admin/session')->isAllowed('sumankcdotcom_faq/category');
327
+ }
328
+ }
app/code/community/Sumankcdotcom/Faq/controllers/Adminhtml/Faq/FaqController.php ADDED
@@ -0,0 +1,365 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Faq admin controller
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_Adminhtml_Faq_FaqController extends Sumankcdotcom_Faq_Controller_Adminhtml_Faq
25
+ {
26
+ /**
27
+ * init the faq
28
+ *
29
+ * @access protected
30
+ * @return Sumankcdotcom_Faq_Model_Faq
31
+ */
32
+ protected function _initFaq()
33
+ {
34
+ $faqId = (int) $this->getRequest()->getParam('id');
35
+ $faq = Mage::getModel('sumankcdotcom_faq/faq');
36
+ if ($faqId) {
37
+ $faq->load($faqId);
38
+ }
39
+ Mage::register('current_faq', $faq);
40
+ return $faq;
41
+ }
42
+
43
+ /**
44
+ * default action
45
+ *
46
+ * @access public
47
+ * @return void
48
+ * @author Suman K.C [WWW.SUMANKC.COM]
49
+ */
50
+ public function indexAction()
51
+ {
52
+ $this->loadLayout();
53
+ $this->_title(Mage::helper('sumankcdotcom_faq')->__('FAQ'))
54
+ ->_title(Mage::helper('sumankcdotcom_faq')->__('Faqs'));
55
+ $this->renderLayout();
56
+ }
57
+
58
+ /**
59
+ * grid action
60
+ *
61
+ * @access public
62
+ * @return void
63
+ * @author Suman K.C [WWW.SUMANKC.COM]
64
+ */
65
+ public function gridAction()
66
+ {
67
+ $this->loadLayout()->renderLayout();
68
+ }
69
+
70
+ /**
71
+ * edit faq - action
72
+ *
73
+ * @access public
74
+ * @return void
75
+ * @author Suman K.C [WWW.SUMANKC.COM]
76
+ */
77
+ public function editAction()
78
+ {
79
+ $faqId = $this->getRequest()->getParam('id');
80
+ $faq = $this->_initFaq();
81
+ if ($faqId && !$faq->getId()) {
82
+ $this->_getSession()->addError(
83
+ Mage::helper('sumankcdotcom_faq')->__('This faq no longer exists.')
84
+ );
85
+ $this->_redirect('*/*/');
86
+ return;
87
+ }
88
+ $data = Mage::getSingleton('adminhtml/session')->getFaqData(true);
89
+ if (!empty($data)) {
90
+ $faq->setData($data);
91
+ }
92
+ Mage::register('faq_data', $faq);
93
+ $this->loadLayout();
94
+ $this->_title(Mage::helper('sumankcdotcom_faq')->__('FAQ'))
95
+ ->_title(Mage::helper('sumankcdotcom_faq')->__('Faqs'));
96
+ if ($faq->getId()) {
97
+ $this->_title($faq->getQuestion());
98
+ } else {
99
+ $this->_title(Mage::helper('sumankcdotcom_faq')->__('Add faq'));
100
+ }
101
+ if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
102
+ $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
103
+ }
104
+ $this->renderLayout();
105
+ }
106
+
107
+ /**
108
+ * new faq action
109
+ *
110
+ * @access public
111
+ * @return void
112
+ * @author Suman K.C [WWW.SUMANKC.COM]
113
+ */
114
+ public function newAction()
115
+ {
116
+ $this->_forward('edit');
117
+ }
118
+
119
+ /**
120
+ * save faq - action
121
+ *
122
+ * @access public
123
+ * @return void
124
+ * @author Suman K.C [WWW.SUMANKC.COM]
125
+ */
126
+ public function saveAction()
127
+ {
128
+ if ($data = $this->getRequest()->getPost('faq')) {
129
+ try {
130
+ $faq = $this->_initFaq();
131
+ $faq->addData($data);
132
+ $faq->save();
133
+ Mage::getSingleton('adminhtml/session')->addSuccess(
134
+ Mage::helper('sumankcdotcom_faq')->__('Faq was successfully saved')
135
+ );
136
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
137
+ if ($this->getRequest()->getParam('back')) {
138
+ $this->_redirect('*/*/edit', array('id' => $faq->getId()));
139
+ return;
140
+ }
141
+ $this->_redirect('*/*/');
142
+ return;
143
+ } catch (Mage_Core_Exception $e) {
144
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
145
+ Mage::getSingleton('adminhtml/session')->setFaqData($data);
146
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
147
+ return;
148
+ } catch (Exception $e) {
149
+ Mage::logException($e);
150
+ Mage::getSingleton('adminhtml/session')->addError(
151
+ Mage::helper('sumankcdotcom_faq')->__('There was a problem saving the faq.')
152
+ );
153
+ Mage::getSingleton('adminhtml/session')->setFaqData($data);
154
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
155
+ return;
156
+ }
157
+ }
158
+ Mage::getSingleton('adminhtml/session')->addError(
159
+ Mage::helper('sumankcdotcom_faq')->__('Unable to find faq to save.')
160
+ );
161
+ $this->_redirect('*/*/');
162
+ }
163
+
164
+ /**
165
+ * delete faq - action
166
+ *
167
+ * @access public
168
+ * @return void
169
+ * @author Suman K.C [WWW.SUMANKC.COM]
170
+ */
171
+ public function deleteAction()
172
+ {
173
+ if ( $this->getRequest()->getParam('id') > 0) {
174
+ try {
175
+ $faq = Mage::getModel('sumankcdotcom_faq/faq');
176
+ $faq->setId($this->getRequest()->getParam('id'))->delete();
177
+ Mage::getSingleton('adminhtml/session')->addSuccess(
178
+ Mage::helper('sumankcdotcom_faq')->__('Faq was successfully deleted.')
179
+ );
180
+ $this->_redirect('*/*/');
181
+ return;
182
+ } catch (Mage_Core_Exception $e) {
183
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
184
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
185
+ } catch (Exception $e) {
186
+ Mage::getSingleton('adminhtml/session')->addError(
187
+ Mage::helper('sumankcdotcom_faq')->__('There was an error deleting faq.')
188
+ );
189
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
190
+ Mage::logException($e);
191
+ return;
192
+ }
193
+ }
194
+ Mage::getSingleton('adminhtml/session')->addError(
195
+ Mage::helper('sumankcdotcom_faq')->__('Could not find faq to delete.')
196
+ );
197
+ $this->_redirect('*/*/');
198
+ }
199
+
200
+ /**
201
+ * mass delete faq - action
202
+ *
203
+ * @access public
204
+ * @return void
205
+ * @author Suman K.C [WWW.SUMANKC.COM]
206
+ */
207
+ public function massDeleteAction()
208
+ {
209
+ $faqIds = $this->getRequest()->getParam('faq');
210
+ if (!is_array($faqIds)) {
211
+ Mage::getSingleton('adminhtml/session')->addError(
212
+ Mage::helper('sumankcdotcom_faq')->__('Please select faqs to delete.')
213
+ );
214
+ } else {
215
+ try {
216
+ foreach ($faqIds as $faqId) {
217
+ $faq = Mage::getModel('sumankcdotcom_faq/faq');
218
+ $faq->setId($faqId)->delete();
219
+ }
220
+ Mage::getSingleton('adminhtml/session')->addSuccess(
221
+ Mage::helper('sumankcdotcom_faq')->__('Total of %d faqs were successfully deleted.', count($faqIds))
222
+ );
223
+ } catch (Mage_Core_Exception $e) {
224
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
225
+ } catch (Exception $e) {
226
+ Mage::getSingleton('adminhtml/session')->addError(
227
+ Mage::helper('sumankcdotcom_faq')->__('There was an error deleting faqs.')
228
+ );
229
+ Mage::logException($e);
230
+ }
231
+ }
232
+ $this->_redirect('*/*/index');
233
+ }
234
+
235
+ /**
236
+ * mass status change - action
237
+ *
238
+ * @access public
239
+ * @return void
240
+ * @author Suman K.C [WWW.SUMANKC.COM]
241
+ */
242
+ public function massStatusAction()
243
+ {
244
+ $faqIds = $this->getRequest()->getParam('faq');
245
+ if (!is_array($faqIds)) {
246
+ Mage::getSingleton('adminhtml/session')->addError(
247
+ Mage::helper('sumankcdotcom_faq')->__('Please select faqs.')
248
+ );
249
+ } else {
250
+ try {
251
+ foreach ($faqIds as $faqId) {
252
+ $faq = Mage::getSingleton('sumankcdotcom_faq/faq')->load($faqId)
253
+ ->setStatus($this->getRequest()->getParam('status'))
254
+ ->setIsMassupdate(true)
255
+ ->save();
256
+ }
257
+ $this->_getSession()->addSuccess(
258
+ $this->__('Total of %d faqs were successfully updated.', count($faqIds))
259
+ );
260
+ } catch (Mage_Core_Exception $e) {
261
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
262
+ } catch (Exception $e) {
263
+ Mage::getSingleton('adminhtml/session')->addError(
264
+ Mage::helper('sumankcdotcom_faq')->__('There was an error updating faqs.')
265
+ );
266
+ Mage::logException($e);
267
+ }
268
+ }
269
+ $this->_redirect('*/*/index');
270
+ }
271
+
272
+ /**
273
+ * mass category change - action
274
+ *
275
+ * @access public
276
+ * @return void
277
+ * @author Suman K.C [WWW.SUMANKC.COM]
278
+ */
279
+ public function massCategoryIdAction()
280
+ {
281
+ $faqIds = $this->getRequest()->getParam('faq');
282
+ if (!is_array($faqIds)) {
283
+ Mage::getSingleton('adminhtml/session')->addError(
284
+ Mage::helper('sumankcdotcom_faq')->__('Please select faqs.')
285
+ );
286
+ } else {
287
+ try {
288
+ foreach ($faqIds as $faqId) {
289
+ $faq = Mage::getSingleton('sumankcdotcom_faq/faq')->load($faqId)
290
+ ->setCategoryId($this->getRequest()->getParam('flag_category_id'))
291
+ ->setIsMassupdate(true)
292
+ ->save();
293
+ }
294
+ $this->_getSession()->addSuccess(
295
+ $this->__('Total of %d faqs were successfully updated.', count($faqIds))
296
+ );
297
+ } catch (Mage_Core_Exception $e) {
298
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
299
+ } catch (Exception $e) {
300
+ Mage::getSingleton('adminhtml/session')->addError(
301
+ Mage::helper('sumankcdotcom_faq')->__('There was an error updating faqs.')
302
+ );
303
+ Mage::logException($e);
304
+ }
305
+ }
306
+ $this->_redirect('*/*/index');
307
+ }
308
+
309
+ /**
310
+ * export as csv - action
311
+ *
312
+ * @access public
313
+ * @return void
314
+ * @author Suman K.C [WWW.SUMANKC.COM]
315
+ */
316
+ public function exportCsvAction()
317
+ {
318
+ $fileName = 'faq.csv';
319
+ $content = $this->getLayout()->createBlock('sumankcdotcom_faq/adminhtml_faq_grid')
320
+ ->getCsv();
321
+ $this->_prepareDownloadResponse($fileName, $content);
322
+ }
323
+
324
+ /**
325
+ * export as MsExcel - action
326
+ *
327
+ * @access public
328
+ * @return void
329
+ * @author Suman K.C [WWW.SUMANKC.COM]
330
+ */
331
+ public function exportExcelAction()
332
+ {
333
+ $fileName = 'faq.xls';
334
+ $content = $this->getLayout()->createBlock('sumankcdotcom_faq/adminhtml_faq_grid')
335
+ ->getExcelFile();
336
+ $this->_prepareDownloadResponse($fileName, $content);
337
+ }
338
+
339
+ /**
340
+ * export as xml - action
341
+ *
342
+ * @access public
343
+ * @return void
344
+ * @author Suman K.C [WWW.SUMANKC.COM]
345
+ */
346
+ public function exportXmlAction()
347
+ {
348
+ $fileName = 'faq.xml';
349
+ $content = $this->getLayout()->createBlock('sumankcdotcom_faq/adminhtml_faq_grid')
350
+ ->getXml();
351
+ $this->_prepareDownloadResponse($fileName, $content);
352
+ }
353
+
354
+ /**
355
+ * Check if admin has permissions to visit related pages
356
+ *
357
+ * @access protected
358
+ * @return boolean
359
+ * @author Suman K.C [WWW.SUMANKC.COM]
360
+ */
361
+ protected function _isAllowed()
362
+ {
363
+ return Mage::getSingleton('admin/session')->isAllowed('sumankcdotcom_faq/faq');
364
+ }
365
+ }
app/code/community/Sumankcdotcom/Faq/controllers/CategoryController.php ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Category front contrller
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_CategoryController extends Mage_Core_Controller_Front_Action
25
+ {
26
+
27
+ /**
28
+ * default action
29
+ *
30
+ * @access public
31
+ * @return void
32
+ * @author Suman K.C [WWW.SUMANKC.COM]
33
+ */
34
+ public function indexAction()
35
+ {
36
+ $this->loadLayout();
37
+ $this->_initLayoutMessages('catalog/session');
38
+ $this->_initLayoutMessages('customer/session');
39
+ $this->_initLayoutMessages('checkout/session');
40
+ if (Mage::helper('sumankcdotcom_faq/category')->getUseBreadcrumbs()) {
41
+ if ($breadcrumbBlock = $this->getLayout()->getBlock('breadcrumbs')) {
42
+ $breadcrumbBlock->addCrumb(
43
+ 'home',
44
+ array(
45
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('Home'),
46
+ 'link' => Mage::getUrl(),
47
+ )
48
+ );
49
+ $breadcrumbBlock->addCrumb(
50
+ 'categories',
51
+ array(
52
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('FAQ'),
53
+ 'link' => '',
54
+ )
55
+ );
56
+ }
57
+ }
58
+ $headBlock = $this->getLayout()->getBlock('head');
59
+ if ($headBlock) {
60
+ $headBlock->addLinkRel('canonical', Mage::helper('sumankcdotcom_faq/category')->getCategoriesUrl());
61
+ }
62
+ $this->renderLayout();
63
+ }
64
+
65
+ /**
66
+ * init Category
67
+ *
68
+ * @access protected
69
+ * @return Sumankcdotcom_Faq_Model_Category
70
+ * @author Suman K.C [WWW.SUMANKC.COM]
71
+ */
72
+ protected function _initCategory()
73
+ {
74
+ $categoryId = $this->getRequest()->getParam('id', 0);
75
+ $category = Mage::getModel('sumankcdotcom_faq/category')
76
+ ->setStoreId(Mage::app()->getStore()->getId())
77
+ ->load($categoryId);
78
+ if (!$category->getId()) {
79
+ return false;
80
+ } elseif (!$category->getStatus()) {
81
+ return false;
82
+ }
83
+ return $category;
84
+ }
85
+
86
+ /**
87
+ * view category action
88
+ *
89
+ * @access public
90
+ * @return void
91
+ * @author Suman K.C [WWW.SUMANKC.COM]
92
+ */
93
+ public function viewAction()
94
+ {
95
+ $category = $this->_initCategory();
96
+ if (!$category) {
97
+ $this->_forward('no-route');
98
+ return;
99
+ }
100
+ Mage::register('current_category', $category);
101
+ $this->loadLayout();
102
+ $this->_initLayoutMessages('catalog/session');
103
+ $this->_initLayoutMessages('customer/session');
104
+ $this->_initLayoutMessages('checkout/session');
105
+ if ($root = $this->getLayout()->getBlock('root')) {
106
+ $root->addBodyClass('faq-category faq-category' . $category->getId());
107
+ }
108
+ if (Mage::helper('sumankcdotcom_faq/category')->getUseBreadcrumbs()) {
109
+ if ($breadcrumbBlock = $this->getLayout()->getBlock('breadcrumbs')) {
110
+ $breadcrumbBlock->addCrumb(
111
+ 'home',
112
+ array(
113
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('Home'),
114
+ 'link' => Mage::getUrl(),
115
+ )
116
+ );
117
+ $breadcrumbBlock->addCrumb(
118
+ 'categories',
119
+ array(
120
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('Categories'),
121
+ 'link' => Mage::helper('sumankcdotcom_faq/category')->getCategoriesUrl(),
122
+ )
123
+ );
124
+ $breadcrumbBlock->addCrumb(
125
+ 'category',
126
+ array(
127
+ 'label' => $category->getCategories(),
128
+ 'link' => '',
129
+ )
130
+ );
131
+ }
132
+ }
133
+ $headBlock = $this->getLayout()->getBlock('head');
134
+ if ($headBlock) {
135
+ $headBlock->addLinkRel('canonical', $category->getCategoryUrl());
136
+ }
137
+ $this->renderLayout();
138
+ }
139
+ }
app/code/community/Sumankcdotcom/Faq/controllers/FaqController.php ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Faq front contrller
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ class Sumankcdotcom_Faq_FaqController extends Mage_Core_Controller_Front_Action
25
+ {
26
+
27
+ /**
28
+ * default action
29
+ *
30
+ * @access public
31
+ * @return void
32
+ * @author Suman K.C [WWW.SUMANKC.COM]
33
+ */
34
+ public function indexAction()
35
+ {
36
+ $this->loadLayout();
37
+ $this->_initLayoutMessages('catalog/session');
38
+ $this->_initLayoutMessages('customer/session');
39
+ $this->_initLayoutMessages('checkout/session');
40
+ if (Mage::helper('sumankcdotcom_faq/faq')->getUseBreadcrumbs()) {
41
+ if ($breadcrumbBlock = $this->getLayout()->getBlock('breadcrumbs')) {
42
+ $breadcrumbBlock->addCrumb(
43
+ 'home',
44
+ array(
45
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('Home'),
46
+ 'link' => Mage::getUrl(),
47
+ )
48
+ );
49
+ $breadcrumbBlock->addCrumb(
50
+ 'faqs',
51
+ array(
52
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('Faqs'),
53
+ 'link' => '',
54
+ )
55
+ );
56
+ }
57
+ }
58
+ $headBlock = $this->getLayout()->getBlock('head');
59
+ if ($headBlock) {
60
+ $headBlock->addLinkRel('canonical', Mage::helper('sumankcdotcom_faq/faq')->getFaqsUrl());
61
+ }
62
+ $this->renderLayout();
63
+ }
64
+
65
+ /**
66
+ * init Faq
67
+ *
68
+ * @access protected
69
+ * @return Sumankcdotcom_Faq_Model_Faq
70
+ * @author Suman K.C [WWW.SUMANKC.COM]
71
+ */
72
+ protected function _initFaq()
73
+ {
74
+ $faqId = $this->getRequest()->getParam('id', 0);
75
+ $faq = Mage::getModel('sumankcdotcom_faq/faq')
76
+ ->setStoreId(Mage::app()->getStore()->getId())
77
+ ->load($faqId);
78
+ if (!$faq->getId()) {
79
+ return false;
80
+ } elseif (!$faq->getStatus()) {
81
+ return false;
82
+ }
83
+ return $faq;
84
+ }
85
+
86
+ /**
87
+ * view faq action
88
+ *
89
+ * @access public
90
+ * @return void
91
+ * @author Suman K.C [WWW.SUMANKC.COM]
92
+ */
93
+ public function viewAction()
94
+ {
95
+ $faq = $this->_initFaq();
96
+ if (!$faq) {
97
+ $this->_forward('no-route');
98
+ return;
99
+ }
100
+ Mage::register('current_faq', $faq);
101
+ $this->loadLayout();
102
+ $this->_initLayoutMessages('catalog/session');
103
+ $this->_initLayoutMessages('customer/session');
104
+ $this->_initLayoutMessages('checkout/session');
105
+ if ($root = $this->getLayout()->getBlock('root')) {
106
+ $root->addBodyClass('faq-faq faq-faq' . $faq->getId());
107
+ }
108
+ if (Mage::helper('sumankcdotcom_faq/faq')->getUseBreadcrumbs()) {
109
+ if ($breadcrumbBlock = $this->getLayout()->getBlock('breadcrumbs')) {
110
+ $breadcrumbBlock->addCrumb(
111
+ 'home',
112
+ array(
113
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('Home'),
114
+ 'link' => Mage::getUrl(),
115
+ )
116
+ );
117
+ $breadcrumbBlock->addCrumb(
118
+ 'faqs',
119
+ array(
120
+ 'label' => Mage::helper('sumankcdotcom_faq')->__('Faqs'),
121
+ 'link' => Mage::helper('sumankcdotcom_faq/faq')->getFaqsUrl(),
122
+ )
123
+ );
124
+ $breadcrumbBlock->addCrumb(
125
+ 'faq',
126
+ array(
127
+ 'label' => $faq->getQuestion(),
128
+ 'link' => '',
129
+ )
130
+ );
131
+ }
132
+ }
133
+ $headBlock = $this->getLayout()->getBlock('head');
134
+ if ($headBlock) {
135
+ $headBlock->addLinkRel('canonical', $faq->getFaqUrl());
136
+ }
137
+ $this->renderLayout();
138
+ }
139
+ }
app/code/community/Sumankcdotcom/Faq/etc/adminhtml.xml ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Sumankcdotcom_Faq extension
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the MIT License
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/mit-license.php
12
+ *
13
+ * @category Sumankcdotcom
14
+ * @package Sumankcdotcom_Faq
15
+ * @copyright Copyright (c) 2016
16
+ * @license http://opensource.org/licenses/mit-license.php MIT License
17
+ */
18
+ -->
19
+ <config>
20
+ <acl>
21
+ <resources>
22
+ <admin>
23
+ <children>
24
+ <system>
25
+ <children>
26
+ <config>
27
+ <children>
28
+ <sumankcdotcom_faq translate="title" module="sumankcdotcom_faq">
29
+ <title>Faq</title>
30
+ </sumankcdotcom_faq>
31
+ </children>
32
+ </config>
33
+ </children>
34
+ </system>
35
+ <sumankcdotcom_faq translate="title" module="sumankcdotcom_faq">
36
+ <title>FAQ</title>
37
+ <children>
38
+ <faq translate="title" module="sumankcdotcom_faq">
39
+ <title>Faq</title>
40
+ <sort_order>0</sort_order>
41
+ </faq>
42
+ <category translate="title" module="sumankcdotcom_faq">
43
+ <title>Category</title>
44
+ <sort_order>10</sort_order>
45
+ </category>
46
+ <Setting translate="tile" module="sumankcdotcom_faq">
47
+ <title>Setting</title>
48
+ <sort_order>20</sort_order>
49
+ </Setting>
50
+ </children>
51
+ </sumankcdotcom_faq>
52
+ </children>
53
+ </admin>
54
+ </resources>
55
+ </acl>
56
+ <menu>
57
+ <sumankcdotcom_faq translate="title" module="sumankcdotcom_faq">
58
+ <title>FAQ</title>
59
+ <sort_order>75</sort_order>
60
+ <children>
61
+ <faq translate="title" module="sumankcdotcom_faq">
62
+ <title>Manage FAQ</title>
63
+ <action>adminhtml/faq_faq</action>
64
+ <sort_order>0</sort_order>
65
+ </faq>
66
+ <category translate="title" module="sumankcdotcom_faq">
67
+ <title>Category</title>
68
+ <action>adminhtml/faq_category</action>
69
+ <sort_order>10</sort_order>
70
+ </category>
71
+ <setting translate="title" module="sumankcdotcom_faq">
72
+ <title>Setting</title>
73
+ <action>adminhtml/system_config/edit/section/sumankcdotcom_faq/</action>
74
+ <sort_order>20</sort_order>
75
+ </setting>
76
+ </children>
77
+ </sumankcdotcom_faq>
78
+ </menu>
79
+ </config>
app/code/community/Sumankcdotcom/Faq/etc/config.xml ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Sumankcdotcom_Faq extension
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the MIT License
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/mit-license.php
12
+ *
13
+ * @category Sumankcdotcom
14
+ * @package Sumankcdotcom_Faq
15
+ * @copyright Copyright (c) 2016
16
+ * @license http://opensource.org/licenses/mit-license.php MIT License
17
+ */
18
+ -->
19
+ <config>
20
+ <modules>
21
+ <Sumankcdotcom_Faq>
22
+ <version>1.0.0</version>
23
+ </Sumankcdotcom_Faq>
24
+ </modules>
25
+ <global>
26
+ <resources>
27
+ <sumankcdotcom_faq_setup>
28
+ <setup>
29
+ <module>Sumankcdotcom_Faq</module>
30
+ <class>Sumankcdotcom_Faq_Model_Resource_Setup</class>
31
+ </setup>
32
+ </sumankcdotcom_faq_setup>
33
+ </resources>
34
+ <blocks>
35
+ <sumankcdotcom_faq>
36
+ <class>Sumankcdotcom_Faq_Block</class>
37
+ </sumankcdotcom_faq>
38
+ </blocks>
39
+ <helpers>
40
+ <sumankcdotcom_faq>
41
+ <class>Sumankcdotcom_Faq_Helper</class>
42
+ </sumankcdotcom_faq>
43
+ </helpers>
44
+ <models>
45
+ <sumankcdotcom_faq>
46
+ <class>Sumankcdotcom_Faq_Model</class>
47
+ <resourceModel>sumankcdotcom_faq_resource</resourceModel>
48
+ </sumankcdotcom_faq>
49
+ <sumankcdotcom_faq_resource>
50
+ <class>Sumankcdotcom_Faq_Model_Resource</class>
51
+ <entities>
52
+ <faq>
53
+ <table>sumankcdotcom_faq_faq</table>
54
+ </faq>
55
+ <category>
56
+ <table>sumankcdotcom_faq_category</table>
57
+ </category>
58
+ <category_store>
59
+ <table>sumankcdotcom_faq_category_store</table>
60
+ </category_store>
61
+ </entities>
62
+ </sumankcdotcom_faq_resource>
63
+ </models>
64
+ <events>
65
+ <controller_front_init_routers>
66
+ <observers>
67
+ <sumankcdotcom_faq>
68
+ <class>Sumankcdotcom_Faq_Controller_Router</class>
69
+ <method>initControllerRouters</method>
70
+ </sumankcdotcom_faq>
71
+ </observers>
72
+ </controller_front_init_routers>
73
+ </events>
74
+ </global>
75
+ <adminhtml>
76
+ <layout>
77
+ <updates>
78
+ <sumankcdotcom_faq>
79
+ <file>sumankcdotcom_faq.xml</file>
80
+ </sumankcdotcom_faq>
81
+ </updates>
82
+ </layout>
83
+ <translate>
84
+ <modules>
85
+ <Sumankcdotcom_Faq>
86
+ <files>
87
+ <default>Sumankcdotcom_Faq.csv</default>
88
+ </files>
89
+ </Sumankcdotcom_Faq>
90
+ </modules>
91
+ </translate>
92
+ <global_search>
93
+ <category>
94
+ <class>sumankcdotcom_faq/adminhtml_search_category</class>
95
+ <acl>sumankcdotcom_faq</acl>
96
+ </category>
97
+ </global_search>
98
+ </adminhtml>
99
+ <admin>
100
+ <routers>
101
+ <adminhtml>
102
+ <args>
103
+ <modules>
104
+ <Sumankcdotcom_Faq before="Mage_Adminhtml">Sumankcdotcom_Faq_Adminhtml</Sumankcdotcom_Faq>
105
+ </modules>
106
+ </args>
107
+ </adminhtml>
108
+ </routers>
109
+ </admin>
110
+ <frontend>
111
+ <routers>
112
+ <sumankcdotcom_faq>
113
+ <use>standard</use>
114
+ <args>
115
+ <module>Sumankcdotcom_Faq</module>
116
+ <frontName>faq</frontName>
117
+ </args>
118
+ </sumankcdotcom_faq>
119
+ </routers>
120
+ <layout>
121
+ <updates>
122
+ <sumankcdotcom_faq>
123
+ <file>sumankcdotcom_faq.xml</file>
124
+ </sumankcdotcom_faq>
125
+ </updates>
126
+ </layout>
127
+ <translate>
128
+ <modules>
129
+ <Sumankcdotcom_Faq>
130
+ <files>
131
+ <default>Sumankcdotcom_Faq.csv</default>
132
+ </files>
133
+ </Sumankcdotcom_Faq>
134
+ </modules>
135
+ </translate>
136
+ </frontend>
137
+ <default>
138
+ <sumankcdotcom_faq>
139
+ <faq>
140
+ <breadcrumbs>1</breadcrumbs>
141
+ </faq>
142
+ <category>
143
+ <breadcrumbs>1</breadcrumbs>
144
+ </category>
145
+ </sumankcdotcom_faq>
146
+ </default>
147
+ </config>
app/code/community/Sumankcdotcom/Faq/etc/system.xml ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Sumankcdotcom_Faq extension
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the MIT License
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/mit-license.php
12
+ *
13
+ * @category Sumankcdotcom
14
+ * @package Sumankcdotcom_Faq
15
+ * @copyright Copyright (c) 2016
16
+ * @license http://opensource.org/licenses/mit-license.php MIT License
17
+ */
18
+ -->
19
+ <config>
20
+ <tabs>
21
+ <sumankcdotcom translate="label" module="sumankcdotcom_faq">
22
+ <label>Sumankcdotcom</label>
23
+ <sort_order>2000</sort_order>
24
+ </sumankcdotcom>
25
+ </tabs>
26
+ <sections>
27
+ <sumankcdotcom_faq translate="label" module="sumankcdotcom_faq">
28
+ <class>separator-top</class>
29
+ <label>FAQ</label>
30
+ <tab>sumankcdotcom</tab>
31
+ <frontend_type>text</frontend_type>
32
+ <sort_order>100</sort_order>
33
+ <show_in_default>1</show_in_default>
34
+ <show_in_website>1</show_in_website>
35
+ <show_in_store>1</show_in_store>
36
+ <groups>
37
+ <category translate="label" module="sumankcdotcom_faq">
38
+ <label>FAQ Configurations</label>
39
+ <frontend_type>text</frontend_type>
40
+ <sort_order>10</sort_order>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>1</show_in_website>
43
+ <show_in_store>1</show_in_store>
44
+ <fields>
45
+ <breadcrumbs translate="label">
46
+ <label>Use Breadcrumbs</label>
47
+ <frontend_type>select</frontend_type>
48
+ <source_model>adminhtml/system_config_source_yesno</source_model>
49
+ <sort_order>10</sort_order>
50
+ <show_in_default>1</show_in_default>
51
+ <show_in_website>1</show_in_website>
52
+ <show_in_store>1</show_in_store>
53
+ </breadcrumbs>
54
+ <url_rewrite_list translate="label comment">
55
+ <label>URL key ( page url)</label>
56
+ <frontend_type>text</frontend_type>
57
+ <sort_order>20</sort_order>
58
+ <show_in_default>1</show_in_default>
59
+ <show_in_website>1</show_in_website>
60
+ <show_in_store>1</show_in_store>
61
+ <comment>Leave empty to use default URL module/controller/action eg. faq </comment>
62
+ </url_rewrite_list>
63
+ <url_prefix translate="label comment">
64
+ <label>URL prefix</label>
65
+ <frontend_type>text</frontend_type>
66
+ <sort_order>30</sort_order>
67
+ <show_in_default>1</show_in_default>
68
+ <show_in_website>1</show_in_website>
69
+ <show_in_store>1</show_in_store>
70
+ <comment>Leave empty for no prefix</comment>
71
+ </url_prefix>
72
+ <url_suffix translate="label comment">
73
+ <label>Url suffix</label>
74
+ <frontend_type>text</frontend_type>
75
+ <sort_order>40</sort_order>
76
+ <show_in_default>1</show_in_default>
77
+ <show_in_website>1</show_in_website>
78
+ <show_in_store>1</show_in_store>
79
+ <comment>What goes after the dot. Leave empty for no suffix.</comment>
80
+ </url_suffix>
81
+ </fields>
82
+ </category>
83
+ </groups>
84
+ </sumankcdotcom_faq>
85
+ </sections>
86
+ </config>
app/code/community/Sumankcdotcom/Faq/sql/sumankcdotcom_faq_setup/install-1.0.0.php ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Faq module install script
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ */
23
+ $this->startSetup();
24
+ $table = $this->getConnection()
25
+ ->newTable($this->getTable('sumankcdotcom_faq/faq'))
26
+ ->addColumn(
27
+ 'entity_id',
28
+ Varien_Db_Ddl_Table::TYPE_INTEGER,
29
+ null,
30
+ array(
31
+ 'identity' => true,
32
+ 'nullable' => false,
33
+ 'primary' => true,
34
+ ),
35
+ 'Faq ID'
36
+ )
37
+ ->addColumn(
38
+ 'category_id',
39
+ Varien_Db_Ddl_Table::TYPE_INTEGER, null,
40
+ array(
41
+ 'unsigned' => true,
42
+ ),
43
+ 'Category ID'
44
+ )
45
+ ->addColumn(
46
+ 'question',
47
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
48
+ array(
49
+ 'nullable' => false,
50
+ ),
51
+ 'Question'
52
+ )
53
+ ->addColumn(
54
+ 'answer',
55
+ Varien_Db_Ddl_Table::TYPE_TEXT, '64k',
56
+ array(
57
+ 'nullable' => false,
58
+ ),
59
+ 'Answer'
60
+ )
61
+ ->addColumn(
62
+ 'status',
63
+ Varien_Db_Ddl_Table::TYPE_SMALLINT, null,
64
+ array(),
65
+ 'Enabled'
66
+ )
67
+ ->addColumn(
68
+ 'url_key',
69
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
70
+ array(),
71
+ 'URL key'
72
+ )
73
+ ->addColumn(
74
+ 'updated_at',
75
+ Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
76
+ null,
77
+ array(),
78
+ 'Faq Modification Time'
79
+ )
80
+ ->addColumn(
81
+ 'created_at',
82
+ Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
83
+ null,
84
+ array(),
85
+ 'Faq Creation Time'
86
+ )
87
+ ->addIndex($this->getIdxName('sumankcdotcom_faq/category', array('category_id')), array('category_id'))
88
+ ->setComment('Faq Table');
89
+ $this->getConnection()->createTable($table);
90
+ $table = $this->getConnection()
91
+ ->newTable($this->getTable('sumankcdotcom_faq/category'))
92
+ ->addColumn(
93
+ 'entity_id',
94
+ Varien_Db_Ddl_Table::TYPE_INTEGER,
95
+ null,
96
+ array(
97
+ 'identity' => true,
98
+ 'nullable' => false,
99
+ 'primary' => true,
100
+ ),
101
+ 'Category ID'
102
+ )
103
+ ->addColumn(
104
+ 'categories',
105
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
106
+ array(
107
+ 'nullable' => false,
108
+ ),
109
+ 'category Name'
110
+ )
111
+ ->addColumn(
112
+ 'status',
113
+ Varien_Db_Ddl_Table::TYPE_SMALLINT, null,
114
+ array(),
115
+ 'Enabled'
116
+ )
117
+ ->addColumn(
118
+ 'url_key',
119
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
120
+ array(),
121
+ 'URL key'
122
+ )
123
+ ->addColumn(
124
+ 'updated_at',
125
+ Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
126
+ null,
127
+ array(),
128
+ 'Category Modification Time'
129
+ )
130
+ ->addColumn(
131
+ 'created_at',
132
+ Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
133
+ null,
134
+ array(),
135
+ 'Category Creation Time'
136
+ )
137
+ ->setComment('Category Table');
138
+ $this->getConnection()->createTable($table);
139
+ $table = $this->getConnection()
140
+ ->newTable($this->getTable('sumankcdotcom_faq/category_store'))
141
+ ->addColumn(
142
+ 'category_id',
143
+ Varien_Db_Ddl_Table::TYPE_SMALLINT,
144
+ null,
145
+ array(
146
+ 'nullable' => false,
147
+ 'primary' => true,
148
+ ),
149
+ 'Category ID'
150
+ )
151
+ ->addColumn(
152
+ 'store_id',
153
+ Varien_Db_Ddl_Table::TYPE_SMALLINT,
154
+ null,
155
+ array(
156
+ 'unsigned' => true,
157
+ 'nullable' => false,
158
+ 'primary' => true,
159
+ ),
160
+ 'Store ID'
161
+ )
162
+ ->addIndex(
163
+ $this->getIdxName(
164
+ 'sumankcdotcom_faq/category_store',
165
+ array('store_id')
166
+ ),
167
+ array('store_id')
168
+ )
169
+ ->addForeignKey(
170
+ $this->getFkName(
171
+ 'sumankcdotcom_faq/category_store',
172
+ 'category_id',
173
+ 'sumankcdotcom_faq/category',
174
+ 'entity_id'
175
+ ),
176
+ 'category_id',
177
+ $this->getTable('sumankcdotcom_faq/category'),
178
+ 'entity_id',
179
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
180
+ Varien_Db_Ddl_Table::ACTION_CASCADE
181
+ )
182
+ ->addForeignKey(
183
+ $this->getFkName(
184
+ 'sumankcdotcom_faq/category_store',
185
+ 'store_id',
186
+ 'core/store',
187
+ 'store_id'
188
+ ),
189
+ 'store_id',
190
+ $this->getTable('core/store'),
191
+ 'store_id',
192
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
193
+ Varien_Db_Ddl_Table::ACTION_CASCADE
194
+ )
195
+ ->setComment('Categories To Store Linkage Table');
196
+ $this->getConnection()->createTable($table);
197
+ $this->endSetup();
app/design/frontend/base/default/layout/sumankcdotcom_faq.xml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Sumankcdotcom_Faq extension
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the MIT License
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/mit-license.php
12
+ *
13
+ * @category Sumankcdotcom
14
+ * @package Sumankcdotcom_Faq
15
+ * @copyright Copyright (c) 2016
16
+ * @license http://opensource.org/licenses/mit-license.php MIT License
17
+ */
18
+ -->
19
+ <layout>
20
+ <sumankcdotcom_faq_category_index translate="label" module="sumankcdotcom_faq">
21
+ <label>Categories list</label>
22
+ <update handle="page_two_columns_left" />
23
+ <reference name="content">
24
+ <block type="sumankcdotcom_faq/category_list" name="category_list" template="sumankcdotcom_faq/list.phtml" />
25
+ </reference>
26
+ </sumankcdotcom_faq_category_index>
27
+ </layout>
app/design/frontend/base/default/template/sumankcdotcom_faq/list.phtml ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sumankcdotcom_Faq extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/mit-license.php
11
+ *
12
+ * @category Sumankcdotcom
13
+ * @package Sumankcdotcom_Faq
14
+ * @copyright Copyright (c) 2016
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Category list template
19
+ *
20
+ * @category Sumankcdotcom
21
+ * @package Sumankcdotcom_Faq
22
+ * @author Suman K.C [WWW.SUMANKC.COM]
23
+ */
24
+ ?>
25
+ <!--/ just few styling to make it look ok : do change as according to your need -->
26
+ <style type="text/css">
27
+ .category-list-container h2 {
28
+ text-transform: none;
29
+ margin-top: 15px;
30
+ }
31
+ .question {
32
+ background: #f9f9f9 none repeat scroll 0 0;
33
+ border: 1px solid #ccc;
34
+ cursor: pointer;
35
+ font-size: 16px;
36
+ margin-top: 5px;
37
+ padding: 5px 10px;
38
+ }
39
+ .answer {
40
+ display: none;
41
+ background: #eee none repeat scroll 0 0;
42
+ border-bottom: 1px solid #ccc;
43
+ border-left: 1px solid #ccc;
44
+ border-right: 1px solid #ccc;
45
+ margin-bottom: 16px;
46
+ padding: 13px;
47
+ }
48
+ </style>
49
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
50
+ <?php $_categories = $this->getCategories(); ?>
51
+ <?php if ($_categories->getSize() > 0) :?>
52
+ <?php echo $this->getPagerHtml(); ?>
53
+ <div class="category-list-container">
54
+ <?php foreach ($_categories as $_category) : ?>
55
+
56
+ <h2><?php echo $_category->getCategories();?></h2>
57
+
58
+ <?php $faqs = $this->getfaqs($_category->getId());
59
+
60
+ foreach($faqs as $faq){
61
+ echo '<div class="question">'.$faq->getQuestion().'</div>';
62
+ echo '<div class="answer">'.$faq->getAnswer().'</div>';
63
+ }
64
+
65
+ ?>
66
+
67
+ <?php endforeach;?>
68
+ </div>
69
+ <?php echo $this->getPagerHtml(); ?>
70
+ <?php else : ?>
71
+ <?php echo Mage::helper('sumankcdotcom_faq')->__('There are no categories at this moment');?>
72
+ <?php endif;?>
73
+ <script type="text/javascript">
74
+ jQuery(document).ready(function(){
75
+ jQuery('.question').click(function(){
76
+ jQuery(this).next().slideToggle();
77
+ });
78
+ })
79
+ </script>
app/etc/modules/Sumankcdotcom_Faq.xml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Sumankcdotcom_Faq extension
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the MIT License
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/mit-license.php
12
+ *
13
+ * @category Sumankcdotcom
14
+ * @package Sumankcdotcom_Faq
15
+ * @copyright Copyright (c) 2016
16
+ * @license http://opensource.org/licenses/mit-license.php MIT License
17
+ */
18
+ -->
19
+ <config>
20
+ <modules>
21
+ <Sumankcdotcom_Faq>
22
+ <active>true</active>
23
+ <codePool>community</codePool>
24
+ <depends>
25
+ <Mage_Core />
26
+ </depends>
27
+ </Sumankcdotcom_Faq>
28
+ </modules>
29
+ </config>
app/locale/en_US/Sumankcdotcom_Faq.csv ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ " - Edit"," - Edit"
2
+ "",""
3
+ "Action","Action"
4
+ "Add Category","Add Category"
5
+ "Add Faq","Add Faq"
6
+ "An error occurred while updating the categories.","An error occurred while updating the categories."
7
+ "An error occurred while updating the faqs.","An error occurred while updating the faqs."
8
+ "Answer","Answer"
9
+ "Are you sure?","Are you sure?"
10
+ "CSV","CSV"
11
+ "Categories","Categories"
12
+ "Category was saved","Category was saved"
13
+ "Category was successfully deleted.","Category was successfully deleted."
14
+ "Category was successfully saved","Category was successfully saved"
15
+ "Category","Category"
16
+ "Change Category","Change Category"
17
+ "Change status","Change status"
18
+ "Could not find category to delete.","Could not find category to delete."
19
+ "Could not find faq to delete.","Could not find faq to delete."
20
+ "Created at","Created at"
21
+ "Delete Category","Delete Category"
22
+ "Delete Faq","Delete Faq"
23
+ "Delete","Delete"
24
+ "Disabled","Disabled"
25
+ "Edit Category '%s'","Edit Category '%s'"
26
+ "Edit Faq '%s'","Edit Faq '%s'"
27
+ "Edit","Edit"
28
+ "Enabled","Enabled"
29
+ "Error saving category","Error saving category"
30
+ "Error saving faq","Error saving faq"
31
+ "Excel","Excel"
32
+ "Faq was saved","Faq was saved"
33
+ "Faq was successfully deleted.","Faq was successfully deleted."
34
+ "Faq was successfully saved","Faq was successfully saved"
35
+ "Faq","Faq"
36
+ "Faqs","Faqs"
37
+ "Home","Home"
38
+ "Id","Id"
39
+ "Leave empty for no prefix","Leave empty for no prefix"
40
+ "Leave empty to use default URL module/controller/action","Leave empty to use default URL module/controller/action"
41
+ "No","No"
42
+ "None","None"
43
+ "Please select categories to delete.","Please select categories to delete."
44
+ "Please select categories.","Please select categories."
45
+ "Please select faqs to delete.","Please select faqs to delete."
46
+ "Please select faqs.","Please select faqs."
47
+ "Position","Position"
48
+ "Question","Question"
49
+ "Relative to Website Base URL","Relative to Website Base URL"
50
+ "Reset","Reset"
51
+ "Save And Continue Edit","Save And Continue Edit"
52
+ "Save Category","Save Category"
53
+ "Save Faq","Save Faq"
54
+ "Status","Status"
55
+ "Store views","Store views"
56
+ "The URL key cannot consist only of numbers.","The URL key cannot consist only of numbers."
57
+ "The URL key contains capital letters or disallowed symbols.","The URL key contains capital letters or disallowed symbols."
58
+ "The categories has been deleted.","The categories has been deleted."
59
+ "The faqs has been deleted.","The faqs has been deleted."
60
+ "There was a problem saving the category.","There was a problem saving the category."
61
+ "There was a problem saving the faq.","There was a problem saving the faq."
62
+ "There was an error deleting categories.","There was an error deleting categories."
63
+ "There was an error deleting category.","There was an error deleting category."
64
+ "There was an error deleting faq.","There was an error deleting faq."
65
+ "There was an error deleting faqs.","There was an error deleting faqs."
66
+ "There was an error updating categories.","There was an error updating categories."
67
+ "There was an error updating faqs.","There was an error updating faqs."
68
+ "This category no longer exists.","This category no longer exists."
69
+ "This faq no longer exists.","This faq no longer exists."
70
+ "Total of %d categories were successfully deleted.","Total of %d categories were successfully deleted."
71
+ "Total of %d categories were successfully updated.","Total of %d categories were successfully updated."
72
+ "Total of %d faqs were successfully deleted.","Total of %d faqs were successfully deleted."
73
+ "Total of %d faqs were successfully updated.","Total of %d faqs were successfully updated."
74
+ "Total of %d record(s) have been deleted.","Total of %d record(s) have been deleted."
75
+ "Total of %d record(s) have been updated.","Total of %d record(s) have been updated."
76
+ "URL key already exists.","URL key already exists."
77
+ "URL key for list page","URL key for list page"
78
+ "URL key","URL key"
79
+ "URL prefix","URL prefix"
80
+ "URL suffix","URL suffix"
81
+ "Unable to find category to save.","Unable to find category to save."
82
+ "Unable to find faq to save.","Unable to find faq to save."
83
+ "Updated at","Updated at"
84
+ "Use Breadcrumbs","Use Breadcrumbs"
85
+ "View {#name}","View {#name}"
86
+ "WYSIWYG Editor","WYSIWYG Editor"
87
+ "What goes after the dot. Leave empty for no suffix.","What goes after the dot. Leave empty for no suffix."
88
+ "XML","XML"
89
+ "Yes","Yes"
90
+ "category Name","category Name"
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Sumankcdotcom_Faq</name>
4
+ <version>1.0.0</version>
5
+ <stability>devel</stability>
6
+ <license uri="http://opensource.org/licenses/mit-license.php">MIT License</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This extension allows you to present FAQ(frequently asked question) category wise </summary>
10
+ <description>This extension Frequently aked question allows admin to present FAQs category wise. Store wise management feature, backend configuration and manageable from backend. The faq contents can be input from WYSIWYG editor.</description>
11
+ <notes>Initial release</notes>
12
+ <authors><author><name>Suman K.C</name><user>sumankc</user><email>sumankc55@gmail.com</email></author></authors>
13
+ <date>2016-01-19</date>
14
+ <time>09:26:48</time>
15
+ <contents><target name="magecommunity"><dir name="Sumankcdotcom"><dir name="Faq"><dir name="Block"><dir name="Adminhtml"><dir name="Category"><dir name="Edit"><file name="Form.php" hash="69b0f0a8811e6aadfd749057447bbe61"/><dir name="Tab"><file name="Form.php" hash="3b2bc80dc7b70142eaf2e344369bd326"/><file name="Stores.php" hash="2204dce92dd0d934111a7ec6a6b68813"/></dir><file name="Tabs.php" hash="acfdf11c1319b810010ae5c120082842"/></dir><file name="Edit.php" hash="7fa91dfc6683f0cd2b89a3335ab8cf2c"/><file name="Grid.php" hash="c552ead8790b7d39f3ead05136eab743"/></dir><file name="Category.php" hash="8db5806626d7565505ee4d6bc0e0cdfc"/><dir name="Faq"><dir name="Edit"><file name="Form.php" hash="5bd5f811422ef91e47ad38e1b94b7408"/><dir name="Tab"><file name="Form.php" hash="0a44919c10a42b91735644bd9c70ca82"/></dir><file name="Tabs.php" hash="d88234adbbe463b013616f26e2469567"/></dir><file name="Edit.php" hash="90cc225af2c4c2e53b53114c29550fdd"/><file name="Grid.php" hash="94b05c79251b92ac4fb2b0207fbeb140"/></dir><file name="Faq.php" hash="ec197e9774ca547ca458e0caac39d307"/><dir name="Helper"><dir name="Column"><dir name="Renderer"><file name="Parent.php" hash="b09a714f6ff67bd77dc9b1a696105f69"/></dir></dir></dir></dir><dir name="Category"><dir name="Faq"><file name="List.php" hash="f935eaae93e78bf0a0f945481b531e23"/></dir><file name="List.php" hash="77622bb41c82125624a1777d1253d799"/><file name="View.php" hash="e6633e29f9daab93f3225adfd6150929"/></dir><dir name="Faq"><file name="List.php" hash="2696ade284a62d0753fbfd5864dd4ee5"/><file name="View.php" hash="cd4701140c0342367987f30d63f8f606"/></dir></dir><dir name="Controller"><dir name="Adminhtml"><file name="Faq.php" hash="08a75de2e8e07c05ee8476c27f6c53cb"/></dir><file name="Router.php" hash="1824904a41d1f636d2179ec81c53685c"/></dir><dir name="Helper"><file name="Category.php" hash="c6ae228f1a8872fa4295784cdd2a45b3"/><file name="Data.php" hash="acf76520a803d7bb8b8835d9c269dccf"/><file name="Faq.php" hash="c59b2a087029abbbd230dba958a12f9f"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="Search"><file name="Category.php" hash="030fab6629e29e38247d4db07782bed7"/></dir></dir><dir name="Category"><file name="Source.php" hash="ca4b39cc3aaaba532f8bae0276979017"/></dir><file name="Category.php" hash="ed06464813ce0b6991d41751fb216d41"/><file name="Faq.php" hash="44a500210873860e261dd976e8750f07"/><dir name="Resource"><dir name="Category"><file name="Collection.php" hash="07dad2bc694ca634759282f0a120b71d"/></dir><file name="Category.php" hash="6076a5e94e2225d72f629fe33bd853e4"/><dir name="Faq"><file name="Collection.php" hash="eaaf706ee2982ef19a76fe188fee6863"/></dir><file name="Faq.php" hash="f8b5fb1eb1263c65f64b62975ea24358"/><file name="Setup.php" hash="ed5a353811ac287ff4c09233a1347533"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Faq"><file name="CategoryController.php" hash="0bf2b242653acc44b2f3acd2fc76314d"/><file name="FaqController.php" hash="b93118789f82d273d6ede86fc6fd2111"/></dir></dir><file name="CategoryController.php" hash="aa3de82488007e37f02d9101abdff30f"/><file name="FaqController.php" hash="c9b7ee772dad27011b0e14e113488424"/></dir><dir name="etc"><file name="adminhtml.xml" hash="615ce4d790420ec70c6040514dc4ca88"/><file name="config.xml" hash="da96f5b508f3472e052beb74af9cbbcd"/><file name="system.xml" hash="8899dafa8982c6ad5c2decea737e3479"/></dir><dir name="sql"><dir name="sumankcdotcom_faq_setup"><file name="install-1.0.0.php" hash="0be8c15679c3405d78d57285a194ac9e"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sumankcdotcom_Faq.xml" hash="f3bf6aeebbd0303493eb23f72893a22d"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Sumankcdotcom_Faq.csv" hash="5b5c1b757e9d7d811c2304a8c9b8d64f"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="sumankcdotcom_faq.xml" hash="1dbe159c38b03b535cb01b676636d0c4"/></dir><dir name="template"><dir name="sumankcdotcom_faq"><file name="list.phtml" hash="146b6a82c56fc66089e8dc359ff7b4df"/></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>