Version Notes
Stable Version tested the compatibility with magento 1.9.0
Change log
1.0.0 --> Initial version
1.0.1 --> Small display issue fix
1.0.2 --> Frentend design changes
1.0.3 --> Add Category
1.0.4 --> Export option & Lable changes
1.0.5 --> Add Admin portfolio image display
Download this release
Release Info
Developer | Samdoit |
Extension | Samdoit_Mageportfolio |
Version | 1.1.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.4 to 1.1.0
- app/code/community/Samdoit/Mageportfolio/Block/Adminhtml/Mageportfolio.php +12 -12
- app/code/community/Samdoit/Mageportfolio/Block/Adminhtml/Mageportfolio/Edit.php +45 -45
- app/code/community/Samdoit/Mageportfolio/Block/Adminhtml/Mageportfolio/Edit/Form.php +19 -19
- app/code/community/Samdoit/Mageportfolio/Block/Adminhtml/Mageportfolio/Edit/Tab/Form.php +64 -64
- app/code/community/Samdoit/Mageportfolio/Block/Adminhtml/Mageportfolio/Edit/Tabs.php +24 -24
- app/code/community/Samdoit/Mageportfolio/Block/Adminhtml/Mageportfolio/Grid.php +114 -114
- app/code/community/Samdoit/Mageportfolio/Block/Mageportfolio.php +30 -23
- app/code/community/Samdoit/Mageportfolio/Helper/Data.php +6 -6
- app/code/community/Samdoit/Mageportfolio/Model/Mageportfolio.php +21 -21
- app/code/community/Samdoit/Mageportfolio/Model/Mysql4/Mageportfolio.php +10 -10
- app/code/community/Samdoit/Mageportfolio/Model/Mysql4/Mageportfolio/Collection.php +10 -10
- app/code/community/Samdoit/Mageportfolio/README.txt +8 -2
- app/code/community/Samdoit/Mageportfolio/controllers/Adminhtml/MageportfolioController.php +207 -179
- app/code/community/Samdoit/Mageportfolio/controllers/IndexController.php +9 -9
- app/code/community/Samdoit/Mageportfolio/etc/config.xml +118 -118
- app/code/community/Samdoit/Mageportfolio/sql/mageportfolio_setup/mysql4-install-1.0.0.php +23 -23
- app/code/community/Samdoit/Mageportfolio/sql/mageportfolio_setup/mysql4-upgrade-1.0.2-1.0.3.php +13 -13
- app/design/adminhtml/default/default/layout/mageportfolio.xml +8 -8
- app/design/frontend/default/default/layout/mageportfolio.xml +15 -0
- app/design/frontend/default/default/template/mageportfolio/mageportfolio.phtml +60 -99
- app/design/frontend/default/default/template/mageportfolio/mageportfolio.phtml.old +61 -0
- app/etc/modules/Samdoit_Mageportfolio.xml +9 -9
- package.xml +7 -6
- skin/frontend/default/default/css/portfolio.css +1 -0
app/code/community/Samdoit/Mageportfolio/Block/Adminhtml/Mageportfolio.php
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
-
<?php
|
2 |
-
class Samdoit_Mageportfolio_Block_Adminhtml_Mageportfolio extends Mage_Adminhtml_Block_Widget_Grid_Container
|
3 |
-
{
|
4 |
-
public function __construct()
|
5 |
-
{
|
6 |
-
$this->_controller = 'adminhtml_mageportfolio';
|
7 |
-
$this->_blockGroup = 'mageportfolio';
|
8 |
-
$this->_headerText = Mage::helper('mageportfolio')->__('
|
9 |
-
$this->_addButtonLabel = Mage::helper('mageportfolio')->__('Add
|
10 |
-
parent::__construct();
|
11 |
-
}
|
12 |
-
}
|
1 |
+
<?php
|
2 |
+
class Samdoit_Mageportfolio_Block_Adminhtml_Mageportfolio extends Mage_Adminhtml_Block_Widget_Grid_Container
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
$this->_controller = 'adminhtml_mageportfolio';
|
7 |
+
$this->_blockGroup = 'mageportfolio';
|
8 |
+
$this->_headerText = Mage::helper('mageportfolio')->__('Manage Portfolio');
|
9 |
+
$this->_addButtonLabel = Mage::helper('mageportfolio')->__('Add New Portfolio');
|
10 |
+
parent::__construct();
|
11 |
+
}
|
12 |
+
}
|
app/code/community/Samdoit/Mageportfolio/Block/Adminhtml/Mageportfolio/Edit.php
CHANGED
@@ -1,45 +1,45 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Samdoit_Mageportfolio_Block_Adminhtml_Mageportfolio_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
4 |
-
{
|
5 |
-
public function __construct()
|
6 |
-
{
|
7 |
-
parent::__construct();
|
8 |
-
|
9 |
-
$this->_objectId = 'id';
|
10 |
-
$this->_blockGroup = 'mageportfolio';
|
11 |
-
$this->_controller = 'adminhtml_mageportfolio';
|
12 |
-
|
13 |
-
$this->_updateButton('save', 'label', Mage::helper('mageportfolio')->__('Save Item'));
|
14 |
-
$this->_updateButton('delete', 'label', Mage::helper('mageportfolio')->__('Delete Item'));
|
15 |
-
|
16 |
-
$this->_addButton('saveandcontinue', array(
|
17 |
-
'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
|
18 |
-
'onclick' => 'saveAndContinueEdit()',
|
19 |
-
'class' => 'save',
|
20 |
-
), -100);
|
21 |
-
|
22 |
-
$this->_formScripts[] = "
|
23 |
-
function toggleEditor() {
|
24 |
-
if (tinyMCE.getInstanceById('mageportfolio_content') == null) {
|
25 |
-
tinyMCE.execCommand('mceAddControl', false, 'mageportfolio_content');
|
26 |
-
} else {
|
27 |
-
tinyMCE.execCommand('mceRemoveControl', false, 'mageportfolio_content');
|
28 |
-
}
|
29 |
-
}
|
30 |
-
|
31 |
-
function saveAndContinueEdit(){
|
32 |
-
editForm.submit($('edit_form').action+'back/edit/');
|
33 |
-
}
|
34 |
-
";
|
35 |
-
}
|
36 |
-
|
37 |
-
public function getHeaderText()
|
38 |
-
{
|
39 |
-
if( Mage::registry('mageportfolio_data') && Mage::registry('mageportfolio_data')->getId() ) {
|
40 |
-
return Mage::helper('mageportfolio')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('mageportfolio_data')->getTitle()));
|
41 |
-
} else {
|
42 |
-
return Mage::helper('mageportfolio')->__('Add Item');
|
43 |
-
}
|
44 |
-
}
|
45 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Samdoit_Mageportfolio_Block_Adminhtml_Mageportfolio_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
|
9 |
+
$this->_objectId = 'id';
|
10 |
+
$this->_blockGroup = 'mageportfolio';
|
11 |
+
$this->_controller = 'adminhtml_mageportfolio';
|
12 |
+
|
13 |
+
$this->_updateButton('save', 'label', Mage::helper('mageportfolio')->__('Save Item'));
|
14 |
+
$this->_updateButton('delete', 'label', Mage::helper('mageportfolio')->__('Delete Item'));
|
15 |
+
|
16 |
+
$this->_addButton('saveandcontinue', array(
|
17 |
+
'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
|
18 |
+
'onclick' => 'saveAndContinueEdit()',
|
19 |
+
'class' => 'save',
|
20 |
+
), -100);
|
21 |
+
|
22 |
+
$this->_formScripts[] = "
|
23 |
+
function toggleEditor() {
|
24 |
+
if (tinyMCE.getInstanceById('mageportfolio_content') == null) {
|
25 |
+
tinyMCE.execCommand('mceAddControl', false, 'mageportfolio_content');
|
26 |
+
} else {
|
27 |
+
tinyMCE.execCommand('mceRemoveControl', false, 'mageportfolio_content');
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
function saveAndContinueEdit(){
|
32 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
33 |
+
}
|
34 |
+
";
|
35 |
+
}
|
36 |
+
|
37 |
+
public function getHeaderText()
|
38 |
+
{
|
39 |
+
if( Mage::registry('mageportfolio_data') && Mage::registry('mageportfolio_data')->getId() ) {
|
40 |
+
return Mage::helper('mageportfolio')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('mageportfolio_data')->getTitle()));
|
41 |
+
} else {
|
42 |
+
return Mage::helper('mageportfolio')->__('Add Item');
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
app/code/community/Samdoit/Mageportfolio/Block/Adminhtml/Mageportfolio/Edit/Form.php
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Samdoit_Mageportfolio_Block_Adminhtml_Mageportfolio_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
-
{
|
5 |
-
protected function _prepareForm()
|
6 |
-
{
|
7 |
-
$form = new Varien_Data_Form(array(
|
8 |
-
'id' => 'edit_form',
|
9 |
-
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
10 |
-
'method' => 'post',
|
11 |
-
'enctype' => 'multipart/form-data'
|
12 |
-
)
|
13 |
-
);
|
14 |
-
|
15 |
-
$form->setUseContainer(true);
|
16 |
-
$this->setForm($form);
|
17 |
-
return parent::_prepareForm();
|
18 |
-
}
|
19 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Samdoit_Mageportfolio_Block_Adminhtml_Mageportfolio_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
+
{
|
5 |
+
protected function _prepareForm()
|
6 |
+
{
|
7 |
+
$form = new Varien_Data_Form(array(
|
8 |
+
'id' => 'edit_form',
|
9 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
10 |
+
'method' => 'post',
|
11 |
+
'enctype' => 'multipart/form-data'
|
12 |
+
)
|
13 |
+
);
|
14 |
+
|
15 |
+
$form->setUseContainer(true);
|
16 |
+
$this->setForm($form);
|
17 |
+
return parent::_prepareForm();
|
18 |
+
}
|
19 |
+
}
|
app/code/community/Samdoit/Mageportfolio/Block/Adminhtml/Mageportfolio/Edit/Tab/Form.php
CHANGED
@@ -1,64 +1,64 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Samdoit_Mageportfolio_Block_Adminhtml_Mageportfolio_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
-
{
|
5 |
-
protected function _prepareForm()
|
6 |
-
{
|
7 |
-
$form = new Varien_Data_Form();
|
8 |
-
$this->setForm($form);
|
9 |
-
$fieldset = $form->addFieldset('mageportfolio_form', array('legend'=>Mage::helper('mageportfolio')->__('
|
10 |
-
|
11 |
-
$fieldset->addField('title', 'text', array(
|
12 |
-
'label' => Mage::helper('mageportfolio')->__('Title'),
|
13 |
-
'class' => 'required-entry',
|
14 |
-
'required' => true,
|
15 |
-
'name' => 'title',
|
16 |
-
));
|
17 |
-
|
18 |
-
$fieldset->addField('filename', '
|
19 |
-
'label' => Mage::helper('mageportfolio')->__('File'),
|
20 |
-
'required' => false,
|
21 |
-
'name' => 'filename',
|
22 |
-
));
|
23 |
-
|
24 |
-
$fieldset->addField('status', 'select', array(
|
25 |
-
'label' => Mage::helper('mageportfolio')->__('Status'),
|
26 |
-
'name' => 'status',
|
27 |
-
'values' => array(
|
28 |
-
array(
|
29 |
-
'value' => 1,
|
30 |
-
'label' => Mage::helper('mageportfolio')->__('Enabled'),
|
31 |
-
),
|
32 |
-
|
33 |
-
array(
|
34 |
-
'value' => 2,
|
35 |
-
'label' => Mage::helper('mageportfolio')->__('Disabled'),
|
36 |
-
),
|
37 |
-
),
|
38 |
-
));
|
39 |
-
$fieldset->addField('category', 'text', array(
|
40 |
-
'label' => Mage::helper('mageportfolio')->__('Category'),
|
41 |
-
'required' => true,
|
42 |
-
'name' => 'category',
|
43 |
-
'value' => 'Uncategor',
|
44 |
-
));
|
45 |
-
|
46 |
-
$fieldset->addField('content', 'editor', array(
|
47 |
-
'name' => 'content',
|
48 |
-
'label' => Mage::helper('mageportfolio')->__('Content'),
|
49 |
-
'title' => Mage::helper('mageportfolio')->__('Content'),
|
50 |
-
'style' => 'width:700px; height:500px;',
|
51 |
-
'wysiwyg' => false,
|
52 |
-
'required' => true,
|
53 |
-
));
|
54 |
-
|
55 |
-
if ( Mage::getSingleton('adminhtml/session')->getMageportfolioData() )
|
56 |
-
{
|
57 |
-
$form->setValues(Mage::getSingleton('adminhtml/session')->getMageportfolioData());
|
58 |
-
Mage::getSingleton('adminhtml/session')->setMageportfolioData(null);
|
59 |
-
} elseif ( Mage::registry('mageportfolio_data') ) {
|
60 |
-
$form->setValues(Mage::registry('mageportfolio_data')->getData());
|
61 |
-
}
|
62 |
-
return parent::_prepareForm();
|
63 |
-
}
|
64 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Samdoit_Mageportfolio_Block_Adminhtml_Mageportfolio_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
+
{
|
5 |
+
protected function _prepareForm()
|
6 |
+
{
|
7 |
+
$form = new Varien_Data_Form();
|
8 |
+
$this->setForm($form);
|
9 |
+
$fieldset = $form->addFieldset('mageportfolio_form', array('legend'=>Mage::helper('mageportfolio')->__('Portfolio Information')));
|
10 |
+
|
11 |
+
$fieldset->addField('title', 'text', array(
|
12 |
+
'label' => Mage::helper('mageportfolio')->__('Title'),
|
13 |
+
'class' => 'required-entry',
|
14 |
+
'required' => true,
|
15 |
+
'name' => 'title',
|
16 |
+
));
|
17 |
+
|
18 |
+
$fieldset->addField('filename', 'image', array(
|
19 |
+
'label' => Mage::helper('mageportfolio')->__('File'),
|
20 |
+
'required' => false,
|
21 |
+
'name' => 'filename',
|
22 |
+
));
|
23 |
+
|
24 |
+
$fieldset->addField('status', 'select', array(
|
25 |
+
'label' => Mage::helper('mageportfolio')->__('Status'),
|
26 |
+
'name' => 'status',
|
27 |
+
'values' => array(
|
28 |
+
array(
|
29 |
+
'value' => 1,
|
30 |
+
'label' => Mage::helper('mageportfolio')->__('Enabled'),
|
31 |
+
),
|
32 |
+
|
33 |
+
array(
|
34 |
+
'value' => 2,
|
35 |
+
'label' => Mage::helper('mageportfolio')->__('Disabled'),
|
36 |
+
),
|
37 |
+
),
|
38 |
+
));
|
39 |
+
$fieldset->addField('category', 'text', array(
|
40 |
+
'label' => Mage::helper('mageportfolio')->__('Category'),
|
41 |
+
'required' => true,
|
42 |
+
'name' => 'category',
|
43 |
+
'value' => 'Uncategor',
|
44 |
+
));
|
45 |
+
|
46 |
+
$fieldset->addField('content', 'editor', array(
|
47 |
+
'name' => 'content',
|
48 |
+
'label' => Mage::helper('mageportfolio')->__('Content'),
|
49 |
+
'title' => Mage::helper('mageportfolio')->__('Content'),
|
50 |
+
'style' => 'width:700px; height:500px;',
|
51 |
+
'wysiwyg' => false,
|
52 |
+
'required' => true,
|
53 |
+
));
|
54 |
+
|
55 |
+
if ( Mage::getSingleton('adminhtml/session')->getMageportfolioData() )
|
56 |
+
{
|
57 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getMageportfolioData());
|
58 |
+
Mage::getSingleton('adminhtml/session')->setMageportfolioData(null);
|
59 |
+
} elseif ( Mage::registry('mageportfolio_data') ) {
|
60 |
+
$form->setValues(Mage::registry('mageportfolio_data')->getData());
|
61 |
+
}
|
62 |
+
return parent::_prepareForm();
|
63 |
+
}
|
64 |
+
}
|
app/code/community/Samdoit/Mageportfolio/Block/Adminhtml/Mageportfolio/Edit/Tabs.php
CHANGED
@@ -1,24 +1,24 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Samdoit_Mageportfolio_Block_Adminhtml_Mageportfolio_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
4 |
-
{
|
5 |
-
|
6 |
-
public function __construct()
|
7 |
-
{
|
8 |
-
parent::__construct();
|
9 |
-
$this->setId('mageportfolio_tabs');
|
10 |
-
$this->setDestElementId('edit_form');
|
11 |
-
$this->setTitle(Mage::helper('mageportfolio')->__('
|
12 |
-
}
|
13 |
-
|
14 |
-
protected function _beforeToHtml()
|
15 |
-
{
|
16 |
-
$this->addTab('form_section', array(
|
17 |
-
'label' => Mage::helper('mageportfolio')->__('
|
18 |
-
'title' => Mage::helper('mageportfolio')->__('
|
19 |
-
'content' => $this->getLayout()->createBlock('mageportfolio/adminhtml_mageportfolio_edit_tab_form')->toHtml(),
|
20 |
-
));
|
21 |
-
|
22 |
-
return parent::_beforeToHtml();
|
23 |
-
}
|
24 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Samdoit_Mageportfolio_Block_Adminhtml_Mageportfolio_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
4 |
+
{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
parent::__construct();
|
9 |
+
$this->setId('mageportfolio_tabs');
|
10 |
+
$this->setDestElementId('edit_form');
|
11 |
+
$this->setTitle(Mage::helper('mageportfolio')->__('Portfolio Information'));
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _beforeToHtml()
|
15 |
+
{
|
16 |
+
$this->addTab('form_section', array(
|
17 |
+
'label' => Mage::helper('mageportfolio')->__('Portfolio Information'),
|
18 |
+
'title' => Mage::helper('mageportfolio')->__('Portfolio Information'),
|
19 |
+
'content' => $this->getLayout()->createBlock('mageportfolio/adminhtml_mageportfolio_edit_tab_form')->toHtml(),
|
20 |
+
));
|
21 |
+
|
22 |
+
return parent::_beforeToHtml();
|
23 |
+
}
|
24 |
+
}
|
app/code/community/Samdoit/Mageportfolio/Block/Adminhtml/Mageportfolio/Grid.php
CHANGED
@@ -1,114 +1,114 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Samdoit_Mageportfolio_Block_Adminhtml_Mageportfolio_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
-
{
|
5 |
-
public function __construct()
|
6 |
-
{
|
7 |
-
parent::__construct();
|
8 |
-
$this->setId('mageportfolioGrid');
|
9 |
-
$this->setDefaultSort('mageportfolio_id');
|
10 |
-
$this->setDefaultDir('ASC');
|
11 |
-
$this->setSaveParametersInSession(true);
|
12 |
-
}
|
13 |
-
|
14 |
-
protected function _prepareCollection()
|
15 |
-
{
|
16 |
-
$collection = Mage::getModel('mageportfolio/mageportfolio')->getCollection();
|
17 |
-
$this->setCollection($collection);
|
18 |
-
return parent::_prepareCollection();
|
19 |
-
}
|
20 |
-
|
21 |
-
protected function _prepareColumns()
|
22 |
-
{
|
23 |
-
$this->addColumn('mageportfolio_id', array(
|
24 |
-
'header' => Mage::helper('mageportfolio')->__('ID'),
|
25 |
-
'align' =>'right',
|
26 |
-
'width' => '50px',
|
27 |
-
'index' => 'mageportfolio_id',
|
28 |
-
));
|
29 |
-
|
30 |
-
$this->addColumn('title', array(
|
31 |
-
'header' => Mage::helper('mageportfolio')->__('Title'),
|
32 |
-
'align' =>'left',
|
33 |
-
'index' => 'title',
|
34 |
-
));
|
35 |
-
|
36 |
-
$this->addColumn('content', array(
|
37 |
-
'header' => Mage::helper('mageportfolio')->__('Category'),
|
38 |
-
'width' => '150px',
|
39 |
-
'index' => 'category',
|
40 |
-
));
|
41 |
-
|
42 |
-
$this->addColumn('status', array(
|
43 |
-
'header' => Mage::helper('mageportfolio')->__('Status'),
|
44 |
-
'align' => 'left',
|
45 |
-
'width' => '80px',
|
46 |
-
'index' => 'status',
|
47 |
-
'type' => 'options',
|
48 |
-
'options' => array(
|
49 |
-
1 => 'Enabled',
|
50 |
-
2 => 'Disabled',
|
51 |
-
),
|
52 |
-
));
|
53 |
-
|
54 |
-
$this->addColumn('action',
|
55 |
-
array(
|
56 |
-
'header' => Mage::helper('mageportfolio')->__('Action'),
|
57 |
-
'width' => '100',
|
58 |
-
'type' => 'action',
|
59 |
-
'getter' => 'getId',
|
60 |
-
'actions' => array(
|
61 |
-
array(
|
62 |
-
'caption' => Mage::helper('mageportfolio')->__('Edit'),
|
63 |
-
'url' => array('base'=> '*/*/edit'),
|
64 |
-
'field' => 'id'
|
65 |
-
)
|
66 |
-
),
|
67 |
-
'filter' => false,
|
68 |
-
'sortable' => false,
|
69 |
-
'index' => 'stores',
|
70 |
-
'is_system' => true,
|
71 |
-
));
|
72 |
-
|
73 |
-
$this->addExportType('*/*/exportCsv', Mage::helper('mageportfolio')->__('CSV'));
|
74 |
-
$this->addExportType('*/*/exportXml', Mage::helper('mageportfolio')->__('XML'));
|
75 |
-
|
76 |
-
return parent::_prepareColumns();
|
77 |
-
}
|
78 |
-
|
79 |
-
protected function _prepareMassaction()
|
80 |
-
{
|
81 |
-
$this->setMassactionIdField('mageportfolio_id');
|
82 |
-
$this->getMassactionBlock()->setFormFieldName('mageportfolio');
|
83 |
-
|
84 |
-
$this->getMassactionBlock()->addItem('delete', array(
|
85 |
-
'label' => Mage::helper('mageportfolio')->__('Delete'),
|
86 |
-
'url' => $this->getUrl('*/*/massDelete'),
|
87 |
-
'confirm' => Mage::helper('mageportfolio')->__('Are you sure?')
|
88 |
-
));
|
89 |
-
|
90 |
-
$statuses = Mage::getSingleton('mageportfolio/status')->getOptionArray();
|
91 |
-
|
92 |
-
array_unshift($statuses, array('label'=>'', 'value'=>''));
|
93 |
-
$this->getMassactionBlock()->addItem('status', array(
|
94 |
-
'label'=> Mage::helper('mageportfolio')->__('Change status'),
|
95 |
-
'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
|
96 |
-
'additional' => array(
|
97 |
-
'visibility' => array(
|
98 |
-
'name' => 'status',
|
99 |
-
'type' => 'select',
|
100 |
-
'class' => 'required-entry',
|
101 |
-
'label' => Mage::helper('mageportfolio')->__('Status'),
|
102 |
-
'values' => $statuses
|
103 |
-
)
|
104 |
-
)
|
105 |
-
));
|
106 |
-
return $this;
|
107 |
-
}
|
108 |
-
|
109 |
-
public function getRowUrl($row)
|
110 |
-
{
|
111 |
-
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
112 |
-
}
|
113 |
-
|
114 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Samdoit_Mageportfolio_Block_Adminhtml_Mageportfolio_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setId('mageportfolioGrid');
|
9 |
+
$this->setDefaultSort('mageportfolio_id');
|
10 |
+
$this->setDefaultDir('ASC');
|
11 |
+
$this->setSaveParametersInSession(true);
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _prepareCollection()
|
15 |
+
{
|
16 |
+
$collection = Mage::getModel('mageportfolio/mageportfolio')->getCollection();
|
17 |
+
$this->setCollection($collection);
|
18 |
+
return parent::_prepareCollection();
|
19 |
+
}
|
20 |
+
|
21 |
+
protected function _prepareColumns()
|
22 |
+
{
|
23 |
+
$this->addColumn('mageportfolio_id', array(
|
24 |
+
'header' => Mage::helper('mageportfolio')->__('ID'),
|
25 |
+
'align' =>'right',
|
26 |
+
'width' => '50px',
|
27 |
+
'index' => 'mageportfolio_id',
|
28 |
+
));
|
29 |
+
|
30 |
+
$this->addColumn('title', array(
|
31 |
+
'header' => Mage::helper('mageportfolio')->__('Title'),
|
32 |
+
'align' =>'left',
|
33 |
+
'index' => 'title',
|
34 |
+
));
|
35 |
+
|
36 |
+
$this->addColumn('content', array(
|
37 |
+
'header' => Mage::helper('mageportfolio')->__('Category'),
|
38 |
+
'width' => '150px',
|
39 |
+
'index' => 'category',
|
40 |
+
));
|
41 |
+
|
42 |
+
$this->addColumn('status', array(
|
43 |
+
'header' => Mage::helper('mageportfolio')->__('Status'),
|
44 |
+
'align' => 'left',
|
45 |
+
'width' => '80px',
|
46 |
+
'index' => 'status',
|
47 |
+
'type' => 'options',
|
48 |
+
'options' => array(
|
49 |
+
1 => 'Enabled',
|
50 |
+
2 => 'Disabled',
|
51 |
+
),
|
52 |
+
));
|
53 |
+
|
54 |
+
$this->addColumn('action',
|
55 |
+
array(
|
56 |
+
'header' => Mage::helper('mageportfolio')->__('Action'),
|
57 |
+
'width' => '100',
|
58 |
+
'type' => 'action',
|
59 |
+
'getter' => 'getId',
|
60 |
+
'actions' => array(
|
61 |
+
array(
|
62 |
+
'caption' => Mage::helper('mageportfolio')->__('Edit'),
|
63 |
+
'url' => array('base'=> '*/*/edit'),
|
64 |
+
'field' => 'id'
|
65 |
+
)
|
66 |
+
),
|
67 |
+
'filter' => false,
|
68 |
+
'sortable' => false,
|
69 |
+
'index' => 'stores',
|
70 |
+
'is_system' => true,
|
71 |
+
));
|
72 |
+
|
73 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('mageportfolio')->__('CSV'));
|
74 |
+
$this->addExportType('*/*/exportXml', Mage::helper('mageportfolio')->__('XML'));
|
75 |
+
|
76 |
+
return parent::_prepareColumns();
|
77 |
+
}
|
78 |
+
|
79 |
+
protected function _prepareMassaction()
|
80 |
+
{
|
81 |
+
$this->setMassactionIdField('mageportfolio_id');
|
82 |
+
$this->getMassactionBlock()->setFormFieldName('mageportfolio');
|
83 |
+
|
84 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
85 |
+
'label' => Mage::helper('mageportfolio')->__('Delete'),
|
86 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
87 |
+
'confirm' => Mage::helper('mageportfolio')->__('Are you sure?')
|
88 |
+
));
|
89 |
+
|
90 |
+
$statuses = Mage::getSingleton('mageportfolio/status')->getOptionArray();
|
91 |
+
|
92 |
+
array_unshift($statuses, array('label'=>'', 'value'=>''));
|
93 |
+
$this->getMassactionBlock()->addItem('status', array(
|
94 |
+
'label'=> Mage::helper('mageportfolio')->__('Change status'),
|
95 |
+
'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
|
96 |
+
'additional' => array(
|
97 |
+
'visibility' => array(
|
98 |
+
'name' => 'status',
|
99 |
+
'type' => 'select',
|
100 |
+
'class' => 'required-entry',
|
101 |
+
'label' => Mage::helper('mageportfolio')->__('Status'),
|
102 |
+
'values' => $statuses
|
103 |
+
)
|
104 |
+
)
|
105 |
+
));
|
106 |
+
return $this;
|
107 |
+
}
|
108 |
+
|
109 |
+
public function getRowUrl($row)
|
110 |
+
{
|
111 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
112 |
+
}
|
113 |
+
|
114 |
+
}
|
app/code/community/Samdoit/Mageportfolio/Block/Mageportfolio.php
CHANGED
@@ -1,23 +1,30 @@
|
|
1 |
-
<?php
|
2 |
-
class Samdoit_Mageportfolio_Block_Mageportfolio extends Mage_Core_Block_Template
|
3 |
-
{
|
4 |
-
protected $_pageCollection;
|
5 |
-
public function _prepareLayout()
|
6 |
-
{
|
7 |
-
return parent::_prepareLayout();
|
8 |
-
}
|
9 |
-
|
10 |
-
public function getMageportfolio($id='',$group='',$category='')
|
11 |
-
{
|
12 |
-
$resource = Mage::getSingleton('core/resource');
|
13 |
-
$readConnection = $resource->getConnection('core_read');
|
14 |
-
if($id)
|
15 |
-
$query = "SELECT *FROM ".$resource->getTableName('mageportfolio/mageportfolio')." WHERE status=1 AND mageportfolio_id=$id";
|
16 |
-
else if($group)
|
17 |
-
$query = "SELECT category FROM ".$resource->getTableName('mageportfolio/mageportfolio')." WHERE status=1 GROUP BY category";
|
18 |
-
else if($category)
|
19 |
-
$query = "SELECT *FROM ".$resource->getTableName('mageportfolio/mageportfolio')." WHERE status=1 AND category='$category'";
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Samdoit_Mageportfolio_Block_Mageportfolio extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
protected $_pageCollection;
|
5 |
+
public function _prepareLayout()
|
6 |
+
{
|
7 |
+
return parent::_prepareLayout();
|
8 |
+
}
|
9 |
+
|
10 |
+
public function getMageportfolio($id='',$group='',$category='')
|
11 |
+
{
|
12 |
+
$resource = Mage::getSingleton('core/resource');
|
13 |
+
$readConnection = $resource->getConnection('core_read');
|
14 |
+
if($id)
|
15 |
+
$query = "SELECT *FROM ".$resource->getTableName('mageportfolio/mageportfolio')." WHERE status=1 AND mageportfolio_id=$id";
|
16 |
+
else if($group)
|
17 |
+
$query = "SELECT category FROM ".$resource->getTableName('mageportfolio/mageportfolio')." WHERE status=1 GROUP BY category";
|
18 |
+
else if($category)
|
19 |
+
$query = "SELECT *FROM ".$resource->getTableName('mageportfolio/mageportfolio')." WHERE status=1 AND category='$category'";
|
20 |
+
|
21 |
+
if ($query) {
|
22 |
+
$pageCollection = $readConnection->fetchAll($query);
|
23 |
+
}
|
24 |
+
else
|
25 |
+
{
|
26 |
+
$pageCollection = '';
|
27 |
+
}
|
28 |
+
return $pageCollection;
|
29 |
+
}
|
30 |
+
}
|
app/code/community/Samdoit/Mageportfolio/Helper/Data.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Samdoit_Mageportfolio_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
-
{
|
5 |
-
|
6 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Samdoit_Mageportfolio_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/community/Samdoit/Mageportfolio/Model/Mageportfolio.php
CHANGED
@@ -1,21 +1,21 @@
|
|
1 |
-
<?php
|
2 |
-
class Samdoit_Mageportfolio_Model_Mageportfolio extends Mage_Core_Model_Abstract
|
3 |
-
{
|
4 |
-
public function _construct()
|
5 |
-
{
|
6 |
-
parent::_construct();
|
7 |
-
$this->_init('mageportfolio/mageportfolio');
|
8 |
-
}
|
9 |
-
/* public getDetail()
|
10 |
-
{
|
11 |
-
$resource = Mage::getSingleton('core/resource');
|
12 |
-
$readConnection = $resource->getConnection('core_read');
|
13 |
-
$query = "SELECT *FROM mageportfolio";
|
14 |
-
echo $query;
|
15 |
-
$wppageCollection = $readConnection->fetchAll($query);
|
16 |
-
foreach($wppageCollection as $key=>$value)
|
17 |
-
{
|
18 |
-
print_r($value);
|
19 |
-
}
|
20 |
-
}*/
|
21 |
-
}
|
1 |
+
<?php
|
2 |
+
class Samdoit_Mageportfolio_Model_Mageportfolio extends Mage_Core_Model_Abstract
|
3 |
+
{
|
4 |
+
public function _construct()
|
5 |
+
{
|
6 |
+
parent::_construct();
|
7 |
+
$this->_init('mageportfolio/mageportfolio');
|
8 |
+
}
|
9 |
+
/* public getDetail()
|
10 |
+
{
|
11 |
+
$resource = Mage::getSingleton('core/resource');
|
12 |
+
$readConnection = $resource->getConnection('core_read');
|
13 |
+
$query = "SELECT *FROM mageportfolio";
|
14 |
+
echo $query;
|
15 |
+
$wppageCollection = $readConnection->fetchAll($query);
|
16 |
+
foreach($wppageCollection as $key=>$value)
|
17 |
+
{
|
18 |
+
print_r($value);
|
19 |
+
}
|
20 |
+
}*/
|
21 |
+
}
|
app/code/community/Samdoit/Mageportfolio/Model/Mysql4/Mageportfolio.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Samdoit_Mageportfolio_Model_Mysql4_Mageportfolio extends Mage_Core_Model_Mysql4_Abstract
|
4 |
-
{
|
5 |
-
public function _construct()
|
6 |
-
{
|
7 |
-
// Note that the mageportfolio_id refers to the key field in your database table.
|
8 |
-
$this->_init('mageportfolio/mageportfolio', 'mageportfolio_id');
|
9 |
-
}
|
10 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Samdoit_Mageportfolio_Model_Mysql4_Mageportfolio extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
// Note that the mageportfolio_id refers to the key field in your database table.
|
8 |
+
$this->_init('mageportfolio/mageportfolio', 'mageportfolio_id');
|
9 |
+
}
|
10 |
+
}
|
app/code/community/Samdoit/Mageportfolio/Model/Mysql4/Mageportfolio/Collection.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Samdoit_Mageportfolio_Model_Mysql4_Mageportfolio_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
-
{
|
5 |
-
public function _construct()
|
6 |
-
{
|
7 |
-
parent::_construct();
|
8 |
-
$this->_init('mageportfolio/mageportfolio');
|
9 |
-
}
|
10 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Samdoit_Mageportfolio_Model_Mysql4_Mageportfolio_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('mageportfolio/mageportfolio');
|
9 |
+
}
|
10 |
+
}
|
app/code/community/Samdoit/Mageportfolio/README.txt
CHANGED
@@ -1,7 +1,13 @@
|
|
1 |
sudo apt-get install php5-imagick
|
2 |
sudo /etc/init.d/apache2 restart
|
3 |
|
|
|
4 |
change log
|
5 |
1.0.0 --> Initial version
|
6 |
-
1.0.1 -->
|
7 |
-
1.0.2 -->
|
|
|
|
|
|
|
|
|
|
1 |
sudo apt-get install php5-imagick
|
2 |
sudo /etc/init.d/apache2 restart
|
3 |
|
4 |
+
no need to install php5-imagick
|
5 |
change log
|
6 |
1.0.0 --> Initial version
|
7 |
+
1.0.1 --> Small display issue fix
|
8 |
+
1.0.2 --> Frentend design changes
|
9 |
+
1.0.3 --> Add Category
|
10 |
+
1.0.4 --> Bug fix
|
11 |
+
1.0.5 --> Export option & Lable changes
|
12 |
+
1.0.6 --> Add Admin portfolio image display
|
13 |
+
|
app/code/community/Samdoit/Mageportfolio/controllers/Adminhtml/MageportfolioController.php
CHANGED
@@ -1,179 +1,207 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Samdoit_Mageportfolio_Adminhtml_MageportfolioController extends Mage_Adminhtml_Controller_action
|
4 |
-
{
|
5 |
-
protected function _initAction() {
|
6 |
-
$this->loadLayout()
|
7 |
-
->_setActiveMenu('admin')
|
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()
|
15 |
-
->renderLayout();
|
16 |
-
}
|
17 |
-
|
18 |
-
public function editAction() {
|
19 |
-
$id = $this->getRequest()->getParam('id');
|
20 |
-
$model = Mage::getModel('mageportfolio/mageportfolio')->load($id);
|
21 |
-
|
22 |
-
if ($model->getId() || $id == 0) {
|
23 |
-
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
24 |
-
if (!empty($data)) {
|
25 |
-
$model->setData($data);
|
26 |
-
}
|
27 |
-
|
28 |
-
Mage::register('mageportfolio_data', $model);
|
29 |
-
|
30 |
-
$this->loadLayout();
|
31 |
-
$this->_setActiveMenu('mageportfolio/items');
|
32 |
-
|
33 |
-
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
34 |
-
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
|
35 |
-
|
36 |
-
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
37 |
-
|
38 |
-
$this->_addContent($this->getLayout()->createBlock('mageportfolio/adminhtml_mageportfolio_edit'))
|
39 |
-
->_addLeft($this->getLayout()->createBlock('mageportfolio/adminhtml_mageportfolio_edit_tabs'));
|
40 |
-
|
41 |
-
$this->renderLayout();
|
42 |
-
} else {
|
43 |
-
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('mageportfolio')->__('Item does not exist'));
|
44 |
-
$this->_redirect('*/*/');
|
45 |
-
}
|
46 |
-
}
|
47 |
-
|
48 |
-
public function newAction() {
|
49 |
-
$this->_forward('edit');
|
50 |
-
}
|
51 |
-
|
52 |
-
public function saveAction() {
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
//
|
66 |
-
//
|
67 |
-
//
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
$
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
$
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Samdoit_Mageportfolio_Adminhtml_MageportfolioController extends Mage_Adminhtml_Controller_action
|
4 |
+
{
|
5 |
+
protected function _initAction() {
|
6 |
+
$this->loadLayout()
|
7 |
+
->_setActiveMenu('admin')
|
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()
|
15 |
+
->renderLayout();
|
16 |
+
}
|
17 |
+
|
18 |
+
public function editAction() {
|
19 |
+
$id = $this->getRequest()->getParam('id');
|
20 |
+
$model = Mage::getModel('mageportfolio/mageportfolio')->load($id);
|
21 |
+
|
22 |
+
if ($model->getId() || $id == 0) {
|
23 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
24 |
+
if (!empty($data)) {
|
25 |
+
$model->setData($data);
|
26 |
+
}
|
27 |
+
|
28 |
+
Mage::register('mageportfolio_data', $model);
|
29 |
+
|
30 |
+
$this->loadLayout();
|
31 |
+
$this->_setActiveMenu('mageportfolio/items');
|
32 |
+
|
33 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
34 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
|
35 |
+
|
36 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
37 |
+
|
38 |
+
$this->_addContent($this->getLayout()->createBlock('mageportfolio/adminhtml_mageportfolio_edit'))
|
39 |
+
->_addLeft($this->getLayout()->createBlock('mageportfolio/adminhtml_mageportfolio_edit_tabs'));
|
40 |
+
|
41 |
+
$this->renderLayout();
|
42 |
+
} else {
|
43 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('mageportfolio')->__('Item does not exist'));
|
44 |
+
$this->_redirect('*/*/');
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
public function newAction() {
|
49 |
+
$this->_forward('edit');
|
50 |
+
}
|
51 |
+
|
52 |
+
public function saveAction() {
|
53 |
+
|
54 |
+
if ($data = $this->getRequest()->getPost()) {
|
55 |
+
|
56 |
+
if(isset($_FILES['filename']['name']) && $_FILES['filename']['name'] != '') {
|
57 |
+
try {
|
58 |
+
/* Starting upload */
|
59 |
+
$uploader = new Varien_File_Uploader('filename');
|
60 |
+
|
61 |
+
// Any extention would work
|
62 |
+
$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
|
63 |
+
$uploader->setAllowRenameFiles(false);
|
64 |
+
|
65 |
+
// Set the file upload mode
|
66 |
+
// false -> get the file directly in the specified folder
|
67 |
+
// true -> get the file in the product like folders
|
68 |
+
// (file.jpg will go in something like /media/f/i/file.jpg)
|
69 |
+
$uploader->setFilesDispersion(false);
|
70 |
+
|
71 |
+
// We set media as the upload dir
|
72 |
+
$pathinfo = pathinfo($_FILES["filename"]["name"]);
|
73 |
+
$filename_final = $this->clean($pathinfo['filename']).'.'.$pathinfo['extension'];
|
74 |
+
$path = Mage::getBaseDir('media') . DS .'Mageportfolio' . DS ;
|
75 |
+
$uploader->save($path, $filename_final );
|
76 |
+
|
77 |
+
} catch (Exception $e) {
|
78 |
+
echo $e->getMessage();
|
79 |
+
Mage::log($e->getMessage(), null, 'Mageportfolio.log');
|
80 |
+
}
|
81 |
+
|
82 |
+
//this way the name is saved in DB
|
83 |
+
$data['filename'] = 'Mageportfolio' . DS . $filename_final;
|
84 |
+
}
|
85 |
+
else {
|
86 |
+
if(isset($data['filename']['delete']) && $data['filename']['delete'] == 1)
|
87 |
+
$data['filename'] = '';
|
88 |
+
else
|
89 |
+
unset($data['filename']);
|
90 |
+
}
|
91 |
+
|
92 |
+
|
93 |
+
$model = Mage::getModel('mageportfolio/mageportfolio');
|
94 |
+
$model->setData($data)
|
95 |
+
->setId($this->getRequest()->getParam('id'));
|
96 |
+
|
97 |
+
try {
|
98 |
+
if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
|
99 |
+
$model->setCreatedTime(now())
|
100 |
+
->setUpdateTime(now());
|
101 |
+
} else {
|
102 |
+
$model->setUpdateTime(now());
|
103 |
+
}
|
104 |
+
|
105 |
+
$model->save();
|
106 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('mageportfolio')->__('Item was successfully saved'));
|
107 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
108 |
+
|
109 |
+
if ($this->getRequest()->getParam('back')) {
|
110 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId()));
|
111 |
+
return;
|
112 |
+
}
|
113 |
+
$this->_redirect('*/*/');
|
114 |
+
return;
|
115 |
+
} catch (Exception $e) {
|
116 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
117 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
118 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
119 |
+
return;
|
120 |
+
}
|
121 |
+
}
|
122 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('mageportfolio')->__('Unable to find item to save'));
|
123 |
+
$this->_redirect('*/*/');
|
124 |
+
}
|
125 |
+
|
126 |
+
public function deleteAction() {
|
127 |
+
if( $this->getRequest()->getParam('id') > 0 ) {
|
128 |
+
try {
|
129 |
+
$model = Mage::getModel('mageportfolio/mageportfolio');
|
130 |
+
|
131 |
+
$model->setId($this->getRequest()->getParam('id'))
|
132 |
+
->delete();
|
133 |
+
|
134 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
|
135 |
+
$this->_redirect('*/*/');
|
136 |
+
} catch (Exception $e) {
|
137 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
138 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
139 |
+
}
|
140 |
+
}
|
141 |
+
$this->_redirect('*/*/');
|
142 |
+
}
|
143 |
+
|
144 |
+
public function massDeleteAction() {
|
145 |
+
$mageportfolioIds = $this->getRequest()->getParam('mageportfolio');
|
146 |
+
if(!is_array($mageportfolioIds)) {
|
147 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
|
148 |
+
} else {
|
149 |
+
try {
|
150 |
+
foreach ($mageportfolioIds as $mageportfolioId) {
|
151 |
+
$mageportfolio = Mage::getModel('mageportfolio/mageportfolio')->load($mageportfolioId);
|
152 |
+
$mageportfolio->delete();
|
153 |
+
}
|
154 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
155 |
+
Mage::helper('adminhtml')->__(
|
156 |
+
'Total of %d record(s) were successfully deleted', count($mageportfolioIds)
|
157 |
+
)
|
158 |
+
);
|
159 |
+
} catch (Exception $e) {
|
160 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
161 |
+
}
|
162 |
+
}
|
163 |
+
$this->_redirect('*/*/index');
|
164 |
+
}
|
165 |
+
|
166 |
+
public function massStatusAction()
|
167 |
+
{
|
168 |
+
$mageportfolioIds = $this->getRequest()->getParam('mageportfolio');
|
169 |
+
if(!is_array($mageportfolioIds)) {
|
170 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
|
171 |
+
} else {
|
172 |
+
try {
|
173 |
+
foreach ($mageportfolioIds as $mageportfolioId) {
|
174 |
+
$mageportfolio = Mage::getSingleton('mageportfolio/mageportfolio')
|
175 |
+
->load($mageportfolioId)
|
176 |
+
->setStatus($this->getRequest()->getParam('status'))
|
177 |
+
->setIsMassupdate(true)
|
178 |
+
->save();
|
179 |
+
}
|
180 |
+
$this->_getSession()->addSuccess(
|
181 |
+
$this->__('Total of %d record(s) were successfully updated', count($mageportfolioIds))
|
182 |
+
);
|
183 |
+
} catch (Exception $e) {
|
184 |
+
$this->_getSession()->addError($e->getMessage());
|
185 |
+
}
|
186 |
+
}
|
187 |
+
$this->_redirect('*/*/index');
|
188 |
+
}
|
189 |
+
public function exportCsvAction() {
|
190 |
+
$fileName = 'portfolio.csv';
|
191 |
+
$content = $this->getLayout ()
|
192 |
+
->createBlock('mageportfolio/adminhtml_mageportfolio_grid')
|
193 |
+
->getCsvFile();
|
194 |
+
$this->_prepareDownloadResponse($fileName, $content);
|
195 |
+
}
|
196 |
+
public function exportXmlAction() {
|
197 |
+
$fileName = 'portfolio.xml';
|
198 |
+
$content = $this->getLayout ()
|
199 |
+
->createBlock('mageportfolio/adminhtml_mageportfolio_grid')
|
200 |
+
->getExcelFile();
|
201 |
+
$this->_prepareDownloadResponse($fileName, $content);
|
202 |
+
}
|
203 |
+
public function clean($string) {
|
204 |
+
$string = str_replace(' ', '-', $string); // Replaces all spaces with hyphens.
|
205 |
+
return preg_replace('/[^A-Za-z0-9\-]/', '', $string); // Removes special chars.
|
206 |
+
}
|
207 |
+
}
|
app/code/community/Samdoit/Mageportfolio/controllers/IndexController.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
<?php
|
2 |
-
class Samdoit_Mageportfolio_IndexController extends Mage_Core_Controller_Front_Action
|
3 |
-
{
|
4 |
-
public function indexAction()
|
5 |
-
{
|
6 |
-
$this->loadLayout();
|
7 |
-
$this->renderLayout();
|
8 |
-
}
|
9 |
-
}
|
1 |
+
<?php
|
2 |
+
class Samdoit_Mageportfolio_IndexController extends Mage_Core_Controller_Front_Action
|
3 |
+
{
|
4 |
+
public function indexAction()
|
5 |
+
{
|
6 |
+
$this->loadLayout();
|
7 |
+
$this->renderLayout();
|
8 |
+
}
|
9 |
+
}
|
app/code/community/Samdoit/Mageportfolio/etc/config.xml
CHANGED
@@ -1,118 +1,118 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<Samdoit_Mageportfolio>
|
5 |
-
<version>1.0
|
6 |
-
</Samdoit_Mageportfolio>
|
7 |
-
</modules>
|
8 |
-
<frontend>
|
9 |
-
<routers>
|
10 |
-
<mageportfolio>
|
11 |
-
<use>standard</use>
|
12 |
-
<args>
|
13 |
-
<module>Samdoit_Mageportfolio</module>
|
14 |
-
<frontName>portfolio</frontName>
|
15 |
-
</args>
|
16 |
-
</mageportfolio>
|
17 |
-
</routers>
|
18 |
-
<layout>
|
19 |
-
<updates>
|
20 |
-
<mageportfolio>
|
21 |
-
<file>mageportfolio.xml</file>
|
22 |
-
</mageportfolio>
|
23 |
-
</updates>
|
24 |
-
</layout>
|
25 |
-
</frontend>
|
26 |
-
<admin>
|
27 |
-
<routers>
|
28 |
-
<mageportfolio>
|
29 |
-
<use>admin</use>
|
30 |
-
<args>
|
31 |
-
<module>Samdoit_Mageportfolio</module>
|
32 |
-
<frontName>mageportfolio</frontName>
|
33 |
-
</args>
|
34 |
-
</mageportfolio>
|
35 |
-
</routers>
|
36 |
-
</admin>
|
37 |
-
<adminhtml>
|
38 |
-
<menu>
|
39 |
-
<cms>
|
40 |
-
<children>
|
41 |
-
<items module="mageportfolio">
|
42 |
-
<title>Portfolio</title>
|
43 |
-
<sort_order>50</sort_order>
|
44 |
-
<action>mageportfolio/adminhtml_mageportfolio</action>
|
45 |
-
</items>
|
46 |
-
</children>
|
47 |
-
</cms>
|
48 |
-
</menu>
|
49 |
-
<acl>
|
50 |
-
<resources>
|
51 |
-
<all>
|
52 |
-
<title>Allow Everything</title>
|
53 |
-
</all>
|
54 |
-
<admin>
|
55 |
-
<children>
|
56 |
-
<Samdoit_Mageportfolio>
|
57 |
-
<title>Mageportfolio Module</title>
|
58 |
-
<sort_order>10</sort_order>
|
59 |
-
</Samdoit_Mageportfolio>
|
60 |
-
</children>
|
61 |
-
</admin>
|
62 |
-
</resources>
|
63 |
-
</acl>
|
64 |
-
<layout>
|
65 |
-
<updates>
|
66 |
-
<mageportfolio>
|
67 |
-
<file>mageportfolio.xml</file>
|
68 |
-
</mageportfolio>
|
69 |
-
</updates>
|
70 |
-
</layout>
|
71 |
-
</adminhtml>
|
72 |
-
<global>
|
73 |
-
<models>
|
74 |
-
<mageportfolio>
|
75 |
-
<class>Samdoit_Mageportfolio_Model</class>
|
76 |
-
<resourceModel>mageportfolio_mysql4</resourceModel>
|
77 |
-
</mageportfolio>
|
78 |
-
<mageportfolio_mysql4>
|
79 |
-
<class>Samdoit_Mageportfolio_Model_Mysql4</class>
|
80 |
-
<entities>
|
81 |
-
<mageportfolio>
|
82 |
-
<table>mageportfolio</table>
|
83 |
-
</mageportfolio>
|
84 |
-
</entities>
|
85 |
-
</mageportfolio_mysql4>
|
86 |
-
</models>
|
87 |
-
<resources>
|
88 |
-
<mageportfolio_setup>
|
89 |
-
<setup>
|
90 |
-
<module>Samdoit_Mageportfolio</module>
|
91 |
-
</setup>
|
92 |
-
<connection>
|
93 |
-
<use>core_setup</use>
|
94 |
-
</connection>
|
95 |
-
</mageportfolio_setup>
|
96 |
-
<mageportfolio_write>
|
97 |
-
<connection>
|
98 |
-
<use>core_write</use>
|
99 |
-
</connection>
|
100 |
-
</mageportfolio_write>
|
101 |
-
<mageportfolio_read>
|
102 |
-
<connection>
|
103 |
-
<use>core_read</use>
|
104 |
-
</connection>
|
105 |
-
</mageportfolio_read>
|
106 |
-
</resources>
|
107 |
-
<blocks>
|
108 |
-
<mageportfolio>
|
109 |
-
<class>Samdoit_Mageportfolio_Block</class>
|
110 |
-
</mageportfolio>
|
111 |
-
</blocks>
|
112 |
-
<helpers>
|
113 |
-
<mageportfolio>
|
114 |
-
<class>Samdoit_Mageportfolio_Helper</class>
|
115 |
-
</mageportfolio>
|
116 |
-
</helpers>
|
117 |
-
</global>
|
118 |
-
</config>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Samdoit_Mageportfolio>
|
5 |
+
<version>1.1.0</version>
|
6 |
+
</Samdoit_Mageportfolio>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<mageportfolio>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Samdoit_Mageportfolio</module>
|
14 |
+
<frontName>portfolio</frontName>
|
15 |
+
</args>
|
16 |
+
</mageportfolio>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<mageportfolio>
|
21 |
+
<file>mageportfolio.xml</file>
|
22 |
+
</mageportfolio>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<admin>
|
27 |
+
<routers>
|
28 |
+
<mageportfolio>
|
29 |
+
<use>admin</use>
|
30 |
+
<args>
|
31 |
+
<module>Samdoit_Mageportfolio</module>
|
32 |
+
<frontName>mageportfolio</frontName>
|
33 |
+
</args>
|
34 |
+
</mageportfolio>
|
35 |
+
</routers>
|
36 |
+
</admin>
|
37 |
+
<adminhtml>
|
38 |
+
<menu>
|
39 |
+
<cms>
|
40 |
+
<children>
|
41 |
+
<items module="mageportfolio">
|
42 |
+
<title>Portfolio</title>
|
43 |
+
<sort_order>50</sort_order>
|
44 |
+
<action>mageportfolio/adminhtml_mageportfolio</action>
|
45 |
+
</items>
|
46 |
+
</children>
|
47 |
+
</cms>
|
48 |
+
</menu>
|
49 |
+
<acl>
|
50 |
+
<resources>
|
51 |
+
<all>
|
52 |
+
<title>Allow Everything</title>
|
53 |
+
</all>
|
54 |
+
<admin>
|
55 |
+
<children>
|
56 |
+
<Samdoit_Mageportfolio>
|
57 |
+
<title>Mageportfolio Module</title>
|
58 |
+
<sort_order>10</sort_order>
|
59 |
+
</Samdoit_Mageportfolio>
|
60 |
+
</children>
|
61 |
+
</admin>
|
62 |
+
</resources>
|
63 |
+
</acl>
|
64 |
+
<layout>
|
65 |
+
<updates>
|
66 |
+
<mageportfolio>
|
67 |
+
<file>mageportfolio.xml</file>
|
68 |
+
</mageportfolio>
|
69 |
+
</updates>
|
70 |
+
</layout>
|
71 |
+
</adminhtml>
|
72 |
+
<global>
|
73 |
+
<models>
|
74 |
+
<mageportfolio>
|
75 |
+
<class>Samdoit_Mageportfolio_Model</class>
|
76 |
+
<resourceModel>mageportfolio_mysql4</resourceModel>
|
77 |
+
</mageportfolio>
|
78 |
+
<mageportfolio_mysql4>
|
79 |
+
<class>Samdoit_Mageportfolio_Model_Mysql4</class>
|
80 |
+
<entities>
|
81 |
+
<mageportfolio>
|
82 |
+
<table>mageportfolio</table>
|
83 |
+
</mageportfolio>
|
84 |
+
</entities>
|
85 |
+
</mageportfolio_mysql4>
|
86 |
+
</models>
|
87 |
+
<resources>
|
88 |
+
<mageportfolio_setup>
|
89 |
+
<setup>
|
90 |
+
<module>Samdoit_Mageportfolio</module>
|
91 |
+
</setup>
|
92 |
+
<connection>
|
93 |
+
<use>core_setup</use>
|
94 |
+
</connection>
|
95 |
+
</mageportfolio_setup>
|
96 |
+
<mageportfolio_write>
|
97 |
+
<connection>
|
98 |
+
<use>core_write</use>
|
99 |
+
</connection>
|
100 |
+
</mageportfolio_write>
|
101 |
+
<mageportfolio_read>
|
102 |
+
<connection>
|
103 |
+
<use>core_read</use>
|
104 |
+
</connection>
|
105 |
+
</mageportfolio_read>
|
106 |
+
</resources>
|
107 |
+
<blocks>
|
108 |
+
<mageportfolio>
|
109 |
+
<class>Samdoit_Mageportfolio_Block</class>
|
110 |
+
</mageportfolio>
|
111 |
+
</blocks>
|
112 |
+
<helpers>
|
113 |
+
<mageportfolio>
|
114 |
+
<class>Samdoit_Mageportfolio_Helper</class>
|
115 |
+
</mageportfolio>
|
116 |
+
</helpers>
|
117 |
+
</global>
|
118 |
+
</config>
|
app/code/community/Samdoit/Mageportfolio/sql/mageportfolio_setup/mysql4-install-1.0.0.php
CHANGED
@@ -1,23 +1,23 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
$installer = $this;
|
4 |
-
|
5 |
-
$installer->startSetup();
|
6 |
-
|
7 |
-
$installer->run("
|
8 |
-
|
9 |
-
-- DROP TABLE IF EXISTS {$this->getTable('mageportfolio')};
|
10 |
-
CREATE TABLE {$this->getTable('mageportfolio')} (
|
11 |
-
`mageportfolio_id` int(11) unsigned NOT NULL auto_increment,
|
12 |
-
`title` varchar(255) NOT NULL default '',
|
13 |
-
`filename` varchar(255) NOT NULL default '',
|
14 |
-
`content` text NOT NULL default '',
|
15 |
-
`status` smallint(6) NOT NULL default '0',
|
16 |
-
`created_time` datetime NULL,
|
17 |
-
`update_time` datetime NULL,
|
18 |
-
PRIMARY KEY (`mageportfolio_id`)
|
19 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
20 |
-
|
21 |
-
");
|
22 |
-
|
23 |
-
$installer->endSetup();
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
|
9 |
+
-- DROP TABLE IF EXISTS {$this->getTable('mageportfolio')};
|
10 |
+
CREATE TABLE {$this->getTable('mageportfolio')} (
|
11 |
+
`mageportfolio_id` int(11) unsigned NOT NULL auto_increment,
|
12 |
+
`title` varchar(255) NOT NULL default '',
|
13 |
+
`filename` varchar(255) NOT NULL default '',
|
14 |
+
`content` text NOT NULL default '',
|
15 |
+
`status` smallint(6) NOT NULL default '0',
|
16 |
+
`created_time` datetime NULL,
|
17 |
+
`update_time` datetime NULL,
|
18 |
+
PRIMARY KEY (`mageportfolio_id`)
|
19 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
20 |
+
|
21 |
+
");
|
22 |
+
|
23 |
+
$installer->endSetup();
|
app/code/community/Samdoit/Mageportfolio/sql/mageportfolio_setup/mysql4-upgrade-1.0.2-1.0.3.php
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
$installer = $this;
|
4 |
-
|
5 |
-
$installer->startSetup();
|
6 |
-
|
7 |
-
$installer->run("
|
8 |
-
|
9 |
-
ALTER TABLE {$this->getTable('mageportfolio')}
|
10 |
-
ADD COLUMN `category` varchar(255) AFTER `content`;
|
11 |
-
");
|
12 |
-
|
13 |
-
$installer->endSetup();
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
|
9 |
+
ALTER TABLE {$this->getTable('mageportfolio')}
|
10 |
+
ADD COLUMN `category` varchar(255) AFTER `content`;
|
11 |
+
");
|
12 |
+
|
13 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/mageportfolio.xml
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<layout version="0.1.0">
|
3 |
-
<mageportfolio_adminhtml_mageportfolio_index>
|
4 |
-
<reference name="content">
|
5 |
-
<block type="mageportfolio/adminhtml_mageportfolio" name="mageportfolio" />
|
6 |
-
</reference>
|
7 |
-
</mageportfolio_adminhtml_mageportfolio_index>
|
8 |
-
</layout>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<mageportfolio_adminhtml_mageportfolio_index>
|
4 |
+
<reference name="content">
|
5 |
+
<block type="mageportfolio/adminhtml_mageportfolio" name="mageportfolio" />
|
6 |
+
</reference>
|
7 |
+
</mageportfolio_adminhtml_mageportfolio_index>
|
8 |
+
</layout>
|
app/design/frontend/default/default/layout/mageportfolio.xml
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<layout version="0.1.0">
|
2 |
+
<mageportfolio_index_index>
|
3 |
+
<reference name="head">
|
4 |
+
<action method="addItem"><type>skin_css</type><file>css/portfolio.css</file></action>
|
5 |
+
</reference>
|
6 |
+
<reference name="root">
|
7 |
+
<action method="setTemplate">
|
8 |
+
<template>page/1column.phtml</template>
|
9 |
+
</action>
|
10 |
+
</reference>
|
11 |
+
<reference name="content">
|
12 |
+
<block type="mageportfolio/mageportfolio" name="mageportfolio" template="mageportfolio/mageportfolio.phtml" />
|
13 |
+
</reference>
|
14 |
+
</mageportfolio_index_index>
|
15 |
+
</layout>
|
app/design/frontend/default/default/template/mageportfolio/mageportfolio.phtml
CHANGED
@@ -1,99 +1,60 @@
|
|
1 |
-
<?php
|
2 |
-
if(!$_REQUEST)
|
3 |
-
{
|
4 |
-
|
5 |
-
$pageCategory
|
6 |
-
|
7 |
-
|
8 |
-
$
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
<
|
14 |
-
<
|
15 |
-
|
16 |
-
|
17 |
-
<
|
18 |
-
<div>
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
<
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
}
|
60 |
-
?>
|
61 |
-
<?php
|
62 |
-
}
|
63 |
-
else
|
64 |
-
{
|
65 |
-
$pageDetail = $this->getMageportfolio($_REQUEST['id']);
|
66 |
-
foreach($pageDetail as $value) {
|
67 |
-
?>
|
68 |
-
<div>
|
69 |
-
<div id="portfolio-header">
|
70 |
-
<h3><a href="portfolio?id=<?php echo $value['mageportfolio_id'] ; ?>"><?php echo $value['title'];?></a></h3>
|
71 |
-
</div>
|
72 |
-
<div id="portfolio-content">
|
73 |
-
<?php
|
74 |
-
if($value['filename'])
|
75 |
-
{
|
76 |
-
$thumb = new Imagick();
|
77 |
-
$files = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).$value['filename'];
|
78 |
-
$file_info = pathinfo($files);
|
79 |
-
$out_file_name = $file_info['filename'].'_320_240.'.$file_info['extension'];
|
80 |
-
if($out_file_name)
|
81 |
-
{
|
82 |
-
$thumb->readImage($files);
|
83 |
-
$thumb->resizeImage(320,240,Imagick::FILTER_LANCZOS,1);
|
84 |
-
$files_output = Mage::getBaseDir('media') . DS .$out_file_name;
|
85 |
-
$thumb->writeImage($files_output);
|
86 |
-
$thumb->clear();
|
87 |
-
$thumb->destroy();
|
88 |
-
}
|
89 |
-
?>
|
90 |
-
<img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).$out_file_name;?>" alt="<?php echo $value['title'];?>"><br/><br/>
|
91 |
-
<?php } ?>
|
92 |
-
<?php echo $value['content'];?>
|
93 |
-
</div>
|
94 |
-
</div>
|
95 |
-
|
96 |
-
<?php
|
97 |
-
}
|
98 |
-
}
|
99 |
-
?>
|
1 |
+
<?php
|
2 |
+
if(!$_REQUEST)
|
3 |
+
{
|
4 |
+
$pageCategory = $this->getMageportfolio('','category');
|
5 |
+
if(!empty($pageCategory))
|
6 |
+
{
|
7 |
+
$i=0;
|
8 |
+
foreach($pageCategory as $key_cat=>$value_cat)
|
9 |
+
{
|
10 |
+
$pageDetail = $this->getMageportfolio('','',$value_cat['category']);
|
11 |
+
?>
|
12 |
+
<div class="category">
|
13 |
+
<h3><?php echo $value_cat['category'] ; ?></h3>
|
14 |
+
<ul id="portfolio-grid">
|
15 |
+
<?php foreach($pageDetail as $key=>$value) {?>
|
16 |
+
<li>
|
17 |
+
<div>
|
18 |
+
<div id="portfolio-header">
|
19 |
+
<h3><a href="portfolio?id=<?php echo $value['mageportfolio_id'] ; ?>"><?php echo $value['title'];?></a></h3>
|
20 |
+
</div>
|
21 |
+
<div id="portfolio-content">
|
22 |
+
<img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).$value['filename'];?>" alt="<?php echo $value['title'];?>" width="250" height="350">
|
23 |
+
|
24 |
+
</div>
|
25 |
+
</div>
|
26 |
+
</li>
|
27 |
+
<?php } ?>
|
28 |
+
</ul>
|
29 |
+
<script type="text/javascript">decorateGeneric($$('ul#portfolio-grid>li'), ['odd','even','first','last'])</script>
|
30 |
+
</div>
|
31 |
+
<?php }
|
32 |
+
}
|
33 |
+
else
|
34 |
+
{
|
35 |
+
?>
|
36 |
+
<p class="note-msg">
|
37 |
+
<?php echo $this->__('You have no Portfolio.') ?>
|
38 |
+
</p>
|
39 |
+
<?php
|
40 |
+
}
|
41 |
+
}
|
42 |
+
else
|
43 |
+
{
|
44 |
+
$pageDetail = $this->getMageportfolio($_REQUEST['id']);
|
45 |
+
foreach($pageDetail as $value) {
|
46 |
+
?>
|
47 |
+
<div>
|
48 |
+
<div id="portfolio-header">
|
49 |
+
<h3><a href="portfolio?id=<?php echo $value['mageportfolio_id'] ; ?>"><?php echo $value['title'];?></a></h3>
|
50 |
+
</div>
|
51 |
+
<div id="portfolio-content">
|
52 |
+
<img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).$value['filename'];?>" alt="<?php echo $value['title'];?>"><br/><br/>
|
53 |
+
<?php echo $value['content'];?>
|
54 |
+
</div>
|
55 |
+
</div>
|
56 |
+
|
57 |
+
<?php
|
58 |
+
}
|
59 |
+
}
|
60 |
+
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/default/default/template/mageportfolio/mageportfolio.phtml.old
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if(!$_REQUEST)
|
3 |
+
{
|
4 |
+
//$pageDetail = $this->getMageportfolio();
|
5 |
+
$pageCategory = $this->getMageportfolio('','category');
|
6 |
+
if(!empty($pageCategory))
|
7 |
+
{
|
8 |
+
$i=0;
|
9 |
+
foreach($pageCategory as $key_cat=>$value_cat)
|
10 |
+
{
|
11 |
+
$pageDetail = $this->getMageportfolio('','',$value_cat['category']);
|
12 |
+
?>
|
13 |
+
<div class="category">
|
14 |
+
<h3><?php echo $value_cat['category'] ; ?></h3>
|
15 |
+
<ul id="portfolio-grid">
|
16 |
+
<?php foreach($pageDetail as $key=>$value) {?>
|
17 |
+
<li>
|
18 |
+
<div>
|
19 |
+
<div id="portfolio-header">
|
20 |
+
<h3><a href="portfolio?id=<?php echo $value['mageportfolio_id'] ; ?>"><?php echo $value['title'];?></a></h3>
|
21 |
+
</div>
|
22 |
+
<div id="portfolio-content">
|
23 |
+
<img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).$value['filename'];?>" alt="<?php echo $value['title'];?>" width="250" height="350">
|
24 |
+
|
25 |
+
</div>
|
26 |
+
</div>
|
27 |
+
</li>
|
28 |
+
<?php } ?>
|
29 |
+
</ul>
|
30 |
+
<script type="text/javascript">decorateGeneric($$('ul#portfolio-grid>li'), ['odd','even','first','last'])</script>
|
31 |
+
</div>
|
32 |
+
<?php }
|
33 |
+
}
|
34 |
+
else
|
35 |
+
{
|
36 |
+
?>
|
37 |
+
<p class="note-msg">
|
38 |
+
<?php echo $this->__('You have no Portfolio.') ?>
|
39 |
+
</p>
|
40 |
+
<?php
|
41 |
+
}
|
42 |
+
}
|
43 |
+
else
|
44 |
+
{
|
45 |
+
$pageDetail = $this->getMageportfolio($_REQUEST['id']);
|
46 |
+
foreach($pageDetail as $value) {
|
47 |
+
?>
|
48 |
+
<div>
|
49 |
+
<div id="portfolio-header">
|
50 |
+
<h3><a href="portfolio?id=<?php echo $value['mageportfolio_id'] ; ?>"><?php echo $value['title'];?></a></h3>
|
51 |
+
</div>
|
52 |
+
<div id="portfolio-content">
|
53 |
+
<img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).$value['filename'];?>" alt="<?php echo $value['title'];?>"><br/><br/>
|
54 |
+
<?php echo $value['content'];?>
|
55 |
+
</div>
|
56 |
+
</div>
|
57 |
+
|
58 |
+
<?php
|
59 |
+
}
|
60 |
+
}
|
61 |
+
?>
|
app/etc/modules/Samdoit_Mageportfolio.xml
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<Samdoit_Mageportfolio>
|
5 |
-
<active>true</active>
|
6 |
-
<codePool>community</codePool>
|
7 |
-
</Samdoit_Mageportfolio>
|
8 |
-
</modules>
|
9 |
-
</config>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Samdoit_Mageportfolio>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Samdoit_Mageportfolio>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
CHANGED
@@ -1,25 +1,26 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Samdoit_Mageportfolio</name>
|
4 |
-
<version>1.0
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Portfolio easy to create your portfolio detail snapshot content of portfolio and easy to access by admin user</summary>
|
10 |
<description>Magento Portfolio to add your portfolio in magento admin you can view from your front end, you can view the portfolio by http://your-domain/portfolio</description>
|
11 |
-
<notes>Stable Version tested the compatibility with magento 1.
|
12 |

|
13 |
Change log
|
14 |
1.0.0 --> Initial version
|
15 |
1.0.1 --> Small display issue fix
|
16 |
1.0.2 --> Frentend design changes
|
17 |
1.0.3 --> Add Category
|
18 |
-
1.0.4 -->
|
|
|
19 |
<authors><author><name>Samdoit</name><user>samdoit</user><email>arulmanickams@samdoit.com</email></author></authors>
|
20 |
-
<date>
|
21 |
-
<time>
|
22 |
-
<contents><target name="mageetc"><dir name="modules"><file name="Samdoit_Mageportfolio.xml" hash="
|
23 |
<compatible/>
|
24 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
25 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Samdoit_Mageportfolio</name>
|
4 |
+
<version>1.1.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Portfolio easy to create your portfolio detail snapshot content of portfolio and easy to access by admin user</summary>
|
10 |
<description>Magento Portfolio to add your portfolio in magento admin you can view from your front end, you can view the portfolio by http://your-domain/portfolio</description>
|
11 |
+
<notes>Stable Version tested the compatibility with magento 1.9.0
|
12 |

|
13 |
Change log
|
14 |
1.0.0 --> Initial version
|
15 |
1.0.1 --> Small display issue fix
|
16 |
1.0.2 --> Frentend design changes
|
17 |
1.0.3 --> Add Category
|
18 |
+
1.0.4 --> Export option & Lable changes
|
19 |
+
1.0.5 --> Add Admin portfolio image display</notes>
|
20 |
<authors><author><name>Samdoit</name><user>samdoit</user><email>arulmanickams@samdoit.com</email></author></authors>
|
21 |
+
<date>2015-12-26</date>
|
22 |
+
<time>09:27:04</time>
|
23 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Samdoit_Mageportfolio.xml" hash="79b6981fc034a1f66c1ed6e1c08001bb"/></dir></target><target name="magecommunity"><dir name="Samdoit"><dir name="Mageportfolio"><dir><dir name="Block"><dir name="Adminhtml"><dir name="Mageportfolio"><dir name="Edit"><file name="Form.php" hash="a7e9b31af0f3a7ac522889638d7553cf"/><dir name="Tab"><file name="Form.php" hash="602fccf1260df98e509f2f8e92349e7e"/></dir><file name="Tabs.php" hash="f34623b294d3ac50fde9171c8d6ef89b"/></dir><file name="Edit.php" hash="cf30e6e8a32aa165f64a6f342cf0f28c"/><file name="Grid.php" hash="eb47a63a854953edc2c39dd03aa7c53e"/></dir><file name="Mageportfolio.php" hash="907a7b9c791412de5cf73485511f0eaa"/></dir><file name="Mageportfolio.php" hash="710faea53f4e1d8caa6d3442a0e4b518"/></dir><dir name="Helper"><file name="Data.php" hash="c673ae17e45863601594f0e734e07f07"/></dir><dir name="Model"><file name="Mageportfolio.php" hash="524ab5b0cf50c735086f606ceddad521"/><dir name="Mysql4"><dir name="Mageportfolio"><file name="Collection.php" hash="346c8a44d7d8f0c3bfacd0080bed7649"/></dir><file name="Mageportfolio.php" hash="37c1f290aee03e4033e91b4a06eb04e4"/></dir><file name="Status.php" hash="daf6330870b4c091b5be510b1d379493"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="MageportfolioController.php" hash="7f7202120588edecc4934570e89da6d5"/></dir><file name="IndexController.php" hash="4fd7ef9f3bc675497cd1f7cd82864996"/></dir><dir name="etc"><file name="config.xml" hash="1e97f4be037af1414409c878cc8df623"/></dir><dir name="sql"><dir name="mageportfolio_setup"><file name="mysql4-install-1.0.0.php" hash="83e7118384edf4b1716b8188c0dcec3b"/><file name="mysql4-upgrade-1.0.2-1.0.3.php" hash="d6ed22d1a9d6656150e3eaf29b74e8ba"/></dir></dir></dir><file name="README.txt" hash="4e906ec6999880d803c3be9a938fc375"/></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="mageportfolio.xml" hash="0192fd61407c07908a61ab9a6ef13180"/></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="mageportfolio"><file name="mageportfolio.phtml" hash="103414389e8ee3666afc48b9c5707ec0"/><file name="mageportfolio.phtml.old" hash="1dd53a238177c44d82ecb17c26885468"/></dir></dir><dir name="layout"><file name="mageportfolio.xml" hash="fafcde13628d9d79a92f605146d87dd2"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><file name="portfolio.css" hash="55ccb9b2e29eccd1f40acad7678755d0"/></dir></dir></dir></dir></target></contents>
|
24 |
<compatible/>
|
25 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
26 |
</package>
|
skin/frontend/default/default/css/portfolio.css
CHANGED
@@ -1,3 +1,4 @@
|
|
1 |
#portfolio-grid li.last, #portfolio-grid li.first { padding-left: 0; }
|
2 |
#portfolio-grid li { float: left; padding-left:10px; }
|
3 |
.category { width: 100%; float: left; }
|
|
1 |
#portfolio-grid li.last, #portfolio-grid li.first { padding-left: 0; }
|
2 |
#portfolio-grid li { float: left; padding-left:10px; }
|
3 |
.category { width: 100%; float: left; }
|
4 |
+
#portfolio-content > img { width: 100%; }
|