Samdoit_Mageportfolio - Version 1.0.2

Version Notes

Stable Version tested the compatibility with magento 1.7.2

Download this release

Release Info

Developer Samdoit
Extension Samdoit_Mageportfolio
Version 1.0.2
Comparing to
See all releases


Code changes from version 1.0.1 to 1.0.2

app/code/community/Samdoit/Mageportfolio/Block/Mageportfolio.php CHANGED
@@ -7,11 +7,14 @@ class Samdoit_Mageportfolio_Block_Mageportfolio extends Mage_Core_Block_Template
7
  return parent::_prepareLayout();
8
  }
9
 
10
- public function getMageportfolio()
11
  {
12
  $resource = Mage::getSingleton('core/resource');
13
  $readConnection = $resource->getConnection('core_read');
14
- $query = "SELECT *FROM ".$resource->getTableName('mageportfolio/mageportfolio')." WHERE status=1";
 
 
 
15
  $pageCollection = $readConnection->fetchAll($query);
16
  return $pageCollection;
17
  }
7
  return parent::_prepareLayout();
8
  }
9
 
10
+ public function getMageportfolio($id='')
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";
16
+ else
17
+ $query = "SELECT *FROM ".$resource->getTableName('mageportfolio/mageportfolio')." WHERE status=1 AND mageportfolio_id=$id";
18
  $pageCollection = $readConnection->fetchAll($query);
19
  return $pageCollection;
20
  }
app/code/community/Samdoit/Mageportfolio/README.txt ADDED
@@ -0,0 +1,2 @@
 
 
1
+ sudo apt-get install php5-imagick
2
+ sudo /etc/init.d/apache2 restart
app/code/community/Samdoit/Mageportfolio/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Samdoit_Mageportfolio>
5
- <version>1.0.1</version>
6
  </Samdoit_Mageportfolio>
7
  </modules>
8
  <frontend>
@@ -40,7 +40,7 @@
40
  <children>
41
  <items module="mageportfolio">
42
  <title>Portfolio</title>
43
- <sort_order>25</sort_order>
44
  <action>mageportfolio/adminhtml_mageportfolio</action>
45
  </items>
46
  </children>
2
  <config>
3
  <modules>
4
  <Samdoit_Mageportfolio>
5
+ <version>1.0.2</version>
6
  </Samdoit_Mageportfolio>
7
  </modules>
8
  <frontend>
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>
app/design/frontend/default/default/layout/mageportfolio.xml CHANGED
@@ -1,4 +1,9 @@
1
  <layout version="0.1.0">
 
 
 
 
 
2
  <mageportfolio_index_index>
3
  <reference name="root">
4
  <action method="setTemplate">
1
  <layout version="0.1.0">
2
+ <default>
3
+ <reference name="head">
4
+ <action method="addItem"><type>skin_css</type><file>css/portfolio.css</file></action>
5
+ </reference>
6
+ </default>
7
  <mageportfolio_index_index>
8
  <reference name="root">
9
  <action method="setTemplate">
app/design/frontend/default/default/template/mageportfolio/mageportfolio.phtml CHANGED
@@ -1,18 +1,72 @@
1
  <?php
2
- $pageDetail = $this->getMageportfolio();
 
 
3
  ?>
4
- <ul>
5
  <?php foreach($pageDetail as $key=>$value) {?>
6
  <li>
7
  <div>
8
  <div id="portfolio-header">
9
- <h3><?php echo $value['title'];?></h3>
10
  </div>
11
  <div id="portfolio-content">
12
- <img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).$value['filename'];?>" height="500" width="500" alt="<?php echo $value['title'];?>"><br/><br/>
13
- <?php echo $value['content'];?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  </div>
15
  </div>
16
  </li>
17
  <?php } ?>
18
  </ul>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
+ if(!$_REQUEST)
3
+ {
4
+ $pageDetail = $this->getMageportfolio();
5
  ?>
6
+ <ul id="portfolio-grid">
7
  <?php foreach($pageDetail as $key=>$value) {?>
8
  <li>
9
  <div>
10
  <div id="portfolio-header">
11
+ <h3><a href="portfolio?id=<?php echo $value['mageportfolio_id'] ; ?>"><?php echo $value['title'];?></a></h3>
12
  </div>
13
  <div id="portfolio-content">
14
+ <?php
15
+ $thumb = new Imagick();
16
+ $files = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).$value['filename'];
17
+ $file_info = pathinfo($files);
18
+ $out_file_name = $file_info['filename'].'_320_240.'.$file_info['extension'];
19
+ if($out_file_name)
20
+ {
21
+ $thumb->readImage($files);
22
+ $thumb->resizeImage(320,240,Imagick::FILTER_LANCZOS,1);
23
+ $files_output = Mage::getBaseDir('media') . DS .$out_file_name;
24
+ $thumb->writeImage($files_output);
25
+ $thumb->clear();
26
+ $thumb->destroy();
27
+ }
28
+ ?>
29
+ <img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).$out_file_name;?>" alt="<?php echo $value['title'];?>">
30
  </div>
31
  </div>
32
  </li>
33
  <?php } ?>
34
  </ul>
35
+ <script type="text/javascript">decorateGeneric($$('ul#portfolio-grid>li'), ['odd','even','first','last'])</script>
36
+
37
+ <?php
38
+ }
39
+ else
40
+ {
41
+ $pageDetail = $this->getMageportfolio($_REQUEST['id']);
42
+ foreach($pageDetail as $value) {
43
+ ?>
44
+ <div>
45
+ <div id="portfolio-header">
46
+ <h3><a href="portfolio?id=<?php echo $value['mageportfolio_id'] ; ?>"><?php echo $value['title'];?></a></h3>
47
+ </div>
48
+ <div id="portfolio-content">
49
+ <?php
50
+ $thumb = new Imagick();
51
+ $files = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).$value['filename'];
52
+ $file_info = pathinfo($files);
53
+ $out_file_name = $file_info['filename'].'_320_240.'.$file_info['extension'];
54
+ if($out_file_name)
55
+ {
56
+ $thumb->readImage($files);
57
+ $thumb->resizeImage(320,240,Imagick::FILTER_LANCZOS,1);
58
+ $files_output = Mage::getBaseDir('media') . DS .$out_file_name;
59
+ $thumb->writeImage($files_output);
60
+ $thumb->clear();
61
+ $thumb->destroy();
62
+ }
63
+ ?>
64
+ <img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).$out_file_name;?>" alt="<?php echo $value['title'];?>"><br/><br/>
65
+ <?php echo $value['content'];?>
66
+ </div>
67
+ </div>
68
+
69
+ <?php
70
+ }
71
+ }
72
+ ?>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Samdoit_Mageportfolio</name>
4
- <version>1.0.1</version>
5
  <stability>stable</stability>
6
  <license>OSL</license>
7
  <channel>community</channel>
@@ -11,8 +11,8 @@
11
  <notes>Stable Version tested the compatibility with magento 1.7.2</notes>
12
  <authors><author><name>Samdoit</name><user>samdoit</user><email>arulmanickams@samdoit.com</email></author></authors>
13
  <date>2013-09-10</date>
14
- <time>09:09:21</time>
15
- <contents><target name="mageetc"><dir name="modules"><file name="Samdoit_Mageportfolio.xml" hash="dcb64db6ad3dae0c5159cfdf6bb6577d"/></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="cc698dcf823567d00e4fc8471a582e06"/><dir name="Tab"><file name="Form.php" hash="22534371cd7fac3c324fc89c53b86282"/></dir><file name="Tabs.php" hash="a06c18da85fd0193ba9cc4dd21b6c2a5"/></dir><file name="Edit.php" hash="567bbee4f4600fd829c3d7799eda5260"/><file name="Grid.php" hash="40dc87defc4117a2266b7ee5c99f1cf0"/></dir><file name="Mageportfolio.php" hash="c415927c72ae9e96cf4015648385d469"/></dir><file name="Mageportfolio.php" hash="c8f86dfd024b031bef9868997dad9b76"/></dir><dir name="Helper"><file name="Data.php" hash="6ce7a43b4ff0a8db4bcf3083acfcb73b"/></dir><dir name="Model"><file name="Mageportfolio.php" hash="761446fe4bdaad58405af79bac8e5e39"/><dir name="Mysql4"><dir name="Mageportfolio"><file name="Collection.php" hash="44f8c04d09679178a5493387cf2bc259"/></dir><file name="Mageportfolio.php" hash="657f9cf6e7c4d435169fd85934c68552"/></dir><file name="Status.php" hash="daf6330870b4c091b5be510b1d379493"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="MageportfolioController.php" hash="e70d03debbbced4501144e09416625b2"/></dir><file name="IndexController.php" hash="fa482fc73dd8568ae615c237f06f0475"/></dir><dir name="etc"><file name="config.xml" hash="fe8d8e125d67335d91c382d109571ae0"/></dir><dir name="sql"><dir name="mageportfolio_setup"><file name="mysql4-install-1.0.0.php" hash="37aa00fead24136e24f356e3c16f3513"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="mageportfolio.xml" hash="91ced8de17332ecfdfe307c575ad0de4"/></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="mageportfolio"><file name="mageportfolio.phtml" hash="aafb21a30bdaccdd469016b80a4d8b83"/></dir></dir><dir name="layout"><file name="mageportfolio.xml" hash="ab2876109f8a2a0bf576da5bc7e0e852"/></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="c029779604d16867300f63518e7b7089"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Samdoit_Mageportfolio</name>
4
+ <version>1.0.2</version>
5
  <stability>stable</stability>
6
  <license>OSL</license>
7
  <channel>community</channel>
11
  <notes>Stable Version tested the compatibility with magento 1.7.2</notes>
12
  <authors><author><name>Samdoit</name><user>samdoit</user><email>arulmanickams@samdoit.com</email></author></authors>
13
  <date>2013-09-10</date>
14
+ <time>09:13:35</time>
15
+ <contents><target name="mageetc"><dir name="modules"><file name="Samdoit_Mageportfolio.xml" hash="dcb64db6ad3dae0c5159cfdf6bb6577d"/></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="cc698dcf823567d00e4fc8471a582e06"/><dir name="Tab"><file name="Form.php" hash="22534371cd7fac3c324fc89c53b86282"/></dir><file name="Tabs.php" hash="a06c18da85fd0193ba9cc4dd21b6c2a5"/></dir><file name="Edit.php" hash="567bbee4f4600fd829c3d7799eda5260"/><file name="Grid.php" hash="40dc87defc4117a2266b7ee5c99f1cf0"/></dir><file name="Mageportfolio.php" hash="c415927c72ae9e96cf4015648385d469"/></dir><file name="Mageportfolio.php" hash="8ef0986b0bd9303007c4957e5c6ca88c"/></dir><dir name="Helper"><file name="Data.php" hash="6ce7a43b4ff0a8db4bcf3083acfcb73b"/></dir><dir name="Model"><file name="Mageportfolio.php" hash="761446fe4bdaad58405af79bac8e5e39"/><dir name="Mysql4"><dir name="Mageportfolio"><file name="Collection.php" hash="44f8c04d09679178a5493387cf2bc259"/></dir><file name="Mageportfolio.php" hash="657f9cf6e7c4d435169fd85934c68552"/></dir><file name="Status.php" hash="daf6330870b4c091b5be510b1d379493"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="MageportfolioController.php" hash="e70d03debbbced4501144e09416625b2"/></dir><file name="IndexController.php" hash="fa482fc73dd8568ae615c237f06f0475"/></dir><dir name="etc"><file name="config.xml" hash="c9676ff6a325d14a521fa19fa3695c7a"/></dir><dir name="sql"><dir name="mageportfolio_setup"><file name="mysql4-install-1.0.0.php" hash="37aa00fead24136e24f356e3c16f3513"/></dir></dir></dir><file name="README.txt" hash="d6ac14415b208bcbeac94a17e55a0c74"/></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="mageportfolio.xml" hash="91ced8de17332ecfdfe307c575ad0de4"/></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="mageportfolio"><file name="mageportfolio.phtml" hash="e785995065fd582f48784af1e374f9f1"/></dir></dir><dir name="layout"><file name="mageportfolio.xml" hash="a45a958770db29aa3c1ffe51cf0597bd"/></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="86aa4389e0db9ba020e7e6564cedca5c"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
skin/frontend/default/default/css/portfolio.css CHANGED
@@ -1,3 +1,2 @@
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; }