Auguria_Video - Version 0.0.1

Version Notes

Auguria_Video

Download this release

Release Info

Developer Auguria
Extension Auguria_Video
Version 0.0.1
Comparing to
See all releases


Version 0.0.1

Files changed (28) hide show
  1. app/code/community/Auguria/Video/Block/Adminhtml/Catalog/Product/Widget/Chooser.php +55 -0
  2. app/code/community/Auguria/Video/Block/Adminhtml/Video.php +17 -0
  3. app/code/community/Auguria/Video/Block/Adminhtml/Video/Edit.php +58 -0
  4. app/code/community/Auguria/Video/Block/Adminhtml/Video/Edit/Form.php +24 -0
  5. app/code/community/Auguria/Video/Block/Adminhtml/Video/Edit/Tab/Form.php +124 -0
  6. app/code/community/Auguria/Video/Block/Adminhtml/Video/Edit/Tabs.php +28 -0
  7. app/code/community/Auguria/Video/Block/Adminhtml/Video/Grid.php +118 -0
  8. app/code/community/Auguria/Video/Block/Home.php +29 -0
  9. app/code/community/Auguria/Video/Block/List.php +24 -0
  10. app/code/community/Auguria/Video/Block/Product.php +25 -0
  11. app/code/community/Auguria/Video/Helper/Data.php +56 -0
  12. app/code/community/Auguria/Video/Model/Mysql4/Video.php +14 -0
  13. app/code/community/Auguria/Video/Model/Mysql4/Video/Collection.php +15 -0
  14. app/code/community/Auguria/Video/Model/Video.php +25 -0
  15. app/code/community/Auguria/Video/controllers/Adminhtml/VideoController.php +217 -0
  16. app/code/community/Auguria/Video/controllers/IndexController.php +28 -0
  17. app/code/community/Auguria/Video/etc/adminhtml.xml +44 -0
  18. app/code/community/Auguria/Video/etc/config.xml +133 -0
  19. app/code/community/Auguria/Video/sql/auguria_video_setup/mysql4-install-0.0.1.php +25 -0
  20. app/design/adminhtml/default/default/layout/auguria/video.xml +22 -0
  21. app/design/frontend/base/default/layout/auguria/video.xml +26 -0
  22. app/design/frontend/base/default/template/auguria/video/home.phtml +47 -0
  23. app/design/frontend/base/default/template/auguria/video/list.phtml +68 -0
  24. app/design/frontend/base/default/template/auguria/video/product.phtml +66 -0
  25. app/etc/modules/Auguria_Video.xml +17 -0
  26. app/locale/fr_FR/Auguria_Contact.csv +35 -0
  27. package.xml +18 -0
  28. skin/frontend/base/default/css/auguria/video/styles.css +9 -0
app/code/community/Auguria/Video/Block/Adminhtml/Catalog/Product/Widget/Chooser.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Video
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ class Auguria_Video_Block_Adminhtml_Catalog_Product_Widget_Chooser extends Mage_Adminhtml_Block_Catalog_Product_Widget_Chooser
9
+ {
10
+ protected $_category;
11
+
12
+ public function getRowClickCallback()
13
+ {
14
+ return "function (grid, event) {
15
+ var trElement = Event.findElement(event, 'tr');
16
+ var productId = trElement.down('td').innerHTML;
17
+ var productName = trElement.down('td').next().next().innerHTML;
18
+
19
+ $('auguria_video_product_id').value = productId.replace(/^\s+/g,'').replace(/\s+$/g,'');
20
+ $('video_name').innerHTML = productName;
21
+ winGrid.close();
22
+ }";
23
+ }
24
+
25
+ public function getCategory()
26
+ {
27
+ if (!isset($this->_category)) {
28
+ $categoryId = (int)$this->getCategoryId();
29
+ if ($categoryId>0) {
30
+ $this->_category = Mage::getModel('catalog/category')->load($categoryId);
31
+ }
32
+ }
33
+ return $this->_category;
34
+ }
35
+
36
+ protected function _prepareCollection()
37
+ {
38
+ /* @var $collection Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection */
39
+ $collection = Mage::getResourceModel('catalog/product_collection')
40
+ ->setStoreId(0)
41
+ ->addAttributeToSelect('name');
42
+
43
+ if ($this->getCategory()) {
44
+ $collection->addCategoryFilter($this->_category);
45
+ }
46
+
47
+ if ($productTypeId = $this->getProductTypeId()) {
48
+ $collection->addAttributeToFilter('type_id', $productTypeId);
49
+ }
50
+
51
+ $this->setCollection($collection);
52
+
53
+ return Mage_Adminhtml_Block_Widget_Grid::_prepareCollection();
54
+ }
55
+ }
app/code/community/Auguria/Video/Block/Adminhtml/Video.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Video
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ class Auguria_Video_Block_Adminhtml_Video extends Mage_Adminhtml_Block_Widget_Grid_Container
9
+ {
10
+ public function __construct()
11
+ {
12
+ $this->_controller = 'adminhtml_video';
13
+ $this->_blockGroup = 'auguria_video';
14
+ $this->_headerText = $this->__('Videos list');
15
+ parent::__construct();
16
+ }
17
+ }
app/code/community/Auguria/Video/Block/Adminhtml/Video/Edit.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Video
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ class Auguria_Video_Block_Adminhtml_Video_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
9
+ {
10
+ public function __construct()
11
+ {
12
+ parent::__construct();
13
+
14
+ $this->_objectId = 'id';
15
+ $this->_blockGroup = 'auguria_video';
16
+ $this->_controller = 'adminhtml_video';
17
+
18
+ $this->_updateButton('save', 'label', Mage::helper('auguria_video')->__('Save Item'));
19
+ $this->_updateButton('delete', 'label', Mage::helper('auguria_video')->__('Delete Item'));
20
+
21
+ $this->_addButton('saveandcontinue', array(
22
+ 'label' => Mage::helper('auguria_video')->__('Save And Continue Edit'),
23
+ 'onclick' => 'saveAndContinueEdit()',
24
+ 'class' => 'save',
25
+ ), -100);
26
+
27
+ $this->_formScripts[] = "
28
+ function toggleEditor() {
29
+ if (tinyMCE.getInstanceById('description') == null) {
30
+ tinyMCE.execCommand('mceAddControl', false, 'description');
31
+ } else {
32
+ tinyMCE.execCommand('mceRemoveControl', false, 'description');
33
+ }
34
+ }
35
+
36
+ function saveAndContinueEdit(){
37
+ editForm.submit($('edit_form').action+'back/edit/');
38
+ }
39
+ ";
40
+ }
41
+
42
+ public function getHeaderText()
43
+ {
44
+ if( Mage::registry('video_data') && Mage::registry('video_data')->getId() ) {
45
+ return Mage::helper('auguria_video')->__("Edition of the video '%s'", Mage::registry('video_data')->getTitle());
46
+ }
47
+ else {
48
+ return Mage::helper('auguria_video')->__('Add a video');
49
+ }
50
+ }
51
+
52
+ protected function _prepareLayout() {
53
+ parent::_prepareLayout();
54
+ if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
55
+ $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
56
+ }
57
+ }
58
+ }
app/code/community/Auguria/Video/Block/Adminhtml/Video/Edit/Form.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Video
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ class Auguria_Video_Block_Adminhtml_Video_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
9
+ {
10
+ protected function _prepareForm()
11
+ {
12
+ $form = new Varien_Data_Form(array(
13
+ 'id' => 'edit_form',
14
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
15
+ 'method' => 'post',
16
+ 'enctype' => 'multipart/form-data'
17
+ )
18
+ );
19
+
20
+ $form->setUseContainer(true);
21
+ $this->setForm($form);
22
+ return parent::_prepareForm();
23
+ }
24
+ }
app/code/community/Auguria/Video/Block/Adminhtml/Video/Edit/Tab/Form.php ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Video
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ class Auguria_Video_Block_Adminhtml_Video_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
9
+ {
10
+ protected function _prepareForm()
11
+ {
12
+ $form = new Varien_Data_Form();
13
+ $this->setForm($form);
14
+ $fieldset = $form->addFieldset('video_form', array('legend'=>Mage::helper('auguria_video')->__('Item information')));
15
+
16
+ $fieldset->addField('title', 'text', array(
17
+ 'label' => Mage::helper('auguria_video')->__('Title'),
18
+ 'class' => 'required-entry input-text',
19
+ 'required' => true,
20
+ 'name' => 'title',
21
+ ));
22
+
23
+
24
+ //$wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig();
25
+ $fieldset->addField('description', 'editor', array(
26
+ 'name' => 'description',
27
+ 'label' => Mage::helper('auguria_video')->__('Description'),
28
+ 'title' => Mage::helper('auguria_video')->__('Description'),
29
+ 'wysiwyg' => true,
30
+ 'style' => 'width:725px;height:460px',
31
+ //'config' => $wysiwygConfig
32
+ ));
33
+
34
+ $fieldset->addField('image_identifier', 'text', array(
35
+ 'label' => Mage::helper('auguria_video')->__('Identifier'),
36
+ 'class' => 'required-entry input-text',
37
+ 'required' => true,
38
+ 'name' => 'image_identifier',
39
+ ));
40
+
41
+ $fieldset->addField('preview', 'image', array(
42
+ 'label' => Mage::helper('auguria_video')->__('Preview'),
43
+ 'class' => 'required-entry input-text',
44
+ 'required' => true,
45
+ 'name' => 'preview',
46
+ 'after_element_html' => '<p class="note"><span>Format: 425x239 pixels</span></p>',
47
+ ));
48
+
49
+ $fieldset->addField('status', 'select',
50
+ array(
51
+ 'name' => 'status',
52
+ 'label' => Mage::helper('auguria_video')->__('Status'),
53
+ 'values' => Mage::helper('auguria_video')->statusToOptionArray(),
54
+ )
55
+ );
56
+
57
+ $button = $this->_getAddProductButton();
58
+ $fieldset->addField('product_id', 'note', array(
59
+ 'label' => Mage::helper('auguria_video')->__('Associated product'),
60
+ 'text' => $button,
61
+ ));
62
+
63
+ $fieldset->addField('display_on_home_page', 'select',
64
+ array(
65
+ 'name' => 'display_on_home_page',
66
+ 'label' => Mage::helper('auguria_video')->__('Display on home page'),
67
+ 'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray(),
68
+ )
69
+ );
70
+
71
+ if (Mage::registry('video_data')) {
72
+ $form->setValues(Mage::registry('video_data')->getData());
73
+ }
74
+ return parent::_prepareForm();
75
+ }
76
+
77
+ public function _getAddProductButton()
78
+ {
79
+ $productId = "";
80
+ if (Mage::registry('video_data') && (int)Mage::registry('video_data')->getProductId()>0) {
81
+ $productId = Mage::registry('video_data')->getProductId();
82
+ }
83
+ $input = '<input type="hidden" value="'.$productId.'" name="product_id" id="auguria_video_product_id" />';
84
+ if ((int)$productId==0) {
85
+ $value = Mage::helper('auguria_video')->__('No product');
86
+ }
87
+ else {
88
+ $product = Mage::getModel('catalog/product')->load($productId);
89
+ $value = $product->getName();
90
+ }
91
+
92
+ $layout = Mage::getSingleton('core/layout');
93
+
94
+ $html = '<script type="text/javascript">// <![CDATA[
95
+ function displayProductGrid() {
96
+ winGrid = new Window({className:"magento",title:"'.Mage::helper('auguria_video')->__('Select product').'",width:800,height:450,minimizable:false,maximizable:false,showEffectOptions:{duration:0.4},hideEffectOptions:{duration:0.4}});
97
+ winGrid.setZIndex(100);
98
+ winGrid.showCenter(true);
99
+ winGrid.setContent("video_chooser_container");
100
+ }
101
+ // ]]></script>';
102
+ $html .= $layout->createBlock('adminhtml/widget_button')
103
+ ->setData(array(
104
+ 'label' => Mage::helper('adminhtml')->__('Select product'),
105
+ 'onclick' => 'displayProductGrid()',
106
+ 'class' => 'add',
107
+ 'before_html' => $input.'<div class="main"><p id="video_name">'.$value.'</p>',
108
+ 'after_html' => '</div>'))
109
+ ->toHtml();
110
+
111
+ $productsGrid = $layout->createBlock('auguria_video/adminhtml_catalog_product_widget_chooser', '', array(
112
+ 'id' => 'video_chooser',
113
+ 'use_massaction' => false,
114
+ 'product_type_id' => null,
115
+ 'category_id' => null,
116
+ ));
117
+
118
+ $html .= "<div id='video_chooser_container' style='display:none'>";
119
+ $html .= $productsGrid->toHtml();
120
+ $html .= "</div>";
121
+ return $html;
122
+
123
+ }
124
+ }
app/code/community/Auguria/Video/Block/Adminhtml/Video/Edit/Tabs.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Video
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ class Auguria_Video_Block_Adminhtml_Video_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
9
+ {
10
+ public function __construct()
11
+ {
12
+ parent::__construct();
13
+ $this->setId('video_tabs');
14
+ $this->setDestElementId('edit_form');
15
+ $this->setTitle(Mage::helper('auguria_video')->__('Item Information'));
16
+ }
17
+
18
+ protected function _beforeToHtml()
19
+ {
20
+ $this->addTab('form_section', array(
21
+ 'label' => Mage::helper('auguria_video')->__('Item Information'),
22
+ 'title' => Mage::helper('auguria_video')->__('Item Information'),
23
+ 'content' => $this->getLayout()->createBlock('auguria_video/adminhtml_video_edit_tab_form')->toHtml(),
24
+ ));
25
+
26
+ return parent::_beforeToHtml();
27
+ }
28
+ }
app/code/community/Auguria/Video/Block/Adminhtml/Video/Grid.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Video
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ class Auguria_Video_Block_Adminhtml_Video_Grid extends Mage_Adminhtml_Block_Widget_Grid
9
+ {
10
+ public function __construct()
11
+ {
12
+ parent::__construct();
13
+ $this->setId('videoGrid');
14
+ $this->setDefaultSort('auguria_video_id');
15
+ $this->setDefaultDir('ASC');
16
+ $this->setSaveParametersInSession(true);
17
+ }
18
+
19
+ protected function _prepareCollection()
20
+ {
21
+ $collection = Mage::getResourceModel('auguria_video/video_collection');
22
+ $this->setCollection($collection);
23
+ return parent::_prepareCollection();
24
+ }
25
+
26
+ protected function _prepareColumns()
27
+ {
28
+ $this->addColumn('auguria_video_id', array(
29
+ 'header' => Mage::helper('auguria_video')->__('ID'),
30
+ 'align' =>'right',
31
+ 'width' => '20px',
32
+ 'index' => 'auguria_video_id',
33
+ ));
34
+
35
+ $this->addColumn('title', array(
36
+ 'header' => Mage::helper('auguria_video')->__('Title'),
37
+ 'align' =>'left',
38
+ 'index' => 'title',
39
+ ));
40
+
41
+ $this->addColumn('filename', array(
42
+ 'header' => Mage::helper('auguria_video')->__('Filename'),
43
+ 'align' =>'left',
44
+ 'index' => 'filename',
45
+ ));
46
+
47
+ $this->addColumn('status', array(
48
+ 'header' => Mage::helper('auguria_video')->__('Status'),
49
+ 'align' => 'left',
50
+ 'index' => 'status',
51
+ 'width' => '100px',
52
+ 'type' => 'options',
53
+ 'options' => Mage::helper('auguria_video')->statusToOptionArray(),
54
+ ));
55
+
56
+ $this->addColumn('action',
57
+ array(
58
+ 'header' => Mage::helper('auguria_video')->__('Action'),
59
+ 'width' => '100',
60
+ 'type' => 'action',
61
+ 'getter' => 'getId',
62
+ 'actions' => array(
63
+ array(
64
+ 'caption' => Mage::helper('auguria_video')->__('Edit'),
65
+ 'url' => array('base'=> '*/*/edit'),
66
+ 'field' => 'id'
67
+ )
68
+ ),
69
+ 'filter' => false,
70
+ 'sortable' => false,
71
+ 'index' => 'auguria_video_id',
72
+ 'is_system' => true,
73
+ ));
74
+
75
+ //$this->addExportType('*/*/exportCsv', Mage::helper('auguria_video')->__('CSV'));
76
+ //$this->addExportType('*/*/exportXml', Mage::helper('auguria_video')->__('XML'));
77
+
78
+ return parent::_prepareColumns();
79
+ }
80
+
81
+ protected function _prepareMassaction()
82
+ {
83
+ $this->setMassactionIdField('auguria_video_id');
84
+ $this->getMassactionBlock()->setFormFieldName('videos');
85
+
86
+ $this->getMassactionBlock()->addItem('delete', array(
87
+ 'label' => Mage::helper('auguria_video')->__('Delete'),
88
+ 'url' => $this->getUrl('*/*/massDelete'),
89
+ 'confirm' => Mage::helper('auguria_video')->__('Are you sure to delete selected videos ?')
90
+ ));
91
+
92
+ $statuses = Mage::getSingleton('adminhtml/system_config_source_enabledisable')->toOptionArray();
93
+ array_unshift($statuses, array('label'=>'', 'value'=>''));
94
+
95
+ $this->getMassactionBlock()->addItem('status', array(
96
+ 'label'=> Mage::helper('auguria_video')->__('Update status'),
97
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
98
+ 'confirm' => Mage::helper('auguria_video')->__('Are you sure to change status of selected videos ?'),
99
+ 'additional' => array(
100
+ 'visibility' => array(
101
+ 'name' => 'status',
102
+ 'type' => 'select',
103
+ 'class' => 'required-entry',
104
+ 'label' => Mage::helper('auguria_video')->__('Status'),
105
+ 'values' => $statuses
106
+ )
107
+ )
108
+ )
109
+ );
110
+ return $this;
111
+ }
112
+
113
+ public function getRowUrl($row)
114
+ {
115
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
116
+ }
117
+
118
+ }
app/code/community/Auguria/Video/Block/Home.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Video
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+
9
+ class Auguria_Video_Block_Home extends Mage_Core_Block_Template
10
+ {
11
+ public function getVideo()
12
+ {
13
+ $collection = Mage::getResourceModel('auguria_video/video_collection')
14
+ ->addFieldToFilter('status',1)
15
+ ->addFieldToFilter('display_on_home_page',1);
16
+ $collection->getSelect()->order(new Zend_Db_Expr('RAND()'));
17
+ if ($collection && $collection->count()>0) {
18
+ return $collection->getFirstItem();
19
+ }
20
+ return false;
21
+ }
22
+
23
+ public function getItemImage($_item)
24
+ {
25
+ $width = Mage::getStoreConfig('auguria_video/sizes/preview_home_width');
26
+ $height = Mage::getStoreConfig('auguria_video/sizes/preview_home_height');
27
+ return Mage::helper('auguria_video')->getPreviewResizedImage($_item, $width, $height);
28
+ }
29
+ }
app/code/community/Auguria/Video/Block/List.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Video
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+
9
+ class Auguria_Video_Block_List extends Mage_Core_Block_Template
10
+ {
11
+ public function getVideos()
12
+ {
13
+ $collection = Mage::getResourceModel('auguria_video/video_collection')
14
+ ->addFieldToFilter('status',1);
15
+ return $collection;
16
+ }
17
+
18
+ public function getItemImage($_item)
19
+ {
20
+ $width = Mage::getStoreConfig('auguria_video/sizes/preview_list_width');
21
+ $height = Mage::getStoreConfig('auguria_video/sizes/preview_list_height');
22
+ return Mage::helper('auguria_video')->getPreviewResizedImage($_item, $width, $height);
23
+ }
24
+ }
app/code/community/Auguria/Video/Block/Product.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Video
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+
9
+ class Auguria_Video_Block_Product extends Mage_Catalog_Block_Product_Abstract
10
+ {
11
+ public function getVideos()
12
+ {
13
+ $collection = Mage::getResourceModel('auguria_video/video_collection')
14
+ ->addFieldToFilter('status',1)
15
+ ->addFieldToFilter('product_id', $this->getProduct()->getId());
16
+ return $collection;
17
+ }
18
+
19
+ public function getItemImage($_item)
20
+ {
21
+ $width = Mage::getStoreConfig('auguria_video/sizes/preview_product_width');
22
+ $height = Mage::getStoreConfig('auguria_video/sizes/preview_product_height');
23
+ return Mage::helper('auguria_video')->getPreviewResizedImage($_item, $width, $height);
24
+ }
25
+ }
app/code/community/Auguria/Video/Helper/Data.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Video
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ class Auguria_Video_Helper_Data extends Mage_Core_Helper_Abstract
9
+ {
10
+ public function statusToOptionArray()
11
+ {
12
+ return array (
13
+ 0 => $this->__('Disabled'),
14
+ 1 => $this->__('Enabled')
15
+ );
16
+ }
17
+
18
+ public function getPreviewResizedImage($_video, $width, $height)
19
+ {
20
+ if (!$_video->getPreview()) {
21
+ return false;
22
+ }
23
+
24
+ $baseImage = Mage::getBaseDir ( 'media' ) . DS . $_video->getPreview();
25
+ if (!is_file($baseImage)) {
26
+ return false;
27
+ }
28
+
29
+ $imageResized = Mage::getBaseDir ( 'media' ) . DS . "catalog" . DS . "product" . DS . "cache" . DS . (int)$width . DS . (int)$height. DS . $_video->getPreview();// Because clean Image cache function works in this folder only
30
+
31
+ if (!file_exists($imageResized) && file_exists($baseImage) || file_exists($baseImage) && filemtime($baseImage) > filemtime($imageResized)) {
32
+ if ((int)$height == 0) {
33
+ $height = null;
34
+ }
35
+ if ((int)$width == 0) {
36
+ $width = null;
37
+ }
38
+ $quality = 100;
39
+
40
+ $imageObj = new Varien_Image ($baseImage);
41
+ $imageObj->constrainOnly(true);
42
+ $imageObj->keepAspectRatio(true);
43
+ $imageObj->keepFrame(false);
44
+ $imageObj->quality($quality);
45
+ $imageObj->resize($width, $height);
46
+ $imageObj->save($imageResized);
47
+ }
48
+
49
+ if (file_exists($imageResized)) {
50
+ return Mage::getBaseUrl ( 'media' ) ."catalog/product/cache/".(int)$width.'/'.(int)$height.'/'.str_replace(DS, '/', $_video->getPreview());
51
+ }
52
+ else {
53
+ return false;
54
+ }
55
+ }
56
+ }
app/code/community/Auguria/Video/Model/Mysql4/Video.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Video
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ class Auguria_Video_Model_Mysql4_Video extends Mage_Core_Model_Mysql4_Abstract
9
+ {
10
+ public function _construct()
11
+ {
12
+ $this->_init('auguria_video/video', 'auguria_video_id');
13
+ }
14
+ }
app/code/community/Auguria/Video/Model/Mysql4/Video/Collection.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Video
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ class Auguria_Video_Model_Mysql4_Video_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
9
+ {
10
+ public function _construct()
11
+ {
12
+ parent::_construct();
13
+ $this->_init('auguria_video/video');
14
+ }
15
+ }
app/code/community/Auguria/Video/Model/Video.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Video
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ class Auguria_Video_Model_Video extends Mage_Core_Model_Abstract
9
+ {
10
+ public function _construct()
11
+ {
12
+ parent::_construct();
13
+ $this->_init('auguria_video/video');
14
+ }
15
+
16
+ public function getPreviewListUrl()
17
+ {
18
+ if (is_file(Mage::getBaseDir('media').DS.$this->getPreview())) {
19
+ return Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).str_replace(DS, '/', $this->getPreview());
20
+ }
21
+ else {
22
+ return false;
23
+ }
24
+ }
25
+ }
app/code/community/Auguria/Video/controllers/Adminhtml/VideoController.php ADDED
@@ -0,0 +1,217 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Video
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ class Auguria_Video_Adminhtml_VideoController extends Mage_Adminhtml_Controller_Action
9
+ {
10
+
11
+ protected function _initAction()
12
+ {
13
+ $this->loadLayout()
14
+ ->_setActiveMenu('auguria_video')
15
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Videos Manager'), Mage::helper('adminhtml')->__('Videos Manager'));
16
+ return $this;
17
+ }
18
+
19
+ public function indexAction()
20
+ {
21
+ $this->_initAction()
22
+ ->renderLayout();
23
+ }
24
+
25
+ public function newAction()
26
+ {
27
+ $this->_forward('edit');
28
+ }
29
+
30
+ public function deleteAction()
31
+ {
32
+ $id = $this->getRequest()->getParam('id');
33
+ $model = Mage::getModel('auguria_video/video')->load($id);
34
+ if ($model->getId()) {
35
+ $model->delete();
36
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('auguria_video')->__("The video has been successfully deleted"));
37
+ $this->_redirect('*/*/');
38
+ }
39
+ else {
40
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('auguria_video')->__("This video doesn't exist"));
41
+ $this->_redirect('*/*/');
42
+ }
43
+ }
44
+
45
+ public function editAction()
46
+ {
47
+ $id = $this->getRequest()->getParam('id');
48
+
49
+ $model = Mage::getModel('auguria_video/video')->load($id);
50
+ if ($model->getId() || $id == 0)
51
+ {
52
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
53
+ if (!empty($data))
54
+ {
55
+ $model->setData($data);
56
+ }
57
+
58
+ Mage::register('video_data', $model);
59
+
60
+ $this->loadLayout();
61
+ $this->_setActiveMenu('auguria_video');
62
+
63
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
64
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
65
+
66
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
67
+
68
+ $this->_addContent($this->getLayout()->createBlock('auguria_video/adminhtml_video_edit'))
69
+ ->_addLeft($this->getLayout()->createBlock('auguria_video/adminhtml_video_edit_tabs'));
70
+
71
+ $this->renderLayout();
72
+ }
73
+ else
74
+ {
75
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('auguria_video')->__('Item does not exist'));
76
+ $this->_redirect('*/*/');
77
+ }
78
+ }
79
+
80
+ public function saveAction()
81
+ {
82
+ if ($data = $this->getRequest()->getPost()) {
83
+ if(isset($_FILES['preview']['name']) && $_FILES['preview']['name'] != '')
84
+ {
85
+ try
86
+ {
87
+ /* Starting upload */
88
+ $uploader = new Varien_File_Uploader('preview');
89
+
90
+ // Any extention would work
91
+ $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
92
+ $uploader->setFilesDispersion(false);
93
+
94
+ // Upload image and copy into product dir
95
+ $path = Mage::getBaseDir('media') . DS . 'videos' . DS;
96
+ $fileName = $_FILES['preview']['name'];
97
+ $uploader->save($path, $fileName );
98
+
99
+ }
100
+ catch (Exception $e)
101
+ {
102
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
103
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
104
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
105
+ return;
106
+ }
107
+
108
+ //this way the name is saved in DB
109
+ $data['preview'] = 'videos'.'/'.$_FILES['preview']['name'];
110
+ }
111
+ if (isset($data['preview']) && is_array($data['preview'])) {
112
+ unset($data['preview']);
113
+ }
114
+ try {
115
+ $id = $this->getRequest()->getParam('id');
116
+ $model = Mage::getModel('auguria_video/video')->load($id);
117
+ $data['auguria_video_id'] = $id;
118
+ $model->setData($data);
119
+ $model->save();
120
+
121
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('auguria_video')->__("The video has been successfully recorded"));
122
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
123
+
124
+ if ($this->getRequest()->getParam('back')) {
125
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
126
+ return;
127
+ }
128
+ $this->_redirect('*/*/');
129
+ return;
130
+ }
131
+ catch (Exception $e) {
132
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
133
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
134
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
135
+ return;
136
+ }
137
+ }
138
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('auguria_video')->__("Unable to find change to save"));
139
+ $this->_redirect('*/*/');
140
+ }
141
+
142
+ public function massDeleteAction()
143
+ {
144
+ $videoIds = $this->getRequest()->getParam('videos');
145
+ if(!is_array($videoIds)) {
146
+ $this->_getSession()->addError(Mage::helper('auguria_video')->__("Please select keys"));
147
+ }
148
+ else {
149
+ foreach ($videoIds as $keyId) {
150
+ $model = Mage::getModel('auguria_video/video')->load($keyId);
151
+ if ($model->getId()) {
152
+ $model->delete();
153
+ }
154
+ }
155
+ $this->_getSession()->addSuccess(
156
+ $this->__('Total of %d record(s) were successfully deleted', count($videoIds))
157
+ );
158
+ }
159
+ $this->_redirect('*/*/index');
160
+ }
161
+
162
+ public function massStatusAction()
163
+ {
164
+ $videoIds = $this->getRequest()->getParam('videos');
165
+ if(!is_array($videoIds)) {
166
+ $this->_getSession()->addError(Mage::helper('auguria_video')->__("Please select keys"));
167
+ }
168
+ else {
169
+ foreach ($videoIds as $keyId) {
170
+ $model = Mage::getModel('auguria_video/video')->load($keyId);
171
+ if ($model->getId()) {
172
+ $model->setStatus($this->getRequest()->getParam('status'));
173
+ $model->save();
174
+ }
175
+ }
176
+ $this->_getSession()->addSuccess(
177
+ $this->__('Total of %d record(s) were successfully updated', count($videoIds))
178
+ );
179
+ }
180
+ $this->_redirect('*/*/index');
181
+ }
182
+
183
+ /*
184
+ public function exportCsvAction()
185
+ {
186
+ $fileName = 'productdescriptionKeys.csv';
187
+ $content = $this->getLayout()->createBlock('auguria_productdescription/adminhtml_change_grid')
188
+ ->getCsv();
189
+ $this->_sendUploadResponse($fileName, $content);
190
+ }
191
+
192
+ public function exportXmlAction()
193
+ {
194
+ $fileName = 'sponsorshipChange.xml';
195
+ $content = $this->getLayout()->createBlock('auguria_productdescription/adminhtml_change_grid')
196
+ ->getXml();
197
+
198
+ $this->_sendUploadResponse($fileName, $content);
199
+ }
200
+
201
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
202
+ {
203
+ $response = $this->getResponse();
204
+ $response->setHeader('HTTP/1.1 200 OK','');
205
+ $response->setHeader('Pragma', 'public', true);
206
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
207
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
208
+ $response->setHeader('Last-Modified', date('r'));
209
+ $response->setHeader('Accept-Ranges', 'bytes');
210
+ $response->setHeader('Content-Length', strlen($content));
211
+ $response->setHeader('Content-type', $contentType);
212
+ $response->setBody($content);
213
+ $response->sendResponse();
214
+ die;
215
+ }
216
+ */
217
+ }
app/code/community/Auguria/Video/controllers/IndexController.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Video
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ class Auguria_Video_IndexController extends Mage_Core_Controller_Front_Action
9
+ {
10
+ public function indexAction()
11
+ {
12
+ $this->loadLayout();
13
+
14
+ $this->getLayout()->getBlock('customer');
15
+ $this->_initLayoutMessages('customer/session');
16
+ $this->_initLayoutMessages('catalog/session');
17
+
18
+ $breadcrumbs = $this->getLayout()->getBlock('breadcrumbs');
19
+ $breadcrumbs->addCrumb ('home', array(
20
+ 'label'=>Mage::helper('cms')->__('Home'),
21
+ 'title'=>Mage::helper('cms')->__('Home'), 'link'=>Mage::getBaseUrl()));
22
+ $breadcrumbs->addCrumb ('Video', array(
23
+ 'label'=>Mage::helper('auguria_video')->__('Video page'),
24
+ 'title'=>Mage::helper('auguria_video')->__('Video page')));
25
+
26
+ $this->renderLayout();
27
+ }
28
+ }
app/code/community/Auguria/Video/etc/adminhtml.xml ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * @category Auguria
5
+ * @package Auguria_Video
6
+ * @author Auguria
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ -->
10
+ <config>
11
+ <menu>
12
+ <auguria_video translate="title" module="auguria_video">
13
+ <title>Videos</title>
14
+ <sort_order>80</sort_order>
15
+ <children>
16
+ <items module="auguria_video">
17
+ <title>Manage videos</title>
18
+ <sort_order>0</sort_order>
19
+ <action>adminhtml/video</action>
20
+ </items>
21
+ </children>
22
+ </auguria_video>
23
+ </menu>
24
+ <acl>
25
+ <resources>
26
+ <all>
27
+ <title>Allow Everything</title>
28
+ </all>
29
+ <admin>
30
+ <children>
31
+ <auguria_video module="auguria_video">
32
+ <title>Videos</title>
33
+ <sort_order>80</sort_order>
34
+ <children>
35
+ <items module="auguria_video">
36
+ <title>Manage videos</title>
37
+ </items>
38
+ </children>
39
+ </auguria_video>
40
+ </children>
41
+ </admin>
42
+ </resources>
43
+ </acl>
44
+ </config>
app/code/community/Auguria/Video/etc/config.xml ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category Auguria
5
+ * @package Auguria_Video
6
+ * @author Auguria
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ -->
10
+ <config>
11
+ <modules>
12
+ <Auguria_Video>
13
+ <version>0.0.1</version>
14
+ </Auguria_Video>
15
+ </modules>
16
+ <frontend>
17
+ <routers>
18
+ <video>
19
+ <use>standard</use>
20
+ <args>
21
+ <module>Auguria_Video</module>
22
+ <frontName>video</frontName>
23
+ </args>
24
+ </video>
25
+ </routers>
26
+ <translate>
27
+ <modules>
28
+ <Auguria_Video>
29
+ <files>
30
+ <default>Auguria_Video.csv</default>
31
+ </files>
32
+ </Auguria_Video>
33
+ </modules>
34
+ </translate>
35
+ <layout>
36
+ <updates>
37
+ <auguria_video>
38
+ <file>auguria/video.xml</file>
39
+ </auguria_video>
40
+ </updates>
41
+ </layout>
42
+ </frontend>
43
+ <admin>
44
+ <routers>
45
+ <adminhtml>
46
+ <args>
47
+ <modules>
48
+ <auguria_video before="Mage_Adminhtml">Auguria_Video_Adminhtml</auguria_video>
49
+ </modules>
50
+ </args>
51
+ </adminhtml>
52
+ </routers>
53
+ </admin>
54
+ <adminhtml>
55
+ <translate>
56
+ <modules>
57
+ <Auguria_Video>
58
+ <files>
59
+ <default>Auguria_Video.csv</default>
60
+ </files>
61
+ </Auguria_Video>
62
+ </modules>
63
+ </translate>
64
+ <layout>
65
+ <updates>
66
+ <auguria_video>
67
+ <file>auguria/video.xml</file>
68
+ </auguria_video>
69
+ </updates>
70
+ </layout>
71
+ </adminhtml>
72
+ <global>
73
+ <models>
74
+ <auguria_video>
75
+ <class>Auguria_Video_Model</class>
76
+ <resourceModel>auguria_video_mysql4</resourceModel>
77
+ </auguria_video>
78
+ <auguria_video_mysql4>
79
+ <class>Auguria_Video_Model_Mysql4</class>
80
+ <entities>
81
+ <video>
82
+ <table>auguria_video</table>
83
+ </video>
84
+ </entities>
85
+ </auguria_video_mysql4>
86
+ </models>
87
+ <resources>
88
+ <auguria_video_setup>
89
+ <setup>
90
+ <module>Auguria_Video</module>
91
+ <class>Mage_Eav_Model_Entity_Setup</class>
92
+ </setup>
93
+ <connection>
94
+ <use>core_setup</use>
95
+ </connection>
96
+ </auguria_video_setup>
97
+ <auguria_video_write>
98
+ <connection>
99
+ <use>core_write</use>
100
+ </connection>
101
+ </auguria_video_write>
102
+ <auguria_video_read>
103
+ <connection>
104
+ <use>core_read</use>
105
+ </connection>
106
+ </auguria_video_read>
107
+ </resources>
108
+ <blocks>
109
+ <auguria_video>
110
+ <class>Auguria_Video_Block</class>
111
+ </auguria_video>
112
+ </blocks>
113
+ <helpers>
114
+ <auguria_video>
115
+ <class>Auguria_Video_Helper</class>
116
+ </auguria_video>
117
+ </helpers>
118
+ </global>
119
+ <default>
120
+ <auguria_video>
121
+ <sizes>
122
+ <video_player_width>560</video_player_width>
123
+ <video_player_height>315</video_player_height>
124
+ <preview_list_width>140</preview_list_width>
125
+ <preview_list_height>140</preview_list_height>
126
+ <preview_home_width>425</preview_home_width>
127
+ <preview_home_height>239</preview_home_height>
128
+ <preview_product_width>96</preview_product_width>
129
+ <preview_product_height>121</preview_product_height>
130
+ </sizes>
131
+ </auguria_video>
132
+ </default>
133
+ </config>
app/code/community/Auguria/Video/sql/auguria_video_setup/mysql4-install-0.0.1.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Create video table
4
+ * @category Auguria
5
+ * @package Auguria_Video
6
+ * @author Auguria
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ $installer = $this;
10
+ $installer->startSetup();
11
+ $installer->run("
12
+ -- DROP TABLE IF EXISTS {$this->getTable('auguria_video/video')};
13
+ CREATE TABLE {$this->getTable('auguria_video/video')} (
14
+ `auguria_video_id` int(11) unsigned NOT NULL auto_increment,
15
+ `title` varchar(255) NOT NULL default '',
16
+ `description` text,
17
+ `image_identifier` varchar(255) NOT NULL default '',
18
+ `preview` varchar(255) NOT NULL default '',
19
+ `status` smallint(6) NOT NULL default '0',
20
+ `product_id` int(11) unsigned,
21
+ `display_on_home_page` tinyint(1) unsigned NOT NULL default '0',
22
+ PRIMARY KEY (`auguria_video_id`)
23
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
24
+ ");
25
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/auguria/video.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category Auguria
5
+ * @package Auguria_Video
6
+ * @author Auguria
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ -->
10
+ <layout version="0.1.0">
11
+ <adminhtml_video_index>
12
+ <reference name="content">
13
+ <block type="auguria_video/adminhtml_video" name="video_list" />
14
+ </reference>
15
+ </adminhtml_video_index>
16
+ <adminhtml_video_edit>
17
+ <reference name="head">
18
+ <action method="addItem"><type>js_css</type><name>prototype/windows/themes/default.css</name></action>
19
+ <action method="addItem"><type>js_css</type><name>prototype/windows/themes/magento.css</name></action>
20
+ </reference>
21
+ </adminhtml_video_edit>
22
+ </layout>
app/design/frontend/base/default/layout/auguria/video.xml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addJs"><script>prototype/window.js</script></action>
6
+ <action method="addItem"><type>js_css</type><name>prototype/windows/themes/default.css</name></action>
7
+ <action method="addItem"><type>js_css</type><name>prototype/windows/themes/magento.css</name></action>
8
+ <action method="addCss"><stylesheet>css/auguria/video/styles.css</stylesheet></action>
9
+ </reference>
10
+ </default>
11
+ <video_index_index>
12
+ <reference name="content">
13
+ <block type="auguria_video/list" name="video_list" template="auguria/video/list.phtml"/>
14
+ </reference>
15
+ </video_index_index>
16
+ <cms_index_index>
17
+ <reference name="content">
18
+ <block type="auguria_video/home" name="video_home" template="auguria/video/home.phtml"/>
19
+ </reference>
20
+ </cms_index_index>
21
+ <catalog_product_view>
22
+ <reference name="product.info">
23
+ <block type="auguria_video/product" name="video_product" template="auguria/video/product.phtml" />
24
+ </reference>
25
+ </catalog_product_view>
26
+ </layout>
app/design/frontend/base/default/template/auguria/video/home.phtml ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Video
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ ?>
9
+ <?php
10
+ $_item = $this->getVideo();
11
+ if ($_item):
12
+ if ($this->getItemImage($_item)!=false):
13
+ ?>
14
+ <div id="video-player-container" style="display:none">
15
+ <iframe id="video-player" width="<?php echo Mage::getStoreConfig('auguria_video/sizes/video_player_width'); ?>" height="<?php echo Mage::getStoreConfig('auguria_video/sizes/video_player_height'); ?>" src="" frameborder="0" allowfullscreen></iframe>
16
+ </div>
17
+ <div id="home_video_preview" class="link">
18
+ <div class="hvp_play"></div>
19
+ <img src="<?php echo $this->getItemImage($_item); ?>" alt="<?php echo $_item->getTitle(); ?>" />
20
+ <div><?php echo $_item->getDescription(); ?></div>
21
+ </div>
22
+ <script type="text/javascript">
23
+ //<![CDATA[
24
+ Event.observe('home_video_preview', 'click', function(event) {
25
+ videoPlayer = new Window({
26
+ className:'magento',
27
+ title:'<?php echo $_item->getTitle(); ?>',
28
+ content:$('video-player'),
29
+ width:<?php echo Mage::getStoreConfig('auguria_video/sizes/video_player_width'); ?>,
30
+ height:<?php echo Mage::getStoreConfig('auguria_video/sizes/video_player_height')+5; ?>,
31
+ minimizable:false,
32
+ maximizable:false,
33
+ showEffectOptions:{duration:0.4},
34
+ hideEffectOptions:{duration:0.4}
35
+ });
36
+ videoPlayer.setZIndex(100);
37
+ videoPlayer.showCenter(true);
38
+ $('video-player').src="http://www.youtube.com/v/<?php echo $_item->getImageIdentifier(); ?>&hl=fr&autoplay=1";
39
+ videoPlayer.getContent().update($('video-player'));
40
+ });
41
+ //]]>
42
+ </script>
43
+
44
+ <?php
45
+ endif;
46
+ endif;
47
+ ?>
app/design/frontend/base/default/template/auguria/video/list.phtml ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Video
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ ?>
9
+ <div id="messages_video_list">
10
+ <div id="messages_video_msg"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
11
+
12
+ <?php
13
+ $_videos = $this->getVideos();
14
+
15
+ if ($_videos && $_videos->count()>0):
16
+ ?>
17
+ <div id="video-player-container" style="display:none">
18
+ <iframe id="video-player" width="<?php echo Mage::getStoreConfig('auguria_video/sizes/video_player_width'); ?>" height="<?php echo Mage::getStoreConfig('auguria_video/sizes/video_player_height'); ?>" src="" frameborder="0" allowfullscreen></iframe>
19
+ </div>
20
+ <ul>
21
+ <?php
22
+ foreach ($_videos as $_item):
23
+ ?>
24
+
25
+ <?php
26
+ if ($this->getItemImage($_item)!=false):
27
+ ?>
28
+ <li class="link" id="li-<?php echo $_item->getId(); ?>">
29
+ <div class="hvp_play"></div>
30
+ <p class="title"><?php echo $_item->getTitle(); ?></p>
31
+ <img src="<?php echo $this->getItemImage($_item); ?>" alt="<?php echo $_item->getTitle(); ?>" />
32
+ <p class="description"><?php echo $_item->getDescription(); ?></p>
33
+
34
+ <script type="text/javascript">
35
+ //<![CDATA[
36
+ Event.observe('li-<?php echo $_item->getId(); ?>', 'click', function(event) {
37
+ videoPlayer = new Window({
38
+ className:'magento',
39
+ title:'<?php echo $_item->getTitle(); ?>',
40
+ content:$('video-player'),
41
+ width:<?php echo Mage::getStoreConfig('auguria_video/sizes/video_player_width'); ?>,
42
+ height:<?php echo Mage::getStoreConfig('auguria_video/sizes/video_player_height')+5; ?>,
43
+ minimizable:false,
44
+ maximizable:false,
45
+ showEffectOptions:{duration:0.4},
46
+ hideEffectOptions:{duration:0.4}
47
+ });
48
+ videoPlayer.setZIndex(100);
49
+ videoPlayer.showCenter(true);
50
+ $('video-player').src="http://www.youtube.com/v/<?php echo $_item->getImageIdentifier(); ?>&hl=fr&autoplay=1";
51
+ videoPlayer.getContent().update($('video-player'));
52
+ });
53
+ //]]>
54
+ </script>
55
+ </li>
56
+ <?php
57
+ endif;
58
+ endforeach;
59
+ ?>
60
+ </ul>
61
+ <?php
62
+ else:
63
+ ?>
64
+ <p id="no-video"><?php echo $this->__('There is no available video.'); ?></p>
65
+ <?php
66
+ endif;
67
+ ?>
68
+ </div>
app/design/frontend/base/default/template/auguria/video/product.phtml ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Video
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ ?>
9
+ <div id="messages_video_list">
10
+ <div id="messages_video_msg"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
11
+
12
+ <?php
13
+ $_videos = $this->getVideos();
14
+
15
+ if ($_videos && $_videos->count()>0):
16
+ ?>
17
+ <div id="video-player-container" style="display:none">
18
+ <iframe id="video-player" width="<?php echo Mage::getStoreConfig('auguria_video/sizes/video_player_width'); ?>" height="<?php echo Mage::getStoreConfig('auguria_video/sizes/video_player_height'); ?>" src="" frameborder="0" allowfullscreen></iframe>
19
+ </div>
20
+ <ul>
21
+ <?php
22
+ foreach ($_videos as $_item):
23
+ ?>
24
+
25
+ <?php
26
+ if ($this->getItemImage($_item)!=false):
27
+ ?>
28
+ <li class="link" id="li-<?php echo $_item->getId(); ?>">
29
+ <div class="hvp_play"></div>
30
+ <img src="<?php echo $this->getItemImage($_item); ?>" alt="<?php echo $_item->getTitle(); ?>" />
31
+
32
+ <script type="text/javascript">
33
+ //<![CDATA[
34
+ Event.observe('li-<?php echo $_item->getId(); ?>', 'click', function(event) {
35
+ videoPlayer = new Window({
36
+ className:'magento',
37
+ title:'<?php echo $_item->getTitle(); ?>',
38
+ content:$('video-player'),
39
+ width:<?php echo Mage::getStoreConfig('auguria_video/sizes/video_player_width'); ?>,
40
+ height:<?php echo Mage::getStoreConfig('auguria_video/sizes/video_player_height')+5; ?>,
41
+ minimizable:false,
42
+ maximizable:false,
43
+ showEffectOptions:{duration:0.4},
44
+ hideEffectOptions:{duration:0.4}
45
+ });
46
+ videoPlayer.setZIndex(100);
47
+ videoPlayer.showCenter(true);
48
+ $('video-player').src="http://www.youtube.com/v/<?php echo $_item->getImageIdentifier(); ?>&hl=fr&autoplay=1";
49
+ videoPlayer.getContent().update($('video-player'));
50
+ });
51
+ //]]>
52
+ </script>
53
+ </li>
54
+ <?php
55
+ endif;
56
+ endforeach;
57
+ ?>
58
+ </ul>
59
+ <?php
60
+ else:
61
+ ?>
62
+ <p id="no-video"><?php echo $this->__('There is no available video.'); ?></p>
63
+ <?php
64
+ endif;
65
+ ?>
66
+ </div>
app/etc/modules/Auguria_Video.xml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category Auguria
5
+ * @package Auguria_Video
6
+ * @author Auguria
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ -->
10
+ <config>
11
+ <modules>
12
+ <Auguria_Video>
13
+ <active>true</active>
14
+ <codePool>community</codePool>
15
+ </Auguria_Video>
16
+ </modules>
17
+ </config>
app/locale/fr_FR/Auguria_Contact.csv ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Contacts","Contacts"
2
+ "Add Contact","Ajouter un contact"
3
+ "An error occurred while mass deleting contacts. Please review log and try again.","Une erreur est survenue lors de la suppression en masse des contacts. Merci de regarder les logs et d'essayer ultérieurement."
4
+ "Are you sure you want to delete these contacts?","Êtes vous sure de vouloir supprimer ces contacts ?"
5
+ "Comment","Message"
6
+ "Contact a service","Contactez un service"
7
+ "Contact Information","Informations du contact"
8
+ "Default recipient","Destinataire par défaut"
9
+ "Delete","Supprimer"
10
+ "Delete Contact","Supprimer le contact"
11
+ "Edit Contact","Édition de contact"
12
+ "Edit Contact '%s'","Édition du contact '%s'"
13
+ "Email","Email"
14
+ "Email Subject","Sujet de l'email"
15
+ "Email Template","Gabarit du mail"
16
+ "Firstname","Prénom"
17
+ "Form contact","Formulaire de contact"
18
+ "Frontend Subject","Sujet proposé au client"
19
+ "General Information","Informations générales"
20
+ "ID","ID"
21
+ "Identifier","Identifiant"
22
+ "Lastname","Nom"
23
+ "Manage Contacts","Gérer les contacts"
24
+ "New Contact","Nouveau contact"
25
+ "Order Id","N° de commande"
26
+ "Please select a subject","Contactez un service"
27
+ "Please select contact(s).","Merci de sélectionner au moins un contact."
28
+ "Position","Position"
29
+ "Save Contact","Sauvegarder le contact"
30
+ "Store View","Vue magasin"
31
+ "Telephone","Téléphone"
32
+ "The contact has been deleted.","Le contact a bien été supprimé."
33
+ "The contact has been saved.","Le contact a bien été sauvegardé."
34
+ "This contact no longer exists.","Ce contact n'existe plus."
35
+ "Unable to find a contact to delete.","Impossible de trouver le contact à supprimer."
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Auguria_Video</name>
4
+ <version>0.0.1</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL 3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Auguria_Video</summary>
10
+ <description>Auguria_Video</description>
11
+ <notes>Auguria_Video</notes>
12
+ <authors><author><name>Auguria</name><user>Auguria</user><email>magento@auguria.net</email></author></authors>
13
+ <date>2012-06-21</date>
14
+ <time>15:52:08</time>
15
+ <contents><target name="mageetc"><dir name="modules"><file name="Auguria_Video.xml" hash="3f7d24c30b1d1bf38f51f75ad89d141a"/></dir></target><target name="magecommunity"><dir name="Auguria"><dir name="Video"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><dir name="Widget"><file name="Chooser.php" hash="757e3d10d47e1735f8aa4e7d36d57537"/></dir></dir></dir><dir name="Video"><dir name="Edit"><file name="Form.php" hash="743d6f1ab0091382fdf544db3fb11a15"/><dir name="Tab"><file name="Form.php" hash="45c3dc5c07ffca04d681a95b6f7d6af9"/></dir><file name="Tabs.php" hash="ebacc489645260eb8dc420a444ef30f3"/></dir><file name="Edit.php" hash="6c6be466d306e743885be08ff7462260"/><file name="Grid.php" hash="991bbfaadee5f62ad29f0e726ba15d11"/></dir><file name="Video.php" hash="7e6631a917efda1d8374f034748dbe5f"/></dir><file name="Home.php" hash="87d328c177ccd0b39366ba9284b275cf"/><file name="List.php" hash="9b73d80cb69871fc0a1da80552ab78fa"/><file name="Product.php" hash="0e3183b98bacb084396fd62293923afc"/></dir><dir name="Helper"><file name="Data.php" hash="d56b466bdfc3a3359689e994fc95a6ab"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Video"><file name="Collection.php" hash="573e4551b271bd450e64225a3c7657fb"/></dir><file name="Video.php" hash="9ee3447fe36e87ec224959d28b01dc90"/></dir><file name="Video.php" hash="37c3b550cae6838a2405ca94200c5326"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="VideoController.php" hash="b44de16050b0ec5991dbe215fe53bb5c"/></dir><file name="IndexController.php" hash="3588273b74295159313b52de9ee65160"/></dir><dir name="etc"><file name="adminhtml.xml" hash="85dcc6fe92520c617ffc00861f6b1db8"/><file name="config.xml" hash="558b94a504675f120bf9934ad381fbc3"/></dir><dir name="sql"><dir name="auguria_video_setup"><file name="mysql4-install-0.0.1.php" hash="bf474926ec7a92a220704024ee1ff555"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="auguria"><file name="video.xml" hash="197da266c6534bffa927b4a364740d3d"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="auguria"><file name="video.xml" hash="493f00d4ea694b5afcff96deabe50359"/></dir></dir><dir name="template"><dir name="auguria"><dir name="video"><file name="home.phtml" hash="c591a615fda40244d74028553cd7d0b3"/><file name="list.phtml" hash="140998d6688097ffa20c7fd46c7152af"/><file name="product.phtml" hash="c23c9bfcfc2f689c42383f8e16ec6711"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Auguria_Contact.csv" hash="da1180263c41e32d20826cf37bbd9034"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="auguria"><dir name="video"><file name="styles.css" hash="bba9a986a4ff8e826fcf371bd453c7d2"/></dir></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>5.6.0</max></php></required></dependencies>
18
+ </package>
skin/frontend/base/default/css/auguria/video/styles.css ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ #home_video_preview {position:relative; cursor:pointer;}
2
+ #home_video_preview .hvp_play {position:absolute; top:90px; left:185px; width:71px; height:71px; background:url('../../../images/auguria/video/i_video-player_play.png') no-repeat;}
3
+
4
+ #messages_video_list {float:left; cursor:pointer;}
5
+ #messages_video_list .title {font-size:14px; font-weight:bold; color:#FFF;}
6
+ #messages_video_list li {position:relative; border:1px solid #775629; }
7
+ #messages_video_list li .hvp_play {position:absolute; top:47px; left:33px; width:71px; height:71px; background:url('../../../images/auguria/video/i_video-player_play.png') no-repeat;}
8
+
9
+ .catalog-product-view #messages_video_list li .hvp_play {position:absolute; top:10px; left:30px; width:71px; height:71px; background:url('../../../images/auguria/video/i_video-player_play_thumb.png') no-repeat;}