Flagbit_Faq - Version 1.1.2

Version Notes

* Initial Release

Download this release

Release Info

Developer Magento Core Team
Extension Flagbit_Faq
Version 1.1.2
Comparing to
See all releases


Code changes from version 1.0.6 to 1.1.2

Files changed (40) hide show
  1. app/code/community/Flagbit/Faq/Block/Admin/Edit.php +0 -64
  2. app/code/community/Flagbit/Faq/Block/Admin/Edit/Form.php +0 -36
  3. app/code/community/Flagbit/Faq/Block/Admin/Edit/Tab/Main.php +0 -115
  4. app/code/community/Flagbit/Faq/Block/Admin/Edit/Tabs.php +0 -51
  5. app/code/community/Flagbit/Faq/Block/Admin/List.php +0 -45
  6. app/code/community/Flagbit/Faq/Block/Admin/List/Grid.php +0 -163
  7. app/code/community/Flagbit/Faq/Block/Adminhtml/Category.php +45 -0
  8. app/code/community/Flagbit/Faq/Block/Adminhtml/Category/Edit.php +78 -0
  9. app/code/community/Flagbit/Faq/Block/Adminhtml/Category/Edit/Form.php +35 -0
  10. app/code/community/Flagbit/Faq/Block/Adminhtml/Category/Edit/Tab/Main.php +82 -0
  11. app/code/community/Flagbit/Faq/Block/Adminhtml/Category/Edit/Tabs.php +54 -0
  12. app/code/community/Flagbit/Faq/Block/Adminhtml/Category/Grid.php +167 -0
  13. app/code/community/Flagbit/Faq/Block/Adminhtml/Item.php +45 -0
  14. app/code/community/Flagbit/Faq/Block/Adminhtml/Item/Edit.php +79 -0
  15. app/code/community/Flagbit/Faq/Block/Adminhtml/Item/Edit/Form.php +35 -0
  16. app/code/community/Flagbit/Faq/Block/Adminhtml/Item/Edit/Tab/Main.php +125 -0
  17. app/code/community/Flagbit/Faq/Block/Adminhtml/Item/Edit/Tabs.php +54 -0
  18. app/code/community/Flagbit/Faq/Block/Adminhtml/Item/Grid.php +155 -0
  19. app/code/community/Flagbit/Faq/Block/Frontend/Detail.php +1 -1
  20. app/code/community/Flagbit/Faq/Block/Frontend/List.php +40 -14
  21. app/code/community/Flagbit/Faq/Helper/Data.php +11 -12
  22. app/code/community/Flagbit/Faq/Model/Category.php +42 -0
  23. app/code/community/Flagbit/Faq/Model/Faq.php +10 -13
  24. app/code/community/Flagbit/Faq/Model/Mysql4/Category.php +107 -0
  25. app/code/community/Flagbit/Faq/Model/Mysql4/Category/Collection.php +109 -0
  26. app/code/community/Flagbit/Faq/Model/Mysql4/Faq.php +40 -22
  27. app/code/community/Flagbit/Faq/Model/Mysql4/Faq/Collection.php +117 -96
  28. app/code/community/Flagbit/Faq/controllers/Adminhtml/Faq/CategoryController.php +193 -0
  29. app/code/community/Flagbit/Faq/controllers/{AdminController.php → Adminhtml/FaqController.php} +41 -53
  30. app/code/community/Flagbit/Faq/controllers/IndexController.php +6 -9
  31. app/code/community/Flagbit/Faq/etc/adminhtml.xml +12 -3
  32. app/code/community/Flagbit/Faq/etc/config.xml +28 -26
  33. app/code/community/Flagbit/Faq/sql/faq_setup/mysql4-install-0.1.0.php +5 -7
  34. app/code/community/Flagbit/Faq/sql/faq_setup/mysql4-install-1.0.7.php +67 -0
  35. app/code/community/Flagbit/Faq/sql/faq_setup/mysql4-upgrade-1.0.6-1.0.7.php +52 -0
  36. app/design/frontend/base/default/layout/faq.xml +2 -10
  37. app/design/frontend/base/default/template/faq/list.phtml +26 -8
  38. app/locale/de_DE/Flagbit_Faq.csv +18 -1
  39. app/locale/nl_NL/Flagbit_Faq.csv +56 -0
  40. package.xml +5 -5
app/code/community/Flagbit/Faq/Block/Admin/Edit.php DELETED
@@ -1,64 +0,0 @@
1
- <?php
2
- /**
3
- * FAQ for Magento
4
- *
5
- * @category Flagbit
6
- * @package Flagbit_Faq
7
- * @copyright Copyright (c) 2009 Flagbit GmbH & Co. KG <magento@flagbit.de>
8
- */
9
-
10
- /**
11
- * FAQ for Magento
12
- *
13
- * @category Flagbit
14
- * @package Flagbit_Faq
15
- * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
- */
17
- class Flagbit_Faq_Block_Admin_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
18
-
19
- /**
20
- * Constructor for the FAQ edit form
21
- *
22
- */
23
- public function __construct() {
24
-
25
- $this->_objectId = 'faq_id';
26
- $this->_controller = 'admin';
27
- $this->_blockGroup = 'faq';
28
-
29
- parent :: __construct();
30
-
31
- $this->_updateButton('save', 'label', Mage :: helper('faq')->__('Save FAQ item'));
32
- $this->_updateButton('delete', 'label', Mage :: helper('faq')->__('Delete FAQ item'));
33
-
34
- $this->_addButton('saveandcontinue', array (
35
- 'label' => Mage :: helper('faq')->__('Save and continue edit'),
36
- 'onclick' => 'saveAndContinueEdit()',
37
- 'class' => 'save' ), -100);
38
-
39
- $this->_formScripts[] = "
40
- function saveAndContinueEdit(){
41
- editForm.submit($('edit_form').action+'back/edit/');
42
- }
43
- ";
44
- }
45
-
46
- /**
47
- * Helper function to edit the header of the current form
48
- *
49
- * @return string Returns an "edit" or "new" text depending on the type of modifications.
50
- */
51
- public function getHeaderText() {
52
-
53
- if (Mage :: registry('faq')->getFaqId()) {
54
- return Mage :: helper('faq')->__("Edit FAQ item '%s'", $this->htmlEscape(Mage :: registry('faq')->getQuestion()));
55
- }
56
- else {
57
- return Mage :: helper('faq')->__('New FAQ item');
58
- }
59
- }
60
-
61
- public function getFormActionUrl() {
62
- return $this->getUrl('*/faq/save');
63
- }
64
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Flagbit/Faq/Block/Admin/Edit/Form.php DELETED
@@ -1,36 +0,0 @@
1
- <?php
2
- /**
3
- * FAQ for Magento
4
- *
5
- * @category Flagbit
6
- * @package Flagbit_Faq
7
- * @copyright Copyright (c) 2009 Flagbit GmbH & Co. KG <magento@flagbit.de>
8
- */
9
-
10
- /**
11
- * FAQ for Magento
12
- *
13
- * @category Flagbit
14
- * @package Flagbit_Faq
15
- * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
- */
17
- class Flagbit_Faq_Block_Admin_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {
18
-
19
- /**
20
- * Preperation of current form
21
- *
22
- * @return Flagbit_Faq_Block_Admin_Edit_Form Self
23
- */
24
- protected function _prepareForm() {
25
-
26
- $form = new Varien_Data_Form(array (
27
- 'id' => 'edit_form',
28
- 'action' => $this->getData('action'),
29
- 'method' => 'post',
30
- 'enctype' => 'multipart/form-data' ));
31
- $form->setUseContainer(true);
32
- $this->setForm($form);
33
- return parent :: _prepareForm();
34
- }
35
-
36
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Flagbit/Faq/Block/Admin/Edit/Tab/Main.php DELETED
@@ -1,115 +0,0 @@
1
- <?php
2
- /**
3
- * FAQ for Magento
4
- *
5
- * @category Flagbit
6
- * @package Flagbit_Faq
7
- * @copyright Copyright (c) 2009 Flagbit GmbH & Co. KG <magento@flagbit.de>
8
- */
9
-
10
- /**
11
- * FAQ for Magento
12
- *
13
- * @category Flagbit
14
- * @package Flagbit_Faq
15
- * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
- */
17
- class Flagbit_Faq_Block_Admin_Edit_Tab_Main extends Mage_Adminhtml_Block_Widget_Form {
18
-
19
-
20
- /**
21
- * Prepares the page layout
22
- *
23
- * Loads the WYSIWYG editor on demand if enabled.
24
- *
25
- * @return Flagbit_Faq_Block_Admin_Edit
26
- */
27
- protected function _prepareLayout() {
28
- $return = parent::_prepareLayout();
29
- if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
30
- $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
31
- }
32
- return $return;
33
- }
34
-
35
- /**
36
- * Preparation of current form
37
- *
38
- * @return Flagbit_Faq_Block_Admin_Edit_Tab_Main Self
39
- */
40
- protected function _prepareForm() {
41
-
42
- $model = Mage :: registry('faq');
43
-
44
- $form = new Varien_Data_Form();
45
- $form->setHtmlIdPrefix('faq_');
46
-
47
- $fieldset = $form->addFieldset('base_fieldset', array (
48
- 'legend' => Mage :: helper('faq')->__('General information'),
49
- 'class' => 'fieldset-wide' ));
50
-
51
- if ($model->getFaqId()) {
52
- $fieldset->addField('faq_id', 'hidden', array (
53
- 'name' => 'faq_id' ));
54
- }
55
-
56
- $fieldset->addField('question', 'text', array (
57
- 'name' => 'question',
58
- 'label' => Mage :: helper('faq')->__('FAQ item question'),
59
- 'title' => Mage :: helper('faq')->__('FAQ item question'),
60
- 'required' => true ));
61
-
62
- /**
63
- * Check is single store mode
64
- */
65
- if (!Mage :: app()->isSingleStoreMode()) {
66
- $fieldset->addField('store_id', 'multiselect',
67
- array (
68
- 'name' => 'stores[]',
69
- 'label' => Mage :: helper('faq')->__('Store view'),
70
- 'title' => Mage :: helper('faq')->__('Store view'),
71
- 'required' => true,
72
- 'values' => Mage :: getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true) ));
73
- }
74
- else {
75
- $fieldset->addField('store_id', 'hidden', array (
76
- 'name' => 'stores[]',
77
- 'value' => Mage :: app()->getStore(true)->getId() ));
78
- $model->setStoreId(Mage :: app()->getStore(true)->getId());
79
- }
80
-
81
- $fieldset->addField('is_active', 'select',
82
- array (
83
- 'label' => Mage :: helper('faq')->__('Status'),
84
- 'title' => Mage :: helper('faq')->__('Page status'),
85
- 'name' => 'is_active',
86
- 'required' => true,
87
- 'options' => array (
88
- '1' => Mage :: helper('faq')->__('Enabled'),
89
- '0' => Mage :: helper('faq')->__('Disabled') ) ));
90
-
91
- $fieldset->addField('answer', 'editor',
92
- array (
93
- 'name' => 'answer',
94
- 'label' => Mage :: helper('faq')->__('Content'),
95
- 'title' => Mage :: helper('faq')->__('Content'),
96
- 'style' => 'height:36em;',
97
- 'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig(),
98
- 'required' => true ));
99
-
100
- $fieldset->addField('answer_html', 'select',
101
- array (
102
- 'label' => Mage :: helper('faq')->__('HTML answer'),
103
- 'title' => Mage :: helper('faq')->__('HTML answer'),
104
- 'name' => 'answer_html',
105
- 'required' => true,
106
- 'options' => array (
107
- '1' => Mage :: helper('faq')->__('Enabled'),
108
- '0' => Mage :: helper('faq')->__('Disabled') ) ));
109
-
110
- $form->setValues($model->getData());
111
- $this->setForm($form);
112
-
113
- return parent :: _prepareForm();
114
- }
115
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Flagbit/Faq/Block/Admin/Edit/Tabs.php DELETED
@@ -1,51 +0,0 @@
1
- <?php
2
- /**
3
- * FAQ for Magento
4
- *
5
- * @category Flagbit
6
- * @package Flagbit_Faq
7
- * @copyright Copyright (c) 2009 Flagbit GmbH & Co. KG <magento@flagbit.de>
8
- */
9
-
10
- /**
11
- * FAQ for Magento
12
- *
13
- * @category Flagbit
14
- * @package Flagbit_Faq
15
- * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
- */
17
- class Flagbit_Faq_Block_Admin_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
18
-
19
- /**
20
- * Constructs current object
21
- *
22
- */
23
- public function __construct() {
24
-
25
- parent :: __construct();
26
- $this->setId('qaq_tabs');
27
- $this->setDestElementId('edit_form');
28
- $this->setTitle(Mage :: helper('faq')->__('FAQ item information'));
29
- }
30
-
31
- /**
32
- * Prepares the page layout
33
- *
34
- * Adds the tabs to the left tab menu.
35
- *
36
- * @return Flagbit_Faq_Block_Admin_Edit
37
- */
38
- protected function _prepareLayout()
39
- {
40
- $return = parent::_prepareLayout();
41
-
42
- $this->addTab('main_section',
43
- array (
44
- 'label' => Mage :: helper('faq')->__('General information'),
45
- 'title' => Mage :: helper('faq')->__('General information'),
46
- 'content' => $this->getLayout()->createBlock('faq/admin_edit_tab_main')->toHtml(),
47
- 'active' => true ));
48
-
49
- return $return;
50
- }
51
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Flagbit/Faq/Block/Admin/List.php DELETED
@@ -1,45 +0,0 @@
1
- <?php
2
- /**
3
- * FAQ for Magento
4
- *
5
- * @category Flagbit
6
- * @package Flagbit_Faq
7
- * @copyright Copyright (c) 2009 Flagbit GmbH & Co. KG <magento@flagbit.de>
8
- */
9
-
10
- /**
11
- * FAQ for Magento
12
- *
13
- * @category Flagbit
14
- * @package Flagbit_Faq
15
- * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
- */
17
-
18
- class Flagbit_Faq_Block_Admin_List extends Mage_Adminhtml_Block_Widget_Grid_Container {
19
-
20
- /**
21
- * Constructor for FAQ Admin Block
22
- *
23
- */
24
- public function __construct() {
25
-
26
- $this->_controller = 'admin_list';
27
- $this->_blockGroup = 'faq';
28
- $this->_headerText = Mage :: helper('faq')->__('FAQ');
29
- $this->_addButtonLabel = Mage :: helper('sales')->__('Add new FAQ item');
30
-
31
- parent :: __construct();
32
-
33
- }
34
-
35
-
36
- /**
37
- * Standard grid function for new elements
38
- *
39
- * @return string URL to add element page
40
- */
41
- public function getCreateUrl() {
42
-
43
- return $this->getUrl('adminhtml/faq/new');
44
- }
45
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Flagbit/Faq/Block/Admin/List/Grid.php DELETED
@@ -1,163 +0,0 @@
1
- <?php
2
- /**
3
- * FAQ for Magento
4
- *
5
- * @category Flagbit
6
- * @package Flagbit_Faq
7
- * @copyright Copyright (c) 2009 Flagbit GmbH & Co. KG <magento@flagbit.de>
8
- */
9
-
10
- /**
11
- * FAQ for Magento
12
- *
13
- * @category Flagbit
14
- * @package Flagbit_Faq
15
- * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
- */
17
- class Flagbit_Faq_Block_Admin_List_Grid extends Mage_Adminhtml_Block_Widget_Grid {
18
-
19
-
20
- /**
21
- * Constructor of Grid
22
- *
23
- */
24
- public function __construct() {
25
-
26
- parent :: __construct();
27
- $this->setId('faq_grid');
28
- $this->setUseAjax(false);
29
- $this->setDefaultSort('creation_time');
30
- $this->setDefaultDir('DESC');
31
- $this->setSaveParametersInSession(true);
32
- }
33
-
34
-
35
- /**
36
- * Preparation of the data that is displayed by the grid.
37
- *
38
- * @return Flagbit_Faq_Block_Admin_Grid Self
39
- */
40
- protected function _prepareCollection() {
41
-
42
- //TODO: add full name logic
43
- $collection = Mage :: getResourceModel('faq/faq_collection');
44
- $this->setCollection($collection);
45
- #Mage::Log($collection->getData());
46
- return parent :: _prepareCollection();
47
- }
48
-
49
-
50
- /**
51
- * Preparation of the requested columns of the grid
52
- *
53
- * @return Flagbit_Faq_Block_Admin_Grid Self
54
- */
55
- protected function _prepareColumns() {
56
-
57
- $this->addColumn('faq_id', array (
58
- 'header' => Mage :: helper('faq')->__('FAQ #'),
59
- 'width' => '80px',
60
- 'type' => 'text',
61
- 'index' => 'faq_id' ));
62
-
63
- if (!Mage :: app()->isSingleStoreMode()) {
64
- $this->addColumn('store_id',
65
- array (
66
- 'header' => Mage :: helper('cms')->__('Store view'),
67
- 'index' => 'store_id',
68
- 'type' => 'store',
69
- 'store_all' => true,
70
- 'store_view' => true,
71
- 'sortable' => false,
72
- 'filter_condition_callback' => array (
73
- $this,
74
- '_filterStoreCondition' ) ));
75
- }
76
-
77
- $this->addColumn('question', array (
78
- 'header' => Mage :: helper('faq')->__('Question'),
79
- 'index' => 'question' ));
80
-
81
- $this->addColumn('is_active',
82
- array (
83
- 'header' => Mage :: helper('faq')->__('Active'),
84
- 'index' => 'is_active',
85
- 'type' => 'options',
86
- 'width' => '70px',
87
- 'options' => array (
88
- 0 => Mage :: helper('faq')->__('No'),
89
- 1 => Mage :: helper('faq')->__('Yes') ) ));
90
-
91
- $this->addColumn('action',
92
- array (
93
- 'header' => Mage :: helper('faq')->__('Action'),
94
- 'width' => '50px',
95
- 'type' => 'action',
96
- 'getter' => 'getId',
97
- 'actions' => array (
98
- array (
99
- 'caption' => Mage :: helper('faq')->__('Edit'),
100
- 'url' => array (
101
- 'base' => 'adminhtml/faq/edit' ),
102
- 'field' => 'faq_id' ) ),
103
- 'filter' => false,
104
- 'sortable' => false,
105
- 'index' => 'stores',
106
- 'is_system' => true ));
107
-
108
- return parent :: _prepareColumns();
109
- }
110
-
111
-
112
- /**
113
- * Helper function to do after load modifications
114
- *
115
- */
116
- protected function _afterLoadCollection() {
117
-
118
- $this->getCollection()->walk('afterLoad');
119
- parent :: _afterLoadCollection();
120
- }
121
-
122
-
123
- /**
124
- * Helper function to add store filter condition
125
- *
126
- * @param Mage_Core_Model_Mysql4_Collection_Abstract $collection Data collection
127
- * @param Mage_Adminhtml_Block_Widget_Grid_Column $column Column information to be filtered
128
- */
129
- protected function _filterStoreCondition($collection, $column) {
130
-
131
- if (!$value = $column->getFilter()->getValue()) {
132
- return;
133
- }
134
-
135
- $this->getCollection()->addStoreFilter($value);
136
- }
137
-
138
-
139
- /**
140
- * Helper function to reveive on row click url
141
- *
142
- * @param Flagbit_Faq_Model_Faq $row Current rows dataset
143
- * @return string URL for current row's onclick event
144
- */
145
- public function getRowUrl($row) {
146
-
147
- return $this->getUrl('adminhtml/faq/edit', array (
148
- 'faq_id' => $row->getFaqId() ));
149
- }
150
-
151
-
152
- /**
153
- * Helper function to receive grid functionality urls for current grid
154
- *
155
- * @return string Requested URL
156
- */
157
- public function getGridUrl() {
158
-
159
- return $this->getUrl('adminhtml/faq/index', array (
160
- '_current' => true ));
161
- }
162
-
163
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Flagbit/Faq/Block/Adminhtml/Category.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * FAQ for Magento
4
+ *
5
+ * @category Flagbit
6
+ * @package Flagbit_Faq
7
+ * @copyright Copyright (c) 2009 Flagbit GmbH & Co. KG <magento@flagbit.de>
8
+ */
9
+
10
+ /**
11
+ * FAQ for Magento
12
+ *
13
+ * @category Flagbit
14
+ * @package Flagbit_Faq
15
+ * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
+ */
17
+ class Flagbit_Faq_Block_Adminhtml_Category extends Mage_Adminhtml_Block_Widget_Grid_Container
18
+ {
19
+ /**
20
+ * Constructor for FAQ Adminhtml Block
21
+ */
22
+ public function __construct()
23
+ {
24
+ $this->_blockGroup = 'flagbit_faq';
25
+ $this->_controller = 'adminhtml_category';
26
+ $this->_headerText = Mage::helper('flagbit_faq')->__('Manage FAQ Categories');
27
+ $this->_addButtonLabel = Mage::helper('flagbit_faq')->__('Add New FAQ Category');
28
+
29
+ parent::__construct();
30
+ }
31
+
32
+ /**
33
+ * Returns the CSS class for the header
34
+ *
35
+ * Usually 'icon-head' and a more precise class is returned. We return
36
+ * only an empty string to avoid spacing on the left of the header as we
37
+ * don't have an icon.
38
+ *
39
+ * @return string
40
+ */
41
+ public function getHeaderCssClass()
42
+ {
43
+ return '';
44
+ }
45
+ }
app/code/community/Flagbit/Faq/Block/Adminhtml/Category/Edit.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * FAQ for Magento
4
+ *
5
+ * @category Flagbit
6
+ * @package Flagbit_Faq
7
+ * @copyright Copyright (c) 2009 Flagbit GmbH & Co. KG <magento@flagbit.de>
8
+ */
9
+
10
+ /**
11
+ * FAQ for Magento
12
+ *
13
+ * @category Flagbit
14
+ * @package Flagbit_Faq
15
+ * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
+ */
17
+ class Flagbit_Faq_Block_Adminhtml_Category_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
18
+ {
19
+ /**
20
+ * Constructor for the FAQ edit form
21
+ */
22
+ public function __construct()
23
+ {
24
+ $this->_objectId = 'category_id';
25
+ $this->_blockGroup = 'flagbit_faq';
26
+ $this->_controller = 'adminhtml_category';
27
+
28
+ parent::__construct();
29
+
30
+ $this->_updateButton('save', 'label', Mage::helper('flagbit_faq')->__('Save FAQ Category'));
31
+ $this->_updateButton('delete', 'label', Mage::helper('flagbit_faq')->__('Delete FAQ Category'));
32
+
33
+ $this->_addButton('saveandcontinue', array (
34
+ 'label' => Mage::helper('flagbit_faq')->__('Save and continue edit'),
35
+ 'onclick' => 'saveAndContinueEdit()',
36
+ 'class' => 'save' ), -100);
37
+
38
+ $this->_formScripts[] = "
39
+ function saveAndContinueEdit(){
40
+ editForm.submit($('edit_form').action+'back/edit/');
41
+ }
42
+ ";
43
+ }
44
+
45
+ /**
46
+ * Helper function to edit the header of the current form
47
+ *
48
+ * @return string Returns an "edit" or "new" text depending on the type of modifications.
49
+ */
50
+ public function getHeaderText()
51
+ {
52
+ if (Mage::registry('faq_category')->getFaqId()) {
53
+ return Mage::helper('flagbit_faq')->__("Edit FAQ Category '%s'", $this->htmlEscape(Mage::registry('faq_category')->getCategoryName()));
54
+ }
55
+ else {
56
+ return Mage::helper('flagbit_faq')->__('New FAQ Category');
57
+ }
58
+ }
59
+
60
+ public function getFormActionUrl()
61
+ {
62
+ return $this->getUrl('*/*/save');
63
+ }
64
+
65
+ /**
66
+ * Returns the CSS class for the header
67
+ *
68
+ * Usually 'icon-head' and a more precise class is returned. We return
69
+ * only an empty string to avoid spacing on the left of the header as we
70
+ * don't have an icon.
71
+ *
72
+ * @return string
73
+ */
74
+ public function getHeaderCssClass()
75
+ {
76
+ return '';
77
+ }
78
+ }
app/code/community/Flagbit/Faq/Block/Adminhtml/Category/Edit/Form.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * FAQ for Magento
4
+ *
5
+ * @category Flagbit
6
+ * @package Flagbit_Faq
7
+ * @copyright Copyright (c) 2009 Flagbit GmbH & Co. KG <magento@flagbit.de>
8
+ */
9
+
10
+ /**
11
+ * FAQ for Magento
12
+ *
13
+ * @category Flagbit
14
+ * @package Flagbit_Faq
15
+ * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
+ */
17
+ class Flagbit_Faq_Block_Adminhtml_Category_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
18
+ {
19
+ /**
20
+ * Preperation of current form
21
+ *
22
+ * @return Flagbit_Faq_Block_Adminhtml_Category_Edit_Form
23
+ */
24
+ protected function _prepareForm()
25
+ {
26
+ $form = new Varien_Data_Form(array (
27
+ 'id' => 'edit_form',
28
+ 'action' => $this->getData('action'),
29
+ 'method' => 'post',
30
+ 'enctype' => 'multipart/form-data' ));
31
+ $form->setUseContainer(true);
32
+ $this->setForm($form);
33
+ return parent::_prepareForm();
34
+ }
35
+ }
app/code/community/Flagbit/Faq/Block/Adminhtml/Category/Edit/Tab/Main.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * FAQ for Magento
4
+ *
5
+ * @category Flagbit
6
+ * @package Flagbit_Faq
7
+ * @copyright Copyright (c) 2009 Flagbit GmbH & Co. KG <magento@flagbit.de>
8
+ */
9
+
10
+ /**
11
+ * FAQ for Magento
12
+ *
13
+ * @category Flagbit
14
+ * @package Flagbit_Faq
15
+ * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
+ */
17
+ class Flagbit_Faq_Block_Adminhtml_Category_Edit_Tab_Main extends Mage_Adminhtml_Block_Widget_Form
18
+ {
19
+ /**
20
+ * Preparation of current form
21
+ *
22
+ * @return Flagbit_Faq_Block_Adminhtml_Category_Edit_Tab_Main
23
+ */
24
+ protected function _prepareForm()
25
+ {
26
+ $model = Mage::registry('faq_category');
27
+
28
+ $form = new Varien_Data_Form();
29
+ $form->setHtmlIdPrefix('faq_');
30
+
31
+ $fieldset = $form->addFieldset('base_fieldset', array (
32
+ 'legend' => Mage::helper('flagbit_faq')->__('General information'),
33
+ 'class' => 'fieldset-wide' ));
34
+
35
+ if ($model->getCategoryId()) {
36
+ $fieldset->addField('category_id', 'hidden', array (
37
+ 'name' => 'category_id'
38
+ ));
39
+ }
40
+
41
+ $fieldset->addField('category_name', 'text', array (
42
+ 'name' => 'category_name',
43
+ 'label' => Mage::helper('flagbit_faq')->__('Category Name'),
44
+ 'title' => Mage::helper('flagbit_faq')->__('Category Name'),
45
+ 'required' => true,
46
+ ));
47
+
48
+ /**
49
+ * Check is single store mode
50
+ */
51
+ if (!Mage::app()->isSingleStoreMode()) {
52
+ $fieldset->addField('store_id', 'multiselect',
53
+ array (
54
+ 'name' => 'stores[]',
55
+ 'label' => Mage::helper('cms')->__('Store view'),
56
+ 'title' => Mage::helper('cms')->__('Store view'),
57
+ 'required' => true,
58
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true) ));
59
+ }
60
+ else {
61
+ $fieldset->addField('store_id', 'hidden', array (
62
+ 'name' => 'stores[]',
63
+ 'value' => Mage::app()->getStore(true)->getId() ));
64
+ $model->setStoreId(Mage::app()->getStore(true)->getId());
65
+ }
66
+
67
+ $fieldset->addField('is_active', 'select',
68
+ array (
69
+ 'label' => Mage::helper('cms')->__('Status'),
70
+ 'title' => Mage::helper('flagbit_faq')->__('Category Status'),
71
+ 'name' => 'is_active',
72
+ 'required' => true,
73
+ 'options' => array (
74
+ '1' => Mage::helper('cms')->__('Enabled'),
75
+ '0' => Mage::helper('cms')->__('Disabled') ) ));
76
+
77
+ $form->setValues($model->getData());
78
+ $this->setForm($form);
79
+
80
+ return parent::_prepareForm();
81
+ }
82
+ }
app/code/community/Flagbit/Faq/Block/Adminhtml/Category/Edit/Tabs.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * FAQ for Magento
4
+ *
5
+ * @category Flagbit
6
+ * @package Flagbit_Faq
7
+ * @copyright Copyright (c) 2009 Flagbit GmbH & Co. KG <magento@flagbit.de>
8
+ */
9
+
10
+ /**
11
+ * FAQ for Magento
12
+ *
13
+ * @category Flagbit
14
+ * @package Flagbit_Faq
15
+ * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
+ */
17
+ class Flagbit_Faq_Block_Adminhtml_Category_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
18
+ {
19
+ /**
20
+ * Constructs current object
21
+ *
22
+ */
23
+ public function __construct()
24
+ {
25
+ parent::__construct();
26
+ $this->setId('faq_tabs');
27
+ $this->setDestElementId('edit_form');
28
+ $this->setTitle(Mage::helper('flagbit_faq')->__('Category Information'));
29
+ }
30
+
31
+ /**
32
+ * Prepares the page layout
33
+ *
34
+ * Adds the tabs to the left tab menu.
35
+ *
36
+ * @return Flagbit_Faq_Block_Adminhtml_Category_Edit_Tabs
37
+ */
38
+ protected function _prepareLayout()
39
+ {
40
+ $return = parent::_prepareLayout();
41
+
42
+ $this->addTab(
43
+ 'main_section',
44
+ array(
45
+ 'label' => Mage::helper('flagbit_faq')->__('General information'),
46
+ 'title' => Mage::helper('flagbit_faq')->__('General information'),
47
+ 'content' => $this->getLayout()->createBlock('flagbit_faq/adminhtml_category_edit_tab_main')->toHtml(),
48
+ 'active' => true,
49
+ )
50
+ );
51
+
52
+ return $return;
53
+ }
54
+ }
app/code/community/Flagbit/Faq/Block/Adminhtml/Category/Grid.php ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * FAQ for Magento
4
+ *
5
+ * @category Flagbit
6
+ * @package Flagbit_Faq
7
+ * @copyright Copyright (c) 2009 Flagbit GmbH & Co. KG <magento@flagbit.de>
8
+ */
9
+
10
+ /**
11
+ * FAQ for Magento
12
+ *
13
+ * @category Flagbit
14
+ * @package Flagbit_Faq
15
+ * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
+ */
17
+ class Flagbit_Faq_Block_Adminhtml_Category_Grid extends Mage_Adminhtml_Block_Widget_Grid
18
+ {
19
+ /**
20
+ * Constructor of Grid
21
+ *
22
+ */
23
+ public function __construct()
24
+ {
25
+ parent::__construct();
26
+ $this->setId('faq_grid');
27
+ $this->setUseAjax(false);
28
+ $this->setDefaultSort('creation_time');
29
+ $this->setDefaultDir('DESC');
30
+ $this->setSaveParametersInSession(true);
31
+ }
32
+
33
+ /**
34
+ * Preparation of the data that is displayed by the grid.
35
+ *
36
+ * @return Flagbit_Faq_Block_Admin_Grid Self
37
+ */
38
+ protected function _prepareCollection()
39
+ {
40
+ $collection = Mage::getResourceModel('flagbit_faq/category_collection');
41
+ $this->setCollection($collection);
42
+ return parent::_prepareCollection();
43
+ }
44
+
45
+ /**
46
+ * Preparation of the requested columns of the grid
47
+ *
48
+ * @return Flagbit_Faq_Block_Admin_Grid Self
49
+ */
50
+ protected function _prepareColumns()
51
+ {
52
+ $this->addColumn('category_id', array (
53
+ 'header' => Mage::helper('flagbit_faq')->__('Category #'),
54
+ 'width' => '80px',
55
+ 'type' => 'text',
56
+ 'index' => 'category_id' ));
57
+
58
+ if (!Mage::app()->isSingleStoreMode()) {
59
+ $this->addColumn('store_id',
60
+ array (
61
+ 'header' => Mage::helper('cms')->__('Store view'),
62
+ 'index' => 'store_id',
63
+ 'type' => 'store',
64
+ 'store_all' => true,
65
+ 'store_view' => true,
66
+ 'sortable' => false,
67
+ 'filter_condition_callback' => array (
68
+ $this,
69
+ '_filterStoreCondition' ) ));
70
+ }
71
+
72
+ $this->addColumn(
73
+ 'category_name',
74
+ array(
75
+ 'header' => Mage::helper('flagbit_faq')->__('Category Name'),
76
+ 'index' => 'category_name',
77
+ )
78
+ );
79
+
80
+ $this->addColumn('is_active',
81
+ array (
82
+ 'header' => Mage::helper('cms')->__('Active'),
83
+ 'index' => 'is_active',
84
+ 'type' => 'options',
85
+ 'width' => '70px',
86
+ 'options' => array (
87
+ 0 => Mage::helper('cms')->__('No'),
88
+ 1 => Mage::helper('cms')->__('Yes') ) ));
89
+
90
+ $this->addColumn(
91
+ 'action',
92
+ array (
93
+ 'header' => Mage::helper('flagbit_faq')->__('Action'),
94
+ 'width' => '50px',
95
+ 'type' => 'action',
96
+ 'getter' => 'getId',
97
+ 'actions' => array (
98
+ array (
99
+ 'caption' => Mage::helper('flagbit_faq')->__('Edit'),
100
+ 'url' => array (
101
+ 'base' => '*/*/edit'
102
+ ),
103
+ 'field' => 'category_id'
104
+ ),
105
+ ),
106
+ 'filter' => false,
107
+ 'sortable' => false,
108
+ 'index' => 'stores',
109
+ 'is_system' => true,
110
+ )
111
+ );
112
+
113
+ return parent::_prepareColumns();
114
+ }
115
+
116
+ /**
117
+ * Helper function to do after load modifications
118
+ *
119
+ */
120
+ protected function _afterLoadCollection()
121
+ {
122
+ $this->getCollection()->walk('afterLoad');
123
+ parent::_afterLoadCollection();
124
+ }
125
+
126
+ /**
127
+ * Helper function to add store filter condition
128
+ *
129
+ * @param Mage_Core_Model_Mysql4_Collection_Abstract $collection Data collection
130
+ * @param Mage_Adminhtml_Block_Widget_Grid_Column $column Column information to be filtered
131
+ */
132
+ protected function _filterStoreCondition($collection, $column)
133
+ {
134
+ if (!$value = $column->getFilter()->getValue()) {
135
+ return;
136
+ }
137
+
138
+ $this->getCollection()->addStoreFilter($value);
139
+ }
140
+
141
+ /**
142
+ * Helper function to reveive on row click url
143
+ *
144
+ * @param Flagbit_Faq_Model_Faq $row Current rows dataset
145
+ * @return string URL for current row's onclick event
146
+ */
147
+ public function getRowUrl($row)
148
+ {
149
+ return $this->getUrl('*/*/edit', array (
150
+ 'category_id' => $row->getCategoryId() ));
151
+ }
152
+
153
+ /**
154
+ * Helper function to receive grid functionality urls for current grid
155
+ *
156
+ * @return string Requested URL
157
+ */
158
+ public function getGridUrl()
159
+ {
160
+ return $this->getUrl(
161
+ '*/*/',
162
+ array (
163
+ '_current' => true,
164
+ )
165
+ );
166
+ }
167
+ }
app/code/community/Flagbit/Faq/Block/Adminhtml/Item.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * FAQ for Magento
4
+ *
5
+ * @category Flagbit
6
+ * @package Flagbit_Faq
7
+ * @copyright Copyright (c) 2009 Flagbit GmbH & Co. KG <magento@flagbit.de>
8
+ */
9
+
10
+ /**
11
+ * FAQ for Magento
12
+ *
13
+ * @category Flagbit
14
+ * @package Flagbit_Faq
15
+ * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
+ */
17
+ class Flagbit_Faq_Block_Adminhtml_Item extends Mage_Adminhtml_Block_Widget_Grid_Container
18
+ {
19
+ /**
20
+ * Constructor for FAQ Adminhtml Block
21
+ */
22
+ public function __construct()
23
+ {
24
+ $this->_blockGroup = 'flagbit_faq';
25
+ $this->_controller = 'adminhtml_item';
26
+ $this->_headerText = Mage::helper('flagbit_faq')->__('Manage FAQ Items');
27
+ $this->_addButtonLabel = Mage::helper('flagbit_faq')->__('Add New FAQ Item');
28
+
29
+ parent::__construct();
30
+ }
31
+
32
+ /**
33
+ * Returns the CSS class for the header
34
+ *
35
+ * Usually 'icon-head' and a more precise class is returned. We return
36
+ * only an empty string to avoid spacing on the left of the header as we
37
+ * don't have an icon.
38
+ *
39
+ * @return string
40
+ */
41
+ public function getHeaderCssClass()
42
+ {
43
+ return '';
44
+ }
45
+ }
app/code/community/Flagbit/Faq/Block/Adminhtml/Item/Edit.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * FAQ for Magento
4
+ *
5
+ * @category Flagbit
6
+ * @package Flagbit_Faq
7
+ * @copyright Copyright (c) 2009 Flagbit GmbH & Co. KG <magento@flagbit.de>
8
+ */
9
+
10
+ /**
11
+ * FAQ for Magento
12
+ *
13
+ * @category Flagbit
14
+ * @package Flagbit_Faq
15
+ * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
+ */
17
+ class Flagbit_Faq_Block_Adminhtml_Item_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
18
+ {
19
+ /**
20
+ * Constructor for the FAQ edit form
21
+ *
22
+ */
23
+ public function __construct()
24
+ {
25
+ $this->_objectId = 'faq_id';
26
+ $this->_blockGroup = 'flagbit_faq';
27
+ $this->_controller = 'adminhtml_item';
28
+
29
+ parent::__construct();
30
+
31
+ $this->_updateButton('save', 'label', Mage::helper('flagbit_faq')->__('Save FAQ item'));
32
+ $this->_updateButton('delete', 'label', Mage::helper('flagbit_faq')->__('Delete FAQ item'));
33
+
34
+ $this->_addButton('saveandcontinue', array (
35
+ 'label' => Mage::helper('flagbit_faq')->__('Save and continue edit'),
36
+ 'onclick' => 'saveAndContinueEdit()',
37
+ 'class' => 'save' ), -100);
38
+
39
+ $this->_formScripts[] = "
40
+ function saveAndContinueEdit(){
41
+ editForm.submit($('edit_form').action+'back/edit/');
42
+ }
43
+ ";
44
+ }
45
+
46
+ /**
47
+ * Helper function to edit the header of the current form
48
+ *
49
+ * @return string Returns an "edit" or "new" text depending on the type of modifications.
50
+ */
51
+ public function getHeaderText()
52
+ {
53
+ if (Mage::registry('faq')->getFaqId()) {
54
+ return Mage::helper('flagbit_faq')->__("Edit FAQ item '%s'", $this->htmlEscape(Mage::registry('faq')->getQuestion()));
55
+ }
56
+ else {
57
+ return Mage::helper('flagbit_faq')->__('New FAQ item');
58
+ }
59
+ }
60
+
61
+ public function getFormActionUrl()
62
+ {
63
+ return $this->getUrl('*/faq/save');
64
+ }
65
+
66
+ /**
67
+ * Returns the CSS class for the header
68
+ *
69
+ * Usually 'icon-head' and a more precise class is returned. We return
70
+ * only an empty string to avoid spacing on the left of the header as we
71
+ * don't have an icon.
72
+ *
73
+ * @return string
74
+ */
75
+ public function getHeaderCssClass()
76
+ {
77
+ return '';
78
+ }
79
+ }
app/code/community/Flagbit/Faq/Block/Adminhtml/Item/Edit/Form.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * FAQ for Magento
4
+ *
5
+ * @category Flagbit
6
+ * @package Flagbit_Faq
7
+ * @copyright Copyright (c) 2009 Flagbit GmbH & Co. KG <magento@flagbit.de>
8
+ */
9
+
10
+ /**
11
+ * FAQ for Magento
12
+ *
13
+ * @category Flagbit
14
+ * @package Flagbit_Faq
15
+ * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
+ */
17
+ class Flagbit_Faq_Block_Adminhtml_Item_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
18
+ {
19
+ /**
20
+ * Preperation of current form
21
+ *
22
+ * @return Flagbit_Faq_Block_Adminhtml_Item_Edit_Form
23
+ */
24
+ protected function _prepareForm()
25
+ {
26
+ $form = new Varien_Data_Form(array (
27
+ 'id' => 'edit_form',
28
+ 'action' => $this->getData('action'),
29
+ 'method' => 'post',
30
+ 'enctype' => 'multipart/form-data' ));
31
+ $form->setUseContainer(true);
32
+ $this->setForm($form);
33
+ return parent::_prepareForm();
34
+ }
35
+ }
app/code/community/Flagbit/Faq/Block/Adminhtml/Item/Edit/Tab/Main.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * FAQ for Magento
4
+ *
5
+ * @category Flagbit
6
+ * @package Flagbit_Faq
7
+ * @copyright Copyright (c) 2009 Flagbit GmbH & Co. KG <magento@flagbit.de>
8
+ */
9
+
10
+ /**
11
+ * FAQ for Magento
12
+ *
13
+ * @category Flagbit
14
+ * @package Flagbit_Faq
15
+ * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
+ */
17
+ class Flagbit_Faq_Block_Adminhtml_Item_Edit_Tab_Main extends Mage_Adminhtml_Block_Widget_Form
18
+ {
19
+ /**
20
+ * Prepares the page layout
21
+ *
22
+ * Loads the WYSIWYG editor on demand if enabled.
23
+ *
24
+ * @return Flagbit_Faq_Block_Admin_Edit
25
+ */
26
+ protected function _prepareLayout()
27
+ {
28
+ $return = parent::_prepareLayout();
29
+ if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
30
+ $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
31
+ }
32
+ return $return;
33
+ }
34
+
35
+ /**
36
+ * Preparation of current form
37
+ *
38
+ * @return Flagbit_Faq_Block_Admin_Edit_Tab_Main Self
39
+ */
40
+ protected function _prepareForm()
41
+ {
42
+ $model = Mage::registry('faq');
43
+
44
+ $form = new Varien_Data_Form();
45
+ $form->setHtmlIdPrefix('faq_');
46
+
47
+ $fieldset = $form->addFieldset('base_fieldset', array (
48
+ 'legend' => Mage::helper('flagbit_faq')->__('General information'),
49
+ 'class' => 'fieldset-wide' ));
50
+
51
+ if ($model->getFaqId()) {
52
+ $fieldset->addField('faq_id', 'hidden', array (
53
+ 'name' => 'faq_id' ));
54
+ }
55
+
56
+ $fieldset->addField('question', 'text', array (
57
+ 'name' => 'question',
58
+ 'label' => Mage::helper('flagbit_faq')->__('FAQ item question'),
59
+ 'title' => Mage::helper('flagbit_faq')->__('FAQ item question'),
60
+ 'required' => true ));
61
+
62
+ /**
63
+ * Check is single store mode
64
+ */
65
+ if (!Mage::app()->isSingleStoreMode()) {
66
+ $fieldset->addField('store_id', 'multiselect',
67
+ array (
68
+ 'name' => 'stores[]',
69
+ 'label' => Mage::helper('cms')->__('Store view'),
70
+ 'title' => Mage::helper('cms')->__('Store view'),
71
+ 'required' => true,
72
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true) ));
73
+ }
74
+ else {
75
+ $fieldset->addField('store_id', 'hidden', array (
76
+ 'name' => 'stores[]',
77
+ 'value' => Mage::app()->getStore(true)->getId() ));
78
+ $model->setStoreId(Mage::app()->getStore(true)->getId());
79
+ }
80
+
81
+ $fieldset->addField('is_active', 'select',
82
+ array (
83
+ 'label' => Mage::helper('cms')->__('Status'),
84
+ 'title' => Mage::helper('flagbit_faq')->__('Item status'),
85
+ 'name' => 'is_active',
86
+ 'required' => true,
87
+ 'options' => array (
88
+ '1' => Mage::helper('cms')->__('Enabled'),
89
+ '0' => Mage::helper('cms')->__('Disabled') ) ));
90
+
91
+ $fieldset->addField('category_id', 'multiselect',
92
+ array (
93
+ 'label' => Mage::helper('flagbit_faq')->__('Category'),
94
+ 'title' => Mage::helper('flagbit_faq')->__('Category'),
95
+ 'name' => 'categories[]',
96
+ 'required' => false,
97
+ 'values' => Mage::getResourceSingleton('flagbit_faq/category_collection')->toOptionArray(),
98
+ )
99
+ );
100
+
101
+ $fieldset->addField('answer', 'editor',
102
+ array (
103
+ 'name' => 'answer',
104
+ 'label' => Mage::helper('flagbit_faq')->__('Content'),
105
+ 'title' => Mage::helper('flagbit_faq')->__('Content'),
106
+ 'style' => 'height:36em;',
107
+ 'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig(),
108
+ 'required' => true ));
109
+
110
+ $fieldset->addField('answer_html', 'select',
111
+ array (
112
+ 'label' => Mage::helper('flagbit_faq')->__('HTML answer'),
113
+ 'title' => Mage::helper('flagbit_faq')->__('HTML answer'),
114
+ 'name' => 'answer_html',
115
+ 'required' => true,
116
+ 'options' => array (
117
+ '1' => Mage::helper('cms')->__('Enabled'),
118
+ '0' => Mage::helper('cms')->__('Disabled') ) ));
119
+
120
+ $form->setValues($model->getData());
121
+ $this->setForm($form);
122
+
123
+ return parent::_prepareForm();
124
+ }
125
+ }
app/code/community/Flagbit/Faq/Block/Adminhtml/Item/Edit/Tabs.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * FAQ for Magento
4
+ *
5
+ * @category Flagbit
6
+ * @package Flagbit_Faq
7
+ * @copyright Copyright (c) 2009 Flagbit GmbH & Co. KG <magento@flagbit.de>
8
+ */
9
+
10
+ /**
11
+ * FAQ for Magento
12
+ *
13
+ * @category Flagbit
14
+ * @package Flagbit_Faq
15
+ * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
+ */
17
+ class Flagbit_Faq_Block_Adminhtml_Item_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
18
+ {
19
+ /**
20
+ * Constructs current object
21
+ *
22
+ */
23
+ public function __construct()
24
+ {
25
+ parent::__construct();
26
+ $this->setId('faq_tabs');
27
+ $this->setDestElementId('edit_form');
28
+ $this->setTitle(Mage::helper('flagbit_faq')->__('FAQ item information'));
29
+ }
30
+
31
+ /**
32
+ * Prepares the page layout
33
+ *
34
+ * Adds the tabs to the left tab menu.
35
+ *
36
+ * @return Flagbit_Faq_Block_Admin_Edit
37
+ */
38
+ protected function _prepareLayout()
39
+ {
40
+ $return = parent::_prepareLayout();
41
+
42
+ $this->addTab(
43
+ 'main_section',
44
+ array(
45
+ 'label' => Mage::helper('flagbit_faq')->__('General information'),
46
+ 'title' => Mage::helper('flagbit_faq')->__('General information'),
47
+ 'content' => $this->getLayout()->createBlock('flagbit_faq/adminhtml_item_edit_tab_main')->toHtml(),
48
+ 'active' => true,
49
+ )
50
+ );
51
+
52
+ return $return;
53
+ }
54
+ }
app/code/community/Flagbit/Faq/Block/Adminhtml/Item/Grid.php ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * FAQ for Magento
4
+ *
5
+ * @category Flagbit
6
+ * @package Flagbit_Faq
7
+ * @copyright Copyright (c) 2009 Flagbit GmbH & Co. KG <magento@flagbit.de>
8
+ */
9
+
10
+ /**
11
+ * FAQ for Magento
12
+ *
13
+ * @category Flagbit
14
+ * @package Flagbit_Faq
15
+ * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
+ */
17
+ class Flagbit_Faq_Block_Adminhtml_Item_Grid extends Mage_Adminhtml_Block_Widget_Grid
18
+ {
19
+ /**
20
+ * Constructor of Grid
21
+ *
22
+ */
23
+ public function __construct()
24
+ {
25
+ parent::__construct();
26
+ $this->setId('faq_grid');
27
+ $this->setUseAjax(false);
28
+ $this->setDefaultSort('creation_time');
29
+ $this->setDefaultDir('DESC');
30
+ $this->setSaveParametersInSession(true);
31
+ }
32
+
33
+ /**
34
+ * Preparation of the data that is displayed by the grid.
35
+ *
36
+ * @return Flagbit_Faq_Block_Admin_Grid Self
37
+ */
38
+ protected function _prepareCollection()
39
+ {
40
+ //TODO: add full name logic
41
+ $collection = Mage::getResourceModel('flagbit_faq/faq_collection');
42
+ $this->setCollection($collection);
43
+ #Mage::Log($collection->getData());
44
+ return parent::_prepareCollection();
45
+ }
46
+
47
+ /**
48
+ * Preparation of the requested columns of the grid
49
+ *
50
+ * @return Flagbit_Faq_Block_Admin_Grid Self
51
+ */
52
+ protected function _prepareColumns()
53
+ {
54
+ $this->addColumn('faq_id', array (
55
+ 'header' => Mage::helper('flagbit_faq')->__('FAQ #'),
56
+ 'width' => '80px',
57
+ 'type' => 'text',
58
+ 'index' => 'faq_id' ));
59
+
60
+ if (!Mage::app()->isSingleStoreMode()) {
61
+ $this->addColumn('store_id',
62
+ array (
63
+ 'header' => Mage::helper('cms')->__('Store view'),
64
+ 'index' => 'store_id',
65
+ 'type' => 'store',
66
+ 'store_all' => true,
67
+ 'store_view' => true,
68
+ 'sortable' => false,
69
+ 'filter_condition_callback' => array (
70
+ $this,
71
+ '_filterStoreCondition' ) ));
72
+ }
73
+
74
+ $this->addColumn('question', array (
75
+ 'header' => Mage::helper('flagbit_faq')->__('Question'),
76
+ 'index' => 'question' ));
77
+
78
+ $this->addColumn('is_active',
79
+ array (
80
+ 'header' => Mage::helper('flagbit_faq')->__('Active'),
81
+ 'index' => 'is_active',
82
+ 'type' => 'options',
83
+ 'width' => '70px',
84
+ 'options' => array (
85
+ 0 => Mage::helper('flagbit_faq')->__('No'),
86
+ 1 => Mage::helper('flagbit_faq')->__('Yes') ) ));
87
+
88
+ $this->addColumn('action',
89
+ array (
90
+ 'header' => Mage::helper('flagbit_faq')->__('Action'),
91
+ 'width' => '50px',
92
+ 'type' => 'action',
93
+ 'getter' => 'getId',
94
+ 'actions' => array (
95
+ array (
96
+ 'caption' => Mage::helper('flagbit_faq')->__('Edit'),
97
+ 'url' => array (
98
+ 'base' => 'adminhtml/faq/edit' ),
99
+ 'field' => 'faq_id' ) ),
100
+ 'filter' => false,
101
+ 'sortable' => false,
102
+ 'index' => 'stores',
103
+ 'is_system' => true ));
104
+
105
+ return parent::_prepareColumns();
106
+ }
107
+
108
+ /**
109
+ * Helper function to do after load modifications
110
+ *
111
+ */
112
+ protected function _afterLoadCollection()
113
+ {
114
+ $this->getCollection()->walk('afterLoad');
115
+ parent::_afterLoadCollection();
116
+ }
117
+
118
+ /**
119
+ * Helper function to add store filter condition
120
+ *
121
+ * @param Mage_Core_Model_Mysql4_Collection_Abstract $collection Data collection
122
+ * @param Mage_Adminhtml_Block_Widget_Grid_Column $column Column information to be filtered
123
+ */
124
+ protected function _filterStoreCondition($collection, $column)
125
+ {
126
+ if (!$value = $column->getFilter()->getValue()) {
127
+ return;
128
+ }
129
+
130
+ $this->getCollection()->addStoreFilter($value);
131
+ }
132
+
133
+ /**
134
+ * Helper function to reveive on row click url
135
+ *
136
+ * @param Flagbit_Faq_Model_Faq $row Current rows dataset
137
+ * @return string URL for current row's onclick event
138
+ */
139
+ public function getRowUrl($row)
140
+ {
141
+ return $this->getUrl('adminhtml/faq/edit', array (
142
+ 'faq_id' => $row->getFaqId() ));
143
+ }
144
+
145
+ /**
146
+ * Helper function to receive grid functionality urls for current grid
147
+ *
148
+ * @return string Requested URL
149
+ */
150
+ public function getGridUrl()
151
+ {
152
+ return $this->getUrl('adminhtml/faq/index', array (
153
+ '_current' => true ));
154
+ }
155
+ }
app/code/community/Flagbit/Faq/Block/Frontend/Detail.php CHANGED
@@ -38,7 +38,7 @@ class Flagbit_Faq_Block_Frontend_Detail extends Mage_Core_Block_Template {
38
  if (!$this->_faq) {
39
  $id = intval($this->getRequest()->getParam('faq'));
40
  try {
41
- $this->_faq = Mage :: getModel('faq/faq')->load($id);
42
 
43
  if ($this->_faq->getIsActive() != 1){
44
  Mage::throwException('Faq Item is not active');
38
  if (!$this->_faq) {
39
  $id = intval($this->getRequest()->getParam('faq'));
40
  try {
41
+ $this->_faq = Mage :: getModel('flagbit_faq/faq')->load($id);
42
 
43
  if ($this->_faq->getIsActive() != 1){
44
  Mage::throwException('Faq Item is not active');
app/code/community/Flagbit/Faq/Block/Frontend/List.php CHANGED
@@ -14,8 +14,8 @@
14
  * @package Flagbit_Faq
15
  * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
  */
17
- class Flagbit_Faq_Block_Frontend_List extends Mage_Core_Block_Template {
18
-
19
  protected $_faqCollection;
20
 
21
  protected function _prepareLayout()
@@ -31,11 +31,12 @@ class Flagbit_Faq_Block_Frontend_List extends Mage_Core_Block_Template {
31
  * @param int $pageSize
32
  * @return Flagbit_Faq_Model_Mysql_Faq_Collection collection of current FAQ entries
33
  */
34
- public function getFaqCollection($pageSize = null) {
 
35
  if (!$this->_faqCollection || (intval($pageSize) > 0
36
  && $this->_faqCollection->getSize() != intval($pageSize))
37
  ) {
38
- $this->_faqCollection = Mage :: getModel('faq/faq')
39
  ->getCollection()
40
  ->addStoreFilter(Mage :: app()->getStore())
41
  ->addIsActiveFilter();
@@ -48,18 +49,46 @@ class Flagbit_Faq_Block_Frontend_List extends Mage_Core_Block_Template {
48
  return $this->_faqCollection;
49
  }
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
  /**
53
  * Simple helper function to determine, whether there are FAQ entries or not.
54
  *
55
  * @return boolean True, if FAQ are given.
56
  */
57
- public function hasFaq() {
 
58
  return $this->getFaqCollection()->getSize() > 0;
59
  }
60
 
61
-
62
- public function getIntro($faqItem) {
63
  $_intro = strip_tags($faqItem->getContent());
64
  $_intro = mb_substr($_intro, 0, mb_strpos($_intro, "\n"));
65
 
@@ -75,7 +104,6 @@ class Flagbit_Faq_Block_Frontend_List extends Mage_Core_Block_Template {
75
  return $_intro;
76
  }
77
 
78
-
79
  /**
80
  * Returns
81
  *
@@ -85,13 +113,12 @@ class Flagbit_Faq_Block_Frontend_List extends Mage_Core_Block_Template {
85
  {
86
  if(is_null($this->_faqJumplist))
87
  {
88
- $this->_faqJumplist = Mage::helper('faq/jumplist');
89
  $this->_faqJumplist->setFaqItems($this->getFaqCollection());
90
  }
91
  return $this->_faqJumplist;
92
  }
93
 
94
-
95
  /**
96
  * Simple helper function to determine, whether we should display a jumplist or not.
97
  *
@@ -102,9 +129,8 @@ class Flagbit_Faq_Block_Frontend_List extends Mage_Core_Block_Template {
102
  return count($this->getFaqJumplist()) > 0;
103
  }
104
 
105
-
106
-
107
- public function encodeQuestionForUrl($question) {
108
  return urlencode(
109
  trim(
110
  str_replace(
@@ -115,4 +141,4 @@ class Flagbit_Faq_Block_Frontend_List extends Mage_Core_Block_Template {
115
  )
116
  );
117
  }
118
- }
14
  * @package Flagbit_Faq
15
  * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
  */
17
+ class Flagbit_Faq_Block_Frontend_List extends Mage_Core_Block_Template
18
+ {
19
  protected $_faqCollection;
20
 
21
  protected function _prepareLayout()
31
  * @param int $pageSize
32
  * @return Flagbit_Faq_Model_Mysql_Faq_Collection collection of current FAQ entries
33
  */
34
+ public function getFaqCollection($pageSize = null)
35
+ {
36
  if (!$this->_faqCollection || (intval($pageSize) > 0
37
  && $this->_faqCollection->getSize() != intval($pageSize))
38
  ) {
39
+ $this->_faqCollection = Mage :: getModel('flagbit_faq/faq')
40
  ->getCollection()
41
  ->addStoreFilter(Mage :: app()->getStore())
42
  ->addIsActiveFilter();
49
  return $this->_faqCollection;
50
  }
51
 
52
+ /**
53
+ * Returns all active categories
54
+ *
55
+ * @return Flagbit_Faq_Model_Mysql4_Category_Collection
56
+ */
57
+ public function getCategoryCollection()
58
+ {
59
+ $categories = $this->getData('category_collection');
60
+ if (is_null($categories)) {
61
+ $categories = Mage::getResourceSingleton('flagbit_faq/category_collection')
62
+ ->addStoreFilter(Mage::app()->getStore())
63
+ ->addIsActiveFilter();
64
+ $this->setData('category_collection', $categories);
65
+ }
66
+ return $categories;
67
+ }
68
+
69
+ /**
70
+ * Returns the item collection for the given category
71
+ *
72
+ * @param Flagbit_Faq_Model_Category $category
73
+ * @return Flagbit_Faq_Model_Mysql4_Faq_Collection
74
+ */
75
+ public function getItemCollectionByCategory(Flagbit_Faq_Model_Category $category)
76
+ {
77
+ return $category->getItemCollection()->addIsActiveFilter()->addStoreFilter(Mage::app()->getStore());
78
+ }
79
 
80
  /**
81
  * Simple helper function to determine, whether there are FAQ entries or not.
82
  *
83
  * @return boolean True, if FAQ are given.
84
  */
85
+ public function hasFaq()
86
+ {
87
  return $this->getFaqCollection()->getSize() > 0;
88
  }
89
 
90
+ public function getIntro($faqItem)
91
+ {
92
  $_intro = strip_tags($faqItem->getContent());
93
  $_intro = mb_substr($_intro, 0, mb_strpos($_intro, "\n"));
94
 
104
  return $_intro;
105
  }
106
 
 
107
  /**
108
  * Returns
109
  *
113
  {
114
  if(is_null($this->_faqJumplist))
115
  {
116
+ $this->_faqJumplist = Mage::helper('flagbit_faq/jumplist');
117
  $this->_faqJumplist->setFaqItems($this->getFaqCollection());
118
  }
119
  return $this->_faqJumplist;
120
  }
121
 
 
122
  /**
123
  * Simple helper function to determine, whether we should display a jumplist or not.
124
  *
129
  return count($this->getFaqJumplist()) > 0;
130
  }
131
 
132
+ public function encodeQuestionForUrl($question)
133
+ {
 
134
  return urlencode(
135
  trim(
136
  str_replace(
141
  )
142
  );
143
  }
144
+ }
app/code/community/Flagbit/Faq/Helper/Data.php CHANGED
@@ -16,17 +16,16 @@
16
  */
17
  class Flagbit_Faq_Helper_Data extends Mage_Core_Helper_Abstract
18
  {
19
-
20
- /**
21
- * Returns config data
22
- *
23
- * @param string $field Requested field
24
- * @return array config Configuration information
25
- */
26
- public function getConfigData($field)
27
  {
28
- $path = 'faq/config/'.$field;
29
- $config = Mage::getStoreConfig($path, Mage::app()->getStore());
30
  return $config;
31
- }
32
- }
16
  */
17
  class Flagbit_Faq_Helper_Data extends Mage_Core_Helper_Abstract
18
  {
19
+ /**
20
+ * Returns config data
21
+ *
22
+ * @param string $field Requested field
23
+ * @return array config Configuration information
24
+ */
25
+ public function getConfigData($field)
 
26
  {
27
+ $path = 'faq/config/' . $field;
28
+ $config = Mage::getStoreConfig($path, Mage::app()->getStore());
29
  return $config;
30
+ }
31
+ }
app/code/community/Flagbit/Faq/Model/Category.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * FAQ for Magento
4
+ *
5
+ * @category Flagbit
6
+ * @package Flagbit_Faq
7
+ * @copyright Copyright (c) 2010 Flagbit GmbH & Co. KG <magento@flagbit.de>
8
+ */
9
+
10
+ /**
11
+ * Category Model for FAQ Items
12
+ *
13
+ * @category Flagbit
14
+ * @package Flagbit_Faq
15
+ * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
+ */
17
+ class Flagbit_Faq_Model_Category extends Mage_Core_Model_Abstract
18
+ {
19
+ /**
20
+ * Constructor
21
+ */
22
+ protected function _construct()
23
+ {
24
+ $this->_init('flagbit_faq/category');
25
+ }
26
+
27
+ public function getName()
28
+ {
29
+ return $this->getCategoryName();
30
+ }
31
+
32
+ public function getItemCollection()
33
+ {
34
+ $collection = $this->getData('item_collection');
35
+ if (is_null($collection)) {
36
+ $collection = Mage::getSingleton('flagbit_faq/faq')->getCollection()
37
+ ->addCategoryFilter($this);
38
+ $this->setData('item_collection', $collection);
39
+ }
40
+ return $collection;
41
+ }
42
+ }
app/code/community/Flagbit/Faq/Model/Faq.php CHANGED
@@ -14,16 +14,13 @@
14
  * @package Flagbit_Faq
15
  * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
  */
17
- class Flagbit_Faq_Model_Faq extends Mage_Core_Model_Abstract {
18
-
19
-
20
- /**
21
- * Constructor
22
- *
23
- */
24
- protected function _construct() {
25
-
26
- $this->_init('faq/faq');
27
- }
28
-
29
- }
14
  * @package Flagbit_Faq
15
  * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
  */
17
+ class Flagbit_Faq_Model_Faq extends Mage_Core_Model_Abstract
18
+ {
19
+ /**
20
+ * Constructor
21
+ */
22
+ protected function _construct()
23
+ {
24
+ $this->_init('flagbit_faq/faq');
25
+ }
26
+ }
 
 
 
app/code/community/Flagbit/Faq/Model/Mysql4/Category.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * FAQ for Magento
4
+ *
5
+ * @category Flagbit
6
+ * @package Flagbit_Faq
7
+ * @copyright Copyright (c) 2009 Flagbit GmbH & Co. KG <magento@flagbit.de>
8
+ */
9
+
10
+ /**
11
+ * Category Resource Model for FAQ Items
12
+ *
13
+ * @category Flagbit
14
+ * @package Flagbit_Faq
15
+ * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
+ */
17
+ class Flagbit_Faq_Model_Mysql4_Category extends Mage_Core_Model_Mysql4_Abstract
18
+ {
19
+ /**
20
+ * Constructor
21
+ */
22
+ protected function _construct()
23
+ {
24
+ $this->_init('flagbit_faq/category', 'category_id');
25
+ }
26
+
27
+ /**
28
+ * Retrieve select object for load object data
29
+ *
30
+ * @param string $field
31
+ * @param mixed $value
32
+ * @return Zend_Db_Select
33
+ */
34
+ protected function _getLoadSelect($field, $value, $object)
35
+ {
36
+ $select = parent::_getLoadSelect($field, $value, $object);
37
+
38
+ if ($object->getStoreId()) {
39
+ $select->join(
40
+ array('nns' => $this->getTable('flagbit_faq/category_store')),
41
+ $this->getMainTable() . '.item_id = `nns`.category_id'
42
+ )->where('is_active=1 AND `nns`.store_id in (0, ?) ',
43
+ $object->getStoreId())->order('creation_time DESC')->limit(1);
44
+ }
45
+ return $select;
46
+ }
47
+
48
+ /**
49
+ * Sets the creation and update timestamps
50
+ *
51
+ * @param Mage_Core_Model_Abstract $object Current faq category
52
+ * @return Flagbit_Faq_Model_Mysql4_Category
53
+ */
54
+ protected function _beforeSave(Mage_Core_Model_Abstract $object)
55
+ {
56
+ if (!$object->getId()) {
57
+ $object->setCreationTime(Mage::getSingleton('core/date')->gmtDate());
58
+ }
59
+ $object->setUpdateTime(Mage::getSingleton('core/date')->gmtDate());
60
+
61
+ return parent::_beforeSave($object);
62
+ }
63
+
64
+ /**
65
+ * Assign page to store views
66
+ *
67
+ * @param Mage_Core_Model_Abstract $object
68
+ */
69
+ protected function _afterSave(Mage_Core_Model_Abstract $object)
70
+ {
71
+ $condition = $this->_getWriteAdapter()->quoteInto('category_id = ?', $object->getId());
72
+ $this->_getWriteAdapter()->delete($this->getTable('flagbit_faq/category_store'), $condition);
73
+
74
+ foreach ((array) $object->getData('stores') as $store) {
75
+ $storeArray = array ();
76
+ $storeArray['category_id'] = $object->getId();
77
+ $storeArray['store_id'] = $store;
78
+ $this->_getWriteAdapter()->insert(
79
+ $this->getTable('flagbit_faq/category_store'), $storeArray
80
+ );
81
+ }
82
+
83
+ return parent::_afterSave($object);
84
+ }
85
+
86
+ /**
87
+ * Do store processing after loading
88
+ *
89
+ * @param Mage_Core_Model_Abstract $object Current faq item
90
+ */
91
+ protected function _afterLoad(Mage_Core_Model_Abstract $object)
92
+ {
93
+ $select = $this->_getReadAdapter()->select()->from(
94
+ $this->getTable('flagbit_faq/category_store')
95
+ )->where('category_id = ?', $object->getId());
96
+
97
+ if ($data = $this->_getReadAdapter()->fetchAll($select)) {
98
+ $storesArray = array ();
99
+ foreach ($data as $row) {
100
+ $storesArray[] = $row['store_id'];
101
+ }
102
+ $object->setData('store_id', $storesArray);
103
+ }
104
+
105
+ return parent::_afterLoad($object);
106
+ }
107
+ }
app/code/community/Flagbit/Faq/Model/Mysql4/Category/Collection.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * FAQ for Magento
4
+ *
5
+ * @category Flagbit
6
+ * @package Flagbit_Faq
7
+ * @copyright Copyright (c) 2009 Flagbit GmbH & Co. KG <magento@flagbit.de>
8
+ */
9
+
10
+ /**
11
+ * FAQ for Magento
12
+ *
13
+ * @category Flagbit
14
+ * @package Flagbit_Faq
15
+ * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
+ */
17
+ class Flagbit_Faq_Model_Mysql4_Category_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
18
+ {
19
+ protected $_previewFlag;
20
+
21
+ /**
22
+ * Constructor
23
+ *
24
+ */
25
+ protected function _construct()
26
+ {
27
+ $this->_init('flagbit_faq/category');
28
+ }
29
+
30
+ /**
31
+ * Add Filter by store
32
+ *
33
+ * @param int|Mage_Core_Model_Store $store Store to be filtered
34
+ * @return Flagbit_Faq_Model_Mysql4_Category_Collection
35
+ */
36
+ public function addStoreFilter($store)
37
+ {
38
+ if ($store instanceof Mage_Core_Model_Store) {
39
+ $store = array($store->getId());
40
+ }
41
+
42
+ $this->getSelect()->join(
43
+ array('store_table' => $this->getTable('flagbit_faq/category_store')),
44
+ 'main_table.category_id = store_table.category_id',
45
+ array ()
46
+ )->where('store_table.store_id in (?)', array (
47
+ 0,
48
+ $store
49
+ ))->group('main_table.category_id');
50
+
51
+ return $this;
52
+ }
53
+
54
+
55
+ /**
56
+ * After load processing - adds store information to the datasets
57
+ *
58
+ */
59
+ protected function _afterLoad()
60
+ {
61
+ if ($this->_previewFlag) {
62
+ $items = $this->getColumnValues('faq_id');
63
+ if (count($items)) {
64
+ $select = $this->getConnection()->select()->from(
65
+ $this->getTable('flagbit_faq/category_store')
66
+ )->where(
67
+ $this->getTable('flagbit_faq/category_store') . '.category_id IN (?)',
68
+ $items
69
+ );
70
+ if ($result = $this->getConnection()->fetchPairs($select)) {
71
+ foreach ($this as $item) {
72
+ if (!isset($result[$item->getData('category_id')])) {
73
+ continue;
74
+ }
75
+ if ($result[$item->getData('category_id')] == 0) {
76
+ $stores = Mage::app()->getStores(false, true);
77
+ $storeId = current($stores)->getId();
78
+ $storeCode = key($stores);
79
+ }
80
+ else {
81
+ $storeId = $result[$item->getData('category_id')];
82
+ $storeCode = Mage::app()->getStore($storeId)->getCode();
83
+ }
84
+ $item->setData('_first_store_id', $storeId);
85
+ $item->setData('store_code', $storeCode);
86
+ }
87
+ }
88
+ }
89
+ }
90
+
91
+ parent::_afterLoad();
92
+ }
93
+
94
+ protected function _toOptionArray($valueField = 'category_id', $labelField = 'category_name', $additional = array())
95
+ {
96
+ return parent::_toOptionArray($valueField, $labelField, $additional);
97
+ }
98
+
99
+ protected function _toOptionHash($valueField = 'category_id', $labelField='category_name')
100
+ {
101
+ return parent::_toOptionHash($valueField, $labelField);
102
+ }
103
+
104
+ public function addIsActiveFilter()
105
+ {
106
+ $this->addFilter('is_active', 1);
107
+ return $this;
108
+ }
109
+ }
app/code/community/Flagbit/Faq/Model/Mysql4/Faq.php CHANGED
@@ -23,7 +23,7 @@ class Flagbit_Faq_Model_Mysql4_Faq extends Mage_Core_Model_Mysql4_Abstract {
23
  */
24
  protected function _construct() {
25
 
26
- $this->_init('faq/faq', 'faq_id');
27
  }
28
 
29
 
@@ -36,15 +36,16 @@ class Flagbit_Faq_Model_Mysql4_Faq extends Mage_Core_Model_Mysql4_Abstract {
36
  */
37
  protected function _getLoadSelect($field, $value, $object) {
38
 
39
- $select = parent :: _getLoadSelect($field, $value, $object);
40
 
41
  if ($object->getStoreId()) {
42
  $select->join(
43
- array('nns' => $this->getTable('faq/faq_store')),
44
  $this->getMainTable() . '.item_id = `nns`.faq_id'
45
  )->where('is_active=1 AND `nns`.store_id in (0, ?) ',
46
  $object->getStoreId())->order('creation_time DESC')->limit(1);
47
  }
 
48
  return $select;
49
  }
50
 
@@ -76,33 +77,45 @@ class Flagbit_Faq_Model_Mysql4_Faq extends Mage_Core_Model_Mysql4_Abstract {
76
  *
77
  * @param Mage_Core_Model_Abstract $object
78
  */
79
- protected function _afterSave(Mage_Core_Model_Abstract $object) {
80
-
81
  $condition = $this->_getWriteAdapter()->quoteInto('faq_id = ?', $object->getId());
82
- $this->_getWriteAdapter()->delete($this->getTable('faq/faq_store'), $condition);
83
 
 
 
84
  foreach ((array) $object->getData('stores') as $store) {
85
  $storeArray = array ();
86
  $storeArray['faq_id'] = $object->getId();
87
  $storeArray['store_id'] = $store;
88
  $this->_getWriteAdapter()->insert(
89
- $this->getTable('faq/faq_store'), $storeArray
90
  );
91
  }
92
 
93
- return parent :: _afterSave($object);
 
 
 
 
 
 
 
 
 
 
 
94
  }
95
 
96
-
97
  /**
98
- * Do some processing after loading (stores and images)
99
  *
100
  * @param Mage_Core_Model_Abstract $object Current faq item
101
  */
102
- protected function _afterLoad(Mage_Core_Model_Abstract $object) {
103
-
 
104
  $select = $this->_getReadAdapter()->select()->from(
105
- $this->getTable('faq/faq_store')
106
  )->where('faq_id = ?', $object->getId());
107
 
108
  if ($data = $this->_getReadAdapter()->fetchAll($select)) {
@@ -113,14 +126,19 @@ class Flagbit_Faq_Model_Mysql4_Faq extends Mage_Core_Model_Mysql4_Abstract {
113
  $object->setData('store_id', $storesArray);
114
  }
115
 
116
- $images = trim($object->getData('image'));
117
- if ($images && !empty($images)) {
118
- $object->setData('image', explode(',', $images));
119
- }
120
- else {
121
- $object->setData('image', null);
122
- }
123
-
124
- return parent :: _afterLoad($object);
 
 
 
 
 
125
  }
126
  }
23
  */
24
  protected function _construct() {
25
 
26
+ $this->_init('flagbit_faq/faq', 'faq_id');
27
  }
28
 
29
 
36
  */
37
  protected function _getLoadSelect($field, $value, $object) {
38
 
39
+ $select = parent::_getLoadSelect($field, $value, $object);
40
 
41
  if ($object->getStoreId()) {
42
  $select->join(
43
+ array('nns' => $this->getTable('flagbit_faq/faq_store')),
44
  $this->getMainTable() . '.item_id = `nns`.faq_id'
45
  )->where('is_active=1 AND `nns`.store_id in (0, ?) ',
46
  $object->getStoreId())->order('creation_time DESC')->limit(1);
47
  }
48
+
49
  return $select;
50
  }
51
 
77
  *
78
  * @param Mage_Core_Model_Abstract $object
79
  */
80
+ protected function _afterSave(Mage_Core_Model_Abstract $object)
81
+ {
82
  $condition = $this->_getWriteAdapter()->quoteInto('faq_id = ?', $object->getId());
 
83
 
84
+ // process faq item to store relation
85
+ $this->_getWriteAdapter()->delete($this->getTable('flagbit_faq/faq_store'), $condition);
86
  foreach ((array) $object->getData('stores') as $store) {
87
  $storeArray = array ();
88
  $storeArray['faq_id'] = $object->getId();
89
  $storeArray['store_id'] = $store;
90
  $this->_getWriteAdapter()->insert(
91
+ $this->getTable('flagbit_faq/faq_store'), $storeArray
92
  );
93
  }
94
 
95
+ // process faq item to category relation
96
+ $this->_getWriteAdapter()->delete($this->getTable('flagbit_faq/category_item'), $condition);
97
+ foreach ((array) $object->getData('categories') as $categoryId) {
98
+ $categoryArray = array ();
99
+ $categoryArray['faq_id'] = $object->getId();
100
+ $categoryArray['category_id'] = $categoryId;
101
+ $this->_getWriteAdapter()->insert(
102
+ $this->getTable('flagbit_faq/category_item'), $categoryArray
103
+ );
104
+ }
105
+
106
+ return parent::_afterSave($object);
107
  }
108
 
 
109
  /**
110
+ * Do store and category processing after loading
111
  *
112
  * @param Mage_Core_Model_Abstract $object Current faq item
113
  */
114
+ protected function _afterLoad(Mage_Core_Model_Abstract $object)
115
+ {
116
+ // process faq item to store relation
117
  $select = $this->_getReadAdapter()->select()->from(
118
+ $this->getTable('flagbit_faq/faq_store')
119
  )->where('faq_id = ?', $object->getId());
120
 
121
  if ($data = $this->_getReadAdapter()->fetchAll($select)) {
126
  $object->setData('store_id', $storesArray);
127
  }
128
 
129
+ // process faq item to category relation
130
+ $select = $this->_getReadAdapter()->select()->from(
131
+ $this->getTable('flagbit_faq/category_item')
132
+ )->where('faq_id = ?', $object->getId());
133
+
134
+ if ($data = $this->_getReadAdapter()->fetchAll($select)) {
135
+ $categoryArray = array ();
136
+ foreach ($data as $row) {
137
+ $categoryArray[] = $row['category_id'];
138
+ }
139
+ $object->setData('category_id', $categoryArray);
140
+ }
141
+
142
+ return parent::_afterLoad($object);
143
  }
144
  }
app/code/community/Flagbit/Faq/Model/Mysql4/Faq/Collection.php CHANGED
@@ -14,102 +14,123 @@
14
  * @package Flagbit_Faq
15
  * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
  */
17
- class Flagbit_Faq_Model_Mysql4_Faq_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
 
 
18
 
19
- protected $_previewFlag;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
- /**
23
- * Constructor
24
- *
25
- */
26
- protected function _construct() {
27
-
28
- $this->_init('faq/faq')
29
- ->setOrder('question', 'ASC');
30
- }
31
-
32
-
33
- /**
34
- * Creates an options array for grid filter functionality
35
- *
36
- * @return array Options array
37
- */
38
- public function toOptionArray() {
39
-
40
- return $this->_toOptionArray('faq_id', 'question');
41
- }
42
-
43
-
44
- public function addIsActiveFilter(){
45
- $this->addFilter('is_active', 1);
46
-
47
- return $this;
48
- }
49
-
50
-
51
- /**
52
- * Add Filter by store
53
- *
54
- * @param int|Mage_Core_Model_Store $store Store to be filtered
55
- * @return Flagbit_Faq_Model_Mysql4_Faq_Collection Self
56
- */
57
- public function addStoreFilter($store) {
58
-
59
- if ($store instanceof Mage_Core_Model_Store) {
60
- $store = array (
61
- $store->getId() );
62
- }
63
-
64
- $this->getSelect()->join(
65
- array('store_table' => $this->getTable('faq/faq_store')),
66
- 'main_table.faq_id = store_table.faq_id',
67
- array ()
68
- )->where('store_table.store_id in (?)', array (
69
- 0,
70
- $store
71
- ))->group('main_table.faq_id');
72
-
73
- return $this;
74
- }
75
-
76
-
77
- /**
78
- * After load processing - adds store information to the datasets
79
- *
80
- */
81
- protected function _afterLoad() {
82
-
83
- if ($this->_previewFlag) {
84
- $items = $this->getColumnValues('faq_id');
85
- if (count($items)) {
86
- $select = $this->getConnection()->select()->from(
87
- $this->getTable('faq/faq_store')
88
- )->where(
89
- $this->getTable('faq/faq_store') . '.faq_id IN (?)',
90
- $items
91
- );
92
- if ($result = $this->getConnection()->fetchPairs($select)) {
93
- foreach ($this as $item) {
94
- if (!isset($result[$item->getData('faq_id')])) {
95
- continue;
96
- }
97
- if ($result[$item->getData('faq_id')] == 0) {
98
- $stores = Mage :: app()->getStores(false, true);
99
- $storeId = current($stores)->getId();
100
- $storeCode = key($stores);
101
- }
102
- else {
103
- $storeId = $result[$item->getData('faq_id')];
104
- $storeCode = Mage :: app()->getStore($storeId)->getCode();
105
- }
106
- $item->setData('_first_store_id', $storeId);
107
- $item->setData('store_code', $storeCode);
108
- }
109
- }
110
- }
111
- }
112
-
113
- parent :: _afterLoad();
114
- }
115
- }
14
  * @package Flagbit_Faq
15
  * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
  */
17
+ class Flagbit_Faq_Model_Mysql4_Faq_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
18
+ {
19
+ protected $_previewFlag;
20
 
21
+ /**
22
+ * Constructor
23
+ *
24
+ */
25
+ protected function _construct()
26
+ {
27
+ $this->_init('flagbit_faq/faq')
28
+ ->setOrder('question', 'ASC');
29
+ }
30
+
31
+ /**
32
+ * Creates an options array for grid filter functionality
33
+ *
34
+ * @return array Options array
35
+ */
36
+ public function toOptionArray()
37
+ {
38
+ return $this->_toOptionArray('faq_id', 'question');
39
+ }
40
 
41
+ public function addIsActiveFilter()
42
+ {
43
+ $this->addFilter('is_active', 1);
44
+ return $this;
45
+ }
46
+
47
+ /**
48
+ * Add Filter by category
49
+ *
50
+ * @param int|Flagbit_Faq_Model_Category $category Category to be filtered
51
+ * @return Flagbit_Faq_Model_Mysql4_Category_Collection
52
+ */
53
+ public function addCategoryFilter($category)
54
+ {
55
+ if ($category instanceof Flagbit_Faq_Model_Category) {
56
+ $category = array($category->getId());
57
+ }
58
+
59
+ $this->getSelect()->join(
60
+ array('category_table' => $this->getTable('flagbit_faq/category_item')),
61
+ 'main_table.faq_id = category_table.faq_id',
62
+ array ()
63
+ )->where('category_table.category_id in (?)', array (
64
+ 0,
65
+ $category
66
+ ))->group('main_table.faq_id');
67
+
68
+ return $this;
69
+ }
70
+
71
+ /**
72
+ * Add Filter by store
73
+ *
74
+ * @param int|Mage_Core_Model_Store $store Store to be filtered
75
+ * @return Flagbit_Faq_Model_Mysql4_Faq_Collection Self
76
+ */
77
+ public function addStoreFilter($store)
78
+ {
79
+ if ($store instanceof Mage_Core_Model_Store) {
80
+ $store = array (
81
+ $store->getId()
82
+ );
83
+ }
84
+
85
+ $this->getSelect()->join(
86
+ array('store_table' => $this->getTable('flagbit_faq/faq_store')),
87
+ 'main_table.faq_id = store_table.faq_id',
88
+ array ()
89
+ )->where('store_table.store_id in (?)', array (
90
+ 0,
91
+ $store
92
+ ))->group('main_table.faq_id');
93
+
94
+ return $this;
95
+ }
96
 
97
+
98
+ /**
99
+ * After load processing - adds store information to the datasets
100
+ *
101
+ */
102
+ protected function _afterLoad()
103
+ {
104
+ if ($this->_previewFlag) {
105
+ $items = $this->getColumnValues('faq_id');
106
+ if (count($items)) {
107
+ $select = $this->getConnection()->select()->from(
108
+ $this->getTable('flagbit_faq/faq_store')
109
+ )->where(
110
+ $this->getTable('flagbit_faq/faq_store') . '.faq_id IN (?)',
111
+ $items
112
+ );
113
+ if ($result = $this->getConnection()->fetchPairs($select)) {
114
+ foreach ($this as $item) {
115
+ if (!isset($result[$item->getData('faq_id')])) {
116
+ continue;
117
+ }
118
+ if ($result[$item->getData('faq_id')] == 0) {
119
+ $stores = Mage::app()->getStores(false, true);
120
+ $storeId = current($stores)->getId();
121
+ $storeCode = key($stores);
122
+ }
123
+ else {
124
+ $storeId = $result[$item->getData('faq_id')];
125
+ $storeCode = Mage::app()->getStore($storeId)->getCode();
126
+ }
127
+ $item->setData('_first_store_id', $storeId);
128
+ $item->setData('store_code', $storeCode);
129
+ }
130
+ }
131
+ }
132
+ }
133
+
134
+ parent::_afterLoad();
135
+ }
136
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Flagbit/Faq/controllers/Adminhtml/Faq/CategoryController.php ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * FAQ for Magento
4
+ *
5
+ * @category Flagbit
6
+ * @package Flagbit_Faq
7
+ * @copyright Copyright (c) 2009 Flagbit GmbH & Co. KG <magento@flagbit.de>
8
+ */
9
+
10
+ /**
11
+ * FAQ for Magento
12
+ *
13
+ * @category Flagbit
14
+ * @package Flagbit_Faq
15
+ * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
+ */
17
+ class Flagbit_Faq_Adminhtml_Faq_CategoryController extends Mage_Adminhtml_Controller_Action
18
+ {
19
+ /**
20
+ * Initialization of current view - add's breadcrumps and the current menu status
21
+ *
22
+ * @return Flagbit_Faq_AdminController
23
+ */
24
+ protected function _initAction()
25
+ {
26
+ $this->_usedModuleName = 'flagbit_faq';
27
+
28
+ $this->loadLayout()
29
+ ->_setActiveMenu('cms/faq')
30
+ ->_addBreadcrumb($this->__('CMS'), $this->__('CMS'))
31
+ ->_addBreadcrumb($this->__('FAQ'), $this->__('FAQ'));
32
+
33
+ return $this;
34
+ }
35
+
36
+ /**
37
+ * Displays the FAQ overview grid.
38
+ *
39
+ */
40
+ public function indexAction()
41
+ {
42
+ $this->_initAction()
43
+ ->_addContent($this->getLayout()->createBlock('flagbit_faq/adminhtml_category'))
44
+ ->renderLayout();
45
+ }
46
+
47
+ /**
48
+ * Displays the new FAQ item form
49
+ */
50
+ public function newAction()
51
+ {
52
+ $this->_forward('edit');
53
+ }
54
+
55
+ /**
56
+ * Displays the new FAQ item form or the edit FAQ item form.
57
+ */
58
+ public function editAction()
59
+ {
60
+ $id = $this->getRequest()->getParam('category_id');
61
+ $model = Mage::getModel('flagbit_faq/category');
62
+
63
+ // if current id given -> try to load and edit current FAQ category
64
+ if ($id) {
65
+ $model->load($id);
66
+ if (!$model->getId()) {
67
+ Mage::getSingleton('adminhtml/session')->addError(
68
+ Mage::helper('flagbit_faq')->__('This FAQ category no longer exists')
69
+ );
70
+ $this->_redirect('*/*/');
71
+ return;
72
+ }
73
+ }
74
+
75
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
76
+ if (!empty($data)) {
77
+ $model->setData($data);
78
+ }
79
+
80
+ Mage::register('faq_category', $model);
81
+
82
+ $this->_initAction()
83
+ ->_addBreadcrumb(
84
+ $id
85
+ ? Mage::helper('flagbit_faq')->__('Edit FAQ Category')
86
+ : Mage::helper('flagbit_faq')->__('New FAQ Category'),
87
+ $id
88
+ ? Mage::helper('flagbit_faq')->__('Edit FAQ Category')
89
+ : Mage::helper('flagbit_faq')->__('New FAQ Category')
90
+ )
91
+ ->_addContent(
92
+ $this->getLayout()
93
+ ->createBlock('flagbit_faq/adminhtml_category_edit')
94
+ ->setData('action', $this->getUrl('*/*/save'))
95
+ )
96
+ ->_addLeft($this->getLayout()->createBlock('flagbit_faq/adminhtml_category_edit_tabs'));
97
+
98
+ $this->renderLayout();
99
+ }
100
+
101
+ /**
102
+ * Action that does the actual saving process and redirects back to overview
103
+ */
104
+ public function saveAction()
105
+ {
106
+ // check if data sent
107
+ if ($data = $this->getRequest()->getPost()) {
108
+
109
+ // init model and set data
110
+ $model = Mage::getModel('flagbit_faq/category');
111
+ $model->setData($data);
112
+
113
+ // try to save it
114
+ try {
115
+ // save the data
116
+ $model->save();
117
+
118
+ // display success message
119
+ Mage::getSingleton('adminhtml/session')->addSuccess(
120
+ Mage::helper('flagbit_faq')->__('FAQ Category was successfully saved')
121
+ );
122
+ // clear previously saved data from session
123
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
124
+ // check if 'Save and Continue'
125
+ if ($this->getRequest()->getParam('back')) {
126
+ $this->_redirect('*/*/edit', array (
127
+ 'category_id' => $model->getId() ));
128
+ return;
129
+ }
130
+ }
131
+ catch (Exception $e) {
132
+ // display error message
133
+ Mage::getSingleton('adminhtml/session')->addException($e, $e->getMessage());
134
+ // save data in session
135
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
136
+ // redirect to edit form
137
+ $this->_redirect('*/*/edit', array (
138
+ 'category_id' => $this->getRequest()->getParam('category_id') ));
139
+ return;
140
+ }
141
+ }
142
+ $this->_redirect('*/*/');
143
+ }
144
+
145
+ /**
146
+ * Action that does the actual saving process and redirects back to overview
147
+ */
148
+ public function deleteAction()
149
+ {
150
+ // check if we know what should be deleted
151
+ if ($id = $this->getRequest()->getParam('category_id')) {
152
+ try {
153
+ // init model and delete
154
+ $model = Mage::getModel('flagbit_faq/category');
155
+ $model->load($id);
156
+ $model->delete();
157
+
158
+ // display success message
159
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('flagbit_faq')->__('FAQ Category was successfully deleted'));
160
+
161
+ // go to grid
162
+ $this->_redirect('*/*/');
163
+ return;
164
+
165
+ }
166
+ catch (Exception $e) {
167
+ // display error message
168
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
169
+
170
+ // go back to edit form
171
+ $this->_redirect('*/*/edit', array (
172
+ 'category_id' => $id ));
173
+ return;
174
+ }
175
+ }
176
+
177
+ // display error message
178
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('flagbit_faq')->__('Unable to find a FAQ Category to delete'));
179
+
180
+ // go to grid
181
+ $this->_redirect('*/*/');
182
+ }
183
+
184
+ /**
185
+ * Simple access control
186
+ *
187
+ * @return boolean True if user is allowed to edit FAQ
188
+ */
189
+ protected function _isAllowed()
190
+ {
191
+ return Mage::getSingleton('admin/session')->isAllowed('admin/cms/faq');
192
+ }
193
+ }
app/code/community/Flagbit/Faq/controllers/{AdminController.php → Adminhtml/FaqController.php} RENAMED
@@ -14,16 +14,16 @@
14
  * @package Flagbit_Faq
15
  * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
  */
17
-
18
- class Flagbit_Faq_AdminController extends Mage_Adminhtml_Controller_Action {
19
-
20
  /**
21
  * Initialization of current view - add's breadcrumps and the current menu status
22
  *
23
  * @return Flagbit_Faq_AdminController
24
  */
25
- protected function _initAction() {
26
- $this->_usedModuleName = 'faq';
 
27
 
28
  $this->loadLayout()
29
  ->_setActiveMenu('cms/faq')
@@ -33,88 +33,81 @@ class Flagbit_Faq_AdminController extends Mage_Adminhtml_Controller_Action {
33
  return $this;
34
  }
35
 
36
-
37
  /**
38
  * Displays the FAQ overview grid.
39
  *
40
  */
41
- public function indexAction() {
42
-
43
  $this->_initAction()
44
- ->_addContent($this->getLayout()->createBlock('faq/admin_list'))
45
- ->renderLayout();
46
  }
47
-
48
 
49
  /**
50
  * Displays the new FAQ item form
51
- *
52
  */
53
- public function newAction() {
54
-
55
  $this->_forward('edit');
56
  }
57
-
58
 
59
  /**
60
  * Displays the new FAQ item form or the edit FAQ item form.
61
- *
62
  */
63
- public function editAction() {
64
-
65
  $id = $this->getRequest()->getParam('faq_id');
66
- $model = Mage :: getModel('faq/faq');
67
 
68
  // if current id given -> try to load and edit current FAQ item
69
  if ($id) {
70
  $model->load($id);
71
  if (!$model->getId()) {
72
- Mage :: getSingleton('adminhtml/session')->addError(
73
- Mage :: helper('faq')->__('This FAQ item no longer exists')
74
  );
75
  $this->_redirect('*/*/');
76
  return;
77
  }
78
  }
79
 
80
- $data = Mage :: getSingleton('adminhtml/session')->getFormData(true);
81
  if (!empty($data)) {
82
  $model->setData($data);
83
  }
84
 
85
- Mage :: register('faq', $model);
86
 
87
  $this->_initAction()
88
  ->_addBreadcrumb(
89
  $id
90
- ? Mage :: helper('faq')->__('Edit FAQ Item')
91
- : Mage :: helper('faq')->__('New FAQ Item'),
92
  $id
93
- ? Mage :: helper('faq')->__('Edit FAQ Item')
94
- : Mage :: helper('faq')->__('New FAQ Item')
95
  )
96
  ->_addContent(
97
  $this->getLayout()
98
- ->createBlock('faq/admin_edit')
99
  ->setData('action', $this->getUrl('adminhtml/faq/save'))
100
  )
101
- ->_addLeft($this->getLayout()->createBlock('faq/admin_edit_tabs'));
102
 
103
  $this->renderLayout();
104
  }
105
 
106
-
107
  /**
108
  * Action that does the actual saving process and redirects back to overview
109
- *
110
  */
111
- public function saveAction() {
112
-
113
  // check if data sent
114
  if ($data = $this->getRequest()->getPost()) {
115
 
116
  // init model and set data
117
- $model = Mage :: getModel('faq/faq');
118
  $model->setData($data);
119
 
120
  // try to save it
@@ -123,11 +116,11 @@ class Flagbit_Faq_AdminController extends Mage_Adminhtml_Controller_Action {
123
  $model->save();
124
 
125
  // display success message
126
- Mage :: getSingleton('adminhtml/session')->addSuccess(
127
- Mage :: helper('cms')->__('FAQ Item was successfully saved')
128
  );
129
  // clear previously saved data from session
130
- Mage :: getSingleton('adminhtml/session')->setFormData(false);
131
  // check if 'Save and Continue'
132
  if ($this->getRequest()->getParam('back')) {
133
  $this->_redirect('*/*/edit', array (
@@ -141,9 +134,9 @@ class Flagbit_Faq_AdminController extends Mage_Adminhtml_Controller_Action {
141
  }
142
  catch (Exception $e) {
143
  // display error message
144
- Mage :: getSingleton('adminhtml/session')->addError($e->getMessage());
145
  // save data in session
146
- Mage :: getSingleton('adminhtml/session')->setFormData($data);
147
  // redirect to edit form
148
  $this->_redirect('*/*/edit', array (
149
  'faq_id' => $this->getRequest()->getParam('faq_id') ));
@@ -159,29 +152,27 @@ class Flagbit_Faq_AdminController extends Mage_Adminhtml_Controller_Action {
159
  *
160
  * @return boolean True if user is allowed to edit FAQ
161
  */
162
- protected function _isAllowed() {
163
-
164
- return Mage :: getSingleton('admin/session')->isAllowed('admin/cms/faq');
165
  }
166
 
167
-
168
  /**
169
  * Action that does the actual saving process and redirects back to overview
170
- *
171
  */
172
- public function deleteAction() {
173
-
174
  // check if we know what should be deleted
175
  if ($id = $this->getRequest()->getParam('faq_id')) {
176
  try {
177
 
178
  // init model and delete
179
- $model = Mage :: getModel('faq/faq');
180
  $model->load($id);
181
  $model->delete();
182
 
183
  // display success message
184
- Mage :: getSingleton('adminhtml/session')->addSuccess(Mage :: helper('cms')->__('FAQ Entry was successfully deleted'));
185
 
186
  // go to grid
187
  $this->_redirect('*/*/');
@@ -191,7 +182,7 @@ class Flagbit_Faq_AdminController extends Mage_Adminhtml_Controller_Action {
191
  catch (Exception $e) {
192
 
193
  // display error message
194
- Mage :: getSingleton('adminhtml/session')->addError($e->getMessage());
195
 
196
  // go back to edit form
197
  $this->_redirect('*/*/edit', array (
@@ -201,12 +192,9 @@ class Flagbit_Faq_AdminController extends Mage_Adminhtml_Controller_Action {
201
  }
202
 
203
  // display error message
204
- Mage :: getSingleton('adminhtml/session')->addError(Mage :: helper('cms')->__('Unable to find a FAQ entry to delete'));
205
 
206
  // go to grid
207
  $this->_redirect('*/*/');
208
  }
209
-
210
-
211
-
212
  }
14
  * @package Flagbit_Faq
15
  * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
  */
17
+ class Flagbit_Faq_Adminhtml_FaqController extends Mage_Adminhtml_Controller_Action
18
+ {
 
19
  /**
20
  * Initialization of current view - add's breadcrumps and the current menu status
21
  *
22
  * @return Flagbit_Faq_AdminController
23
  */
24
+ protected function _initAction()
25
+ {
26
+ $this->_usedModuleName = 'flagbit_faq';
27
 
28
  $this->loadLayout()
29
  ->_setActiveMenu('cms/faq')
33
  return $this;
34
  }
35
 
 
36
  /**
37
  * Displays the FAQ overview grid.
38
  *
39
  */
40
+ public function indexAction()
41
+ {
42
  $this->_initAction()
43
+ ->_addContent($this->getLayout()->createBlock('flagbit_faq/adminhtml_item'))
44
+ ->renderLayout();
45
  }
 
46
 
47
  /**
48
  * Displays the new FAQ item form
 
49
  */
50
+ public function newAction()
51
+ {
52
  $this->_forward('edit');
53
  }
 
54
 
55
  /**
56
  * Displays the new FAQ item form or the edit FAQ item form.
 
57
  */
58
+ public function editAction()
59
+ {
60
  $id = $this->getRequest()->getParam('faq_id');
61
+ $model = Mage::getModel('flagbit_faq/faq');
62
 
63
  // if current id given -> try to load and edit current FAQ item
64
  if ($id) {
65
  $model->load($id);
66
  if (!$model->getId()) {
67
+ Mage::getSingleton('adminhtml/session')->addError(
68
+ Mage::helper('flagbit_faq')->__('This FAQ item no longer exists')
69
  );
70
  $this->_redirect('*/*/');
71
  return;
72
  }
73
  }
74
 
75
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
76
  if (!empty($data)) {
77
  $model->setData($data);
78
  }
79
 
80
+ Mage::register('faq', $model);
81
 
82
  $this->_initAction()
83
  ->_addBreadcrumb(
84
  $id
85
+ ? Mage::helper('flagbit_faq')->__('Edit FAQ Item')
86
+ : Mage::helper('flagbit_faq')->__('New FAQ Item'),
87
  $id
88
+ ? Mage::helper('flagbit_faq')->__('Edit FAQ Item')
89
+ : Mage::helper('flagbit_faq')->__('New FAQ Item')
90
  )
91
  ->_addContent(
92
  $this->getLayout()
93
+ ->createBlock('flagbit_faq/adminhtml_item_edit')
94
  ->setData('action', $this->getUrl('adminhtml/faq/save'))
95
  )
96
+ ->_addLeft($this->getLayout()->createBlock('flagbit_faq/adminhtml_item_edit_tabs'));
97
 
98
  $this->renderLayout();
99
  }
100
 
 
101
  /**
102
  * Action that does the actual saving process and redirects back to overview
 
103
  */
104
+ public function saveAction()
105
+ {
106
  // check if data sent
107
  if ($data = $this->getRequest()->getPost()) {
108
 
109
  // init model and set data
110
+ $model = Mage::getModel('flagbit_faq/faq');
111
  $model->setData($data);
112
 
113
  // try to save it
116
  $model->save();
117
 
118
  // display success message
119
+ Mage::getSingleton('adminhtml/session')->addSuccess(
120
+ Mage::helper('cms')->__('FAQ Item was successfully saved')
121
  );
122
  // clear previously saved data from session
123
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
124
  // check if 'Save and Continue'
125
  if ($this->getRequest()->getParam('back')) {
126
  $this->_redirect('*/*/edit', array (
134
  }
135
  catch (Exception $e) {
136
  // display error message
137
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
138
  // save data in session
139
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
140
  // redirect to edit form
141
  $this->_redirect('*/*/edit', array (
142
  'faq_id' => $this->getRequest()->getParam('faq_id') ));
152
  *
153
  * @return boolean True if user is allowed to edit FAQ
154
  */
155
+ protected function _isAllowed()
156
+ {
157
+ return Mage::getSingleton('admin/session')->isAllowed('admin/cms/faq');
158
  }
159
 
 
160
  /**
161
  * Action that does the actual saving process and redirects back to overview
 
162
  */
163
+ public function deleteAction()
164
+ {
165
  // check if we know what should be deleted
166
  if ($id = $this->getRequest()->getParam('faq_id')) {
167
  try {
168
 
169
  // init model and delete
170
+ $model = Mage::getModel('flagbit_faq/faq');
171
  $model->load($id);
172
  $model->delete();
173
 
174
  // display success message
175
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('cms')->__('FAQ Entry was successfully deleted'));
176
 
177
  // go to grid
178
  $this->_redirect('*/*/');
182
  catch (Exception $e) {
183
 
184
  // display error message
185
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
186
 
187
  // go back to edit form
188
  $this->_redirect('*/*/edit', array (
192
  }
193
 
194
  // display error message
195
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('cms')->__('Unable to find a FAQ entry to delete'));
196
 
197
  // go to grid
198
  $this->_redirect('*/*/');
199
  }
 
 
 
200
  }
app/code/community/Flagbit/Faq/controllers/IndexController.php CHANGED
@@ -14,24 +14,21 @@
14
  * @package Flagbit_Faq
15
  * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
  */
17
- class Flagbit_Faq_IndexController extends Mage_Core_Controller_Front_Action {
18
-
19
  /**
20
  * Displays the FAQ list.
21
- *
22
  */
23
- public function indexAction() {
24
-
25
  $this->loadLayout()->renderLayout();
26
  }
27
 
28
  /**
29
  * Displays the current FAQ's detail view
30
- *
31
  */
32
- public function showAction() {
33
-
34
  $this->loadLayout()->renderLayout();
35
  }
36
-
37
  }
14
  * @package Flagbit_Faq
15
  * @author Flagbit GmbH & Co. KG <magento@flagbit.de>
16
  */
17
+ class Flagbit_Faq_IndexController extends Mage_Core_Controller_Front_Action
18
+ {
19
  /**
20
  * Displays the FAQ list.
 
21
  */
22
+ public function indexAction()
23
+ {
24
  $this->loadLayout()->renderLayout();
25
  }
26
 
27
  /**
28
  * Displays the current FAQ's detail view
 
29
  */
30
+ public function showAction()
31
+ {
32
  $this->loadLayout()->renderLayout();
33
  }
 
34
  }
app/code/community/Flagbit/Faq/etc/adminhtml.xml CHANGED
@@ -3,10 +3,19 @@
3
  <menu>
4
  <cms>
5
  <children>
6
- <faq translate="title" module="faq">
7
  <title>FAQ</title>
8
- <action>adminhtml/faq</action>
9
  <sort_order>60</sort_order>
 
 
 
 
 
 
 
 
 
 
10
  </faq>
11
  </children>
12
  </cms>
@@ -18,7 +27,7 @@
18
  <children>
19
  <cms>
20
  <children>
21
- <faq translate="title" module="faq">
22
  <title>Faq</title>
23
  <sort_order>50</sort_order>
24
  </faq>
3
  <menu>
4
  <cms>
5
  <children>
6
+ <faq translate="title" module="flagbit_faq">
7
  <title>FAQ</title>
 
8
  <sort_order>60</sort_order>
9
+ <children>
10
+ <item translate="titl" module="flagbit_faq">
11
+ <title>Manage Items</title>
12
+ <action>adminhtml/faq</action>
13
+ </item>
14
+ <category translate="titl" module="flagbit_faq">
15
+ <title>Manage Categories</title>
16
+ <action>adminhtml/faq_category</action>
17
+ </category>
18
+ </children>
19
  </faq>
20
  </children>
21
  </cms>
27
  <children>
28
  <cms>
29
  <children>
30
+ <faq translate="title" module="flagbit_faq">
31
  <title>Faq</title>
32
  <sort_order>50</sort_order>
33
  </faq>
app/code/community/Flagbit/Faq/etc/config.xml CHANGED
@@ -4,20 +4,20 @@
4
  <Flagbit_Faq>
5
  <active>true</active>
6
  <codePool>community</codePool>
7
- <version>1.0.6</version>
8
  </Flagbit_Faq>
9
  </modules>
10
 
11
  <admin>
12
- <routers>
13
- <faq>
14
- <use>admin</use>
15
- <args>
16
- <module>Flagbit_Faq</module>
17
- <frontName>faq</frontName>
18
- </args>
19
- </faq>
20
- </routers>
21
  </admin>
22
 
23
  <frontend>
@@ -50,25 +50,34 @@
50
 
51
  <global>
52
  <helpers>
53
- <faq>
54
  <class>Flagbit_Faq_Helper</class>
55
- </faq>
56
  </helpers>
57
 
58
  <blocks>
59
- <faq>
60
  <class>Flagbit_Faq_Block</class>
61
- </faq>
62
  </blocks>
63
 
64
  <models>
65
- <faq>
66
  <class>Flagbit_Faq_Model</class>
67
- <resourceModel>faq_mysql4</resourceModel>
68
- </faq>
69
- <faq_mysql4>
70
  <class>Flagbit_Faq_Model_Mysql4</class>
71
  <entities>
 
 
 
 
 
 
 
 
 
72
  <faq>
73
  <table>faq</table>
74
  </faq>
@@ -76,7 +85,7 @@
76
  <table>faq_store</table>
77
  </faq_store>
78
  </entities>
79
- </faq_mysql4>
80
  </models>
81
 
82
  <resources>
@@ -99,13 +108,6 @@
99
  </connection>
100
  </faq_read>
101
  </resources>
102
-
103
- <rewrite>
104
- <Flagbit_Faq>
105
- <from><![CDATA[#^/{adminhtml}/faq/#]]></from>
106
- <to>/faq/admin/</to>
107
- </Flagbit_Faq>
108
- </rewrite>
109
  </global>
110
 
111
  <adminhtml>
4
  <Flagbit_Faq>
5
  <active>true</active>
6
  <codePool>community</codePool>
7
+ <version>1.1.2</version>
8
  </Flagbit_Faq>
9
  </modules>
10
 
11
  <admin>
12
+ <routers>
13
+ <adminhtml>
14
+ <args>
15
+ <modules>
16
+ <Flagbit_Faq before="Mage_Adminhtml">Flagbit_Faq_Adminhtml</Flagbit_Faq>
17
+ </modules>
18
+ </args>
19
+ </adminhtml>
20
+ </routers>
21
  </admin>
22
 
23
  <frontend>
50
 
51
  <global>
52
  <helpers>
53
+ <flagbit_faq>
54
  <class>Flagbit_Faq_Helper</class>
55
+ </flagbit_faq>
56
  </helpers>
57
 
58
  <blocks>
59
+ <flagbit_faq>
60
  <class>Flagbit_Faq_Block</class>
61
+ </flagbit_faq>
62
  </blocks>
63
 
64
  <models>
65
+ <flagbit_faq>
66
  <class>Flagbit_Faq_Model</class>
67
+ <resourceModel>flagbit_faq_mysql4</resourceModel>
68
+ </flagbit_faq>
69
+ <flagbit_faq_mysql4>
70
  <class>Flagbit_Faq_Model_Mysql4</class>
71
  <entities>
72
+ <category>
73
+ <table>faq_category</table>
74
+ </category>
75
+ <category_item>
76
+ <table>faq_category_item</table>
77
+ </category_item>
78
+ <category_store>
79
+ <table>faq_category_store</table>
80
+ </category_store>
81
  <faq>
82
  <table>faq</table>
83
  </faq>
85
  <table>faq_store</table>
86
  </faq_store>
87
  </entities>
88
+ </flagbit_faq_mysql4>
89
  </models>
90
 
91
  <resources>
108
  </connection>
109
  </faq_read>
110
  </resources>
 
 
 
 
 
 
 
111
  </global>
112
 
113
  <adminhtml>
app/code/community/Flagbit/Faq/sql/faq_setup/mysql4-install-0.1.0.php CHANGED
@@ -12,8 +12,8 @@ $installer = $this;
12
  $installer->startSetup();
13
 
14
  $installer->run("
15
- -- DROP TABLE IF EXISTS {$this->getTable('faq/faq')};
16
- CREATE TABLE IF NOT EXISTS {$this->getTable('faq/faq')} (
17
  `faq_id` int(10) unsigned NOT NULL auto_increment,
18
  `question` tinytext NOT NULL default '',
19
  `answer` text NOT NULL default '',
@@ -24,16 +24,14 @@ CREATE TABLE IF NOT EXISTS {$this->getTable('faq/faq')} (
24
  PRIMARY KEY (`faq_id`)
25
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='FAQ items' AUTO_INCREMENT=1 ;
26
 
27
- -- DROP TABLE IF EXISTS {$this->getTable('faq/faq_store')};
28
- CREATE TABLE `{$this->getTable('faq/faq_store')}` (
29
  `faq_id` int(10) unsigned NOT NULL,
30
  `store_id` smallint(5) unsigned NOT NULL,
31
  PRIMARY KEY (`faq_id`,`store_id`),
32
- CONSTRAINT `FK_FAQ_FAQ_STORE_FAQ` FOREIGN KEY (`faq_id`) REFERENCES `{$this->getTable('faq/faq')}` (`faq_id`) ON UPDATE CASCADE ON DELETE CASCADE,
33
  CONSTRAINT `FK_FAQ_FAQ_STORE_STORE` FOREIGN KEY (`store_id`) REFERENCES `{$this->getTable('core/store')}` (`store_id`) ON UPDATE CASCADE ON DELETE CASCADE
34
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='FAQ items to Stores';
35
  ");
36
 
37
  $installer->endSetup();
38
-
39
- ?>
12
  $installer->startSetup();
13
 
14
  $installer->run("
15
+ -- DROP TABLE IF EXISTS {$this->getTable('flagbit_faq/faq')};
16
+ CREATE TABLE IF NOT EXISTS {$this->getTable('flagbit_faq/faq')} (
17
  `faq_id` int(10) unsigned NOT NULL auto_increment,
18
  `question` tinytext NOT NULL default '',
19
  `answer` text NOT NULL default '',
24
  PRIMARY KEY (`faq_id`)
25
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='FAQ items' AUTO_INCREMENT=1 ;
26
 
27
+ -- DROP TABLE IF EXISTS {$this->getTable('flagbit_faq/faq_store')};
28
+ CREATE TABLE `{$this->getTable('flagbit_faq/faq_store')}` (
29
  `faq_id` int(10) unsigned NOT NULL,
30
  `store_id` smallint(5) unsigned NOT NULL,
31
  PRIMARY KEY (`faq_id`,`store_id`),
32
+ CONSTRAINT `FK_FAQ_FAQ_STORE_FAQ` FOREIGN KEY (`faq_id`) REFERENCES `{$this->getTable('flagbit_faq/faq')}` (`faq_id`) ON UPDATE CASCADE ON DELETE CASCADE,
33
  CONSTRAINT `FK_FAQ_FAQ_STORE_STORE` FOREIGN KEY (`store_id`) REFERENCES `{$this->getTable('core/store')}` (`store_id`) ON UPDATE CASCADE ON DELETE CASCADE
34
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='FAQ items to Stores';
35
  ");
36
 
37
  $installer->endSetup();
 
 
app/code/community/Flagbit/Faq/sql/faq_setup/mysql4-install-1.0.7.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * FAQ for Magento
4
+ *
5
+ * @category Flagbit
6
+ * @package Flagbit_Faq
7
+ * @copyright Copyright (c) 2009 Flagbit GmbH & Co. KG <magento@flagbit.de>
8
+ */
9
+
10
+ $installer = $this;
11
+
12
+ $installer->startSetup();
13
+
14
+ $installer->run("
15
+ -- DROP TABLE IF EXISTS {$this->getTable('flagbit_faq/faq')};
16
+ CREATE TABLE IF NOT EXISTS {$this->getTable('flagbit_faq/faq')} (
17
+ `faq_id` int(10) unsigned NOT NULL auto_increment,
18
+ `question` tinytext NOT NULL default '',
19
+ `answer` text NOT NULL default '',
20
+ `answer_html` tinyint(1) NOT NULL default '1',
21
+ `creation_time` datetime NOT NULL,
22
+ `update_time` datetime NOT NULL,
23
+ `is_active` tinyint(1) NOT NULL default '1',
24
+ PRIMARY KEY (`faq_id`)
25
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='FAQ items' AUTO_INCREMENT=1 ;
26
+
27
+ -- DROP TABLE IF EXISTS `{$this->getTable('flagbit_faq/faq_store')}`;
28
+ CREATE TABLE `{$this->getTable('flagbit_faq/faq_store')}` (
29
+ `faq_id` int(10) unsigned NOT NULL,
30
+ `store_id` smallint(5) unsigned NOT NULL,
31
+ PRIMARY KEY (`faq_id`,`store_id`),
32
+ CONSTRAINT `FK_FAQ_FAQ_STORE_FAQ` FOREIGN KEY (`faq_id`) REFERENCES `{$this->getTable('flagbit_faq/faq')}` (`faq_id`) ON UPDATE CASCADE ON DELETE CASCADE,
33
+ CONSTRAINT `FK_FAQ_FAQ_STORE_STORE` FOREIGN KEY (`store_id`) REFERENCES `{$this->getTable('core/store')}` (`store_id`) ON UPDATE CASCADE ON DELETE CASCADE
34
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='FAQ items to Stores';
35
+
36
+ CREATE TABLE `{$this->getTable('flagbit_faq/category')}` (
37
+ `category_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
38
+ `parent_id` INT(10) UNSIGNED NULL,
39
+ `category_name` VARCHAR(255) NOT NULL,
40
+ `creation_time` DATETIME NOT NULL,
41
+ `update_time` DATETIME NOT NULL,
42
+ `is_active` TINYINT(1) NOT NULL DEFAULT 1,
43
+ PRIMARY KEY (`category_id`),
44
+ CONSTRAINT `FK_FAQ_CATEGORY_PARENT_ID` FOREIGN KEY (`parent_id`) REFERENCES `{$this->getTable('flagbit_faq/category')}` (`category_id`) ON DELETE SET NULL
45
+ ) ENGINE=InnoDB COMMENT='FAQ Categories';
46
+
47
+ -- DROP TABLE IF EXISTS `{$this->getTable('flagbit_faq/category_item')}`;
48
+ CREATE TABLE `{$this->getTable('flagbit_faq/category_item')}` (
49
+ `category_id` INT(10) UNSIGNED NOT NULL,
50
+ `faq_id` INT(10) UNSIGNED NOT NULL,
51
+ PRIMARY KEY (`category_id`,`faq_id`),
52
+ CONSTRAINT `FK_FAQ_CATEGORY_ITEM_CATEGORY` FOREIGN KEY (`category_id`) REFERENCES `{$this->getTable('flagbit_faq/category')}` (`category_id`) ON UPDATE CASCADE ON DELETE CASCADE,
53
+ CONSTRAINT `FK_FAQ_CATEGORY_ITEM_ITEM` FOREIGN KEY (`faq_id`) REFERENCES `{$this->getTable('flagbit_faq/faq')}` (`faq_id`) ON UPDATE CASCADE ON DELETE CASCADE
54
+ ) ENGINE=InnoDB COMMENT='FAQ Items to Cateories';
55
+
56
+ -- DROP TABLE IF EXISTS `{$this->getTable('flagbit_faq/category_store')}`;
57
+ CREATE TABLE `{$this->getTable('flagbit_faq/category_store')}` (
58
+ `category_id` INT(10) UNSIGNED NOT NULL,
59
+ `store_id` SMALLINT(5) UNSIGNED NOT NULL,
60
+ PRIMARY KEY (`category_id`,`store_id`),
61
+ CONSTRAINT `FK_FAQ_CATEGORY_STORE_CATEGORY` FOREIGN KEY (`category_id`) REFERENCES `{$this->getTable('flagbit_faq/category')}` (`category_id`) ON UPDATE CASCADE ON DELETE CASCADE,
62
+ CONSTRAINT `FK_FAQ_CATEGORY_STORE_STORE` FOREIGN KEY (`store_id`) REFERENCES `{$this->getTable('core/store')}` (`store_id`) ON UPDATE CASCADE ON DELETE CASCADE
63
+ ) ENGINE=InnoDB COMMENT='FAQ Categories to Stores';
64
+
65
+ ");
66
+
67
+ $installer->endSetup();
app/code/community/Flagbit/Faq/sql/faq_setup/mysql4-upgrade-1.0.6-1.0.7.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * FAQ for Magento
4
+ *
5
+ * @category Flagbit
6
+ * @package Flagbit_Faq
7
+ * @copyright Copyright (c) 2009 Flagbit GmbH & Co. KG <magento@flagbit.de>
8
+ */
9
+
10
+ $installer = $this;
11
+
12
+ $installer->startSetup();
13
+
14
+ $installer->run("
15
+
16
+ ALTER TABLE `{$this->getTable('flagbit_faq/faq')}`
17
+ MODIFY COLUMN `creation_time` DATETIME NOT NULL;
18
+ ALTER TABLE `{$this->getTable('flagbit_faq/faq')}`
19
+ MODIFY COLUMN `update_time` DATETIME NOT NULL;
20
+
21
+ CREATE TABLE `{$this->getTable('flagbit_faq/category')}` (
22
+ `category_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
23
+ `parent_id` INT(10) UNSIGNED NULL,
24
+ `category_name` VARCHAR(255) NOT NULL,
25
+ `creation_time` DATETIME NOT NULL,
26
+ `update_time` DATETIME NOT NULL,
27
+ `is_active` TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
28
+ PRIMARY KEY (`category_id`),
29
+ CONSTRAINT `FK_FAQ_CATEGORY_PARENT_ID` FOREIGN KEY (`parent_id`) REFERENCES `{$this->getTable('flagbit_faq/category')}` (`category_id`) ON DELETE SET NULL
30
+ ) ENGINE=InnoDB COMMENT='FAQ Categories';
31
+
32
+ -- DROP TABLE IF EXISTS `{$this->getTable('flagbit_faq/category_item')}`;
33
+ CREATE TABLE `{$this->getTable('flagbit_faq/category_item')}` (
34
+ `category_id` INT(10) UNSIGNED NOT NULL,
35
+ `faq_id` INT(10) UNSIGNED NOT NULL,
36
+ PRIMARY KEY (`category_id`,`faq_id`),
37
+ CONSTRAINT `FK_FAQ_CATEGORY_ITEM_CATEGORY` FOREIGN KEY (`category_id`) REFERENCES `{$this->getTable('flagbit_faq/category')}` (`category_id`) ON UPDATE CASCADE ON DELETE CASCADE,
38
+ CONSTRAINT `FK_FAQ_CATEGORY_ITEM_ITEM` FOREIGN KEY (`faq_id`) REFERENCES `{$this->getTable('flagbit_faq/faq')}` (`faq_id`) ON UPDATE CASCADE ON DELETE CASCADE
39
+ ) ENGINE=InnoDB COMMENT='FAQ Items to Cateories';
40
+
41
+ -- DROP TABLE IF EXISTS `{$this->getTable('flagbit_faq/category_store')}`;
42
+ CREATE TABLE `{$this->getTable('flagbit_faq/category_store')}` (
43
+ `category_id` INT(10) UNSIGNED NOT NULL,
44
+ `store_id` SMALLINT(5) UNSIGNED NOT NULL,
45
+ PRIMARY KEY (`category_id`,`store_id`),
46
+ CONSTRAINT `FK_FAQ_CATEGORY_STORE_CATEGORY` FOREIGN KEY (`category_id`) REFERENCES `{$this->getTable('flagbit_faq/category')}` (`category_id`) ON UPDATE CASCADE ON DELETE CASCADE,
47
+ CONSTRAINT `FK_FAQ_CATEGORY_STORE_STORE` FOREIGN KEY (`store_id`) REFERENCES `{$this->getTable('core/store')}` (`store_id`) ON UPDATE CASCADE ON DELETE CASCADE
48
+ ) ENGINE=InnoDB COMMENT='FAQ Categories to Stores';
49
+
50
+ ");
51
+
52
+ $installer->endSetup();
app/design/frontend/base/default/layout/faq.xml CHANGED
@@ -26,23 +26,15 @@
26
  */
27
  -->
28
  <layout version="0.1.0">
29
-
30
  <faq_index_index>
31
- <reference name="root">
32
- <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
33
- </reference>
34
  <reference name="content">
35
- <block type="faq/frontend_list" name="faq_list" template="faq/list.phtml"/>
36
  </reference>
37
  </faq_index_index>
38
 
39
  <faq_index_show>
40
- <reference name="root">
41
- <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
42
- </reference>
43
  <reference name="content">
44
- <block type="faq/frontend_detail" name="faq_detail" template="faq/detail.phtml"/>
45
  </reference>
46
  </faq_index_show>
47
-
48
  </layout>
26
  */
27
  -->
28
  <layout version="0.1.0">
 
29
  <faq_index_index>
 
 
 
30
  <reference name="content">
31
+ <block type="flagbit_faq/frontend_list" name="faq_list" template="faq/list.phtml"/>
32
  </reference>
33
  </faq_index_index>
34
 
35
  <faq_index_show>
 
 
 
36
  <reference name="content">
37
+ <block type="flagbit_faq/frontend_detail" name="faq_detail" template="faq/detail.phtml"/>
38
  </reference>
39
  </faq_index_show>
 
40
  </layout>
app/design/frontend/base/default/template/faq/list.phtml CHANGED
@@ -23,22 +23,40 @@
23
  * @copyright Copyright (c) 2009 Flagbit GmbH & Co. KG (http://www.flagbit.de)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
 
26
  ?>
27
  <div class="page-title">
28
  <h1><?php echo $this->__('FAQ overview'); ?></h1>
29
  </div>
30
-
31
  <?php if ($this->hasFaq()): ?>
 
32
  <h2><?php echo $this->__('Questions'); ?></h2>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  <ul class="faq-list">
34
- <?php foreach ($this->getFaqCollection() as $faqItem): ?>
35
- <li>
36
- <a href="#faq-item-<?php echo $faqItem->getId() ?>">
37
- <?php echo $this->htmlEscape($faqItem->getQuestion()) ?>
38
- </a>
39
- </li>
40
- <?php endforeach; ?>
41
  </ul>
 
42
 
43
  <h2><?php echo $this->__('Answers'); ?></h2>
44
  <dl class="faq-items">
23
  * @copyright Copyright (c) 2009 Flagbit GmbH & Co. KG (http://www.flagbit.de)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
+ /* @var $this Flagbit_Faq_Block_Frontend_List */
27
  ?>
28
  <div class="page-title">
29
  <h1><?php echo $this->__('FAQ overview'); ?></h1>
30
  </div>
31
+
32
  <?php if ($this->hasFaq()): ?>
33
+
34
  <h2><?php echo $this->__('Questions'); ?></h2>
35
+ <?php if ($this->getCategoryCollection()) : ?>
36
+ <dl class="faq-list">
37
+ <?php foreach ($this->getCategoryCollection() as $category) : ?>
38
+ <dt><?php echo $this->htmlEscape($category->getName()); ?></dt><dd><ul class="faq-list">
39
+ <?php foreach ($this->getItemCollectionByCategory($category) as $item) : ?>
40
+ <li>
41
+ <a href="#faq-item-<?php echo $item->getId() ?>">
42
+ <?php echo $this->htmlEscape($item->getQuestion()); ?>
43
+ </a>
44
+ </li>
45
+ <?php endforeach; ?>
46
+ </ul></dd>
47
+ <?php endforeach; ?>
48
+ </dl>
49
+ <?php else : ?>
50
  <ul class="faq-list">
51
+ <?php foreach ($this->getFaqCollection() as $faqItem): ?>
52
+ <li>
53
+ <a href="#faq-item-<?php echo $faqItem->getId() ?>">
54
+ <?php echo $this->htmlEscape($faqItem->getQuestion()) ?>
55
+ </a>
56
+ </li>
57
+ <?php endforeach; ?>
58
  </ul>
59
+ <?php endif; ?>
60
 
61
  <h2><?php echo $this->__('Answers'); ?></h2>
62
  <dl class="faq-items">
app/locale/de_DE/Flagbit_Faq.csv CHANGED
@@ -1,8 +1,15 @@
1
  "Action","Aktion"
2
  "Active","Aktiv"
3
- "Add new FAQ item","Neuen FAQ-Eintrag anlegen"
 
 
4
  "Answer","Antwort"
 
5
  "Back to the FAQ overview", "Zurück zur FAQ-Übersicht"
 
 
 
 
6
  "Content","Inhalt"
7
  "Delete FAQ item","FAQ-Eintrag löschen"
8
  "Disabled","Deaktiviert"
@@ -19,16 +26,26 @@
19
  "General information","Allgemeine Informationen"
20
  "HTML answer","HTML Antwort"
21
  "Images","Bilder"
 
 
 
 
 
22
  "New FAQ item","Neuer FAQ-Eintrag"
23
  "No","Nein"
 
24
  "of %s pages","von %d Seiten"
25
  "Page","Seite"
26
  "Page status","Seitenstatus"
27
  "per page","pro Seite"
28
  "Publication date","Veröffentlichungsdatum"
29
  "Published on","Veröffentlichungsdatum"
 
 
30
  "Save and continue edit","Speichern und weiter bearbeiten"
 
31
  "Save FAQ item","FAQ-Eintrag speichern"
 
32
  "Status","Status"
33
  "Store view","StoreView"
34
  "There are no FAQ items at the moment.","Zur Zeit sind keine FAQ-Einträge verfügbar."
1
  "Action","Aktion"
2
  "Active","Aktiv"
3
+ "Add New FAQ Category","Neue FAQ-Kategorie hinzufügen"
4
+ "Add New FAQ Item","Neuen FAQ-Eintrag hinzufügen"
5
+ "All Store Views","Alle StoreViews"
6
  "Answer","Antwort"
7
+ "Back","Zurück"
8
  "Back to the FAQ overview", "Zurück zur FAQ-Übersicht"
9
+ "Category","Kategorie"
10
+ "Category #","Lfd. Nr."
11
+ "Category Information","Kategorieinformation"
12
+ "Category Name","Kategoriename"
13
  "Content","Inhalt"
14
  "Delete FAQ item","FAQ-Eintrag löschen"
15
  "Disabled","Deaktiviert"
26
  "General information","Allgemeine Informationen"
27
  "HTML answer","HTML Antwort"
28
  "Images","Bilder"
29
+ "Manage Categories","Kategorien verwalten"
30
+ "Manage FAQ Categories","FAQ-Kategorien verwalten"
31
+ "Manage FAQ Items","FAQ-Einträge verwalten"
32
+ "Manage Items","Einträge verwalten"
33
+ "New FAQ Category","Neue FAQ-Kategorie"
34
  "New FAQ item","Neuer FAQ-Eintrag"
35
  "No","Nein"
36
+ "No records found.","Keine Einträge gefunden."
37
  "of %s pages","von %d Seiten"
38
  "Page","Seite"
39
  "Page status","Seitenstatus"
40
  "per page","pro Seite"
41
  "Publication date","Veröffentlichungsdatum"
42
  "Published on","Veröffentlichungsdatum"
43
+ "Reset","Zurücksetzen"
44
+ "Reset Filter","Filter zurücksetzen"
45
  "Save and continue edit","Speichern und weiter bearbeiten"
46
+ "Save FAQ Category","FAQ-Kategorie speichern"
47
  "Save FAQ item","FAQ-Eintrag speichern"
48
+ "Search","Suche"
49
  "Status","Status"
50
  "Store view","StoreView"
51
  "There are no FAQ items at the moment.","Zur Zeit sind keine FAQ-Einträge verfügbar."
app/locale/nl_NL/Flagbit_Faq.csv ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Action","Aktie"
2
+ "Active","Aktief"
3
+ "Add New FAQ Category","Nieuwe FAQ categorie aanmaken"
4
+ "Add New FAQ Item","Nieuwe FAQ bijdrage aanmaken"
5
+ "All Store Views","Alle StoreViews"
6
+ "Answers","Antwoorden"
7
+ "Back","Terug"
8
+ "Back to the FAQ overview", "Terug naar het FAQ overzicht"
9
+ "Category","Categorie"
10
+ "Category #","Categorie Nummer"
11
+ "Category Information","Categorie informatie"
12
+ "Category Name","Categorie naam"
13
+ "Content","Inhoud"
14
+ "Delete FAQ item","FAQ bijdrage verwijderen"
15
+ "Disabled","Uitgeschakeld"
16
+ "Display all FAQ items","Alle FAQ-bijdragen weergeven"
17
+ "Edit","Bewerken"
18
+ "Edit FAQ item '%s'","FAQ bijdrage '%s' bewerken"
19
+ "Enabled","Ingeschakeld"
20
+ "FAQ Item was successfully savend","De FAQ bijdrage is met succes opgeslagen"
21
+ "FAQ","FAQ"
22
+ "FAQ #","FAQ. Nr."
23
+ "FAQ item information","FAQ bijdrage nummer"
24
+ "FAQ item question","FAQ bijdrage vraag"
25
+ "FAQ overview","Overzicht Veel gestelde Vragen"
26
+ "Frequently Asked Questions","Veel Gestelde Vragen"
27
+ "General information","Algemene Informatie"
28
+ "HTML answer","HTML Antwoord"
29
+ "Images","Afbeeldingen"
30
+ "Manage Categories","Categori‘n beheren"
31
+ "Manage FAQ Categories","FAQ categori‘n beheren"
32
+ "Manage FAQ Items","FAQ bijdragen beheren"
33
+ "Manage Items","Bijdragen beheren"
34
+ "New FAQ Category","Nieuwe FAQ Categorie"
35
+ "New FAQ item","Nieuwe FAQ Bijdrage"
36
+ "No","Nee"
37
+ "No records fond.","Geeb bijdragen gevonden."
38
+ "of %s pages","van %d Pagina's"
39
+ "Page","Pagina"
40
+ "Page status","Pagina Status"
41
+ "per page","Per Pagina"
42
+ "Publication date","Publicatiedatum"
43
+ "Published on","Gepubliceerd op"
44
+ "Reset","Herstellen"
45
+ "Reset Filter","Herstel Filter"
46
+ "Save and continue edit","Opslaan en verdure bewerken"
47
+ "Save FAQ Category","FAQ Categorie opslaan"
48
+ "Save FAQ item","FAQ bijdrage opslaan"
49
+ "Search","Zoeken"
50
+ "Status","Status"
51
+ "Store view","StoreView"
52
+ "There are no FAQ items at the moment.","Er zijn gene FAQ bijdragen op ditto moment."
53
+ "Questions","Vragen"
54
+ "Total %d records fond","In totaal %s vragen gevonden"
55
+ "View","Weergeven"
56
+ "Yes","Ja"
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Flagbit_Faq</name>
4
- <version>1.0.6</version>
5
  <stability>stable</stability>
6
- <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL 3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>A FAQ module.</summary>
10
  <description>A FAQ module.</description>
11
  <notes>* Initial Release</notes>
12
  <authors><author><name>Flagbit GmbH </name><user>auto-converted</user><email>magento@flagbit.de</email></author></authors>
13
- <date>2010-06-17</date>
14
- <time>13:27:32</time>
15
- <contents><target name="magecommunity"><dir name="Flagbit"><dir name="Faq"><dir name="Block"><dir name="Admin"><dir name="Edit"><dir name="Tab"><file name="Main.php" hash="ec7b6f503fec43e0929f324884bcffff"/></dir><file name="Form.php" hash="164c6bc7663b0f1c107f912e461fe92d"/><file name="Tabs.php" hash="394e0b7b146aa0cb36000d846e163548"/></dir><dir name="List"><file name="Grid.php" hash="714aea6372f00a80cadc20859d2cad48"/></dir><file name="Edit.php" hash="41630762b789d7006ee7d9e53cfbef87"/><file name="List.php" hash="a3c461f3afef73be3e62e75cf6f1abfe"/></dir><dir name="Frontend"><file name="Detail.php" hash="a89de3dd01574b44c056aff952bfb03d"/><file name="List.php" hash="df3fadfe1ffa13c2ccc34d1f03881ac8"/></dir></dir><dir name="controllers"><file name="AdminController.php" hash="375f4c22c589a53abfbc5a217ef81c58"/><file name="IndexController.php" hash="8853a81a89aff92db99a4611d54854bd"/></dir><dir name="etc"><file name="adminhtml.xml" hash="0da584e9a41ca4c315d567b57b1aa7db"/><file name="config.xml" hash="823b211c92161aa595e1878a169d4b5e"/></dir><dir name="Helper"><file name="Data.php" hash="109f9cf7f512c3c677c9c0be21513eae"/><file name="Jumplist.php" hash="df7c4f69b3d71e889860cba0d2a75eb4"/><file name="JumplistItem.php" hash="73f7308bd6a910bda62423b185deb55c"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Faq"><file name="Collection.php" hash="1040f4805227c98df7be62e9eac6b721"/></dir><file name="Faq.php" hash="609b78aacd0d22eba19ede9411a98f64"/></dir><file name="Faq.php" hash="7fee688354c76e062307a909adc68b98"/></dir><dir name="sql"><dir name="faq_setup"><file name="mysql4-install-0.1.0.php" hash="887d39b5a8f4d0e3aa646c1bafcee9c6"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Flagbit_Faq.xml" hash="b1bc7346cc6d7d269be61274c8a9a2ce"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="faq.xml" hash="0ef2e195efb5ec6c96d20b579cb35a3d"/></dir><dir name="template"><dir name="faq"><file name="detail.phtml" hash="945c73c968c7c980c1acc4bed4a4cc4a"/><file name="list.phtml" hash="7c1265b474eedfaba169709173114471"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="de_DE"><file name="Flagbit_Faq.csv" hash="e569564c615509a4ee5bdfb844ec27d6"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Flagbit_Faq</name>
4
+ <version>1.1.2</version>
5
  <stability>stable</stability>
6
+ <license>OSL 3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>A FAQ module.</summary>
10
  <description>A FAQ module.</description>
11
  <notes>* Initial Release</notes>
12
  <authors><author><name>Flagbit GmbH </name><user>auto-converted</user><email>magento@flagbit.de</email></author></authors>
13
+ <date>2010-10-29</date>
14
+ <time>09:36:28</time>
15
+ <contents><target name="magelocale"><dir><dir name="de_DE"><file name="Flagbit_Faq.csv" hash="289b5729e3c29b803705ba524eff0009"/></dir><dir name="nl_NL"><file name="Flagbit_Faq.csv" hash="bf6972e754e13bb9bd622bdcb37123ea"/></dir></dir></target><target name="magecommunity"><dir><dir name="Flagbit"><dir name="Faq"><dir name="Block"><dir name="Adminhtml"><file name="Category.php" hash="1a52f6775f38f8818a6fc964e41186f9"/><file name="Item.php" hash="e0304bd3c1efe19abc7d01fcbcc5fce7"/><dir name="Category"><file name="Edit.php" hash="82ce255a205607ea3f532bec1b866a2b"/><file name="Grid.php" hash="7da55cff4e9a89a1bbd3ed1e16e09473"/><dir name="Edit"><file name="Form.php" hash="fa50256e53f447099c7b4e64e39e070b"/><file name="Tabs.php" hash="120324ed49a124c903881ab589d0fbec"/><dir name="Tab"><file name="Main.php" hash="9a0d9491b391fed26000a56df37844d4"/></dir></dir></dir><dir name="Item"><file name="Edit.php" hash="1be3a6857ec6d7c02f2d0ccfcbfaa634"/><file name="Grid.php" hash="cd62342dc77a3d817a65c1e78803f610"/><dir name="Edit"><file name="Form.php" hash="e5cdc88c803318d8c98c479c026d6e4c"/><file name="Tabs.php" hash="d31354fad683a8e5c9fa7ebfd16419c3"/><dir name="Tab"><file name="Main.php" hash="32a4d8047f193bc14c3d7d236a57b1eb"/></dir></dir></dir></dir><dir name="Frontend"><file name="Detail.php" hash="70dcff48e4e49f12adc57a4c98b5543f"/><file name="List.php" hash="6569030654c5130ab109a27ff3dea8fb"/></dir></dir><dir name="controllers"><file name="IndexController.php" hash="88a6636e20d4e2f442575f708d65af50"/><dir name="Adminhtml"><file name="FaqController.php" hash="12f2d44dd4b8479aa6155711096e7543"/><dir name="Faq"><file name="CategoryController.php" hash="fdeb1cfc69e843ba5501c2918d81de31"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="f6fefba5d78694a568dfe6348699197d"/><file name="config.xml" hash="2e0b759a1afa706e8ada5e029de4f54f"/></dir><dir name="Helper"><file name="Data.php" hash="c1f9eec33617fa58cdcfb57f4de76c53"/><file name="Jumplist.php" hash="df7c4f69b3d71e889860cba0d2a75eb4"/><file name="JumplistItem.php" hash="73f7308bd6a910bda62423b185deb55c"/></dir><dir name="Model"><file name="Category.php" hash="36182780cfc753fb881bdc1b8349b90e"/><file name="Faq.php" hash="8ef029affffadca6a3664a2cc83d41ad"/><dir name="Mysql4"><file name="Category.php" hash="0025f2040dd67bbc7b0ee05998171269"/><file name="Faq.php" hash="02cf076442990202010d70e7de4fbf76"/><dir name="Category"><file name="Collection.php" hash="70a3fc72f517a655e1b9b8b6a36daa8c"/></dir><dir name="Faq"><file name="Collection.php" hash="a3b8ff2ce8a141290cbe0d5028f85d94"/></dir></dir></dir><dir name="sql"><dir name="faq_setup"><file name="mysql4-install-0.1.0.php" hash="d4c5af45f0067e3c1b0d13bdd9c8c198"/><file name="mysql4-install-1.0.7.php" hash="4c0f93b4164c83b2638a4c211dd04a96"/><file name="mysql4-upgrade-1.0.6-1.0.7.php" hash="eafa133026178e6536350c343c0d1298"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="faq.xml" hash="270f8e26e5c57313bbb68a0680709018"/></dir><dir name="template"><dir name="faq"><file name="detail.phtml" hash="945c73c968c7c980c1acc4bed4a4cc4a"/><file name="list.phtml" hash="7c48df7acfbcfec00a81282d47f47e1b"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Flagbit_Faq.xml" hash="b1bc7346cc6d7d269be61274c8a9a2ce"/></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>