Samdoit_Mageportfolio - Version 1.0.3

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.3
Comparing to
See all releases


Code changes from version 1.0.2 to 1.0.3

app/code/community/Samdoit/Mageportfolio/Block/Adminhtml/Mageportfolio/Edit/Tab/Form.php CHANGED
@@ -36,6 +36,12 @@ class Samdoit_Mageportfolio_Block_Adminhtml_Mageportfolio_Edit_Tab_Form extends
36
  ),
37
  ),
38
  ));
 
 
 
 
 
 
39
 
40
  $fieldset->addField('content', 'editor', array(
41
  'name' => 'content',
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',
app/code/community/Samdoit/Mageportfolio/Block/Adminhtml/Mageportfolio/Grid.php CHANGED
@@ -33,13 +33,11 @@ class Samdoit_Mageportfolio_Block_Adminhtml_Mageportfolio_Grid extends Mage_Admi
33
  'index' => 'title',
34
  ));
35
 
36
- /*
37
  $this->addColumn('content', array(
38
- 'header' => Mage::helper('mageportfolio')->__('Item Content'),
39
  'width' => '150px',
40
- 'index' => 'content',
41
  ));
42
- */
43
 
44
  $this->addColumn('status', array(
45
  'header' => Mage::helper('mageportfolio')->__('Status'),
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'),
app/code/community/Samdoit/Mageportfolio/Block/Mageportfolio.php CHANGED
@@ -7,14 +7,16 @@ class Samdoit_Mageportfolio_Block_Mageportfolio extends Mage_Core_Block_Template
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
  }
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
  $pageCollection = $readConnection->fetchAll($query);
21
  return $pageCollection;
22
  }
app/code/community/Samdoit/Mageportfolio/README.txt CHANGED
@@ -1,2 +1,7 @@
1
  sudo apt-get install php5-imagick
2
  sudo /etc/init.d/apache2 restart
 
 
 
 
 
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 --> Frentend design changes
7
+ 1.0.2 --> Add Category
app/code/community/Samdoit/Mageportfolio/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Samdoit_Mageportfolio>
5
- <version>1.0.2</version>
6
  </Samdoit_Mageportfolio>
7
  </modules>
8
  <frontend>
2
  <config>
3
  <modules>
4
  <Samdoit_Mageportfolio>
5
+ <version>1.0.3</version>
6
  </Samdoit_Mageportfolio>
7
  </modules>
8
  <frontend>
app/code/community/Samdoit/Mageportfolio/sql/mageportfolio_setup/mysql4-upgrade-1.0.2-1.0.3.php ADDED
@@ -0,0 +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();
app/design/frontend/default/default/template/mageportfolio/mageportfolio.phtml CHANGED
@@ -1,8 +1,15 @@
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>
@@ -12,28 +19,39 @@ $pageDetail = $this->getMageportfolio();
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
@@ -47,21 +65,24 @@ foreach($pageDetail as $value) {
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>
1
  <?php
2
  if(!$_REQUEST)
3
  {
4
+ //$pageDetail = $this->getMageportfolio();
5
+ $pageCategory = $this->getMageportfolio('','category');
6
+ $i=0;
7
+ foreach($pageCategory as $key_cat=>$value_cat)
8
+ {
9
+ $pageDetail = $this->getMageportfolio('','',$value_cat['category']);
10
  ?>
11
+ <div class="category">
12
+ <h3><?php echo $value_cat['category'] ; ?></h3>
13
  <ul id="portfolio-grid">
14
  <?php foreach($pageDetail as $key=>$value) {?>
15
  <li>
19
  </div>
20
  <div id="portfolio-content">
21
  <?php
22
+ if($value['filename'])
 
 
 
 
23
  {
24
+ $thumb = new Imagick();
25
+ $files = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).$value['filename'];
26
+ $file_info = pathinfo($files);
27
+ $out_file_name = $file_info['filename'].'_320_240.'.$file_info['extension'];
28
+ if($out_file_name)
29
+ {
30
+ $thumb->readImage($files);
31
+ $thumb->resizeImage(320,240,Imagick::FILTER_LANCZOS,1);
32
+ $files_output = Mage::getBaseDir('media') . DS .$out_file_name;
33
+ $thumb->writeImage($files_output);
34
+ $thumb->clear();
35
+ $thumb->destroy();
36
+ }
37
  ?>
38
  <img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).$out_file_name;?>" alt="<?php echo $value['title'];?>">
39
+ <?php } ?>
40
  </div>
41
  </div>
42
  </li>
43
  <?php } ?>
44
  </ul>
45
  <script type="text/javascript">decorateGeneric($$('ul#portfolio-grid>li'), ['odd','even','first','last'])</script>
46
+ </div>
47
+ <?php
48
+ }
49
+
50
+ echo "<pre>";
51
+ print_r($cat_val);
52
+ echo "</pre>";
53
 
54
+ ?>
55
  <?php
56
  }
57
  else
65
  </div>
66
  <div id="portfolio-content">
67
  <?php
68
+ if($value['filename'])
 
 
 
 
69
  {
70
+ $thumb = new Imagick();
71
+ $files = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).$value['filename'];
72
+ $file_info = pathinfo($files);
73
+ $out_file_name = $file_info['filename'].'_320_240.'.$file_info['extension'];
74
+ if($out_file_name)
75
+ {
76
+ $thumb->readImage($files);
77
+ $thumb->resizeImage(320,240,Imagick::FILTER_LANCZOS,1);
78
+ $files_output = Mage::getBaseDir('media') . DS .$out_file_name;
79
+ $thumb->writeImage($files_output);
80
+ $thumb->clear();
81
+ $thumb->destroy();
82
+ }
83
  ?>
84
  <img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).$out_file_name;?>" alt="<?php echo $value['title'];?>"><br/><br/>
85
+ <?php } ?>
86
  <?php echo $value['content'];?>
87
  </div>
88
  </div>
package.xml CHANGED
@@ -1,7 +1,7 @@
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,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: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>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Samdoit_Mageportfolio</name>
4
+ <version>1.0.3</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:19:24</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="8053f008cc5b120ac1c0d8c32c46acf6"/></dir><file name="Tabs.php" hash="a06c18da85fd0193ba9cc4dd21b6c2a5"/></dir><file name="Edit.php" hash="567bbee4f4600fd829c3d7799eda5260"/><file name="Grid.php" hash="9db21e058591f9962ffdd433ab81724a"/></dir><file name="Mageportfolio.php" hash="c415927c72ae9e96cf4015648385d469"/></dir><file name="Mageportfolio.php" hash="53b41c0ffce2cd47c1dd48f21100cd34"/></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="b9ff746f5270d6e408fe38ea1628d59e"/></dir><dir name="sql"><dir name="mageportfolio_setup"><file name="mysql4-install-1.0.0.php" hash="37aa00fead24136e24f356e3c16f3513"/><file name="mysql4-upgrade-1.0.2-1.0.3.php" hash="c4b4ed7f16a6f01fe7dc9dc86b1206bc"/></dir></dir></dir><file name="README.txt" hash="0eb5d0eb022b6abbf98c27d9fa9361ba"/></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="ca9075cdb29b629fd5f80f508638cab2"/></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="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>
skin/frontend/default/default/css/portfolio.css CHANGED
@@ -1,2 +1,3 @@
1
  #portfolio-grid li.last, #portfolio-grid li.first { padding-left: 0; }
2
  #portfolio-grid li { float: left; padding-left:10px; }
 
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; }