Skip to content
This repository was archived by the owner on May 19, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/.idea
/.settings
/.externalToolBuilders
/.project
Expand Down
2 changes: 2 additions & 0 deletions modman
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
src/app/code/community/Flagbit/Faq app/code/community/Flagbit/Faq
src/app/design/adminhtml/default/default/layout/faq.xml app/design/adminhtml/default/default/layout/faq.xml
src/app/design/frontend/base/default/layout/faq.xml app/design/frontend/base/default/layout/faq.xml
src/app/design/frontend/base/default/template/faq app/design/frontend/base/default/template/faq
src/app/etc/modules/Flagbit_Faq.xml app/etc/modules/Flagbit_Faq.xml
src/app/locale/de_DE/Flagbit_Faq.csv app/locale/de_DE/Flagbit_Faq.csv
src/app/locale/fr_FR/Flagbit_Faq.csv app/locale/fr_FR/Flagbit_Faq.csv
src/app/locale/nl_NL/Flagbit_Faq.csv app/locale/nl_NL/Flagbit_Faq.csv
src/app/locale/ru_RU/Flagbit_Faq.csv app/locale/ru_RU/Flagbit_Faq.csv
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected function _prepareForm()
{
$model = Mage::registry('faq_category');

$form = new Varien_Data_Form();
$form = new Varien_Data_Form(array('enctype' => 'multipart/form-data'));
$form->setHtmlIdPrefix('faq_');

$fieldset = $form->addFieldset('base_fieldset', array (
Expand All @@ -44,7 +44,13 @@ protected function _prepareForm()
'title' => Mage::helper('flagbit_faq')->__('Category Name'),
'required' => true,
));


$fieldset->addField('icon', 'image', array(
'label' => Mage::helper('flagbit_faq')->__('Icon'),
'required' => false,
'name' => 'icon',
));

/**
* Check is single store mode
*/
Expand All @@ -63,6 +69,13 @@ protected function _prepareForm()
'value' => Mage::app()->getStore(true)->getId() ));
$model->setStoreId(Mage::app()->getStore(true)->getId());
}

$fieldset->addField('position', 'text',
array (
'label' => Mage::helper('flagbit_faq')->__('position'),
'title' => Mage::helper('flagbit_faq')->__('position'),
'name' => 'position',
'required' => true));

$fieldset->addField('is_active', 'select',
array (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct()
*/
protected function _prepareCollection()
{
$collection = Mage::getResourceModel('flagbit_faq/category_collection');
$collection = Mage::getResourceModel('flagbit_faq/category_collection')->setOrder('position','ASC');
$this->setCollection($collection);
return parent::_prepareCollection();
}
Expand All @@ -54,7 +54,24 @@ protected function _prepareColumns()
'width' => '80px',
'type' => 'text',
'index' => 'category_id' ));


$this->addColumn('position', array (
'header' => Mage::helper('flagbit_faq')->__('position'),
'width' => '20px',
'type' => 'text',
'index' => 'position' ));

$this->addColumn(
'icon',
array(
'header' => Mage::helper('flagbit_faq')->__('Icon'),
'index' => 'icon',
'width' => '50px',
'renderer' => 'Flagbit_Faq_Block_Widget_Grid_Column_Renderer_Media',
'filter' => false
)
);

$this->addColumn(
'category_name',
array(
Expand Down
257 changes: 132 additions & 125 deletions src/app/code/community/Flagbit/Faq/Block/Adminhtml/Item/Edit/Tab/Main.php
Original file line number Diff line number Diff line change
@@ -1,125 +1,132 @@
<?php
/**
* FAQ for Magento
*
* @category Flagbit
* @package Flagbit_Faq
* @copyright Copyright (c) 2009 Flagbit GmbH & Co. KG <[email protected]>
*/

/**
* FAQ for Magento
*
* @category Flagbit
* @package Flagbit_Faq
* @author Flagbit GmbH & Co. KG <[email protected]>
*/
class Flagbit_Faq_Block_Adminhtml_Item_Edit_Tab_Main extends Mage_Adminhtml_Block_Widget_Form
{
/**
* Prepares the page layout
*
* Loads the WYSIWYG editor on demand if enabled.
*
* @return Flagbit_Faq_Block_Admin_Edit
*/
protected function _prepareLayout()
{
$return = parent::_prepareLayout();
if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
$this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
}
return $return;
}

/**
* Preparation of current form
*
* @return Flagbit_Faq_Block_Admin_Edit_Tab_Main Self
*/
protected function _prepareForm()
{
$model = Mage::registry('faq');

$form = new Varien_Data_Form();
$form->setHtmlIdPrefix('faq_');

$fieldset = $form->addFieldset('base_fieldset', array (
'legend' => Mage::helper('flagbit_faq')->__('General information'),
'class' => 'fieldset-wide' ));

if ($model->getFaqId()) {
$fieldset->addField('faq_id', 'hidden', array (
'name' => 'faq_id' ));
}

$fieldset->addField('question', 'text', array (
'name' => 'question',
'label' => Mage::helper('flagbit_faq')->__('FAQ item question'),
'title' => Mage::helper('flagbit_faq')->__('FAQ item question'),
'required' => true ));

/**
* Check is single store mode
*/
if (!Mage::app()->isSingleStoreMode()) {
$fieldset->addField('store_id', 'multiselect',
array (
'name' => 'stores[]',
'label' => Mage::helper('cms')->__('Store view'),
'title' => Mage::helper('cms')->__('Store view'),
'required' => true,
'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true) ));
}
else {
$fieldset->addField('store_id', 'hidden', array (
'name' => 'stores[]',
'value' => Mage::app()->getStore(true)->getId() ));
$model->setStoreId(Mage::app()->getStore(true)->getId());
}

$fieldset->addField('is_active', 'select',
array (
'label' => Mage::helper('cms')->__('Status'),
'title' => Mage::helper('flagbit_faq')->__('Item status'),
'name' => 'is_active',
'required' => true,
'options' => array (
'1' => Mage::helper('cms')->__('Enabled'),
'0' => Mage::helper('cms')->__('Disabled') ) ));

$fieldset->addField('category_id', 'multiselect',
array (
'label' => Mage::helper('flagbit_faq')->__('Category'),
'title' => Mage::helper('flagbit_faq')->__('Category'),
'name' => 'categories[]',
'required' => false,
'values' => Mage::getResourceSingleton('flagbit_faq/category_collection')->toOptionArray(),
)
);

$fieldset->addField('answer', 'editor',
array (
'name' => 'answer',
'label' => Mage::helper('flagbit_faq')->__('Content'),
'title' => Mage::helper('flagbit_faq')->__('Content'),
'style' => 'height:36em;',
'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig(),
'required' => true ));

$fieldset->addField('answer_html', 'select',
array (
'label' => Mage::helper('flagbit_faq')->__('HTML answer'),
'title' => Mage::helper('flagbit_faq')->__('HTML answer'),
'name' => 'answer_html',
'required' => true,
'options' => array (
'1' => Mage::helper('cms')->__('Enabled'),
'0' => Mage::helper('cms')->__('Disabled') ) ));

$form->setValues($model->getData());
$this->setForm($form);

return parent::_prepareForm();
}
}
<?php
/**
* FAQ for Magento
*
* @category Flagbit
* @package Flagbit_Faq
* @copyright Copyright (c) 2009 Flagbit GmbH & Co. KG <[email protected]>
*/

/**
* FAQ for Magento
*
* @category Flagbit
* @package Flagbit_Faq
* @author Flagbit GmbH & Co. KG <[email protected]>
*/
class Flagbit_Faq_Block_Adminhtml_Item_Edit_Tab_Main extends Mage_Adminhtml_Block_Widget_Form
{
/**
* Prepares the page layout
*
* Loads the WYSIWYG editor on demand if enabled.
*
* @return Flagbit_Faq_Block_Admin_Edit
*/
protected function _prepareLayout()
{
$return = parent::_prepareLayout();
if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
$this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
}
return $return;
}

/**
* Preparation of current form
*
* @return Flagbit_Faq_Block_Admin_Edit_Tab_Main Self
*/
protected function _prepareForm()
{
$model = Mage::registry('faq');

$form = new Varien_Data_Form();
$form->setHtmlIdPrefix('faq_');

$fieldset = $form->addFieldset('base_fieldset', array (
'legend' => Mage::helper('flagbit_faq')->__('General information'),
'class' => 'fieldset-wide' ));

if ($model->getFaqId()) {
$fieldset->addField('faq_id', 'hidden', array (
'name' => 'faq_id' ));
}

$fieldset->addField('question', 'text', array (
'name' => 'question',
'label' => Mage::helper('flagbit_faq')->__('FAQ item question'),
'title' => Mage::helper('flagbit_faq')->__('FAQ item question'),
'required' => true ));

/**
* Check is single store mode
*/
if (!Mage::app()->isSingleStoreMode()) {
$fieldset->addField('store_id', 'multiselect',
array (
'name' => 'stores[]',
'label' => Mage::helper('cms')->__('Store view'),
'title' => Mage::helper('cms')->__('Store view'),
'required' => true,
'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true) ));
}
else {
$fieldset->addField('store_id', 'hidden', array (
'name' => 'stores[]',
'value' => Mage::app()->getStore(true)->getId() ));
$model->setStoreId(Mage::app()->getStore(true)->getId());
}

$fieldset->addField('position', 'text',
array (
'label' => Mage::helper('flagbit_faq')->__('position'),
'title' => Mage::helper('flagbit_faq')->__('position'),
'name' => 'position',
'required' => true));

$fieldset->addField('is_active', 'select',
array (
'label' => Mage::helper('cms')->__('Status'),
'title' => Mage::helper('flagbit_faq')->__('Item status'),
'name' => 'is_active',
'required' => true,
'options' => array (
'1' => Mage::helper('cms')->__('Enabled'),
'0' => Mage::helper('cms')->__('Disabled') ) ));

$fieldset->addField('category_id', 'multiselect',
array (
'label' => Mage::helper('flagbit_faq')->__('Category'),
'title' => Mage::helper('flagbit_faq')->__('Category'),
'name' => 'categories[]',
'required' => false,
'values' => Mage::getResourceSingleton('flagbit_faq/category_collection')->toOptionArray(),
)
);

$fieldset->addField('answer', 'editor',
array (
'name' => 'answer',
'label' => Mage::helper('flagbit_faq')->__('Content'),
'title' => Mage::helper('flagbit_faq')->__('Content'),
'style' => 'height:36em;',
'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig(),
'required' => true ));

$fieldset->addField('answer_html', 'select',
array (
'label' => Mage::helper('flagbit_faq')->__('HTML answer'),
'title' => Mage::helper('flagbit_faq')->__('HTML answer'),
'name' => 'answer_html',
'required' => true,
'options' => array (
'1' => Mage::helper('cms')->__('Enabled'),
'0' => Mage::helper('cms')->__('Disabled') ) ));

$form->setValues($model->getData());
$this->setForm($form);

return parent::_prepareForm();
}
}
Loading