Version Notes
Initial release
Download this release
Release Info
Developer | Felix Moche |
Extension | Kreativkonzentrat_Glossary |
Version | 0.5.0 |
Comparing to | |
See all releases |
Version 0.5.0
- app/code/community/Kreativkonzentrat/Glossary/Block/Adminhtml/Glossary.php +13 -0
- app/code/community/Kreativkonzentrat/Glossary/Block/Adminhtml/Glossary/Edit.php +52 -0
- app/code/community/Kreativkonzentrat/Glossary/Block/Adminhtml/Glossary/Edit/Form.php +18 -0
- app/code/community/Kreativkonzentrat/Glossary/Block/Adminhtml/Glossary/Edit/Tab/Form.php +84 -0
- app/code/community/Kreativkonzentrat/Glossary/Block/Adminhtml/Glossary/Edit/Tabs.php +22 -0
- app/code/community/Kreativkonzentrat/Glossary/Block/Adminhtml/Glossary/Grid.php +126 -0
- app/code/community/Kreativkonzentrat/Glossary/Block/Glossary.php +87 -0
- app/code/community/Kreativkonzentrat/Glossary/Block/Glossary/Navigation.php +41 -0
- app/code/community/Kreativkonzentrat/Glossary/Controller/Router.php +53 -0
- app/code/community/Kreativkonzentrat/Glossary/Helper/Data.php +9 -0
- app/code/community/Kreativkonzentrat/Glossary/Model/Adminhtml/Select.php +12 -0
- app/code/community/Kreativkonzentrat/Glossary/Model/Glossary.php +43 -0
- app/code/community/Kreativkonzentrat/Glossary/Model/Mysql4/Glossary.php +36 -0
- app/code/community/Kreativkonzentrat/Glossary/Model/Mysql4/Glossary/Collection.php +52 -0
- app/code/community/Kreativkonzentrat/Glossary/Model/Page.php +38 -0
- app/code/community/Kreativkonzentrat/Glossary/Model/Product.php +69 -0
- app/code/community/Kreativkonzentrat/Glossary/Model/Status.php +14 -0
- app/code/community/Kreativkonzentrat/Glossary/controllers/Adminhtml/GlossaryController.php +230 -0
- app/code/community/Kreativkonzentrat/Glossary/controllers/IndexController.php +37 -0
- app/code/community/Kreativkonzentrat/Glossary/controllers/ViewController.php +79 -0
- app/code/community/Kreativkonzentrat/Glossary/etc/config.xml +196 -0
- app/code/community/Kreativkonzentrat/Glossary/etc/system.xml +71 -0
- app/code/community/Kreativkonzentrat/Glossary/sql/glossary_setup/mysql4-install-0.5.0.php +34 -0
- app/design/adminhtml/default/default/layout/glossary.xml +8 -0
- app/design/frontend/base/default/layout/glossary.xml +81 -0
- app/design/frontend/base/default/template/glossary/glossary.phtml +19 -0
- app/design/frontend/base/default/template/glossary/glossary_letter.phtml +18 -0
- app/design/frontend/base/default/template/glossary/glossary_popup.phtml +17 -0
- app/design/frontend/base/default/template/glossary/glossary_single.phtml +17 -0
- app/design/frontend/base/default/template/glossary/letter/view.phtml +34 -0
- app/design/frontend/base/default/template/glossary/pager.phtml +64 -0
- app/design/frontend/base/default/template/glossary/toolbar.phtml +31 -0
- app/etc/modules/Kreativkonzentrat_Glossary.xml +9 -0
- app/locale/de_DE/Kreativkonzentrat_Glossary.csv +31 -0
- package.xml +18 -0
app/code/community/Kreativkonzentrat/Glossary/Block/Adminhtml/Glossary.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Kreativkonzentrat_Glossary_Block_Adminhtml_Glossary extends Mage_Adminhtml_Block_Widget_Grid_Container {
|
4 |
+
|
5 |
+
public function __construct() {
|
6 |
+
$this->_controller = 'adminhtml_glossary';
|
7 |
+
$this->_blockGroup = 'glossary';
|
8 |
+
$this->_headerText = Mage::helper('glossary')->__('Item Manager');
|
9 |
+
$this->_addButtonLabel = Mage::helper('glossary')->__('Add Item');
|
10 |
+
parent::__construct();
|
11 |
+
}
|
12 |
+
|
13 |
+
}
|
app/code/community/Kreativkonzentrat/Glossary/Block/Adminhtml/Glossary/Edit.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Kreativkonzentrat_Glossary_Block_Adminhtml_Glossary_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
|
4 |
+
|
5 |
+
public function __construct() {
|
6 |
+
parent::__construct();
|
7 |
+
|
8 |
+
$this->_objectId = 'id';
|
9 |
+
$this->_blockGroup = 'glossary';
|
10 |
+
$this->_controller = 'adminhtml_glossary';
|
11 |
+
|
12 |
+
$this->_updateButton('save', 'label', Mage::helper('catalog')->__('Save'));
|
13 |
+
$this->_updateButton('delete', 'label', Mage::helper('catalog')->__('Delete'));
|
14 |
+
|
15 |
+
$this->_addButton('saveandcontinue', array(
|
16 |
+
'label' => Mage::helper('catalog')->__('Save and Continue Edit'),
|
17 |
+
'onclick' => 'saveAndContinueEdit()',
|
18 |
+
'class' => 'save',
|
19 |
+
), -100);
|
20 |
+
|
21 |
+
$this->_formScripts[] = "
|
22 |
+
function toggleEditor() {
|
23 |
+
if (tinyMCE.getInstanceById('glossary_content') == null) {
|
24 |
+
tinyMCE.execCommand('mceAddControl', false, 'glossary_content');
|
25 |
+
} else {
|
26 |
+
tinyMCE.execCommand('mceRemoveControl', false, 'glossary_content');
|
27 |
+
}
|
28 |
+
}
|
29 |
+
|
30 |
+
function saveAndContinueEdit(){
|
31 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
32 |
+
}
|
33 |
+
";
|
34 |
+
}
|
35 |
+
|
36 |
+
protected function _prepareLayout() {
|
37 |
+
$return = parent::_prepareLayout();
|
38 |
+
if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
|
39 |
+
$this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
|
40 |
+
}
|
41 |
+
return $return;
|
42 |
+
}
|
43 |
+
|
44 |
+
public function getHeaderText() {
|
45 |
+
if (Mage::registry('glossary_data') && Mage::registry('glossary_data')->getId()) {
|
46 |
+
return Mage::helper('glossary')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('glossary_data')->getTitle()));
|
47 |
+
} else {
|
48 |
+
return Mage::helper('glossary')->__('Add Item');
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
}
|
app/code/community/Kreativkonzentrat/Glossary/Block/Adminhtml/Glossary/Edit/Form.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Kreativkonzentrat_Glossary_Block_Adminhtml_Glossary_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {
|
4 |
+
|
5 |
+
protected function _prepareForm() {
|
6 |
+
$form = new Varien_Data_Form(array(
|
7 |
+
'id' => 'edit_form',
|
8 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
9 |
+
'method' => 'post',
|
10 |
+
'enctype' => 'multipart/form-data'
|
11 |
+
)
|
12 |
+
);
|
13 |
+
$form->setUseContainer(true);
|
14 |
+
$this->setForm($form);
|
15 |
+
return parent::_prepareForm();
|
16 |
+
}
|
17 |
+
|
18 |
+
}
|
app/code/community/Kreativkonzentrat/Glossary/Block/Adminhtml/Glossary/Edit/Tab/Form.php
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Kreativkonzentrat_Glossary_Block_Adminhtml_Glossary_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
|
4 |
+
|
5 |
+
protected function _prepareForm() {
|
6 |
+
$model = Mage::registry('glossary_data');
|
7 |
+
$form = new Varien_Data_Form();
|
8 |
+
$this->setForm($form);
|
9 |
+
$fieldset = $form->addFieldset('glossary_form', array('legend' => Mage::helper('glossary')->__('Glossary Entry')));
|
10 |
+
|
11 |
+
$fieldset->addField('title', 'text', array(
|
12 |
+
'label' => Mage::helper('cms')->__('Title'),
|
13 |
+
'class' => 'required-entry',
|
14 |
+
'required' => true,
|
15 |
+
'name' => 'title',
|
16 |
+
));
|
17 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
18 |
+
$fieldset->addField('store_id', 'multiselect', array(
|
19 |
+
'name' => 'stores[]',
|
20 |
+
'label' => Mage::helper('cms')->__('Store View'),
|
21 |
+
'title' => Mage::helper('cms')->__('Store View'),
|
22 |
+
'required' => true,
|
23 |
+
'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
|
24 |
+
));
|
25 |
+
} else {
|
26 |
+
$fieldset->addField('store_id', 'hidden', array(
|
27 |
+
'name' => 'stores[]',
|
28 |
+
'value' => Mage::app()->getStore(true)->getId()
|
29 |
+
));
|
30 |
+
$model->setStoreId(Mage::app()->getStore(true)->getId());
|
31 |
+
}
|
32 |
+
$fieldset->addField('metakeywords', 'text', array(
|
33 |
+
'label' => Mage::helper('glossary')->__('Meta Keywords'),
|
34 |
+
'required' => false,
|
35 |
+
'name' => 'metakeywords',
|
36 |
+
));
|
37 |
+
|
38 |
+
$fieldset->addField('metadescription', 'text', array(
|
39 |
+
'label' => Mage::helper('glossary')->__('Meta Description'),
|
40 |
+
'required' => false,
|
41 |
+
'name' => 'metadescription',
|
42 |
+
));
|
43 |
+
|
44 |
+
$fieldset->addField('filename', 'file', array(
|
45 |
+
'label' => Mage::helper('glossary')->__('File'),
|
46 |
+
'required' => false,
|
47 |
+
'name' => 'filename',
|
48 |
+
));
|
49 |
+
|
50 |
+
$fieldset->addField('status', 'select', array(
|
51 |
+
'label' => Mage::helper('cms')->__('Status'),
|
52 |
+
'name' => 'status',
|
53 |
+
'values' => array(
|
54 |
+
array(
|
55 |
+
'value' => 1,
|
56 |
+
'label' => Mage::helper('cms')->__('Enabled'),
|
57 |
+
),
|
58 |
+
array(
|
59 |
+
'value' => 0,
|
60 |
+
'label' => Mage::helper('cms')->__('Disabled'),
|
61 |
+
),
|
62 |
+
),
|
63 |
+
));
|
64 |
+
|
65 |
+
$fieldset->addField('glossary_content', 'editor', array(
|
66 |
+
'name' => 'glossary_content',
|
67 |
+
'label' => Mage::helper('cms')->__('Content'),
|
68 |
+
'title' => Mage::helper('cms')->__('Content'),
|
69 |
+
'style' => 'width:700px; height:500px;',
|
70 |
+
'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig(),
|
71 |
+
'required' => true,
|
72 |
+
));
|
73 |
+
|
74 |
+
if (Mage::getSingleton('adminhtml/session')->getGlossaryData()) {
|
75 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getGlossaryData());
|
76 |
+
Mage::getSingleton('adminhtml/session')->setGlossaryData(null);
|
77 |
+
} elseif (Mage::registry('glossary_data')) {
|
78 |
+
$form->setValues(Mage::registry('glossary_data')->getData());
|
79 |
+
$this->setForm($form);
|
80 |
+
}
|
81 |
+
return parent::_prepareForm();
|
82 |
+
}
|
83 |
+
|
84 |
+
}
|
app/code/community/Kreativkonzentrat/Glossary/Block/Adminhtml/Glossary/Edit/Tabs.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Kreativkonzentrat_Glossary_Block_Adminhtml_Glossary_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
|
4 |
+
|
5 |
+
public function __construct() {
|
6 |
+
parent::__construct();
|
7 |
+
$this->setId('glossary_tabs');
|
8 |
+
$this->setDestElementId('edit_form');
|
9 |
+
$this->setTitle(Mage::helper('glossary')->__('Glossary Entry'));
|
10 |
+
}
|
11 |
+
|
12 |
+
protected function _beforeToHtml() {
|
13 |
+
$this->addTab('form_section', array(
|
14 |
+
'label' => Mage::helper('glossary')->__('Glossary Entry'),
|
15 |
+
'title' => Mage::helper('glossary')->__('Glossary Entry'),
|
16 |
+
'content' => $this->getLayout()->createBlock('glossary/adminhtml_glossary_edit_tab_form')->toHtml(),
|
17 |
+
));
|
18 |
+
|
19 |
+
return parent::_beforeToHtml();
|
20 |
+
}
|
21 |
+
|
22 |
+
}
|
app/code/community/Kreativkonzentrat/Glossary/Block/Adminhtml/Glossary/Grid.php
ADDED
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Kreativkonzentrat_Glossary_Block_Adminhtml_Glossary_Grid extends Mage_Adminhtml_Block_Widget_Grid {
|
4 |
+
|
5 |
+
public function __construct() {
|
6 |
+
parent::__construct();
|
7 |
+
$this->setId('glossarGrid');
|
8 |
+
$this->setDefaultSort('glossary_id');
|
9 |
+
$this->setDefaultDir('ASC');
|
10 |
+
$this->setSaveParametersInSession(true);
|
11 |
+
}
|
12 |
+
|
13 |
+
protected function _prepareCollection() {
|
14 |
+
$collection = Mage::getModel('glossary/glossary')->getCollection();
|
15 |
+
$this->setCollection($collection);
|
16 |
+
return parent::_prepareCollection();
|
17 |
+
}
|
18 |
+
|
19 |
+
protected function _prepareColumns() {
|
20 |
+
$this->addColumn('glossary_id', array(
|
21 |
+
'header' => Mage::helper('glossary')->__('ID'),
|
22 |
+
'align' => 'right',
|
23 |
+
'width' => '50px',
|
24 |
+
'index' => 'glossary_id',
|
25 |
+
));
|
26 |
+
|
27 |
+
$this->addColumn('title', array(
|
28 |
+
'header' => Mage::helper('glossary')->__('Title'),
|
29 |
+
'align' => 'left',
|
30 |
+
'index' => 'title',
|
31 |
+
));
|
32 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
33 |
+
$this->addColumn('store_id', array(
|
34 |
+
'header' => Mage::helper('cms')->__('Store View'),
|
35 |
+
'index' => 'store_id',
|
36 |
+
'type' => 'store',
|
37 |
+
'store_all' => true,
|
38 |
+
'store_view' => true,
|
39 |
+
'sortable' => false,
|
40 |
+
'filter_condition_callback'
|
41 |
+
=> array($this, '_filterStoreCondition'),
|
42 |
+
));
|
43 |
+
}
|
44 |
+
|
45 |
+
$this->addColumn('status', array(
|
46 |
+
'header' => Mage::helper('glossary')->__('Status'),
|
47 |
+
'align' => 'left',
|
48 |
+
'width' => '80px',
|
49 |
+
'index' => 'status',
|
50 |
+
'type' => 'options',
|
51 |
+
'options' => array(
|
52 |
+
1 => 'Enabled',
|
53 |
+
0 => 'Disabled',
|
54 |
+
),
|
55 |
+
));
|
56 |
+
|
57 |
+
$this->addColumn('action', array(
|
58 |
+
'header' => Mage::helper('adminhtml')->__('Action'),
|
59 |
+
'width' => '100',
|
60 |
+
'type' => 'action',
|
61 |
+
'getter' => 'getId',
|
62 |
+
'actions' => array(
|
63 |
+
array(
|
64 |
+
'caption' => Mage::helper('adminhtml')->__('Edit'),
|
65 |
+
'url' => array('base' => '*/*/edit'),
|
66 |
+
'field' => 'id'
|
67 |
+
)
|
68 |
+
),
|
69 |
+
'filter' => false,
|
70 |
+
'sortable' => false,
|
71 |
+
'index' => 'stores',
|
72 |
+
'is_system' => true,
|
73 |
+
));
|
74 |
+
|
75 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('adminhtml')->__('CSV'));
|
76 |
+
$this->addExportType('*/*/exportXml', Mage::helper('adminhtml')->__('XML'));
|
77 |
+
|
78 |
+
return parent::_prepareColumns();
|
79 |
+
}
|
80 |
+
|
81 |
+
protected function _prepareMassaction() {
|
82 |
+
$this->setMassactionIdField('glossary_id');
|
83 |
+
$this->getMassactionBlock()->setFormFieldName('glossary');
|
84 |
+
|
85 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
86 |
+
'label' => Mage::helper('catalog')->__('Delete'),
|
87 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
88 |
+
'confirm' => Mage::helper('catalog')->__('Are you sure?')
|
89 |
+
));
|
90 |
+
|
91 |
+
$statuses = Mage::getSingleton('glossary/status')->getOptionArray();
|
92 |
+
|
93 |
+
array_unshift($statuses, array('label' => '', 'value' => ''));
|
94 |
+
$this->getMassactionBlock()->addItem('status', array(
|
95 |
+
'label' => Mage::helper('catalog')->__('Change status'),
|
96 |
+
'url' => $this->getUrl('*/*/massStatus', array('_current' => true)),
|
97 |
+
'additional' => array(
|
98 |
+
'visibility' => array(
|
99 |
+
'name' => 'status',
|
100 |
+
'type' => 'select',
|
101 |
+
'class' => 'required-entry',
|
102 |
+
'label' => Mage::helper('catalog')->__('Status'),
|
103 |
+
'values' => $statuses
|
104 |
+
)
|
105 |
+
)
|
106 |
+
));
|
107 |
+
return $this;
|
108 |
+
}
|
109 |
+
|
110 |
+
protected function _afterLoadCollection() {
|
111 |
+
$this->getCollection()->walk('afterLoad');
|
112 |
+
parent::_afterLoadCollection();
|
113 |
+
}
|
114 |
+
|
115 |
+
public function getRowUrl($row) {
|
116 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
117 |
+
}
|
118 |
+
|
119 |
+
protected function _filterStoreCondition($collection, $column) {
|
120 |
+
if (!$value = $column->getFilter()->getValue()) {
|
121 |
+
return;
|
122 |
+
}
|
123 |
+
$this->getCollection()->addStoreFilter($value);
|
124 |
+
}
|
125 |
+
|
126 |
+
}
|
app/code/community/Kreativkonzentrat/Glossary/Block/Glossary.php
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Kreativkonzentrat_Glossary_Block_Glossary extends Mage_Core_Block_Template {
|
4 |
+
|
5 |
+
public function _construct() {
|
6 |
+
}
|
7 |
+
|
8 |
+
public function getPagerHtml() {
|
9 |
+
return $this->getChildHtml('pager');
|
10 |
+
}
|
11 |
+
|
12 |
+
public function getCacheKey() {
|
13 |
+
return 'glossary' . Mage::app()->getStore()->getId() . $this->getRequest()->getRequestUri();
|
14 |
+
}
|
15 |
+
|
16 |
+
public function getCrumbTitle() {
|
17 |
+
|
18 |
+
if ($this->getRequest()->getActionName() == 'letter') {
|
19 |
+
$letter = array_keys($this->getRequest()->getParams());
|
20 |
+
if ($letter != null)
|
21 |
+
return $letter[0];
|
22 |
+
}
|
23 |
+
|
24 |
+
$glossary_id = $this->getRequest()->getParam('id');
|
25 |
+
if ($glossary_id != null && $glossary_id != '') {
|
26 |
+
return Mage::getModel('glossary/glossary')->load($glossary_id)->getTitle();
|
27 |
+
}
|
28 |
+
|
29 |
+
return null;
|
30 |
+
}
|
31 |
+
|
32 |
+
public function _prepareLayout() {
|
33 |
+
// show breadcrumbs
|
34 |
+
$kk_gloss = $this->getCrumbTitle();
|
35 |
+
if (Mage::getStoreConfig('web/default/show_cms_breadcrumbs') && ($breadcrumbs = $this->getLayout()->getBlock('breadcrumbs'))) {
|
36 |
+
$breadcrumbs->addCrumb('home', array(
|
37 |
+
'label'=>Mage::helper('catalogsearch')->__('Home'),
|
38 |
+
'title'=>Mage::helper('catalogsearch')->__('Go to Home Page'),
|
39 |
+
'link' => Mage::getBaseUrl()
|
40 |
+
)
|
41 |
+
);
|
42 |
+
|
43 |
+
//set linked glossary crumb and current entry crumb if this is a detail view
|
44 |
+
if ($kk_gloss) {
|
45 |
+
$breadcrumbs->addCrumb('glossary', array('label' => Mage::helper('glossary')->__('Glossary'), 'link' => Mage::getUrl('glossary/'),));
|
46 |
+
$breadcrumbs->addCrumb('title', array('label' => $kk_gloss, 'title' => $kk_gloss));
|
47 |
+
}
|
48 |
+
|
49 |
+
//otherwise just add glossary entry without link
|
50 |
+
else
|
51 |
+
$breadcrumbs->addCrumb('glossary', array('label' => Mage::helper('glossary')->__('Glossary'),));
|
52 |
+
}
|
53 |
+
|
54 |
+
if ($root = $this->getLayout()->getBlock('root')) {
|
55 |
+
$root->addBodyClass('glossary');
|
56 |
+
}
|
57 |
+
|
58 |
+
if ($head = $this->getLayout()->getBlock('head')) {
|
59 |
+
if ($kk_gloss) {
|
60 |
+
$head->setTitle(Mage::helper('glossary')->__('Glossary') . ' - ' . $kk_gloss);
|
61 |
+
} else {
|
62 |
+
$head->setTitle(Mage::helper('glossary')->__('Glossary'));
|
63 |
+
}
|
64 |
+
$glossary_id = $this->getRequest()->getParam('id');
|
65 |
+
$glossary = Mage::getModel('glossary/glossary')->load($glossary_id);
|
66 |
+
$head->setKeywords($glossary->getMetakeywords());
|
67 |
+
$head->setDescription($glossary->getMetadescription());
|
68 |
+
}
|
69 |
+
return parent::_prepareLayout();
|
70 |
+
}
|
71 |
+
|
72 |
+
public function getGlossary() {
|
73 |
+
if (!$this->hasData('glossary')) {
|
74 |
+
$this->setData('glossary', Mage::registry('glossary'));
|
75 |
+
}
|
76 |
+
return $this->getData('glossary');
|
77 |
+
}
|
78 |
+
|
79 |
+
public function getCurrentPage() {
|
80 |
+
$layer = Mage::getSingleton('catalog/layer');
|
81 |
+
if ($layer) {
|
82 |
+
return $layer->getProductCollection()->getCurPage();
|
83 |
+
}
|
84 |
+
return false;
|
85 |
+
}
|
86 |
+
|
87 |
+
}
|
app/code/community/Kreativkonzentrat/Glossary/Block/Glossary/Navigation.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Kreativkonzentrat_Glossary_Block_Glossary_Navigation extends Mage_Core_Block_Template {
|
4 |
+
|
5 |
+
public function _construct() {
|
6 |
+
$this->setCacheLifetime(3600);
|
7 |
+
$this->setCacheKey('glossary_letter_navigation_store_default');
|
8 |
+
}
|
9 |
+
|
10 |
+
public function getCacheKey() {
|
11 |
+
return 'glossary_letter_navigation_' . Mage::app()->getStore()->getId();
|
12 |
+
}
|
13 |
+
|
14 |
+
public function _prepareLayout() {
|
15 |
+
return parent::_prepareLayout();
|
16 |
+
}
|
17 |
+
|
18 |
+
public function buildNavigation() {
|
19 |
+
$store = Mage :: app()->getStore();
|
20 |
+
if ($store instanceof Mage_Core_Model_Store) {
|
21 |
+
$store = array($store->getId());
|
22 |
+
}
|
23 |
+
$store2 = implode(",", $store);
|
24 |
+
$resource = Mage::getSingleton('core/resource');
|
25 |
+
$read = $resource->getConnection('core_read');
|
26 |
+
$glossaryTable = $resource->getTableName('glossary');
|
27 |
+
$storeTable = $resource->getTableName('glossary_store');
|
28 |
+
$conn = Mage::getSingleton('core/resource')->getConnection('core_read');
|
29 |
+
$results = array();
|
30 |
+
foreach($conn->fetchAll("SELECT DISTINCT letter
|
31 |
+
FROM `$glossaryTable`INNER JOIN `$storeTable`
|
32 |
+
ON $glossaryTable.glossary_id = $storeTable.glossary_id
|
33 |
+
WHERE (glossary_store.store_id IN (0, $store2))
|
34 |
+
ORDER BY letter;
|
35 |
+
") as $letter){
|
36 |
+
$results[] = $letter['letter'];
|
37 |
+
};
|
38 |
+
return $results;
|
39 |
+
}
|
40 |
+
|
41 |
+
}
|
app/code/community/Kreativkonzentrat/Glossary/Controller/Router.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Kreativkonzentrat_Glossary_Controller_Router extends Mage_Core_Controller_Varien_Router_Abstract {
|
4 |
+
|
5 |
+
public function initControllerRouters($observer) {
|
6 |
+
$front = $observer->getEvent()->getFront();
|
7 |
+
$front->addRouter('glossary/entry', $this);
|
8 |
+
|
9 |
+
}
|
10 |
+
|
11 |
+
public function match(Zend_Controller_Request_Http $request) {
|
12 |
+
$kk_params = trim($request->getPathInfo(), '/');
|
13 |
+
$kk_params = explode('/', $kk_params);
|
14 |
+
if (isset($kk_params[0]))
|
15 |
+
$kkg_param = $kk_params[0];
|
16 |
+
if (isset($kk_params[1]))
|
17 |
+
$kkg_param2 = $kk_params[1];
|
18 |
+
if (isset($kk_params[2]))
|
19 |
+
$kkg_param3 = $kk_params[2];
|
20 |
+
if (isset($kk_params[3]))
|
21 |
+
$kkg_param4 = $kk_params[3];
|
22 |
+
if (isset($kkg_param2) && isset($kkg_param3) && isset($kkg_param4) && $kkg_param4 == 'popup') {
|
23 |
+
$glossary = Mage::getModel('glossary/glossary');
|
24 |
+
$itemId = $glossary->FindGlossaryEntry($kkg_param3);
|
25 |
+
|
26 |
+
$request->setModuleName('glossary')
|
27 |
+
->setControllerName('view')
|
28 |
+
->setActionName('popup')
|
29 |
+
->setParam('id', $itemId);
|
30 |
+
|
31 |
+
$request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, 'glossary/view/id?id=' . $itemId);
|
32 |
+
|
33 |
+
return true;
|
34 |
+
}
|
35 |
+
|
36 |
+
if (isset($kkg_param) && $kkg_param == 'glossary' && isset($kkg_param2) && $kkg_param2 == 'entry') {
|
37 |
+
$glossary = Mage::getModel('glossary/glossary');
|
38 |
+
$itemId = $glossary->FindGlossaryEntry($kkg_param3);
|
39 |
+
|
40 |
+
$request->setModuleName('glossary')
|
41 |
+
->setControllerName('view')
|
42 |
+
->setActionName('id')
|
43 |
+
->setParam('id', $itemId);
|
44 |
+
|
45 |
+
$request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, 'glossary/view/id?id=' . $itemId);
|
46 |
+
|
47 |
+
return true;
|
48 |
+
} else {
|
49 |
+
return false;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
}
|
app/code/community/Kreativkonzentrat/Glossary/Helper/Data.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Kreativkonzentrat_Glossary_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
public function getGlossaryIndexUrl()
|
6 |
+
{
|
7 |
+
return $this->_getUrl('glossary');
|
8 |
+
}
|
9 |
+
}
|
app/code/community/Kreativkonzentrat/Glossary/Model/Adminhtml/Select.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Kreativkonzentrat_Glossary_Model_Adminhtml_Select {
|
4 |
+
|
5 |
+
public function toOptionArray() {
|
6 |
+
return array(
|
7 |
+
array('value' => 1, 'label' => Mage::helper('core')->__('Yes')),
|
8 |
+
array('value' => 0, 'label' => Mage::helper('core')->__('No')),
|
9 |
+
);
|
10 |
+
}
|
11 |
+
|
12 |
+
}
|
app/code/community/Kreativkonzentrat/Glossary/Model/Glossary.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Kreativkonzentrat_Glossary_Model_Glossary extends Mage_Core_Model_Abstract {
|
4 |
+
|
5 |
+
protected $_glossaryCollection;
|
6 |
+
|
7 |
+
public function _construct() {
|
8 |
+
parent::_construct();
|
9 |
+
$this->_init('glossary/glossary');
|
10 |
+
}
|
11 |
+
|
12 |
+
public function FindGlossaryEntry($request) {
|
13 |
+
$collection = Mage::getModel('glossary/glossary')->getCollection()
|
14 |
+
->addFilter('status', 1)
|
15 |
+
->addStoreFilter(Mage :: app()->getStore());
|
16 |
+
foreach ($collection as $item) {
|
17 |
+
if(strcasecmp(urlencode($item['title']), $request) == 0)
|
18 |
+
return $item->getID();
|
19 |
+
}
|
20 |
+
return false;
|
21 |
+
}
|
22 |
+
|
23 |
+
public function getUrl(){
|
24 |
+
return Mage::app()->getStore()->getUrl('glossary/entry') . urlencode($this->getTitle());
|
25 |
+
}
|
26 |
+
|
27 |
+
public function getTitles() {
|
28 |
+
$collection = Mage::getModel('glossary/glossary')->getCollection()
|
29 |
+
->addStoreFilter(Mage :: app()->getStore());
|
30 |
+
$titles = array();
|
31 |
+
foreach ($collection as $item) {
|
32 |
+
$titles[] = '/(?!(?:[^<]+>|[^>]+<\/a>))(' . htmlentities(str_replace("/", "", $item['title']), ENT_COMPAT, "UTF-8") . ')/i';
|
33 |
+
}
|
34 |
+
return $titles;
|
35 |
+
}
|
36 |
+
|
37 |
+
public function getFilteredCollection() {
|
38 |
+
return Mage::getModel('glossary/glossary')->getCollection()
|
39 |
+
->addFilter('status', 1)
|
40 |
+
->addStoreFilter(Mage :: app()->getStore());
|
41 |
+
}
|
42 |
+
|
43 |
+
}
|
app/code/community/Kreativkonzentrat/Glossary/Model/Mysql4/Glossary.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Kreativkonzentrat_Glossary_Model_Mysql4_Glossary extends Mage_Core_Model_Mysql4_Abstract {
|
4 |
+
|
5 |
+
public function _construct() {
|
6 |
+
$this->_init('glossary/glossary', 'glossary_id');
|
7 |
+
}
|
8 |
+
|
9 |
+
protected function _afterSave(Mage_Core_Model_Abstract $object) {
|
10 |
+
|
11 |
+
$condition = $this->_getWriteAdapter()->quoteInto('glossary_id = ?', $object->getId());
|
12 |
+
// process glossary entry to store relation
|
13 |
+
$this->_getWriteAdapter()->delete($this->getTable('glossary_store'), $condition);
|
14 |
+
foreach ((array) $object->getData('stores') as $store) {
|
15 |
+
$storeArray = array();
|
16 |
+
$storeArray['glossary_id'] = $object->getId();
|
17 |
+
$storeArray['store_id'] = $store;
|
18 |
+
$this->_getWriteAdapter()->insert($this->getTable('glossary_store'), $storeArray);
|
19 |
+
}
|
20 |
+
return parent::_afterSave($object);
|
21 |
+
}
|
22 |
+
|
23 |
+
protected function _afterLoad(Mage_Core_Model_Abstract $object) {
|
24 |
+
// process glossary entry to store relation
|
25 |
+
$select = $this->_getReadAdapter()->select()->from($this->getTable('glossary_store'))->where('glossary_id = ?', $object->getId());
|
26 |
+
if ($data = $this->_getReadAdapter()->fetchAll($select)) {
|
27 |
+
$storesArray = array();
|
28 |
+
foreach ($data as $row) {
|
29 |
+
$storesArray[] = $row['store_id'];
|
30 |
+
}
|
31 |
+
$object->setData('store_id', $storesArray);
|
32 |
+
}
|
33 |
+
return parent::_afterLoad($object);
|
34 |
+
}
|
35 |
+
|
36 |
+
}
|
app/code/community/Kreativkonzentrat/Glossary/Model/Mysql4/Glossary/Collection.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Kreativkonzentrat_Glossary_Model_Mysql4_Glossary_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
|
4 |
+
|
5 |
+
public function _construct() {
|
6 |
+
parent::_construct();
|
7 |
+
$this->_init('glossary/glossary');
|
8 |
+
}
|
9 |
+
|
10 |
+
public function setAlphabeticalOrder() {
|
11 |
+
$this->getSelect()->order('title ASC');
|
12 |
+
return $this;
|
13 |
+
}
|
14 |
+
|
15 |
+
public function addStoreFilter($store) {
|
16 |
+
if ($store instanceof Mage_Core_Model_Store) {
|
17 |
+
$store = array($store->getId());
|
18 |
+
}
|
19 |
+
$test = $this->getSelect()->join(
|
20 |
+
array('store_table' => $this->getTable('glossary_store')), 'main_table.glossary_id = store_table.glossary_id', array()
|
21 |
+
)
|
22 |
+
->where('store_table.store_id in (?)', array(0, $store));
|
23 |
+
//echo ($test->__toString());
|
24 |
+
return $this;
|
25 |
+
}
|
26 |
+
|
27 |
+
protected function _afterLoad() {
|
28 |
+
$items = $this->getColumnValues('glossary_id');
|
29 |
+
if (count($items)) {
|
30 |
+
$select = $this->getConnection()->select()->from($this->getTable('glossary_store'))
|
31 |
+
->where($this->getTable('glossary_store') . '.glossary_id IN (?)', $items);
|
32 |
+
if ($result = $this->getConnection()->fetchPairs($select)) {
|
33 |
+
foreach ($this as $item) {
|
34 |
+
if (!isset($result[$item->getData('glossary_id')])) {
|
35 |
+
continue;
|
36 |
+
}
|
37 |
+
if ($result[$item->getData('glossary_id')] == 0) {
|
38 |
+
$stores = Mage::app()->getStores(false, true);
|
39 |
+
$storeId = current($stores)->getId();
|
40 |
+
$storeCode = key($stores);
|
41 |
+
} else {
|
42 |
+
$storeId = $result[$item->getData('glossary_id')];
|
43 |
+
$storeCode = Mage::app()->getStore($storeId)->getCode();
|
44 |
+
}
|
45 |
+
$item->setData('_first_store_id', $storeId);
|
46 |
+
$item->setData('store_code', $storeCode);
|
47 |
+
}
|
48 |
+
}
|
49 |
+
}
|
50 |
+
parent::_afterLoad();
|
51 |
+
}
|
52 |
+
}
|
app/code/community/Kreativkonzentrat/Glossary/Model/Page.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Kreativkonzentrat_Glossary_Model_Page extends Mage_Cms_Model_Page {
|
4 |
+
|
5 |
+
public function getContent() {
|
6 |
+
if (Mage::getStoreConfig('glossary/replacings/cms_replace') == 1) {
|
7 |
+
$originalContent = parent::getContent();
|
8 |
+
//get available glossary entries
|
9 |
+
$titles = Mage::getModel('glossary/glossary')->getTitles();
|
10 |
+
|
11 |
+
function kkg_callback($hit) {
|
12 |
+
$result =
|
13 |
+
'<a href="#" onclick="popWin(\' '
|
14 |
+
. Mage::getUrl('glossary/entry')
|
15 |
+
. urlencode(html_entity_decode($hit[0], ENT_COMPAT, "UTF-8"))
|
16 |
+
. '/popup\',\'ge\',\'width=300,height=300,resizable=yes,scrollbars=yes\')">'
|
17 |
+
. $hit[0]
|
18 |
+
. '</a>';
|
19 |
+
return $result;
|
20 |
+
}
|
21 |
+
|
22 |
+
//match entries with description and add link
|
23 |
+
if (Mage::getStoreConfig('glossary/replacings/open_popup') == 1) {
|
24 |
+
return preg_replace_callback($titles, 'kkg_callback', $originalContent);
|
25 |
+
} else {
|
26 |
+
return preg_replace_callback(
|
27 |
+
$titles, create_function('$hit', 'return "<a href=\"'
|
28 |
+
. Mage::getUrl()
|
29 |
+
. 'glossary/entry/".urlencode(html_entity_decode($hit[0],ENT_COMPAT,"UTF-8"))
|
30 |
+
."\">".$hit[0]."</a>";'), $originalContent
|
31 |
+
);
|
32 |
+
}
|
33 |
+
} else {
|
34 |
+
return parent::getContent();
|
35 |
+
}
|
36 |
+
}
|
37 |
+
|
38 |
+
}
|
app/code/community/Kreativkonzentrat/Glossary/Model/Product.php
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Kreativkonzentrat_Glossary_Model_Product extends Mage_Catalog_Model_Product
|
3 |
+
{
|
4 |
+
public function getShortDescription()
|
5 |
+
{
|
6 |
+
if (Mage::getStoreConfig('glossary/replacings/sd_replace') == 1){
|
7 |
+
//get original short description
|
8 |
+
$originalShortDescription = parent::getShortDescription();
|
9 |
+
//get available glossary entries
|
10 |
+
$titles = Mage::getModel('glossary/glossary')->getTitles();
|
11 |
+
//match entries with description and add link
|
12 |
+
if (Mage::getStoreConfig('glossary/replacings/open_popup') == 1) {
|
13 |
+
return preg_replace_callback(
|
14 |
+
$titles,
|
15 |
+
create_function('$hit','return "<a href=\"#\" onclick=\"popWin(\'"
|
16 |
+
. Mage::getBaseUrl()
|
17 |
+
. "glossary/entry/"
|
18 |
+
. urlencode(html_entity_decode($hit[0], ENT_COMPAT, \'UTF-8\'))
|
19 |
+
."/popup\',\'ge\',\'width=300,height=300,resizable=yes,scrollbars=yes\')\">"
|
20 |
+
. $hit[0]
|
21 |
+
. "</a>";'),
|
22 |
+
$originalShortDescription
|
23 |
+
);
|
24 |
+
} else {
|
25 |
+
return preg_replace_callback(
|
26 |
+
$titles,
|
27 |
+
create_function('$hit','return "<a href=\"'.Mage::getBaseUrl().'glossary/entry/".urlencode($hit[0])."\">".$hit[0]."</a>";'),
|
28 |
+
$originalShortDescription
|
29 |
+
);
|
30 |
+
}
|
31 |
+
}
|
32 |
+
else {
|
33 |
+
return parent::getShortDescription();
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
public function getDescription()
|
38 |
+
{
|
39 |
+
if (Mage::getStoreConfig('glossary/replacings/d_replace') == 1){
|
40 |
+
//get original description
|
41 |
+
$originalDescription = parent::getDescription();
|
42 |
+
//get available glossary entries
|
43 |
+
$titles = Mage::getModel('glossary/glossary')->getTitles();
|
44 |
+
if (Mage::getStoreConfig('glossary/replacings/open_popup') == 1) {
|
45 |
+
return preg_replace_callback(
|
46 |
+
$titles,
|
47 |
+
create_function('$hit','return "<a href=\"#\" onclick=\"popWin(\'"
|
48 |
+
. Mage::getBaseUrl()
|
49 |
+
. "glossary/entry/"
|
50 |
+
. urlencode(html_entity_decode($hit[0], ENT_COMPAT, \'UTF-8\'))
|
51 |
+
."/popup\',\'ge\',\'width=300,height=300,resizable=yes,scrollbars=yes\')\">"
|
52 |
+
. $hit[0]
|
53 |
+
. "</a>";'),
|
54 |
+
$originalDescription
|
55 |
+
);
|
56 |
+
} else {
|
57 |
+
//match entries with description and add link
|
58 |
+
return preg_replace_callback(
|
59 |
+
$titles,
|
60 |
+
create_function('$hit','return "<a href=\"'.Mage::getBaseUrl().'glossary/entry/".urlencode($hit[0])."\">".$hit[0]."</a>";'),
|
61 |
+
$originalDescription
|
62 |
+
);
|
63 |
+
}
|
64 |
+
}
|
65 |
+
else{
|
66 |
+
return parent::getDescription();
|
67 |
+
}
|
68 |
+
}
|
69 |
+
}
|
app/code/community/Kreativkonzentrat/Glossary/Model/Status.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Kreativkonzentrat_Glossary_Model_Status extends Varien_Object {
|
4 |
+
const STATUS_ENABLED = 1;
|
5 |
+
const STATUS_DISABLED = 0;
|
6 |
+
|
7 |
+
static public function getOptionArray() {
|
8 |
+
return array(
|
9 |
+
self::STATUS_ENABLED => Mage::helper('glossary')->__('Enabled'),
|
10 |
+
self::STATUS_DISABLED => Mage::helper('glossary')->__('Disabled')
|
11 |
+
);
|
12 |
+
}
|
13 |
+
|
14 |
+
}
|
app/code/community/Kreativkonzentrat/Glossary/controllers/Adminhtml/GlossaryController.php
ADDED
@@ -0,0 +1,230 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Kreativkonzentrat_Glossary_Adminhtml_GlossaryController extends Mage_Adminhtml_Controller_Action {
|
4 |
+
|
5 |
+
protected function _initAction() {
|
6 |
+
$this->loadLayout()
|
7 |
+
->_setActiveMenu('glossary/items')
|
8 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
9 |
+
|
10 |
+
return $this;
|
11 |
+
}
|
12 |
+
|
13 |
+
public function indexAction() {
|
14 |
+
$this->_initAction()->renderLayout();
|
15 |
+
}
|
16 |
+
|
17 |
+
public function editAction() {
|
18 |
+
$id = $this->getRequest()->getParam('id');
|
19 |
+
$model = Mage::getModel('glossary/glossary')->load($id);
|
20 |
+
|
21 |
+
if ($model->getId() || $id == 0) {
|
22 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
23 |
+
if (!empty($data)) {
|
24 |
+
$model->setData($data);
|
25 |
+
}
|
26 |
+
|
27 |
+
Mage::register('glossary_data', $model);
|
28 |
+
|
29 |
+
$this->loadLayout();
|
30 |
+
$this->_setActiveMenu('glossary/items');
|
31 |
+
|
32 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
33 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
|
34 |
+
|
35 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
36 |
+
|
37 |
+
$this->_addContent($this->getLayout()->createBlock('glossary/adminhtml_glossary_edit'))
|
38 |
+
->_addLeft($this->getLayout()->createBlock('glossary/adminhtml_glossary_edit_tabs'));
|
39 |
+
|
40 |
+
$this->renderLayout();
|
41 |
+
} else {
|
42 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('glossary')->__('Item does not exist'));
|
43 |
+
$this->_redirect('*/*/');
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
public function newAction() {
|
48 |
+
$this->_forward('edit');
|
49 |
+
}
|
50 |
+
|
51 |
+
public function saveAction() {
|
52 |
+
if ($data = $this->getRequest()->getPost()) {
|
53 |
+
|
54 |
+
if (isset($_FILES['filename']['name']) && $_FILES['filename']['name'] != '') {
|
55 |
+
try {
|
56 |
+
/* Starting upload */
|
57 |
+
$uploader = new Varien_File_Uploader('filename');
|
58 |
+
|
59 |
+
// Any extension would work
|
60 |
+
$uploader->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'));
|
61 |
+
$uploader->setAllowRenameFiles(false);
|
62 |
+
|
63 |
+
// Set the file upload mode
|
64 |
+
// false -> get the file directly in the specified folder
|
65 |
+
// true -> get the file in the product like folders
|
66 |
+
// (file.jpg will go in something like /media/f/i/file.jpg)
|
67 |
+
$uploader->setFilesDispersion(false);
|
68 |
+
|
69 |
+
// We set media as the upload dir
|
70 |
+
$path = Mage::getBaseDir('media') . DS;
|
71 |
+
$uploader->save($path, $_FILES['filename']['name']);
|
72 |
+
} catch (Exception $e) {
|
73 |
+
|
74 |
+
}
|
75 |
+
|
76 |
+
//this way the name is saved in DB
|
77 |
+
$data['filename'] = $_FILES['filename']['name'];
|
78 |
+
}
|
79 |
+
$stores = $this->getRequest()->getPost('stores', false);
|
80 |
+
//fix for "all storeviews"
|
81 |
+
$storeIds = array();
|
82 |
+
if($stores[0] == '0'){
|
83 |
+
$data['stores'] = array('0');
|
84 |
+
}
|
85 |
+
|
86 |
+
$model = Mage::getModel('glossary/glossary');
|
87 |
+
$model->setData($data)
|
88 |
+
->setId($this->getRequest()->getParam('id'));
|
89 |
+
|
90 |
+
try {
|
91 |
+
if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
|
92 |
+
$model->setCreatedTime(now())
|
93 |
+
->setUpdateTime(now());
|
94 |
+
} else {
|
95 |
+
$model->setUpdateTime(now());
|
96 |
+
}
|
97 |
+
$title = $data['title'];
|
98 |
+
$title2 = utf8_decode($data['title']);
|
99 |
+
$title = utf8_encode($title2[0]);
|
100 |
+
|
101 |
+
function testF($title) {
|
102 |
+
if (preg_match('/^[a-z]$/i', $title)) {
|
103 |
+
return strtoupper($title);
|
104 |
+
}
|
105 |
+
|
106 |
+
switch ($title) {
|
107 |
+
case 'ä': case 'Ä':
|
108 |
+
return 'A';
|
109 |
+
case 'ö': case 'Ö':
|
110 |
+
return 'O';
|
111 |
+
case 'ü': case 'Ü':
|
112 |
+
return 'U';
|
113 |
+
default:
|
114 |
+
return '123';
|
115 |
+
}
|
116 |
+
}
|
117 |
+
|
118 |
+
$model->setLetter(testF($title));
|
119 |
+
$model->save();
|
120 |
+
//TODO:
|
121 |
+
//Mage::app()->cleanCache();
|
122 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('glossary')->__('Item was successfully saved'));
|
123 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
124 |
+
|
125 |
+
if ($this->getRequest()->getParam('back')) {
|
126 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId()));
|
127 |
+
return;
|
128 |
+
}
|
129 |
+
$this->_redirect('*/*/');
|
130 |
+
return;
|
131 |
+
} catch (Exception $e) {
|
132 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
133 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
134 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
135 |
+
return;
|
136 |
+
}
|
137 |
+
}
|
138 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('glossary')->__('Unable to find item to save'));
|
139 |
+
$this->_redirect('*/*/');
|
140 |
+
}
|
141 |
+
|
142 |
+
public function deleteAction() {
|
143 |
+
if ($this->getRequest()->getParam('id') > 0) {
|
144 |
+
try {
|
145 |
+
$model = Mage::getModel('glossary/glossary');
|
146 |
+
|
147 |
+
$model->setId($this->getRequest()->getParam('id'))
|
148 |
+
->delete();
|
149 |
+
|
150 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
|
151 |
+
$this->_redirect('*/*/');
|
152 |
+
} catch (Exception $e) {
|
153 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
154 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
155 |
+
}
|
156 |
+
}
|
157 |
+
$this->_redirect('*/*/');
|
158 |
+
}
|
159 |
+
|
160 |
+
public function massDeleteAction() {
|
161 |
+
$glossaryIds = $this->getRequest()->getParam('glossary');
|
162 |
+
if (!is_array($glossaryIds)) {
|
163 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
|
164 |
+
} else {
|
165 |
+
try {
|
166 |
+
foreach ($glossaryIds as $glossaryId) {
|
167 |
+
$glossary = Mage::getModel('glossary/glossary')->load($glossaryId);
|
168 |
+
$glossary->delete();
|
169 |
+
}
|
170 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
171 |
+
Mage::helper('adminhtml')->__('Total of %d record(s) were successfully deleted', count($glossaryIds))
|
172 |
+
);
|
173 |
+
} catch (Exception $e) {
|
174 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
175 |
+
}
|
176 |
+
}
|
177 |
+
$this->_redirect('*/*/index');
|
178 |
+
}
|
179 |
+
|
180 |
+
public function massStatusAction() {
|
181 |
+
$glossaryIds = $this->getRequest()->getParam('glossary');
|
182 |
+
if (!is_array($glossaryIds)) {
|
183 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
|
184 |
+
} else {
|
185 |
+
try {
|
186 |
+
foreach ($glossaryIds as $glossaryId) {
|
187 |
+
$glossary = Mage::getSingleton('glossary/glossary')
|
188 |
+
->load($glossaryId)
|
189 |
+
->setStatus($this->getRequest()->getParam('status'))
|
190 |
+
->setIsMassupdate(true)
|
191 |
+
->save();
|
192 |
+
}
|
193 |
+
$this->_getSession()->addSuccess($this->__('Total of %d record(s) were successfully updated', count($glossaryIds)));
|
194 |
+
} catch (Exception $e) {
|
195 |
+
$this->_getSession()->addError($e->getMessage());
|
196 |
+
}
|
197 |
+
}
|
198 |
+
$this->_redirect('*/*/index');
|
199 |
+
}
|
200 |
+
|
201 |
+
public function exportCsvAction() {
|
202 |
+
$fileName = 'glossary.csv';
|
203 |
+
$content = $this->getLayout()->createBlock('glossary/adminhtml_glossary_grid')
|
204 |
+
->getCsv();
|
205 |
+
$this->_sendUploadResponse($fileName, $content);
|
206 |
+
}
|
207 |
+
|
208 |
+
public function exportXmlAction() {
|
209 |
+
$fileName = 'glossary.xml';
|
210 |
+
$content = $this->getLayout()->createBlock('glossary/adminhtml_glossary_grid')
|
211 |
+
->getXml();
|
212 |
+
$this->_sendUploadResponse($fileName, $content);
|
213 |
+
}
|
214 |
+
|
215 |
+
protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream') {
|
216 |
+
$response = $this->getResponse();
|
217 |
+
$response->setHeader('HTTP/1.1 200 OK', '');
|
218 |
+
$response->setHeader('Pragma', 'public', true);
|
219 |
+
$response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
|
220 |
+
$response->setHeader('Content-Disposition', 'attachment; filename=' . $fileName);
|
221 |
+
$response->setHeader('Last-Modified', date('r'));
|
222 |
+
$response->setHeader('Accept-Ranges', 'bytes');
|
223 |
+
$response->setHeader('Content-Length', strlen($content));
|
224 |
+
$response->setHeader('Content-type', $contentType);
|
225 |
+
$response->setBody($content);
|
226 |
+
$response->sendResponse();
|
227 |
+
die;
|
228 |
+
}
|
229 |
+
|
230 |
+
}
|
app/code/community/Kreativkonzentrat/Glossary/controllers/IndexController.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Kreativkonzentrat_Glossary_IndexController extends Mage_Core_Controller_Front_Action {
|
4 |
+
|
5 |
+
public function indexAction() {
|
6 |
+
$this->loadLayout();
|
7 |
+
$glossary_id = $this->getRequest()->getParam('id');
|
8 |
+
if ($glossary_id != null && $glossary_id != '') {
|
9 |
+
$glossary = Mage::getModel('glossary/glossary')->load($glossary_id)->getData();
|
10 |
+
} else {
|
11 |
+
$glossary = Mage::getModel('glossary/glossary')->getFilteredCollection();
|
12 |
+
$this->getLayout()->getBlock('glossary_toolbar')
|
13 |
+
->addOrderToAvailableOrders('title','Title')
|
14 |
+
->setOrder('title')
|
15 |
+
->setDefaultOrder('title')
|
16 |
+
->setCollection($glossary);
|
17 |
+
$this->getLayout()->getBlock('product_list_toolbar_pager')
|
18 |
+
->setCollection($glossary);
|
19 |
+
}
|
20 |
+
|
21 |
+
Mage::register('glossary', $glossary);
|
22 |
+
$this->renderLayout();
|
23 |
+
}
|
24 |
+
|
25 |
+
public function viewAction() {
|
26 |
+
$glossary_id = $this->getRequest()->getParam('id');
|
27 |
+
|
28 |
+
if ($glossary_id != null) {
|
29 |
+
$glossary = Mage::getModel('glossary/glossary');
|
30 |
+
$glossary->load($glossary_id);
|
31 |
+
Mage::register('glossary', $glossary);
|
32 |
+
}
|
33 |
+
$this->loadLayout();
|
34 |
+
$this->renderLayout();
|
35 |
+
}
|
36 |
+
|
37 |
+
}
|
app/code/community/Kreativkonzentrat/Glossary/controllers/ViewController.php
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Kreativkonzentrat_Glossary_ViewController extends Mage_Core_Controller_Front_Action {
|
4 |
+
|
5 |
+
public function indexAction() {
|
6 |
+
$this->loadLayout();
|
7 |
+
$this->renderLayout();
|
8 |
+
}
|
9 |
+
|
10 |
+
public function IdAction() {
|
11 |
+
$glossary_id = $this->getRequest()->getParam('id');
|
12 |
+
if ($glossary_id != null && $glossary_id != '') {
|
13 |
+
$glossary = Mage::getModel('glossary/glossary')->load($glossary_id);
|
14 |
+
$glossary->getData();
|
15 |
+
} else {
|
16 |
+
$resource = Mage::getSingleton('core/resource');
|
17 |
+
$read = $resource->getConnection('core_read');
|
18 |
+
$glossaryTable = $resource->getTableName('glossary');
|
19 |
+
|
20 |
+
$select = $read->select()
|
21 |
+
->from($glossaryTable, array('glossary_id', 'title', 'glossary_content', 'status'))
|
22 |
+
->where('status', 1)
|
23 |
+
->order('title DESC');
|
24 |
+
|
25 |
+
$glossary = $read->fetchRow($select);
|
26 |
+
}
|
27 |
+
Mage::register('glossary', $glossary);
|
28 |
+
$this->loadLayout();
|
29 |
+
$this->renderLayout();
|
30 |
+
}
|
31 |
+
|
32 |
+
public function popupAction() {
|
33 |
+
$glossary_id = $this->getRequest()->getParam('id');
|
34 |
+
if ($glossary_id != null && $glossary_id != '') {
|
35 |
+
$glossary = Mage::getModel('glossary/glossary')->load($glossary_id);
|
36 |
+
$glossary->getData();
|
37 |
+
} else {
|
38 |
+
$resource = Mage::getSingleton('core/resource');
|
39 |
+
$read = $resource->getConnection('core_read');
|
40 |
+
$glossaryTable = $resource->getTableName('glossary');
|
41 |
+
|
42 |
+
$select = $read->select()
|
43 |
+
->from($glossaryTable, array('glossary_id', 'title', 'glossary_content', 'status'))
|
44 |
+
->where('status', 1)
|
45 |
+
->order('title DESC');
|
46 |
+
|
47 |
+
$glossary = $read->fetchRow($select);
|
48 |
+
}
|
49 |
+
Mage::register('glossary', $glossary);
|
50 |
+
$this->loadLayout();
|
51 |
+
$this->renderLayout();
|
52 |
+
}
|
53 |
+
|
54 |
+
public function letterAction() {
|
55 |
+
//get letter param
|
56 |
+
$params = array_keys($this->getRequest()->getParams());
|
57 |
+
if ($params != null) {
|
58 |
+
//get only entries with corresponding letter
|
59 |
+
$collection = Mage::getModel('glossary/glossary')->getFilteredCollection()->addFieldToFilter('letter', $params[0])->setAlphabeticalOrder();
|
60 |
+
/*
|
61 |
+
* sql variant
|
62 |
+
|
63 |
+
//select only rows starting with letter param
|
64 |
+
$collection = Mage::getModel('glossary/glossary')->getCollection();
|
65 |
+
|
66 |
+
$collection->getSelect()->where("lower(left(title,1)='$params[0]')");
|
67 |
+
//debug query
|
68 |
+
|
69 |
+
*/
|
70 |
+
//echo ($collection->getSelect()->__toString());
|
71 |
+
}
|
72 |
+
else
|
73 |
+
$collection = Mage::getModel('glossary/glossary')->getFilteredCollection();
|
74 |
+
Mage::register('glossary', $collection);
|
75 |
+
$this->loadLayout();
|
76 |
+
$this->renderLayout();
|
77 |
+
}
|
78 |
+
|
79 |
+
}
|
app/code/community/Kreativkonzentrat/Glossary/etc/config.xml
ADDED
@@ -0,0 +1,196 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<default>
|
4 |
+
<glossary>
|
5 |
+
<replacings>
|
6 |
+
<popup_height>300</popup_height>
|
7 |
+
<popup_width>300</popup_width>
|
8 |
+
<open_popup>0</open_popup>
|
9 |
+
<show_empty>0</show_empty>
|
10 |
+
<cat_replace>0</cat_replace>
|
11 |
+
<glos_replace>1</glos_replace>
|
12 |
+
<prod_replace>0</prod_replace>
|
13 |
+
<d_replace>0</d_replace>
|
14 |
+
<sd_replace>0</sd_replace>
|
15 |
+
<cms_replace>0</cms_replace>
|
16 |
+
<cache_expiration>3600</cache_expiration>
|
17 |
+
</replacings>
|
18 |
+
</glossary>
|
19 |
+
</default>
|
20 |
+
<modules>
|
21 |
+
<Kreativkonzentrat_Glossary>
|
22 |
+
<version>0.5.0</version>
|
23 |
+
</Kreativkonzentrat_Glossary>
|
24 |
+
</modules>
|
25 |
+
<frontend>
|
26 |
+
<translate>
|
27 |
+
<modules>
|
28 |
+
<glossary>
|
29 |
+
<files>
|
30 |
+
<default>Kreativkonzentrat_Glossary.csv</default>
|
31 |
+
</files>
|
32 |
+
</glossary>
|
33 |
+
</modules>
|
34 |
+
</translate>
|
35 |
+
<routers>
|
36 |
+
<glossary>
|
37 |
+
<use>standard</use>
|
38 |
+
<args>
|
39 |
+
<module>Kreativkonzentrat_Glossary</module>
|
40 |
+
<frontName>glossary</frontName>
|
41 |
+
</args>
|
42 |
+
</glossary>
|
43 |
+
</routers>
|
44 |
+
<layout>
|
45 |
+
<updates>
|
46 |
+
<glossary>
|
47 |
+
<file>glossary.xml</file>
|
48 |
+
</glossary>
|
49 |
+
</updates>
|
50 |
+
</layout>
|
51 |
+
</frontend>
|
52 |
+
<admin>
|
53 |
+
<routers>
|
54 |
+
<glossary_admin>
|
55 |
+
<use>admin</use>
|
56 |
+
<args>
|
57 |
+
<module>Kreativkonzentrat_Glossary</module>
|
58 |
+
<frontName>glossary_admin</frontName>
|
59 |
+
</args>
|
60 |
+
</glossary_admin>
|
61 |
+
</routers>
|
62 |
+
</admin>
|
63 |
+
<adminhtml>
|
64 |
+
<translate>
|
65 |
+
<modules>
|
66 |
+
<glossary>
|
67 |
+
<files>
|
68 |
+
<default>Kreativkonzentrat_Glossary.csv</default>
|
69 |
+
</files>
|
70 |
+
</glossary>
|
71 |
+
</modules>
|
72 |
+
</translate>
|
73 |
+
<menu>
|
74 |
+
<glossary module="glossary">
|
75 |
+
<title>Glossary</title>
|
76 |
+
<sort_order>71</sort_order>
|
77 |
+
<children>
|
78 |
+
<items module="glossary">
|
79 |
+
<title>Manage Items</title>
|
80 |
+
<sort_order>0</sort_order>
|
81 |
+
<action>glossary_admin/adminhtml_glossary</action>
|
82 |
+
</items>
|
83 |
+
</children>
|
84 |
+
</glossary>
|
85 |
+
</menu>
|
86 |
+
<acl>
|
87 |
+
<resources>
|
88 |
+
<all>
|
89 |
+
<title>Allow Everything</title>
|
90 |
+
</all>
|
91 |
+
<admin>
|
92 |
+
<children>
|
93 |
+
<system>
|
94 |
+
<children>
|
95 |
+
<config>
|
96 |
+
<children>
|
97 |
+
<glossary translate="title" module="glossary">
|
98 |
+
<title>Glossary Module</title>
|
99 |
+
<sort_order>41</sort_order>
|
100 |
+
</glossary>
|
101 |
+
</children>
|
102 |
+
</config>
|
103 |
+
</children>
|
104 |
+
</system>
|
105 |
+
<glossary translate="title" module="glossary">
|
106 |
+
<title>Glossary Module</title>
|
107 |
+
<sort_order>10</sort_order>
|
108 |
+
<children>
|
109 |
+
<items module="glossary">
|
110 |
+
<title>Mange items</title>
|
111 |
+
</items>
|
112 |
+
</children>
|
113 |
+
</glossary>
|
114 |
+
</children>
|
115 |
+
</admin>
|
116 |
+
</resources>
|
117 |
+
</acl>
|
118 |
+
<layout>
|
119 |
+
<updates>
|
120 |
+
<glossary>
|
121 |
+
<file>glossary.xml</file>
|
122 |
+
</glossary>
|
123 |
+
</updates>
|
124 |
+
</layout>
|
125 |
+
</adminhtml>
|
126 |
+
<global>
|
127 |
+
<models>
|
128 |
+
<catalog>
|
129 |
+
<rewrite>
|
130 |
+
<product>Kreativkonzentrat_Glossary_Model_Product</product>
|
131 |
+
</rewrite>
|
132 |
+
</catalog>
|
133 |
+
<cms>
|
134 |
+
<rewrite>
|
135 |
+
<page>Kreativkonzentrat_Glossary_Model_Page</page>
|
136 |
+
</rewrite>
|
137 |
+
</cms>
|
138 |
+
<glossary>
|
139 |
+
<class>Kreativkonzentrat_Glossary_Model</class>
|
140 |
+
<resourceModel>glossary_mysql4</resourceModel>
|
141 |
+
</glossary>
|
142 |
+
<glossary_mysql4>
|
143 |
+
<class>Kreativkonzentrat_Glossary_Model_Mysql4</class>
|
144 |
+
<entities>
|
145 |
+
<glossary>
|
146 |
+
<table>glossary</table>
|
147 |
+
</glossary>
|
148 |
+
<glossary_store>
|
149 |
+
<table>glossary_store</table>
|
150 |
+
</glossary_store>
|
151 |
+
</entities>
|
152 |
+
</glossary_mysql4>
|
153 |
+
</models>
|
154 |
+
<resources>
|
155 |
+
<glossary_setup>
|
156 |
+
<setup>
|
157 |
+
<module>Kreativkonzentrat_Glossary</module>
|
158 |
+
</setup>
|
159 |
+
<connection>
|
160 |
+
<use>core_setup</use>
|
161 |
+
</connection>
|
162 |
+
</glossary_setup>
|
163 |
+
<glossary_write>
|
164 |
+
<connection>
|
165 |
+
<use>core_write</use>
|
166 |
+
</connection>
|
167 |
+
</glossary_write>
|
168 |
+
<glossary_read>
|
169 |
+
<connection>
|
170 |
+
<use>core_read</use>
|
171 |
+
</connection>
|
172 |
+
</glossary_read>
|
173 |
+
</resources>
|
174 |
+
<blocks>
|
175 |
+
<glossary>
|
176 |
+
<class>Kreativkonzentrat_Glossary_Block</class>
|
177 |
+
</glossary>
|
178 |
+
</blocks>
|
179 |
+
<helpers>
|
180 |
+
<glossary>
|
181 |
+
<class>Kreativkonzentrat_Glossary_Helper</class>
|
182 |
+
</glossary>
|
183 |
+
</helpers>
|
184 |
+
<events>
|
185 |
+
<controller_front_init_routers>
|
186 |
+
<observers>
|
187 |
+
<glossary>
|
188 |
+
<type>singleton</type>
|
189 |
+
<class>Kreativkonzentrat_Glossary_Controller_Router</class>
|
190 |
+
<method>initControllerRouters</method>
|
191 |
+
</glossary>
|
192 |
+
</observers>
|
193 |
+
</controller_front_init_routers>
|
194 |
+
</events>
|
195 |
+
</global>
|
196 |
+
</config>
|
app/code/community/Kreativkonzentrat/Glossary/etc/system.xml
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<config>
|
4 |
+
<sections>
|
5 |
+
<glossary translate="label" module="cms">
|
6 |
+
<class>separator-top</class>
|
7 |
+
<label>Glossary</label>
|
8 |
+
<tab>catalog</tab>
|
9 |
+
<frontend_type>text</frontend_type>
|
10 |
+
<sort_order>41</sort_order>
|
11 |
+
<show_in_default>1</show_in_default>
|
12 |
+
<show_in_website>0</show_in_website>
|
13 |
+
<show_in_store>0</show_in_store>
|
14 |
+
<groups>
|
15 |
+
<replacings translate="label">
|
16 |
+
<label>Auto replace</label>
|
17 |
+
<show_in_default>1</show_in_default>
|
18 |
+
<show_in_website>0</show_in_website>
|
19 |
+
<show_in_store>0</show_in_store>
|
20 |
+
<fields>
|
21 |
+
<cms_replace>
|
22 |
+
<label>Enable auto replace glossary entries in cms pages?</label>
|
23 |
+
<frontend_type>select</frontend_type>
|
24 |
+
<source_model>glossary/adminhtml_select</source_model>
|
25 |
+
<sort_order>1</sort_order>
|
26 |
+
<show_in_default>1</show_in_default>
|
27 |
+
<show_in_website>1</show_in_website>
|
28 |
+
<show_in_store>1</show_in_store>
|
29 |
+
</cms_replace>
|
30 |
+
<sd_replace>
|
31 |
+
<label>Enable auto replace glossary entries in product short descriptions?</label>
|
32 |
+
<frontend_type>select</frontend_type>
|
33 |
+
<source_model>glossary/adminhtml_select</source_model>
|
34 |
+
<sort_order>1</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>1</show_in_store>
|
38 |
+
</sd_replace>
|
39 |
+
<d_replace>
|
40 |
+
<label>Enable auto replace glossary entries in product descriptions?</label>
|
41 |
+
<frontend_type>select</frontend_type>
|
42 |
+
<source_model>glossary/adminhtml_select</source_model>
|
43 |
+
<sort_order>1</sort_order>
|
44 |
+
<show_in_default>1</show_in_default>
|
45 |
+
<show_in_website>1</show_in_website>
|
46 |
+
<show_in_store>1</show_in_store>
|
47 |
+
</d_replace>
|
48 |
+
<show_empty>
|
49 |
+
<label>Show alphabetical navigation for empty letters?</label>
|
50 |
+
<frontend_type>select</frontend_type>
|
51 |
+
<source_model>glossary/adminhtml_select</source_model>
|
52 |
+
<sort_order>1</sort_order>
|
53 |
+
<show_in_default>1</show_in_default>
|
54 |
+
<show_in_website>1</show_in_website>
|
55 |
+
<show_in_store>1</show_in_store>
|
56 |
+
</show_empty>
|
57 |
+
<open_popup>
|
58 |
+
<label>Open replaced entries in popup?</label>
|
59 |
+
<frontend_type>select</frontend_type>
|
60 |
+
<source_model>glossary/adminhtml_select</source_model>
|
61 |
+
<sort_order>1</sort_order>
|
62 |
+
<show_in_default>1</show_in_default>
|
63 |
+
<show_in_website>1</show_in_website>
|
64 |
+
<show_in_store>1</show_in_store>
|
65 |
+
</open_popup>
|
66 |
+
</fields>
|
67 |
+
</replacings>
|
68 |
+
</groups>
|
69 |
+
</glossary>
|
70 |
+
</sections>
|
71 |
+
</config>
|
app/code/community/Kreativkonzentrat/Glossary/sql/glossary_setup/mysql4-install-0.5.0.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
-- DROP TABLE IF EXISTS {$this->getTable('glossary')};
|
9 |
+
CREATE TABLE {$this->getTable('glossary')} (
|
10 |
+
`glossary_id` int(11) unsigned NOT NULL auto_increment,
|
11 |
+
`title` varchar(255) NOT NULL default '',
|
12 |
+
`metadescription` varchar(255) NOT NULL default '',
|
13 |
+
`metakeywords` varchar(255) NOT NULL default '',
|
14 |
+
`filename` varchar(255) NOT NULL default '',
|
15 |
+
`letter` varchar(255) NOT NULL default '',
|
16 |
+
`glossary_content` text NOT NULL default '',
|
17 |
+
`status` smallint(6) NOT NULL default '0',
|
18 |
+
`created_time` datetime NULL,
|
19 |
+
`update_time` datetime NULL,
|
20 |
+
PRIMARY KEY (`glossary_id`)
|
21 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Glossary entries';
|
22 |
+
|
23 |
+
|
24 |
+
-- DROP TABLE IF EXISTS {$this->getTable('glossary_store')};
|
25 |
+
CREATE TABLE {$this->getTable('glossary_store')} (
|
26 |
+
`glossary_id` int(11) unsigned NOT NULL,
|
27 |
+
`store_id` smallint(5) unsigned NOT NULL,
|
28 |
+
PRIMARY KEY (`glossary_id`,`store_id`),
|
29 |
+
CONSTRAINT `FK_GLOSSARY_STORE_TO_GLOSSARY` FOREIGN KEY (`glossary_id`) REFERENCES `{$this->getTable('glossary')}` (`glossary_id`) ON UPDATE CASCADE ON DELETE CASCADE,
|
30 |
+
CONSTRAINT `FK_GLOSSARY_STORE_TO_STORE` FOREIGN KEY (`store_id`) REFERENCES `{$this->getTable('core/store')}` (`store_id`) ON UPDATE CASCADE ON DELETE CASCADE
|
31 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Glossary entries to stores';
|
32 |
+
");
|
33 |
+
|
34 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/glossary.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<glossary_admin_adminhtml_glossary_index>
|
4 |
+
<reference name="content">
|
5 |
+
<block type="glossary/adminhtml_glossary" name="glossary" />
|
6 |
+
</reference>
|
7 |
+
</glossary_admin_adminhtml_glossary_index>
|
8 |
+
</layout>
|
app/design/frontend/base/default/layout/glossary.xml
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<default>
|
4 |
+
<!-- comment following lines to not add link to header -->
|
5 |
+
<reference name="top.links">
|
6 |
+
<action method="addLink" translate="label title" module="glossary">
|
7 |
+
<label>Glossary</label>
|
8 |
+
<url helper="glossary/getGlossaryIndexUrl" />
|
9 |
+
<title>Glossary</title><prepare/><urlParams/>
|
10 |
+
<position>200</position>
|
11 |
+
</action>
|
12 |
+
</reference>
|
13 |
+
|
14 |
+
<!-- uncomment following lines to add link to footer -->
|
15 |
+
<!--<reference name="footer_links">-->
|
16 |
+
<!--<action method="addLink" translate="label title" module="glossary">-->
|
17 |
+
<!--<label>Glossary</label>-->
|
18 |
+
<!--<url helper="glossary/getGlossaryIndexUrl" />-->
|
19 |
+
<!--<title>Glossary</title><prepare/><urlParams/><position>200</position>-->
|
20 |
+
<!--</action>-->
|
21 |
+
<!--</reference>-->
|
22 |
+
</default>
|
23 |
+
|
24 |
+
<glossary_index_index>
|
25 |
+
|
26 |
+
<reference name="root">
|
27 |
+
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
|
28 |
+
<action method="setHeaderTitle" translate="title" module="glossary"><title>Glossary</title></action>
|
29 |
+
</reference>
|
30 |
+
<reference name="content">
|
31 |
+
<block type="catalog/product_list_toolbar" name="glossary_toolbar" template="glossary/toolbar.phtml">
|
32 |
+
<block type="page/html_pager" name="product_list_toolbar_pager" template="glossary/pager.phtml"/>
|
33 |
+
</block>
|
34 |
+
<block type="glossary/glossary_navigation" name="glossary_letter_navigation" template="glossary/letter/view.phtml"/>
|
35 |
+
<block type="glossary/glossary" name="glossary" template="glossary/glossary.phtml" />
|
36 |
+
</reference>
|
37 |
+
</glossary_index_index>
|
38 |
+
|
39 |
+
<glossary_index_params>
|
40 |
+
<reference name="root">
|
41 |
+
<action method="setHeaderTitle" translate="title" module="glossary"><title>Glossary</title></action>
|
42 |
+
</reference>
|
43 |
+
<reference name="content">
|
44 |
+
<block type="glossary/glossary" name="glossary" template="glossary/glossary_single.phtml" />
|
45 |
+
</reference>
|
46 |
+
</glossary_index_params>
|
47 |
+
|
48 |
+
<glossary_view_id>
|
49 |
+
<reference name="root">
|
50 |
+
<action method="setHeaderTitle" translate="title" module="glossary"><title>Glossary</title></action>
|
51 |
+
</reference>
|
52 |
+
<reference name="content">
|
53 |
+
<block type="glossary/glossary" name="glossary" template="glossary/glossary_single.phtml" />
|
54 |
+
</reference>
|
55 |
+
</glossary_view_id>
|
56 |
+
|
57 |
+
<glossary_view_popup>
|
58 |
+
<reference name="root">
|
59 |
+
<action method="setTemplate"><template>page/popup.phtml</template></action>
|
60 |
+
<action method="setHeaderTitle" translate="title" module="glossary"><title>Glossary</title></action>
|
61 |
+
</reference>
|
62 |
+
<reference name="content">
|
63 |
+
<block type="glossary/glossary" name="glossary" template="glossary/glossary_popup.phtml" />
|
64 |
+
</reference>
|
65 |
+
</glossary_view_popup>
|
66 |
+
|
67 |
+
<glossary_index_view>
|
68 |
+
<reference name="root">
|
69 |
+
<action method="setHeaderTitle" translate="title" module="glossary"><title>Glossary</title></action>
|
70 |
+
</reference>
|
71 |
+
<reference name="content">
|
72 |
+
<block type="glossary/glossary" name="glossary" template="glossary/glossary_single.phtml" />
|
73 |
+
</reference>
|
74 |
+
</glossary_index_view>
|
75 |
+
|
76 |
+
<glossary_view_letter>
|
77 |
+
<reference name="content">
|
78 |
+
<block type="glossary/glossary" name="glossary_letter" template="glossary/glossary_letter.phtml" />
|
79 |
+
</reference>
|
80 |
+
</glossary_view_letter>
|
81 |
+
</layout>
|
app/design/frontend/base/default/template/glossary/glossary.phtml
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category design
|
4 |
+
* @package base_default
|
5 |
+
* @copyright Kreativkonzentrat GbR 2012
|
6 |
+
*
|
7 |
+
* Date: 04.03.12, 12:50
|
8 |
+
*/
|
9 |
+
?>
|
10 |
+
<?php
|
11 |
+
$collection = $this->getGlossary();
|
12 |
+
?>
|
13 |
+
<h4><?php echo $this->__('Glossary') ?></h4>
|
14 |
+
<?php
|
15 |
+
foreach ($collection as $item) :?>
|
16 |
+
<div class="glossary_entry">
|
17 |
+
<h3><a href="<?php echo $item->getUrl(); ?>" title="<?php echo $this->__('View glossary entry')?>"><?php echo $item->getTitle();?></a></h3>
|
18 |
+
</div>
|
19 |
+
<?php endforeach;?>
|
app/design/frontend/base/default/template/glossary/glossary_letter.phtml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category design
|
4 |
+
* @package base_default
|
5 |
+
* @copyright Kreativkonzentrat GbR 2012
|
6 |
+
*
|
7 |
+
* Date: 04.03.12, 12:56
|
8 |
+
*/
|
9 |
+
?>
|
10 |
+
<h4><?php echo $this->__('Glossary') ?></h4>
|
11 |
+
<?php
|
12 |
+
echo $this->getChildHtml('glossary_letter_navigation');
|
13 |
+
$collection = $this->getGlossary();
|
14 |
+
foreach ($collection as $item) :?>
|
15 |
+
<div class="glossary_entry">
|
16 |
+
<h2><a href="<?php echo $item->getUrl(); ?>"><?php echo $item->getTitle(); ?></a></h2>
|
17 |
+
</div>
|
18 |
+
<?php endforeach; ?>
|
app/design/frontend/base/default/template/glossary/glossary_popup.phtml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category design
|
4 |
+
* @package base_default
|
5 |
+
* @copyright Kreativkonzentrat GbR 2012
|
6 |
+
*
|
7 |
+
* Date: 04.03.12, 12:55
|
8 |
+
*/
|
9 |
+
?>
|
10 |
+
<?php
|
11 |
+
$item = $this->getGlossary();
|
12 |
+
?>
|
13 |
+
<h4><?php echo $item->getTitle(); ?></h4>
|
14 |
+
<div class="glossary_entry">
|
15 |
+
<h2><?php echo $item->getTitle(); ?></h2>
|
16 |
+
<p><?php echo $item->getGlossaryContent(); ?></p>
|
17 |
+
</div>
|
app/design/frontend/base/default/template/glossary/glossary_single.phtml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category design
|
4 |
+
* @package base_default
|
5 |
+
* @copyright Kreativkonzentrat GbR 2012
|
6 |
+
*
|
7 |
+
* Date: 04.03.12, 12:55
|
8 |
+
*/
|
9 |
+
?>
|
10 |
+
<?php
|
11 |
+
$item = $this->getGlossary();
|
12 |
+
?>
|
13 |
+
<h4><?php echo $item->getTitle()?></h4>
|
14 |
+
<div class="glossary_entry">
|
15 |
+
<h2><?php echo $item->getTitle()?></h2>
|
16 |
+
<p><?php echo $item->getGlossaryContent()?></p>
|
17 |
+
</div>
|
app/design/frontend/base/default/template/glossary/letter/view.phtml
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category design
|
4 |
+
* @package base_default
|
5 |
+
* @copyright Kreativkonzentrat GbR 2012
|
6 |
+
*
|
7 |
+
* Date: 04.03.12, 12:55
|
8 |
+
*/
|
9 |
+
?>
|
10 |
+
<?php if (Mage::getStoreConfig('glossary/replacings/show_empty') == 0) : ?>
|
11 |
+
<?php $letters = $this->buildNavigation(); ?>
|
12 |
+
|
13 |
+
<div class="glossary_navigation">
|
14 |
+
<?php foreach ($letters as $_letter) : ?>
|
15 |
+
<span><a href="<?php echo Mage :: app()->getStore()->getUrl('glossary')?>view/letter/<?php echo $_letter; ?>" title="<?php echo $this->__('All entries starting with %s', $_letter) ?>"><?php echo $_letter; ?></a></span>
|
16 |
+
<?php endforeach; ?>
|
17 |
+
</div>
|
18 |
+
|
19 |
+
<?php else : ?>
|
20 |
+
<?php
|
21 |
+
$letters = array();
|
22 |
+
$letters = range('A', 'Z');
|
23 |
+
array_unshift($letters, "123");
|
24 |
+
$letters2 = $this->buildNavigation(); ?>
|
25 |
+
<div class="glossary_navigation">
|
26 |
+
<?php foreach ($letters as $_letter) : ?>
|
27 |
+
<?php if (in_array($_letter, $letters2)): ?>
|
28 |
+
<span><a href="<?php echo Mage::app()->getStore()->getUrl('glossary')?>view/letter/<?php echo $_letter; ?>" title="<?php echo $this->__('All entries starting with %s', $_letter) ?>"><?php echo $_letter; ?></a></span>
|
29 |
+
<?php else : ?>
|
30 |
+
<span><?php echo $_letter; ?></span>
|
31 |
+
<?php endif; ?>
|
32 |
+
<?php endforeach; ?>
|
33 |
+
</div>
|
34 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/glossary/pager.phtml
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category design
|
4 |
+
* @package base_default
|
5 |
+
* @copyright Kreativkonzentrat GbR 2012
|
6 |
+
*
|
7 |
+
* Date: 04.03.12, 12:56
|
8 |
+
*/
|
9 |
+
?>
|
10 |
+
<?php if ($this->getLastPageNum() > 1): ?>
|
11 |
+
<div class="pages">
|
12 |
+
<strong><?php echo $this->__('Page:') ?></strong>
|
13 |
+
<ol>
|
14 |
+
<?php if (!$this->isFirstPage()): ?>
|
15 |
+
<li>
|
16 |
+
<a class="previous<?php if (!$this->getAnchorTextForPrevious()): ?> i-previous<?php endif; ?>" href="<?php echo $this->getPreviousPageUrl() ?>" title="<?php echo $this->__('Previous') ?>">
|
17 |
+
<?php if (!$this->getAnchorTextForPrevious()): ?>
|
18 |
+
<img src="<?php echo $this->getSkinUrl('images/pager_arrow_left.gif') ?>" alt="<?php echo $this->__('Previous') ?>" class="v-middle" />
|
19 |
+
<?php else: ?>
|
20 |
+
<?php echo $this->getAnchorTextForPrevious() ?>
|
21 |
+
<?php endif; ?>
|
22 |
+
</a>
|
23 |
+
</li>
|
24 |
+
<?php endif; ?>
|
25 |
+
|
26 |
+
<?php if ($this->canShowFirst()): ?>
|
27 |
+
<li><a class="first" href="<?php echo $this->getFirstPageUrl() ?>">1</a></li>
|
28 |
+
<?php endif; ?>
|
29 |
+
|
30 |
+
<?php if ($this->canShowPreviousJump()): ?>
|
31 |
+
<li><a class="previous_jump" title="" href="<?php echo $this->getPreviousJumpUrl() ?>">...</a></li>
|
32 |
+
<?php endif; ?>
|
33 |
+
|
34 |
+
<?php foreach ($this->getFramePages() as $_page): ?>
|
35 |
+
<?php if ($this->isPageCurrent($_page)): ?>
|
36 |
+
<li class="current"><?php echo $_page ?></li>
|
37 |
+
<?php else: ?>
|
38 |
+
<li><a href="<?php echo $this->getPageUrl($_page) ?>"><?php echo $_page ?></a></li>
|
39 |
+
<?php endif; ?>
|
40 |
+
<?php endforeach; ?>
|
41 |
+
|
42 |
+
<?php if ($this->canShowNextJump()): ?>
|
43 |
+
<li><a class="next_jump" title="" href="<?php echo $this->getNextJumpUrl() ?>">...</a></li>
|
44 |
+
<?php endif; ?>
|
45 |
+
|
46 |
+
<?php if ($this->canShowLast()): ?>
|
47 |
+
<li><a class="last" href="<?php echo $this->getLastPageUrl() ?>"><?php echo $this->getLastPageNum() ?></a></li>
|
48 |
+
<?php endif; ?>
|
49 |
+
|
50 |
+
<?php if (!$this->isLastPage()): ?>
|
51 |
+
<li>
|
52 |
+
<a class="next<?php if (!$this->getAnchorTextForNext()): ?> i-next<?php endif; ?>" href="<?php echo $this->getNextPageUrl() ?>" title="<?php echo $this->__('Next') ?>">
|
53 |
+
<?php if (!$this->getAnchorTextForNext()): ?>
|
54 |
+
<img src="<?php echo $this->getSkinUrl('images/pager_arrow_right.gif') ?>" alt="<?php echo $this->__('Next') ?>" class="v-middle" />
|
55 |
+
<?php else: ?>
|
56 |
+
<?php echo $this->getAnchorTextForNext() ?>
|
57 |
+
<?php endif; ?>
|
58 |
+
</a>
|
59 |
+
</li>
|
60 |
+
<?php endif; ?>
|
61 |
+
</ol>
|
62 |
+
|
63 |
+
</div>
|
64 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/glossary/toolbar.phtml
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category design
|
4 |
+
* @package base_default
|
5 |
+
* @copyright Kreativkonzentrat GbR 2012
|
6 |
+
*
|
7 |
+
* Date: 04.03.12, 12:56
|
8 |
+
*/
|
9 |
+
?>
|
10 |
+
<div class="toolbar">
|
11 |
+
<div class="pager">
|
12 |
+
<p class="amount">
|
13 |
+
<?php if ($this->getLastPageNum() > 1): ?>
|
14 |
+
<?php echo $this->__('Items %s to %s of %s total', $this->getFirstNum(), $this->getLastNum(), $this->getTotalNum()) ?>
|
15 |
+
<?php else: ?>
|
16 |
+
<strong><?php echo $this->__('%s Item(s)', $this->getTotalNum()) ?></strong>
|
17 |
+
<?php endif; ?>
|
18 |
+
</p>
|
19 |
+
<div class="limiter">
|
20 |
+
<label><?php echo $this->__('Show') ?></label>
|
21 |
+
<select onchange="setLocation(this.value)">
|
22 |
+
<?php foreach ($this->getAvailableLimit() as $_key => $_limit): ?>
|
23 |
+
<option value="<?php echo $this->getLimitUrl($_key) ?>"<?php if ($this->isLimitCurrent($_key)): ?> selected="selected"<?php endif ?>>
|
24 |
+
<?php echo $_limit ?>
|
25 |
+
</option>
|
26 |
+
<?php endforeach; ?>
|
27 |
+
</select> <?php echo $this->__('per page') ?>
|
28 |
+
</div>
|
29 |
+
<?php echo $this->getPagerHtml() ?>
|
30 |
+
</div>
|
31 |
+
</div>
|
app/etc/modules/Kreativkonzentrat_Glossary.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Kreativkonzentrat_Glossary>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Kreativkonzentrat_Glossary>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/locale/de_DE/Kreativkonzentrat_Glossary.csv
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"Enable auto replace glossary entries in cms pages?","Automatische Glossary-Verlinkung auf CMS-Seiten?"
|
2 |
+
"Enable auto replace glossary entries in product descriptions?","Automatische Glossary-Verlinkung in Produktbeschreibungen?"
|
3 |
+
"Enable auto replace glossary entries in product short descriptions?","Automatische Glossary-Verlinkung in Kurzbeschreibungen?"
|
4 |
+
"Open replaced entries in popup?","Ersetzte Einträge in Popup öffnen?"
|
5 |
+
"Show alphabetical navigation for empty letters?","Alphabetische Navigation auch zeigen wenn leer?"
|
6 |
+
"Open in popup","In Popup öffnen"
|
7 |
+
"Glossary","Glossar"
|
8 |
+
"View glossary entry","Glossareintrag ansehen"
|
9 |
+
"All entries starting with %s","Alle Einträge mit beginnend mit %s"
|
10 |
+
"Yes","Ja"
|
11 |
+
"No","Nein"
|
12 |
+
"Auto replace","Automatische Ersetzung"
|
13 |
+
"Title","Titel"
|
14 |
+
"Meta Keywords","Meta Keywords"
|
15 |
+
"Meta Description","Meta Description"
|
16 |
+
"File","Datei"
|
17 |
+
"Status","Status"
|
18 |
+
"Enabled","Aktiviert"
|
19 |
+
"Disabled","Deaktiviert"
|
20 |
+
"Content","Inhalt"
|
21 |
+
"Glossary Entry","Glossareintrag"
|
22 |
+
"Edit Item '%s'","Eintag '%s' bearbeiten"
|
23 |
+
"Item Manager","Einträge verwalten"
|
24 |
+
"Add Item","Eintrag hinzufügen"
|
25 |
+
"Export to:","Exportieren als:"
|
26 |
+
"of %s pages","von %s Seiten"
|
27 |
+
"Page","Seite"
|
28 |
+
"View","Anzeigen"
|
29 |
+
"per page","pro Seite"
|
30 |
+
"Total %d records found","Insgesamt %d Einträge gefunden"
|
31 |
+
"Item was successfully saved","Eintrag gespeichert."
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Kreativkonzentrat_Glossary</name>
|
4 |
+
<version>0.5.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Adds a glossary to your store</summary>
|
10 |
+
<description>The Glossary plugin for Magento allows you to easily add a glossary to your shop and links directly to glossary entries.</description>
|
11 |
+
<notes>Initial release</notes>
|
12 |
+
<authors><author><name>Felix Moche</name><user>kreativkonGBR</user><email>info@kreativkonzentrat.de</email></author></authors>
|
13 |
+
<date>2012-07-25</date>
|
14 |
+
<time>18:09:57</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Kreativkonzentrat"><dir name="Glossary"><dir name="Block"><dir name="Adminhtml"><dir name="Glossary"><dir name="Edit"><file name="Form.php" hash="0fdbefdb7ae7a994c7c72481b0596b1f"/><dir name="Tab"><file name="Form.php" hash="6ab9cfff14d499f24bcb46cab74c313f"/></dir><file name="Tabs.php" hash="f2245c1684628bc56c471f60e9ef9a71"/></dir><file name="Edit.php" hash="d94e1d46e467aae746321a4fd1c95bd7"/><file name="Grid.php" hash="083d4fe4260a9a35fe2b75dd1a8304dc"/></dir><file name="Glossary.php" hash="9df63fd00059bdf3b8eae7f9be4a73ba"/></dir><dir name="Glossary"><file name="Navigation.php" hash="68b8007174bb7fc271fb5a53d807bbeb"/></dir><file name="Glossary.php" hash="9290dc4835357fb0bbe9e1bb0ab6178b"/></dir><dir name="Controller"><file name="Router.php" hash="e46ea43594c1e76d7d12418cbf2e3d90"/></dir><dir name="Helper"><file name="Data.php" hash="0bb8245a37153b5280bec9db389f9f32"/></dir><dir name="Model"><dir name="Adminhtml"><file name="Select.php" hash="ecf281379224f71b0a4ec2b24ab43da3"/></dir><file name="Glossary.php" hash="c8766453bf025c1eac3674b00e78ac0f"/><dir name="Mysql4"><dir name="Glossary"><file name="Collection.php" hash="cb83b8dbc16e09d5506ad8cd9c2b8dd0"/></dir><file name="Glossary.php" hash="a0c7c07d246c22210b3b2bd5c2629432"/></dir><file name="Page.php" hash="c507a9ff530939df51f0748ab1f64430"/><file name="Product.php" hash="4c15e30ad5fd5e0ad63e51ce712d9e16"/><file name="Status.php" hash="5a52b7fc5946f45425b85fa0ef86adce"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="GlossaryController.php" hash="e6f16cdf8faeab2e821508104262f1df"/></dir><file name="IndexController.php" hash="1f3b05d4c9c849e78e02bb084217ace1"/><file name="ViewController.php" hash="1427f3caf03620289ff2b70cc102a8bd"/></dir><dir name="etc"><file name="config.xml" hash="aaf6c2ca30e4723e8ed1e94deac13abc"/><file name="system.xml" hash="1d4e42aaccfd13d388056eb2938916a8"/></dir><dir name="sql"><dir name="glossary_setup"><file name="mysql4-install-0.5.0.php" hash="d19900a2c03411fcf4fb559007060134"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="glossary.xml" hash="126159843fbf0e96428c69ee970faad8"/></dir><dir name="template"><dir name="glossary"><file name="glossary.phtml" hash="a365c2b18a2fc8c322a453b387c4489d"/><file name="glossary_letter.phtml" hash="c734250b896932aacfb7ff8289436bde"/><file name="glossary_popup.phtml" hash="854f07d8fcea7ef649450e37cae4c199"/><file name="glossary_single.phtml" hash="afd557f0b958be793a57ad831f891756"/><dir name="letter"><file name="view.phtml" hash="5bb0b80c315e17942c4326d9a77cc9c7"/></dir><file name="pager.phtml" hash="ff614fd4956d1fe352dda1fe8af5219c"/><file name="toolbar.phtml" hash="70008cca5c4a943b6318deafceaf45e6"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="glossary.xml" hash="47479839622700bc80c6b7ecdf5d1844"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Kreativkonzentrat_Glossary.xml" hash="ae9bb531254247fcd1d628ae582e8b17"/></dir></target><target name="magelocale"><dir name="de_DE"><file name="Kreativkonzentrat_Glossary.csv" hash="f3f9ef70ef94af8f133f7abf56e5c1df"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|