clipgenerator - Version 1.0.0

Version Notes

* Version 1.0.0

Download this release

Release Info

Developer Trivid GmbH
Extension clipgenerator
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (37) hide show
  1. app/code/community/Trivid/Clipgenerator/Adminhtml/MassController.php +43 -0
  2. app/code/community/Trivid/Clipgenerator/Adminhtml/OrderformController.php +36 -0
  3. app/code/community/Trivid/Clipgenerator/Block/Adminhtml/System/Config/Form/Field/Contingentlabel.php +33 -0
  4. app/code/community/Trivid/Clipgenerator/Block/Adminhtml/System/Config/Form/Field/Musiclightbox.php +33 -0
  5. app/code/community/Trivid/Clipgenerator/Block/Catalog/Product/Helper/Form/Images.php +28 -0
  6. app/code/community/Trivid/Clipgenerator/Block/Catalog/Product/Helper/Form/Music.php +10 -0
  7. app/code/community/Trivid/Clipgenerator/Block/Catalog/Product/Helper/Form/music.php +28 -0
  8. app/code/community/Trivid/Clipgenerator/Block/InsertVideo.php +43 -0
  9. app/code/community/Trivid/Clipgenerator/Block/Video.php +31 -0
  10. app/code/community/Trivid/Clipgenerator/Helper/Data.php +298 -0
  11. app/code/community/Trivid/Clipgenerator/Model/Adminhtml/System/Config/Source/Designs.php +60 -0
  12. app/code/community/Trivid/Clipgenerator/Model/Adminhtml/System/Config/Source/Musics.php +60 -0
  13. app/code/community/Trivid/Clipgenerator/Model/Mysql4/Setup.php +22 -0
  14. app/code/community/Trivid/Clipgenerator/Model/Observer.php +59 -0
  15. app/code/community/Trivid/Clipgenerator/Model/Source/Designs.php +34 -0
  16. app/code/community/Trivid/Clipgenerator/Model/Source/Musics.php +34 -0
  17. app/code/community/Trivid/Clipgenerator/controllers/Adminhtml/MassController.php +43 -0
  18. app/code/community/Trivid/Clipgenerator/controllers/Adminhtml/OrderformController.php +36 -0
  19. app/code/community/Trivid/Clipgenerator/etc/adminhtml.xml +3 -0
  20. app/code/community/Trivid/Clipgenerator/etc/config.xml +115 -0
  21. app/code/community/Trivid/Clipgenerator/etc/system.xml +112 -0
  22. app/code/community/Trivid/Clipgenerator/lib/clipgenerator/ClipgeneratorClient.php +584 -0
  23. app/code/community/Trivid/Clipgenerator/lib/clipgenerator/Frame.php +89 -0
  24. app/code/community/Trivid/Clipgenerator/lib/clipgenerator/Logo.php +71 -0
  25. app/code/community/Trivid/Clipgenerator/lib/clipgenerator/LowerThird.php +209 -0
  26. app/code/community/Trivid/Clipgenerator/lib/clipgenerator/Picture.php +97 -0
  27. app/code/community/Trivid/Clipgenerator/lib/clipgenerator/Video.php +572 -0
  28. app/code/community/Trivid/Clipgenerator/sql/clipgenerator_setup/mysql4-install-0.1.0.php +196 -0
  29. app/code/community/Trivid/Clipgenerator/sql/clipgenerator_setup/mysql4-install-1.0.0.php +200 -0
  30. app/design/adminhtml/default/default/layout/clipgenerator.xml +10 -0
  31. app/design/adminhtml/default/default/template/clipgenerator/contingent.phtml +21 -0
  32. app/design/adminhtml/default/default/template/clipgenerator/images.phtml +93 -0
  33. app/design/adminhtml/default/default/template/clipgenerator/music.phtml +225 -0
  34. app/design/adminhtml/default/default/template/clipgenerator/orderform.phtml +288 -0
  35. app/etc/modules/Trivid_Clipgenerator.xml +9 -0
  36. app/locale/de_DE/Trivid_Clipgenerator.csv +5 -0
  37. package.xml +63 -0
app/code/community/Trivid/Clipgenerator/Adminhtml/MassController.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Adminhtml Mass Controller
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * LICENSE: is available through the world-wide-web at the following URI:
8
+ * http://www.clipgenerator.com/static/public/legal.php If you did not receive a copy of
9
+ * the Clipgenerator - End User License Agreement and are unable to obtain it through the web, please
10
+ * send a note to info@trivid.com so we can mail you a copy immediately.
11
+ *
12
+ * @package Trivid
13
+ * @author Trivid GmbH <author@example.com>
14
+ * @author Another Author <another@example.com>
15
+ * @copyright 2013 Trivid GmbH
16
+ * @license http://www.clipgenerator.com/static/public/legal.php Clipgenerator - End User License Agreement
17
+ * @version 1.0.0
18
+ * @since File available since Release 1.0.0
19
+ */
20
+ class Trivid_Clipgenerator_Adminhtml_MassController extends Mage_Adminhtml_Controller_Action {
21
+
22
+ protected $products;
23
+
24
+ protected function init() {
25
+ $this->products = $this->getRequest()->getParam('product');
26
+ if (count($this->products) > 10) {
27
+ Mage::getSingleton('core/session')->addError(Mage::helper('clipgenerator')->__('Sie können maximal 10 Produkte gleichzeitig verarbeiten.'));
28
+ $this->_redirectUrl(Mage::helper('adminhtml')->getUrl('adminhtml/catalog_product/index'));
29
+ }
30
+ }
31
+
32
+ public function activateAction() {
33
+ $this->init();
34
+ Mage::helper('clipgenerator')->activateVideos($this->products);
35
+ $this->_redirectUrl(Mage::helper('adminhtml')->getUrl('adminhtml/catalog_product/index'));
36
+ }
37
+
38
+ public function deactivateAction() {
39
+ $this->init();
40
+ Mage::helper('clipgenerator')->deactivateVideos($this->products);
41
+ $this->_redirectUrl(Mage::helper('adminhtml')->getUrl('adminhtml/catalog_product/index'));
42
+ }
43
+ }
app/code/community/Trivid/Clipgenerator/Adminhtml/OrderformController.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Orderform Controller
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * LICENSE: is available through the world-wide-web at the following URI:
8
+ * http://www.clipgenerator.com/static/public/legal.php If you did not receive a copy of
9
+ * the Clipgenerator - End User License Agreement and are unable to obtain it through the web, please
10
+ * send a note to info@trivid.com so we can mail you a copy immediately.
11
+ *
12
+ * @package Trivid
13
+ * @author Trivid GmbH <author@example.com>
14
+ * @author Another Author <another@example.com>
15
+ * @copyright 2013 Trivid GmbH
16
+ * @license http://www.clipgenerator.com/static/public/legal.php Clipgenerator - End User License Agreement
17
+ * @version 1.0.0
18
+ * @since File available since Release 1.0.0
19
+ */
20
+ class Trivid_Clipgenerator_Adminhtml_OrderformController extends Mage_Adminhtml_Controller_Action {
21
+ public function indexAction() {
22
+ $post = $this->getRequest()->getPost();
23
+ if($post['isAjax']) {
24
+ if($post['apiUser'] && $post['apiSecret']) {
25
+ $response_array['status'] = 'success';
26
+ echo json_encode($response_array);
27
+ Mage::getModel('core/config')->saveConfig('clipgenerator/general/clipgenerator_api_user_id', $post['apiUser']);
28
+ Mage::getModel('core/config')->saveConfig('clipgenerator/general/clipgenerator_api_secret', $post['apiSecret']);
29
+ Mage::getModel('core/config')->saveConfig('clipgenerator/general/clipgenerator_email', $post['email']);
30
+ Mage::getSingleton('core/session')->addSuccess(Mage::helper('clipgenerator')->__('Die Bestellung war erfolgreich!'));
31
+ }
32
+ die();
33
+ }
34
+ $this->loadLayout()->renderLayout();
35
+ }
36
+ }
app/code/community/Trivid/Clipgenerator/Block/Adminhtml/System/Config/Form/Field/Contingentlabel.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Contingent Field
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * LICENSE: is available through the world-wide-web at the following URI:
8
+ * http://www.clipgenerator.com/static/public/legal.php If you did not receive a copy of
9
+ * the Clipgenerator - End User License Agreement and are unable to obtain it through the web, please
10
+ * send a note to info@trivid.com so we can mail you a copy immediately.
11
+ *
12
+ * @package Trivid
13
+ * @author Trivid GmbH <author@example.com>
14
+ * @author Another Author <another@example.com>
15
+ * @copyright 2013 Trivid GmbH
16
+ * @license http://www.clipgenerator.com/static/public/legal.php Clipgenerator - End User License Agreement
17
+ * @version 1.0.0
18
+ * @since File available since Release 1.0.0
19
+ */
20
+ class Trivid_Clipgenerator_Block_Adminhtml_System_Config_Form_Field_Contingentlabel extends Mage_Adminhtml_Block_System_Config_Form_Field {
21
+ /**
22
+ * contingent html
23
+ *
24
+ * @return string
25
+ */
26
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
27
+ $block = Mage::getSingleton('core/layout')
28
+ ->createBlock('adminhtml/template', '', array('template' => 'clipgenerator/contingent.phtml'))
29
+ ->setIsRenderToJsTemplate(TRUE);
30
+
31
+ return $block->toHtml();
32
+ }
33
+ }
app/code/community/Trivid/Clipgenerator/Block/Adminhtml/System/Config/Form/Field/Musiclightbox.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * musiclightbox field
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * LICENSE: is available through the world-wide-web at the following URI:
8
+ * http://www.clipgenerator.com/static/public/legal.php If you did not receive a copy of
9
+ * the Clipgenerator - End User License Agreement and are unable to obtain it through the web, please
10
+ * send a note to info@trivid.com so we can mail you a copy immediately.
11
+ *
12
+ * @package Trivid
13
+ * @author Trivid GmbH <author@example.com>
14
+ * @author Another Author <another@example.com>
15
+ * @copyright 2013 Trivid GmbH
16
+ * @license http://www.clipgenerator.com/static/public/legal.php Clipgenerator - End User License Agreement
17
+ * @version 1.0.0
18
+ * @since File available since Release 1.0.0
19
+ */
20
+ class Trivid_Clipgenerator_Block_Adminhtml_System_Config_Form_Field_Musiclightbox extends Mage_Adminhtml_Block_System_Config_Form_Field {
21
+ /**
22
+ * music choose html
23
+ *
24
+ * @return string
25
+ */
26
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
27
+ $block = Mage::getSingleton('core/layout')
28
+ ->createBlock('adminhtml/template', '', array('template' => 'clipgenerator/music.phtml'))
29
+ ->setIsRenderToJsTemplate(TRUE);
30
+
31
+ return $block->toHtml();
32
+ }
33
+ }
app/code/community/Trivid/Clipgenerator/Block/Catalog/Product/Helper/Form/Images.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * images form helper
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * LICENSE: is available through the world-wide-web at the following URI:
8
+ * http://www.clipgenerator.com/static/public/legal.php If you did not receive a copy of
9
+ * the Clipgenerator - End User License Agreement and are unable to obtain it through the web, please
10
+ * send a note to info@trivid.com so we can mail you a copy immediately.
11
+ *
12
+ * @package Trivid
13
+ * @author Trivid GmbH <author@example.com>
14
+ * @author Another Author <another@example.com>
15
+ * @copyright 2013 Trivid GmbH
16
+ * @license http://www.clipgenerator.com/static/public/legal.php Clipgenerator - End User License Agreement
17
+ * @version 1.0.0
18
+ * @since File available since Release 1.0.0
19
+ */
20
+ class Trivid_Clipgenerator_Block_Catalog_Product_Helper_Form_Images extends Varien_Data_Form_Element_Text {
21
+ public function getAfterElementHtml() {
22
+ $block = Mage::getSingleton('core/layout')
23
+ ->createBlock('adminhtml/template', '', array('template' => 'clipgenerator/images.phtml'))
24
+ ->setIsRenderToJsTemplate(TRUE);
25
+
26
+ return $block->toHtml();
27
+ }
28
+ }
app/code/community/Trivid/Clipgenerator/Block/Catalog/Product/Helper/Form/Music.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Trivid_Clipgenerator_Block_Catalog_Product_Helper_Form_Music extends Varien_Data_Form_Element_Text {
3
+ public function getAfterElementHtml() {
4
+ $block = Mage::getSingleton('core/layout')
5
+ ->createBlock('adminhtml/template', '', array('template' => 'clipgenerator/music.phtml'))
6
+ ->setIsRenderToJsTemplate(TRUE);
7
+
8
+ return $block->toHtml();
9
+ }
10
+ }
app/code/community/Trivid/Clipgenerator/Block/Catalog/Product/Helper/Form/music.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * music form helper
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * LICENSE: is available through the world-wide-web at the following URI:
8
+ * http://www.clipgenerator.com/static/public/legal.php If you did not receive a copy of
9
+ * the Clipgenerator - End User License Agreement and are unable to obtain it through the web, please
10
+ * send a note to info@trivid.com so we can mail you a copy immediately.
11
+ *
12
+ * @package Trivid
13
+ * @author Trivid GmbH <author@example.com>
14
+ * @author Another Author <another@example.com>
15
+ * @copyright 2013 Trivid GmbH
16
+ * @license http://www.clipgenerator.com/static/public/legal.php Clipgenerator - End User License Agreement
17
+ * @version 1.0.0
18
+ * @since File available since Release 1.0.0
19
+ */
20
+ class Trivid_Clipgenerator_Block_Catalog_Product_Helper_Form_Music extends Varien_Data_Form_Element_Text {
21
+ public function getAfterElementHtml() {
22
+ $block = Mage::getSingleton('core/layout')
23
+ ->createBlock('adminhtml/template', '', array('template' => 'clipgenerator/music.phtml'))
24
+ ->setIsRenderToJsTemplate(TRUE);
25
+
26
+ return $block->toHtml();
27
+ }
28
+ }
app/code/community/Trivid/Clipgenerator/Block/InsertVideo.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * insert video block
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * LICENSE: is available through the world-wide-web at the following URI:
8
+ * http://www.clipgenerator.com/static/public/legal.php If you did not receive a copy of
9
+ * the Clipgenerator - End User License Agreement and are unable to obtain it through the web, please
10
+ * send a note to info@trivid.com so we can mail you a copy immediately.
11
+ *
12
+ * @package Trivid
13
+ * @author Trivid GmbH <author@example.com>
14
+ * @author Another Author <another@example.com>
15
+ * @copyright 2013 Trivid GmbH
16
+ * @license http://www.clipgenerator.com/static/public/legal.php Clipgenerator - End User License Agreement
17
+ * @version 1.0.0
18
+ * @since File available since Release 1.0.0
19
+ */
20
+ class Trivid_Clipgenerator_Block_InsertVideo extends Mage_Core_Block_Text {
21
+ protected $_nameInLayout = 'clipgenerator.insertvideo';
22
+ protected $_alias = 'insertvideo';
23
+ protected $videoId;
24
+ protected $show;
25
+
26
+ function __construct($videoId = NULL, $show = FALSE) {
27
+ $this->videoId = $videoId;
28
+ $this->show = $show;
29
+ }
30
+
31
+ public function setPassingTransport($transport) {
32
+ $this->setData('text', $transport . $this->_insertVideoHtml());
33
+ }
34
+
35
+ private function _insertVideoHtml() {
36
+ $html = '';
37
+ if ($this->videoId && $this->show) {
38
+ $html = '<iframe id="clipgeneratorvideo" style="width:400px; height:300px; border:0px none;" src="http://data.clipgenerator.com/player/v2/Player.swf?autoplay=off&webcartURL=http%3A%2F%2Fcg-v3.clipgenerator.com%2FgetWebcart%3FvideoId%3D' . $this->videoId . '"></iframe>';
39
+ }
40
+
41
+ return $html;
42
+ }
43
+ }
app/code/community/Trivid/Clipgenerator/Block/Video.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * video block
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * LICENSE: is available through the world-wide-web at the following URI:
8
+ * http://www.clipgenerator.com/static/public/legal.php If you did not receive a copy of
9
+ * the Clipgenerator - End User License Agreement and are unable to obtain it through the web, please
10
+ * send a note to info@trivid.com so we can mail you a copy immediately.
11
+ *
12
+ * @package Trivid
13
+ * @author Trivid GmbH <author@example.com>
14
+ * @author Another Author <another@example.com>
15
+ * @copyright 2013 Trivid GmbH
16
+ * @license http://www.clipgenerator.com/static/public/legal.php Clipgenerator - End User License Agreement
17
+ * @version 1.0.0
18
+ * @since File available since Release 1.0.0
19
+ */
20
+ class Trivid_Clipgenerator_Block_Video extends Mage_Core_Block_Text {
21
+ protected function _toHtml() {
22
+ $_product = Mage::registry('current_product');
23
+ $video = $_product->getData('clipgenerator_video_id');
24
+ $show = $_product->getData('clipgenerator_show');
25
+ if ($video && $show) {
26
+ $html = '<iframe id="clipgeneratorvideo" style="width:400px; height:300px; border:0px none;" src="http://data.clipgenerator.com/player/v2/Player.swf?autoplay=off&webcartURL=http%3A%2F%2Fcg-v3.clipgenerator.com%2FgetWebcart%3FvideoId%3D' . $video . '"></iframe>';
27
+ }
28
+
29
+ return $html;
30
+ }
31
+ }
app/code/community/Trivid/Clipgenerator/Helper/Data.php ADDED
@@ -0,0 +1,298 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Main Helper Class
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * LICENSE: is available through the world-wide-web at the following URI:
8
+ * http://www.clipgenerator.com/static/public/legal.php If you did not receive a copy of
9
+ * the Clipgenerator - End User License Agreement and are unable to obtain it through the web, please
10
+ * send a note to info@trivid.com so we can mail you a copy immediately.
11
+ *
12
+ * @package Trivid
13
+ * @author Trivid GmbH <author@example.com>
14
+ * @author Another Author <another@example.com>
15
+ * @copyright 2013 Trivid GmbH
16
+ * @license http://www.clipgenerator.com/static/public/legal.php Clipgenerator - End User License Agreement
17
+ * @version 1.0.0
18
+ * @since File available since Release 1.0.0
19
+ */
20
+ require_once(Mage::getModuleDir('', 'Trivid_Clipgenerator') . '/lib/clipgenerator/ClipgeneratorClient.php');
21
+ require_once(Mage::getModuleDir('', 'Trivid_Clipgenerator') . '/lib/clipgenerator/Video.php');
22
+ require_once(Mage::getModuleDir('', 'Trivid_Clipgenerator') . '/lib/clipgenerator/Picture.php');
23
+ require_once(Mage::getModuleDir('', 'Trivid_Clipgenerator') . '/lib/clipgenerator/Frame.php');
24
+ require_once(Mage::getModuleDir('', 'Trivid_Clipgenerator') . '/lib/clipgenerator/Logo.php');
25
+ require_once(Mage::getModuleDir('', 'Trivid_Clipgenerator') . '/lib/clipgenerator/LowerThird.php');
26
+ class Trivid_Clipgenerator_Helper_Data extends Mage_Core_Helper_Abstract {
27
+
28
+ protected $clipgeneratorClient;
29
+
30
+ /**
31
+ * initalize clipgenerator api with given api credentials from
32
+ * clipgenerator konfiguration
33
+ *
34
+ */
35
+ private function initClipgeneratorApi() {
36
+ $apiUserId = Mage::getStoreConfig('clipgenerator/general/clipgenerator_api_user_id', Mage::app()->getStore());
37
+ $apiSecret = Mage::getStoreConfig('clipgenerator/general/clipgenerator_api_secret', Mage::app()->getStore());
38
+ $apiId = 'magento-' . $apiUserId;
39
+ $apiUrl = 'http://cg-v3.clipgenerator.com/';
40
+ $this->clipgeneratorClient = new ClipgeneratorClient(
41
+ $apiId,
42
+ $apiSecret,
43
+ $apiUserId,
44
+ 'de',
45
+ $apiUrl
46
+ );
47
+ }
48
+
49
+ private function curlCall($method, $params = array()) {
50
+ if ($method) {
51
+ $apiCredentials = array(
52
+ 'userId' => Mage::getStoreConfig('clipgenerator/general/clipgenerator_api_user_id', Mage::app()->getStore()),
53
+ 'apiSecret' => Mage::getStoreConfig('clipgenerator/general/clipgenerator_api_secret', Mage::app()->getStore()),
54
+ 'apiId' => 'magento-' . Mage::getStoreConfig('clipgenerator/general/clipgenerator_api_user_id', Mage::app()->getStore())
55
+ );
56
+ $params = array_merge($params, $apiCredentials);
57
+ $apiUrl = 'http://cg-v3.clipgenerator.com/';
58
+ $curl = $apiUrl . $method . '?' . http_build_query($params);
59
+ $ch = curl_init();
60
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
61
+ curl_setopt($ch, CURLOPT_URL, $curl);
62
+ curl_setopt($ch, CURLOPT_HEADER, 0);
63
+ $output = curl_exec($ch);
64
+ curl_close($ch);
65
+
66
+ return $output;
67
+ }
68
+ }
69
+
70
+ public function uploadPicture($file) {
71
+ $this->initClipgeneratorApi();
72
+
73
+ return $this->clipgeneratorClient->uploadPicture($file);
74
+ }
75
+
76
+ public function saveVideo($xml) {
77
+ $this->initClipgeneratorApi();
78
+
79
+ return $this->clipgeneratorClient->saveVideo($xml);
80
+ }
81
+
82
+ /**
83
+ * returns array of designs
84
+ *
85
+ */
86
+ public function getDesigns() {
87
+ $this->initClipgeneratorApi();
88
+ $designs = $this->clipgeneratorClient->getDesigns();
89
+
90
+ return $designs;
91
+ }
92
+
93
+ /**
94
+ * returns array of music
95
+ *
96
+ */
97
+ public function getMusic() {
98
+ $this->initClipgeneratorApi();
99
+ $designs = $this->clipgeneratorClient->getMusic();
100
+
101
+ return $designs;
102
+ }
103
+
104
+ /**
105
+ * returns array of user
106
+ *
107
+ */
108
+ public function getUser() {
109
+ $this->initClipgeneratorApi();
110
+ $user = $this->clipgeneratorClient->getUser();
111
+
112
+ return $user;
113
+ }
114
+
115
+ /**
116
+ * @param $products
117
+ */
118
+ public function activateVideos($products) {
119
+ foreach ($products as $product_id) {
120
+ $product = Mage::getModel('catalog/product')->load($product_id);
121
+ $cid = $product->getData('clipgenerator_video_id');
122
+ if ($cid) {
123
+ $productIdArray[] = $product->getData('clipgenerator_video_id');
124
+ $productArray[$product->getData('clipgenerator_video_id')] = $product;
125
+ } else {
126
+ $product->setData('clipgenerator_show', 1);
127
+ $this->createVideo($product);
128
+ $productIdArray[] = $product->getData('clipgenerator_video_id');
129
+ $productArray[$product->getData('clipgenerator_video_id')] = $product;
130
+ }
131
+ }
132
+ if (!empty($productIdArray)) {
133
+ $params['idList'] = json_encode($productIdArray);
134
+ $params['visibility'] = 1;
135
+ $return = json_decode($this->curlCall('setClipVisibilityBulk', $params));
136
+ $success = $return->result->idList;
137
+ }
138
+ if (!empty($success)) {
139
+ $count = 0;
140
+ foreach ($success as $id) {
141
+ $productArray[$id]->setData('clipgenerator_show', 1);
142
+ $productArray[$id]->save();
143
+ $count++;
144
+ }
145
+ Mage::getSingleton('core/session')->addSuccess(sprintf(Mage::helper('clipgenerator')->__('%s Video/s wurde/n aktivert.'), $count));
146
+ } else {
147
+ Mage::getSingleton('core/session')->addError(Mage::helper('clipgenerator')->__('Die gewählten Videos konnten nicht aktiviert werden. Bitte versuchen Sie es noch einmal.'));
148
+ }
149
+ }
150
+
151
+ /**
152
+ * @param $products
153
+ */
154
+ public function deactivateVideos($products) {
155
+ foreach ($products as $product_id) {
156
+ $product = Mage::getModel('catalog/product')->load($product_id);
157
+ $cid = $product->getData('clipgenerator_video_id');
158
+ if ($cid) {
159
+ $productIdArray[] = $product->getData('clipgenerator_video_id');
160
+ $productArray[$product->getData('clipgenerator_video_id')] = $product;
161
+ }
162
+ }
163
+ if (!empty($productIdArray)) {
164
+ $params['idList'] = json_encode($productIdArray);
165
+ $params['visibility'] = 0;
166
+ $return = json_decode($this->curlCall('setClipVisibilityBulk', $params));
167
+ $success = $return->result->idList;
168
+ }
169
+ if (!empty($success)) {
170
+ $count = 0;
171
+ foreach ($success as $id) {
172
+ $productArray[$id]->setData('clipgenerator_show', 0);
173
+ $productArray[$id]->save();
174
+ $count++;
175
+ }
176
+ Mage::getSingleton('core/session')->addSuccess(sprintf(Mage::helper('clipgenerator')->__('%s Video/s wurde/n deaktivert.'), $count));
177
+ } else {
178
+ Mage::getSingleton('core/session')->addError(Mage::helper('clipgenerator')->__('Die gewählten Videos konnten nicht deaktiviert werden.'));
179
+ }
180
+ }
181
+
182
+ public function createVideo($_product) {
183
+ $this->initClipgeneratorApi();
184
+ if ($_product->getData('clipgenerator_show') && $this->getUser()) {
185
+ $video = new Video($_product->getData('clipgenerator_title'));
186
+ //set video design
187
+ if ($_product->getData('clipgenerator_design')) {
188
+ $video->designId = $_product->getData('clipgenerator_design');
189
+ } else {
190
+ $designs = $this->getDesigns();
191
+ $dKey = array_rand($designs);
192
+ $video->designId = $designs[$dKey]['id'];
193
+ $_product->setData('clipgenerator_design', $designs[$dKey]['id']);
194
+ }
195
+ //set video song
196
+ if ($_product->getData('clipgenerator_song')) {
197
+ $video->songId = $_product->getData('clipgenerator_song');
198
+ } else {
199
+ $music = $this->getMusic();
200
+ $mKey = array_rand($music['songs']);
201
+ $video->designId = $music['songs'][$mKey]['id'];
202
+ $_product->setData('clipgenerator_design', $music['songs'][$mKey]['id']);
203
+ }
204
+ $video->keywords = $_product->getData('clipgenerator_keywords') ? $_product->getData('clipgenerator_keywords') : $_product->getData('meta_keywords');
205
+ $video->title = $_product->getData('clipgenerator_title') ? $_product->getData('clipgenerator_title') : $_product->getData('name');
206
+ $video->description = $_product->getData('clipgenerator_description') ? $_product->getData('clipgenerator_description') : $_product->getData('description');
207
+ $logoUrl = $_product->getData('clipgenerator_logo') ? $_product->getData('clipgenerator_logo') : Mage::getStoreConfig('clipgenerator/settings/clipgenerator_logo_url', Mage::app()->getStore());
208
+ if ($logoUrl) {
209
+ if ($logo = $this->clipgeneratorClient->uploadLogo($logoUrl)) {
210
+ $logoId = $logo['id'];
211
+ $logoUrl = $logo['url'];
212
+ $logo = Logo::fromXml('<logo width="0.2" height="0.2" alpha="1">
213
+ <id>' . $logoId . '</id>
214
+ <url>' . htmlspecialchars($logoUrl) . '</url>
215
+ <link />
216
+ <position verticalAlign="top" horizontalAlign="right" />
217
+ <showInStartPage>false</showInStartPage>
218
+ <showInEndPage>false</showInEndPage>
219
+ <showInTimeline>true</showInTimeline>
220
+ </logo>');
221
+ $video->logo = $logo;
222
+ }
223
+ }
224
+ $images = explode(';', trim($_product->getData('clipgenerator_images_select'), ';'));
225
+ $pImgs = $_product->getMediaGalleryImages();
226
+ $newImgSelect = '';
227
+ $imgCount = 0;
228
+ if ($_product->getData('clipgenerator_images_select')) {
229
+ foreach ($images as $img) {
230
+ foreach ($pImgs as $pImg) {
231
+ if ($pImg->getUrl() == $img) {
232
+ $pic = $this->clipgeneratorClient->uploadPicture($img);
233
+ $picture = new Picture($pic['id']);
234
+ $frame = new Frame($picture);
235
+ if ($pImg->getData('label')) {
236
+ $l3 = new LowerThird();
237
+ $l3->verticalAlign = 300;
238
+ $l3->setText($pImg->getData('label'));
239
+ $l3->textOutlineWidth = 2;
240
+ $l3->textOutlineColor = 0x333333;
241
+ $l3->link = $_product->getProductUrl();
242
+ $frame->addLowerThird($l3);
243
+ }
244
+ $video->addFrame($frame);
245
+ $newImgSelect .= ';' . $img;
246
+ $imgCount++;
247
+ break;
248
+ }
249
+ }
250
+ // limitation to 22 images
251
+ if ($imgCount == 22) {
252
+ break;
253
+ }
254
+ }
255
+ } else {
256
+ foreach ($pImgs as $pImg) {
257
+ $pic = $this->clipgeneratorClient->uploadPicture($pImg->getUrl());
258
+ $picture = new Picture($pic['id']);
259
+ $frame = new Frame($picture);
260
+ if ($pImg->getData('label')) {
261
+ $l3 = new LowerThird();
262
+ $l3->verticalAlign = 300;
263
+ $l3->setText($pImg->getData('label'));
264
+ $l3->textOutlineWidth = 2;
265
+ $l3->textOutlineColor = 0x333333;
266
+ $l3->link = $_product->getProductUrl();
267
+ $frame->addLowerThird($l3);
268
+ }
269
+ $video->addFrame($frame);
270
+ $newImgSelect .= ';' . $pImg->getUrl();
271
+ $imgCount++;
272
+ // limitation to 22 images
273
+ if ($imgCount == 22) {
274
+ break;
275
+ }
276
+ }
277
+ if ($newImgSelect) {
278
+ $_product->setData('clipgenerator_images_select', $newImgSelect);
279
+ }
280
+ }
281
+ $video->format = '360p';
282
+ if ($_product->getData('clipgenerator_video_id')) {
283
+ $video->id = $_product->getData('clipgenerator_video_id');
284
+ }
285
+ $videoXml = $video->asXml();
286
+ $videoId = $this->clipgeneratorClient->saveVideo($videoXml);
287
+ if (!$_product->getData('clipgenerator_video_id')) {
288
+ $_product->setData('clipgenerator_video_id', $videoId);
289
+ $_product->save();
290
+ } else {
291
+ if ($newImgSelect != $_product->getData('clipgenerator_images_select')) {
292
+ $_product->setData('clipgenerator_images_select', $newImgSelect);
293
+ $_product->save();
294
+ }
295
+ }
296
+ }
297
+ }
298
+ }
app/code/community/Trivid/Clipgenerator/Model/Adminhtml/System/Config/Source/Designs.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Design Source
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * LICENSE: is available through the world-wide-web at the following URI:
8
+ * http://www.clipgenerator.com/static/public/legal.php If you did not receive a copy of
9
+ * the Clipgenerator - End User License Agreement and are unable to obtain it through the web, please
10
+ * send a note to info@trivid.com so we can mail you a copy immediately.
11
+ *
12
+ * @package Trivid
13
+ * @author Trivid GmbH <author@example.com>
14
+ * @author Another Author <another@example.com>
15
+ * @copyright 2013 Trivid GmbH
16
+ * @license http://www.clipgenerator.com/static/public/legal.php Clipgenerator - End User License Agreement
17
+ * @version 1.0.0
18
+ * @since File available since Release 1.0.0
19
+ */
20
+ /**
21
+ * Used in creating options for Clipgenerator Designs config value selection
22
+ *
23
+ */
24
+ class Trivid_Clipgenerator_Model_Adminhtml_System_Config_Source_Designs {
25
+
26
+ /**
27
+ * Options getter
28
+ *
29
+ * @return array
30
+ */
31
+ public function toOptionArray() {
32
+ $designs = Mage::helper('clipgenerator')->getDesigns();
33
+ $designArr = array();
34
+ $designArr[] = array('value' => '', 'label' => '');
35
+ foreach ($designs as $k => $v) {
36
+ $designArr[] = array(
37
+ 'value' => $v['id'],
38
+ 'label' => $v['title']
39
+ );
40
+ }
41
+
42
+ return $designArr;
43
+ }
44
+
45
+ /**
46
+ * Get options in "key-value" format
47
+ *
48
+ * @return array
49
+ */
50
+ public function toArray() {
51
+ $designs = Mage::helper('clipgenerator')->getDesigns();
52
+ $designArr = array();
53
+ $designArr[0] = '';
54
+ foreach ($designs as $v) {
55
+ $designArr[$v['id']] = $v['title'];
56
+ }
57
+
58
+ return $designArr;
59
+ }
60
+ }
app/code/community/Trivid/Clipgenerator/Model/Adminhtml/System/Config/Source/Musics.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Music Source
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * LICENSE: is available through the world-wide-web at the following URI:
8
+ * http://www.clipgenerator.com/static/public/legal.php If you did not receive a copy of
9
+ * the Clipgenerator - End User License Agreement and are unable to obtain it through the web, please
10
+ * send a note to info@trivid.com so we can mail you a copy immediately.
11
+ *
12
+ * @package Trivid
13
+ * @author Trivid GmbH <author@example.com>
14
+ * @author Another Author <another@example.com>
15
+ * @copyright 2013 Trivid GmbH
16
+ * @license http://www.clipgenerator.com/static/public/legal.php Clipgenerator - End User License Agreement
17
+ * @version 1.0.0
18
+ * @since File available since Release 1.0.0
19
+ */
20
+ /**
21
+ * Used in creating options for Clipgenerator Music config value selection
22
+ *
23
+ */
24
+ class Trivid_Clipgenerator_Model_Adminhtml_System_Config_Source_Musics {
25
+
26
+ /**
27
+ * Options getter
28
+ *
29
+ * @return array
30
+ */
31
+ public function toOptionArray() {
32
+ $music = Mage::helper('clipgenerator')->getMusic();
33
+ $musicArr = array();
34
+ $musicArr[] = array('value' => '', 'label' => '');
35
+ foreach ($music['songs'] as $k => $v) {
36
+ $musicArr[] = array(
37
+ 'value' => $v['id'],
38
+ 'label' => $v['title']
39
+ );
40
+ }
41
+
42
+ return $musicArr;
43
+ }
44
+
45
+ /**
46
+ * Get options in "key-value" format
47
+ *
48
+ * @return array
49
+ */
50
+ public function toArray() {
51
+ $music = Mage::helper('clipgenerator')->getMusic();
52
+ $musicArr = array();
53
+ $musicArr[0] = '';
54
+ foreach ($music as $v) {
55
+ $musicArr[$v['id']] = $v['title'];
56
+ }
57
+
58
+ return $musicArr;
59
+ }
60
+ }
app/code/community/Trivid/Clipgenerator/Model/Mysql4/Setup.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Setup File
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * LICENSE: is available through the world-wide-web at the following URI:
8
+ * http://www.clipgenerator.com/static/public/legal.php If you did not receive a copy of
9
+ * the Clipgenerator - End User License Agreement and are unable to obtain it through the web, please
10
+ * send a note to info@trivid.com so we can mail you a copy immediately.
11
+ *
12
+ * @package Trivid
13
+ * @author Trivid GmbH <author@example.com>
14
+ * @author Another Author <another@example.com>
15
+ * @copyright 2013 Trivid GmbH
16
+ * @license http://www.clipgenerator.com/static/public/legal.php Clipgenerator - End User License Agreement
17
+ * @version 1.0.0
18
+ * @since File available since Release 1.0.0
19
+ */
20
+ class Trivid_Clipgenerator_Model_Mysql4_Setup extends Mage_Catalog_Model_Resource_Eav_Mysql4_Setup {
21
+
22
+ }
app/code/community/Trivid/Clipgenerator/Model/Observer.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Module Observer
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * LICENSE: is available through the world-wide-web at the following URI:
8
+ * http://www.clipgenerator.com/static/public/legal.php If you did not receive a copy of
9
+ * the Clipgenerator - End User License Agreement and are unable to obtain it through the web, please
10
+ * send a note to info@trivid.com so we can mail you a copy immediately.
11
+ *
12
+ * @package Trivid
13
+ * @author Trivid GmbH <author@example.com>
14
+ * @author Another Author <another@example.com>
15
+ * @copyright 2013 Trivid GmbH
16
+ * @license http://www.clipgenerator.com/static/public/legal.php Clipgenerator - End User License Agreement
17
+ * @version 1.0.0
18
+ * @since File available since Release 1.0.0
19
+ */
20
+ class Trivid_Clipgenerator_Model_Observer {
21
+ const MODULE_NAME = 'Trivid_Clipgenerator';
22
+
23
+ public function catalog_product_save_after(Varien_Event_Observer $observer) {
24
+ $_product = $observer->getProduct();
25
+ Mage::helper('clipgenerator')->createVideo($_product);
26
+ }
27
+
28
+ public function insertVideo(Varien_Event_Observer $observer = NULL) {
29
+ if (!$observer) {
30
+ return;
31
+ }
32
+ if ('product.description' == $observer->getEvent()->getBlock()->getNameInLayout() && Mage::getStoreConfig('clipgenerator/settings/clipgenerator_output', Mage::app()->getStore())) {
33
+ if (!Mage::getStoreConfig('advanced/modules_disable_output/' . self::MODULE_NAME) && Mage::helper('clipgenerator')->getUser() && $observer->getEvent()->getBlock()->getProduct()->getData('clipgenerator_video_id') && $observer->getEvent()->getBlock()->getProduct()->getData('clipgenerator_show')) {
34
+ $event = $observer->getEvent();
35
+ $product = $event->getProduct();
36
+ $transport = $observer->getEvent()->getTransport();
37
+ $block = new Trivid_Clipgenerator_Block_InsertVideo($event->getBlock()->getProduct()->getData('clipgenerator_video_id'), $event->getBlock()->getProduct()->getData('clipgenerator_show'));
38
+ $block->setPassingTransport($transport['html']);
39
+ $block->toHtml();
40
+ }
41
+ }
42
+
43
+ return $this;
44
+ }
45
+
46
+ public function addMassAction($observer) {
47
+ $block = $observer->getEvent()->getBlock();
48
+ if (Mage::helper('clipgenerator')->getUser() && get_class($block) == 'Mage_Adminhtml_Block_Widget_Grid_Massaction' && $block->getRequest()->getControllerName() == 'catalog_product') {
49
+ $block->addItem('video_activate', array(
50
+ 'label' => Mage::helper('clipgenerator')->__('Videos aktivieren'),
51
+ 'url' => Mage::helper("adminhtml")->getUrl("clipgenerator/adminhtml_mass/activate"),
52
+ ));
53
+ $block->addItem('video_deactivate', array(
54
+ 'label' => Mage::helper('clipgenerator')->__('Videos deaktivieren'),
55
+ 'url' => Mage::helper("adminhtml")->getUrl("clipgenerator/adminhtml_mass/deactivate"),
56
+ ));
57
+ }
58
+ }
59
+ }
app/code/community/Trivid/Clipgenerator/Model/Source/Designs.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Design Source
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * LICENSE: is available through the world-wide-web at the following URI:
8
+ * http://www.clipgenerator.com/static/public/legal.php If you did not receive a copy of
9
+ * the Clipgenerator - End User License Agreement and are unable to obtain it through the web, please
10
+ * send a note to info@trivid.com so we can mail you a copy immediately.
11
+ *
12
+ * @package Trivid
13
+ * @author Trivid GmbH <author@example.com>
14
+ * @author Another Author <another@example.com>
15
+ * @copyright 2013 Trivid GmbH
16
+ * @license http://www.clipgenerator.com/static/public/legal.php Clipgenerator - End User License Agreement
17
+ * @version 1.0.0
18
+ * @since File available since Release 1.0.0
19
+ */
20
+ class Trivid_Clipgenerator_Model_Source_Designs extends Mage_Eav_Model_Entity_Attribute_Source_Abstract {
21
+
22
+ public function getAllOptions() {
23
+ $designs = Mage::helper('clipgenerator')->getDesigns();
24
+ $designArr = array();
25
+ foreach ($designs as $k => $v) {
26
+ $designArr[] = array(
27
+ 'value' => $v['id'],
28
+ 'label' => $v['title']
29
+ );
30
+ }
31
+
32
+ return $designArr;
33
+ }
34
+ }
app/code/community/Trivid/Clipgenerator/Model/Source/Musics.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Music Source
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * LICENSE: is available through the world-wide-web at the following URI:
8
+ * http://www.clipgenerator.com/static/public/legal.php If you did not receive a copy of
9
+ * the Clipgenerator - End User License Agreement and are unable to obtain it through the web, please
10
+ * send a note to info@trivid.com so we can mail you a copy immediately.
11
+ *
12
+ * @package Trivid
13
+ * @author Trivid GmbH <author@example.com>
14
+ * @author Another Author <another@example.com>
15
+ * @copyright 2013 Trivid GmbH
16
+ * @license http://www.clipgenerator.com/static/public/legal.php Clipgenerator - End User License Agreement
17
+ * @version 1.0.0
18
+ * @since File available since Release 1.0.0
19
+ */
20
+ class Trivid_Clipgenerator_Model_Source_Musics extends Mage_Eav_Model_Entity_Attribute_Source_Abstract {
21
+
22
+ public function getAllOptions() {
23
+ $music = Mage::helper('clipgenerator')->getMusic();
24
+ $musicArr = array();
25
+ foreach ($music['songs'] as $k => $v) {
26
+ $musicArr[] = array(
27
+ 'value' => $v['id'],
28
+ 'label' => $v['title']
29
+ );
30
+ }
31
+
32
+ return $musicArr;
33
+ }
34
+ }
app/code/community/Trivid/Clipgenerator/controllers/Adminhtml/MassController.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Adminhtml Mass Controller
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * LICENSE: is available through the world-wide-web at the following URI:
8
+ * http://www.clipgenerator.com/static/public/legal.php If you did not receive a copy of
9
+ * the Clipgenerator - End User License Agreement and are unable to obtain it through the web, please
10
+ * send a note to info@trivid.com so we can mail you a copy immediately.
11
+ *
12
+ * @package Trivid
13
+ * @author Trivid GmbH <author@example.com>
14
+ * @author Another Author <another@example.com>
15
+ * @copyright 2013 Trivid GmbH
16
+ * @license http://www.clipgenerator.com/static/public/legal.php Clipgenerator - End User License Agreement
17
+ * @version 1.0.0
18
+ * @since File available since Release 1.0.0
19
+ */
20
+ class Trivid_Clipgenerator_Adminhtml_MassController extends Mage_Adminhtml_Controller_Action {
21
+
22
+ protected $products;
23
+
24
+ protected function init() {
25
+ $this->products = $this->getRequest()->getParam('product');
26
+ if (count($this->products) > 10) {
27
+ Mage::getSingleton('core/session')->addError(Mage::helper('clipgenerator')->__('Sie können maximal 10 Produkte gleichzeitig verarbeiten.'));
28
+ $this->_redirectUrl(Mage::helper('adminhtml')->getUrl('adminhtml/catalog_product/index'));
29
+ }
30
+ }
31
+
32
+ public function activateAction() {
33
+ $this->init();
34
+ Mage::helper('clipgenerator')->activateVideos($this->products);
35
+ $this->_redirectUrl(Mage::helper('adminhtml')->getUrl('adminhtml/catalog_product/index'));
36
+ }
37
+
38
+ public function deactivateAction() {
39
+ $this->init();
40
+ Mage::helper('clipgenerator')->deactivateVideos($this->products);
41
+ $this->_redirectUrl(Mage::helper('adminhtml')->getUrl('adminhtml/catalog_product/index'));
42
+ }
43
+ }
app/code/community/Trivid/Clipgenerator/controllers/Adminhtml/OrderformController.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Orderform Controller
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * LICENSE: is available through the world-wide-web at the following URI:
8
+ * http://www.clipgenerator.com/static/public/legal.php If you did not receive a copy of
9
+ * the Clipgenerator - End User License Agreement and are unable to obtain it through the web, please
10
+ * send a note to info@trivid.com so we can mail you a copy immediately.
11
+ *
12
+ * @package Trivid
13
+ * @author Trivid GmbH <author@example.com>
14
+ * @author Another Author <another@example.com>
15
+ * @copyright 2013 Trivid GmbH
16
+ * @license http://www.clipgenerator.com/static/public/legal.php Clipgenerator - End User License Agreement
17
+ * @version 1.0.0
18
+ * @since File available since Release 1.0.0
19
+ */
20
+ class Trivid_Clipgenerator_Adminhtml_OrderformController extends Mage_Adminhtml_Controller_Action {
21
+ public function indexAction() {
22
+ $post = $this->getRequest()->getPost();
23
+ if($post['isAjax']) {
24
+ if($post['apiUser'] && $post['apiSecret']) {
25
+ $response_array['status'] = 'success';
26
+ echo json_encode($response_array);
27
+ Mage::getModel('core/config')->saveConfig('clipgenerator/general/clipgenerator_api_user_id', $post['apiUser']);
28
+ Mage::getModel('core/config')->saveConfig('clipgenerator/general/clipgenerator_api_secret', $post['apiSecret']);
29
+ Mage::getModel('core/config')->saveConfig('clipgenerator/general/clipgenerator_email', $post['email']);
30
+ Mage::getSingleton('core/session')->addSuccess(Mage::helper('clipgenerator')->__('Die Bestellung war erfolgreich!'));
31
+ }
32
+ die();
33
+ }
34
+ $this->loadLayout()->renderLayout();
35
+ }
36
+ }
app/code/community/Trivid/Clipgenerator/etc/adminhtml.xml ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ </config>
app/code/community/Trivid/Clipgenerator/etc/config.xml ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Trivid_Clipgenerator>
5
+ <version>1.0.0</version>
6
+ </Trivid_Clipgenerator>
7
+ </modules>
8
+ <global>
9
+ <helpers>
10
+ <clipgenerator>
11
+ <class>Trivid_Clipgenerator_Helper</class>
12
+ </clipgenerator>
13
+ </helpers>
14
+ <blocks>
15
+ <clipgenerator>
16
+ <class>Trivid_Clipgenerator_Block</class>
17
+ </clipgenerator>
18
+ <clipgenerator_video>
19
+ <rewrite>
20
+ <class>Trivid_Clipgenerator_Block_Video</class>
21
+ </rewrite>
22
+ </clipgenerator_video>
23
+ </blocks>
24
+ <resources>
25
+ <clipgenerator_setup>
26
+ <setup>
27
+ <module>Trivid_Clipgenerator</module>
28
+ <class>Trivid_Clipgenerator_Model_Mysql4_Setup</class>
29
+ </setup>
30
+ </clipgenerator_setup>
31
+ </resources>
32
+ <events>
33
+ <catalog_product_save_after>
34
+ <observers>
35
+ <clipgeneratorFrontend>
36
+ <type>singleton</type>
37
+ <class>Trivid_Clipgenerator_Model_Observer</class>
38
+ <method>catalog_product_save_after</method>
39
+ </clipgeneratorFrontend>
40
+ </observers>
41
+ </catalog_product_save_after>
42
+ </events>
43
+ </global>
44
+ <frontend>
45
+ <events>
46
+ <core_block_abstract_to_html_after>
47
+ <observers>
48
+ <clipgenerator>
49
+ <type>singleton</type>
50
+ <class>Trivid_Clipgenerator_Model_Observer</class>
51
+ <method>insertVideo</method>
52
+ </clipgenerator>
53
+ </observers>
54
+ </core_block_abstract_to_html_after>
55
+ </events>
56
+ </frontend>
57
+ <admin>
58
+ <routers>
59
+ <clipgenerator>
60
+ <use>admin</use>
61
+ <args>
62
+ <module>Trivid_Clipgenerator</module>
63
+ <frontName>clipgenerator</frontName>
64
+ </args>
65
+ </clipgenerator>
66
+ </routers>
67
+ </admin>
68
+ <adminhtml>
69
+ <events>
70
+ <core_block_abstract_prepare_layout_before>
71
+ <observers>
72
+ <clipgeneratorMass>
73
+ <class>Trivid_Clipgenerator_Model_Observer</class>
74
+ <method>addMassAction</method>
75
+ </clipgeneratorMass>
76
+ </observers>
77
+ </core_block_abstract_prepare_layout_before>
78
+ </events>
79
+ <translate>
80
+ <modules>
81
+ <mage_adminhtml>
82
+ <files>
83
+ <clipgenerator>Trivid_Clipgenerator.csv</clipgenerator>
84
+ </files>
85
+ </mage_adminhtml>
86
+ </modules>
87
+ </translate>
88
+ <acl>
89
+ <resources>
90
+ <admin>
91
+ <children>
92
+ <system>
93
+ <children>
94
+ <config>
95
+ <children>
96
+ <clipgenerator translate="title" module="clipgenerator">
97
+ <title>Clipgenerator Optionen</title>
98
+ </clipgenerator>
99
+ </children>
100
+ </config>
101
+ </children>
102
+ </system>
103
+ </children>
104
+ </admin>
105
+ </resources>
106
+ </acl>
107
+ <layout>
108
+ <updates>
109
+ <clipgenerator>
110
+ <file>clipgenerator.xml</file>
111
+ </clipgenerator>
112
+ </updates>
113
+ </layout>
114
+ </adminhtml>
115
+ </config>
app/code/community/Trivid/Clipgenerator/etc/system.xml ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <clipgenerator translate="label" module="clipgenerator">
5
+ <label>Clipgenerator Optionen</label>
6
+ <tab>general</tab>
7
+ <sort_order>90</sort_order>
8
+ <show_in_default>1</show_in_default>
9
+ <show_in_website>1</show_in_website>
10
+ <show_in_store>1</show_in_store>
11
+ <groups>
12
+ <general translate="label">
13
+ <label>General</label>
14
+ <sort_order>1</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <fields>
19
+ <clipgenerator_contingent_view translate="label">
20
+ <label>Kontingentsanzeige</label>
21
+ <frontend_type>label</frontend_type>
22
+ <frontend_model>trivid_clipgenerator_block_adminhtml_system_config_form_field_contingentlabel</frontend_model>
23
+ <sort_order>1</sort_order>
24
+ <show_in_default>1</show_in_default>
25
+ <show_in_website>1</show_in_website>
26
+ <show_in_store>1</show_in_store>
27
+ </clipgenerator_contingent_view>
28
+ <clipgenerator_email translate="label">
29
+ <label>E-Mail</label>
30
+ <frontend_type>text</frontend_type>
31
+ <sort_order>10</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ </clipgenerator_email>
36
+ <clipgenerator_api_user_id translate="label">
37
+ <label>API USER ID</label>
38
+ <frontend_type>text</frontend_type>
39
+ <sort_order>20</sort_order>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ <show_in_store>1</show_in_store>
43
+ </clipgenerator_api_user_id>
44
+ <clipgenerator_api_secret translate="label">
45
+ <label>API SECRET</label>
46
+ <frontend_type>text</frontend_type>
47
+ <sort_order>30</sort_order>
48
+ <show_in_default>1</show_in_default>
49
+ <show_in_website>1</show_in_website>
50
+ <show_in_store>1</show_in_store>
51
+ </clipgenerator_api_secret>
52
+ </fields>
53
+ </general>
54
+ <settings translate="label">
55
+ <label>Standard Settings</label>
56
+ <sort_order>2</sort_order>
57
+ <show_in_default>1</show_in_default>
58
+ <show_in_website>1</show_in_website>
59
+ <show_in_store>1</show_in_store>
60
+ <fields>
61
+ <!-- <clipgenerator_song>
62
+ <label>Song</label>
63
+ <frontend_type>select</frontend_type>
64
+ <source_model>trivid_clipgenerator_model_adminhtml_system_config_source_musics</source_model>
65
+ <sort_order>1</sort_order>
66
+ <show_in_default>1</show_in_default>
67
+ <show_in_website>1</show_in_website>
68
+ <show_in_store>1</show_in_store>
69
+ </clipgenerator_song>
70
+ <clipgenerator_music translate="label">
71
+ <label>erweiterte Song Auswahl</label>
72
+ <frontend_type>text</frontend_type>
73
+ <frontend_model>trivid_clipgenerator_block_adminhtml_system_config_form_field_musiclightbox</frontend_model>
74
+ <sort_order>10</sort_order>
75
+ <show_in_default>1</show_in_default>
76
+ <show_in_website>1</show_in_website>
77
+ <show_in_store>1</show_in_store>
78
+ </clipgenerator_music>
79
+ <clipgenerator_video_design translate="label">
80
+ <label>Video Design</label>
81
+ <frontend_type>select</frontend_type>
82
+ <source_model>trivid_clipgenerator_model_adminhtml_system_config_source_designs</source_model>
83
+ <sort_order>20</sort_order>
84
+ <show_in_default>1</show_in_default>
85
+ <show_in_website>1</show_in_website>
86
+ <show_in_store>1</show_in_store>
87
+ </clipgenerator_video_design>-->
88
+ <clipgenerator_logo_url translate="label">
89
+ <label>Logo URL</label>
90
+ <frontend_type>text</frontend_type>
91
+ <comment><![CDATA[(Für optimale Darstellung bitte nur freigestellte Logos im PNG-Format verwenden. Maximale Größe 100 x 100 Pixel.)]]></comment>
92
+ <sort_order>30</sort_order>
93
+ <show_in_default>1</show_in_default>
94
+ <show_in_website>1</show_in_website>
95
+ <show_in_store>1</show_in_store>
96
+ </clipgenerator_logo_url>
97
+ <clipgenerator_output translate="label">
98
+ <label>Automatische Ausgabe</label>
99
+ <frontend_type>select</frontend_type>
100
+ <comment><![CDATA[Das Video wird unter dem Produkt-Beschreibungs Block(product.description) ausgegeben.]]></comment>
101
+ <source_model>adminhtml/system_config_source_yesno</source_model>
102
+ <sort_order>40</sort_order>
103
+ <show_in_default>1</show_in_default>
104
+ <show_in_website>1</show_in_website>
105
+ <show_in_store>1</show_in_store>
106
+ </clipgenerator_output>
107
+ </fields>
108
+ </settings>
109
+ </groups>
110
+ </clipgenerator>
111
+ </sections>
112
+ </config>
app/code/community/Trivid/Clipgenerator/lib/clipgenerator/ClipgeneratorClient.php ADDED
@@ -0,0 +1,584 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Copyright 2012 Trivid. All Rights Reserved.
3
+ //
4
+ // +---------------------------------------------------------------------------+
5
+ // | Clipgenerator PHP 5 Client |
6
+ // +---------------------------------------------------------------------------+
7
+ // | Copyright (c) 2012 Trivid GmbH |
8
+ // | All rights reserved. |
9
+ // | |
10
+ // | Redistribution and use in source and binary forms, with or without |
11
+ // | modification, are permitted provided that the following conditions |
12
+ // | are met: |
13
+ // | |
14
+ // | 1. Redistributions of source code must retain the above copyright |
15
+ // | notice, this list of conditions and the following disclaimer. |
16
+ // | 2. Redistributions in binary form must reproduce the above copyright |
17
+ // | notice, this list of conditions and the following disclaimer in the |
18
+ // | documentation and/or other materials provided with the distribution. |
19
+ // | |
20
+ // | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
21
+ // | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
22
+ // | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
23
+ // | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
24
+ // | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
25
+ // | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
26
+ // | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
27
+ // | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28
+ // | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
29
+ // | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30
+ // +---------------------------------------------------------------------------+
31
+ // | For help with this library, contact s.mueller@trivid.com |
32
+ // +---------------------------------------------------------------------------+
33
+
34
+ class ClipgeneratorClient {
35
+ const PACKAGE_TYPE_EDITOR = 'editor';
36
+ const PACKAGE_TYPE_MUSIC = 'music';
37
+ const PACKAGE_TYPE_DESIGN = 'design';
38
+
39
+ const VIDEO_FORMAT_MP4 = 'mp4';
40
+ const VIDEO_RESOLUTION_400x226 = '400x226';
41
+ const VIDEO_RESOLUTION_640x360 = '640x360';
42
+
43
+ const HTTP_CLIENT_ZEND = 'ZendClient';
44
+ const HTTP_CLIENT_CURL = 'Curl';
45
+
46
+ private $apiId;
47
+ private $apiSecret;
48
+ private $apiURL = 'http://api-v2.clipgenerator.com/';
49
+ private $lang = 'de';
50
+ private $error = null;
51
+ private $errorCode = 0;
52
+ private $debug = false;
53
+ private $debugData = array();
54
+ private $userId = null;
55
+ private $curlCookieFile = null;
56
+ private $callMethod = 'Curl';
57
+
58
+ /**
59
+ * Constructor
60
+ *
61
+ * @return
62
+ */
63
+
64
+ function __construct($apiId, $apiSecret, $userId=null, $lang='de', $apiURL = null, $curlCookieFile = null)
65
+ {
66
+ $this->apiId = $apiId;
67
+ $this->apiSecret = $apiSecret;
68
+ $this->userId = $userId;
69
+
70
+ if (!is_null($lang)) $this->lang = $lang;
71
+ if (!is_null($apiURL)) $this->apiURL = $apiURL;
72
+ if (!is_null($curlCookieFile)) $this->curlCookieFile = $curlCookieFile;
73
+ }
74
+
75
+ /**
76
+ * Sets the language for the current session. All subsequent api calls will return data in the configured language.
77
+ *
78
+ * @param $lang String The language identifier. Supported languages are 'en' for English and 'de' for German
79
+ */
80
+ public function setLang($lang)
81
+ {
82
+ $this->lang = $lang;
83
+ }
84
+
85
+ /**
86
+ * Configures the user id that is required to identify the user on the clipgenerator backend.
87
+ * Typically this user id will be a hash of a unique user name from the application that uses this api.
88
+ * @param $userId String User id that will uniquely identify the user inside the app.
89
+ */
90
+ public function setUserId($userId)
91
+ {
92
+ $this->userId = $userId;
93
+ }
94
+
95
+ /**
96
+ * Configures the http client that will be used for communication with the backend.
97
+ * The Zend Http Client is used as default.
98
+ *
99
+ * @param $callMethod String One 'ZendClient' or 'Curl'.
100
+ */
101
+ public function setCallMethod($callMethod)
102
+ {
103
+ if (in_array($callMethod, array('ZendClient', 'Curl')))
104
+ {
105
+ $this->callMethod = $callMethod;
106
+ }
107
+ }
108
+
109
+ /**
110
+ * Lists all videos of the current user
111
+ *
112
+ * @return bool false if error, list of videos otherwise.
113
+ * @todo: this call should be moved to the api and return the corresponding json structure
114
+ */
115
+
116
+ public function getVideos($videoIdFilter=null) {
117
+ $result = $this->call('getVideos', array(
118
+ 'videoIdFilter' => $videoIdFilter
119
+ ));
120
+ return $result;
121
+ }
122
+
123
+ /**
124
+ * Loads a video with the $videoId in the current context. If no $videoId is supplied the id of the currently
125
+ * loaded video will be used. In most cases this will reload the currently loaded video and reset all modifications
126
+ * if the video was not saved using saveVideo().
127
+ *
128
+ * @param null $videoId String The id of the video that should be loaded in the current context.
129
+ * If no $videoId is null the videoId of the current context will be used.
130
+ *
131
+ * @return false | xml string of the video webcart xml
132
+ */
133
+ public function loadVideo($videoId)
134
+ {
135
+ $result = $this->call('loadVideo', array(
136
+ 'videoId' => $videoId,
137
+ ));
138
+
139
+ if ($result !== false) {
140
+ return $result['video'];
141
+ }
142
+ return false;
143
+ }
144
+
145
+ /**
146
+ * Reads downloads pf the $videoId in the current context. If no $videoId is supplied then error.
147
+ *
148
+ * @param null $videoId String The id of the video that should be loaded in the current context.
149
+ * If no $videoId is null the videoId of the current context will be used.
150
+ *
151
+ * @return false | array of downloads with params (status, date, etc.)
152
+ */
153
+ public function getDownloads($videoId)
154
+ {
155
+ $result = $this->call('getDownloads', array(
156
+ 'videoId' => $videoId,
157
+ ));
158
+
159
+ if ($result !== false) {
160
+ return $result;
161
+ }
162
+ return false;
163
+ }
164
+
165
+ /**
166
+ * Saves the current video configuration on the clipgenerator backend. If no $videoId is supplied the backend
167
+ * will save the video as a new video using a new video id.
168
+ * Note: Saving a new video will increase the available video slots for the current user.
169
+ * @param null $videoId String Optional video id of an existing video that should be overwritten.
170
+ * @return false if the call failed, videoId: string if the call succeeded
171
+ * @todo fix the result handling
172
+ */
173
+
174
+ public function saveVideo($videoXmlString, $temporary = false)
175
+ {
176
+ $result = $this->call('saveVideo', array(
177
+ 'video' => $videoXmlString,
178
+ 'temporary' => $temporary ? 'true' : 'false',
179
+ )
180
+ );
181
+
182
+ if ($result !== false) {
183
+ $newVideoId = $result['id'];
184
+ return $newVideoId;
185
+ }
186
+ return false;
187
+ }
188
+
189
+ /**
190
+ * Deletes a video from the users video list.
191
+ * @param $videoId array Array of string ids of the videos that should be deleted.
192
+ * @return bool
193
+ * @todo barely tested.
194
+ * @todo add ids of the successfully deleted video to the response
195
+ */
196
+ public function deleteVideo($videoId)
197
+ {
198
+ $result = $this->call('deleteVideo', array('videoId' => $videoId));
199
+ return $result !== false ? true : false;
200
+ }
201
+
202
+ /**
203
+ * Uploads a local image file to the clipgenerator backend. The picture will be converted to
204
+ * different resolutions and an result array with an unique picture identifier and link will
205
+ * be returned.
206
+ * @param $filePath
207
+ * @return array|bool
208
+ * @todo move getting the file information to the backend
209
+ */
210
+ public function uploadPicture($filePath, $forceNewId=true)
211
+ {
212
+ if(strpos($filePath, "http://") !== false)
213
+ $result = $this->call('uploadPicture', array('forceNewId' => $forceNewId, 'pictureUrl' => $filePath));
214
+ else
215
+ $result = $this->call('uploadPicture', array('forceNewId' => $forceNewId), $filePath);
216
+ return $result;
217
+ }
218
+
219
+ public function uploadLogo($filePath, $forceNewId=true)
220
+ {
221
+ if(strpos($filePath, "http://") !== false)
222
+ $result = $this->call('uploadPicture', array('forceNewId' => $forceNewId, 'logoUrl' => $filePath));
223
+ else
224
+ $result = $this->call('uploadPicture', array('forceNewId' => $forceNewId), $filePath);
225
+ return $result;
226
+ }
227
+
228
+ /**
229
+ * Uploads a local mp3 file to the clipgenerator backend. An unique resource identifier and link will
230
+ * be returned.
231
+ * @param $filePath
232
+ * @return array|bool
233
+ * @todo move getting the file information to the backend
234
+ */
235
+ public function uploadMusic($filePath, $forceNewId=true)
236
+ {
237
+ $result = $this->call('uploadMusic', array('forceNewId' => $forceNewId), $filePath);
238
+ return $result;
239
+ }
240
+
241
+ /**
242
+ * Lists all pictures of the current user including their additional information.
243
+ * @throws Exception
244
+ * @todo implement this call in the backend.
245
+ * note: this call has the same name as an existing call. The existing call should be replaced by this call.
246
+ */
247
+
248
+ public function getPictures() {
249
+ throw new Exception('Not implemented yet: getPictures');
250
+ }
251
+
252
+ /**
253
+ * Deletes uploaded pictures on the clipgenerator backend.
254
+ * @param $pictureIds Array Array of picture ids that should be deleted.
255
+ * @throws Exception
256
+ * @todo implement this call in the backend.
257
+ */
258
+ public function deletePictures($pictureIds) {
259
+ throw new Exception('Not implemented yet: getPictures');
260
+ }
261
+
262
+ /**
263
+ * Lists all available video designs.
264
+ * @todo rename the server api call from getVideoDesign to getDesigns
265
+ * @todo not well tested yet
266
+ */
267
+ public function getDesigns()
268
+ {
269
+ $result = $this->call('getDesigns');
270
+ return $result;
271
+ }
272
+
273
+ /**
274
+ * Get packages, genres and songs lists. With filtering by package and genre ids if set
275
+ * @param package int (0,+)
276
+ * @param genre int (0,+)
277
+ *
278
+ * @return bool false if error, arrays of packages, genres, songs
279
+ * @TODO: rename the call in the backend to get
280
+ * @TODO: later. implement filters on the backend for.
281
+ * @TODO: package=x, only shows data for package x
282
+ * @TODO: mood=x, only shows data for mood x
283
+ * @TODO: speed=x, only shows data for speed x
284
+ * @TODO: genre=x, only shows data for genre x
285
+ * @TODO: song=x, only shows data for song x
286
+ * @TODO: include_songs=true, if false songs will be ommited
287
+ * @TODO: all filters should be combinable so package=x + mood=y would only return data that matches package x AND mood y
288
+ */
289
+ public function getMusic($purchasedOnly=false)
290
+ {
291
+ $result = $this->call('getMusic', array(
292
+ 'purchasedOnly' => $purchasedOnly
293
+ ));
294
+ return $result;
295
+ }
296
+
297
+ /**
298
+ *
299
+ * @param $user
300
+ * @return bool
301
+ */
302
+ public function createUser($userId, $email, $password, $firstName='', $lastName='', $company='',
303
+ $street='', $zipCode='', $city='', $country='', $isActive='true',
304
+ $vatId='')
305
+ {
306
+ $result = $this->call('createUser', array(
307
+ "userId" => $userId,
308
+ "email" => $email,
309
+ "password" => $password,
310
+ "firstName" => $firstName,
311
+ "lastName" => $lastName,
312
+ "company" => $company,
313
+ "street" => $street,
314
+ "zipCode" => $zipCode,
315
+ "city" => $city,
316
+ "country" => $country,
317
+ "isActive" => $isActive,
318
+ "vatId" => $vatId
319
+ ));
320
+ return $result !== false;
321
+ }
322
+
323
+ /**
324
+ * Get account current user information (based on $this->userId)
325
+ *
326
+ * @return array
327
+ */
328
+ public function getUser()
329
+ {
330
+ $user = $this->call('getUser');
331
+ return $user;
332
+ }
333
+
334
+ public function getUserList()
335
+ {
336
+ $userList = $this->call('getUserList');
337
+ return $userList;
338
+ }
339
+
340
+ /**
341
+ * Delete user information
342
+ *
343
+ * @return bool
344
+ */
345
+ public function deleteUser()
346
+ {
347
+ $result = $this->call('deleteUser');
348
+ return $result !== false ? true : false;
349
+ }
350
+
351
+ /**
352
+ * @depricated will be replaced by getMusic for music packages and getPlans() for complex application plans
353
+ * @TODO: think this through again
354
+ */
355
+ public function getPackages()
356
+ {
357
+ $result = $this->call('getPackages');
358
+ return $result;
359
+ }
360
+
361
+ /**
362
+ * Add package to user packages
363
+ * @param packageType string (editor | music)
364
+ * @param packageId int
365
+ * @return bool
366
+ * @depricated will be removed by activateMusicPackage() and activatePlan()
367
+ * @TODO: TBD
368
+ */
369
+ public function activatePackage($packageType, $packageId)
370
+ {
371
+ $result = $this->call('activatePackage', array(
372
+ 'packageType' => $packageType,
373
+ 'packageId' => $packageId,
374
+ ));
375
+ return $result !== false;
376
+ }
377
+
378
+ public function deactivatePackage($packageType, $packageId)
379
+ {
380
+ $result = $this->call('deactivatePackage', array(
381
+ 'packageType' => $packageType,
382
+ 'packageId' => $packageId,
383
+ ));
384
+ return $result !== false;
385
+ }
386
+
387
+ /**
388
+ *
389
+ * @param $videoId
390
+ * @param $params
391
+ * @return bool
392
+ */
393
+
394
+ public function scheduleDownloadJob($videoId, $resolution, $format, $playerVersion="")
395
+ {
396
+ $result = $this->call('scheduleDownloadJob', array(
397
+ 'videoId' => $videoId,
398
+ 'resolution' => $resolution,
399
+ 'format' => $format,
400
+ 'playerVersion' => $playerVersion
401
+ )
402
+ );
403
+
404
+ if ($result !== false) {
405
+ return $result;
406
+ }
407
+ return false;
408
+ }
409
+
410
+ /**
411
+ * Get list of picture pool services
412
+ *
413
+ * @return bool false if error, array of services names otherwise
414
+ */
415
+ public function getPicturePoolServices()
416
+ {
417
+ $result = $this->call('getPicturePoolServices');
418
+ return $result !== false ? $result['services'] : false;
419
+ }
420
+
421
+ /**
422
+ * Get list of picture pool service galleries
423
+ * @param service string
424
+ *
425
+ * @return bool false if error, array of galleries names otherwise
426
+ */
427
+ public function getPicturePoolGalleries($service)
428
+ {
429
+ $result = $this->call('getPicturePoolGalleries', array('service' => $service));
430
+ return $result !== false ? $result['galleries'] : false;
431
+ }
432
+
433
+ /**
434
+ * Get pictures from gallery
435
+ * @param service string
436
+ *
437
+ * @param gallery string
438
+ *
439
+ * @return bool false if error, array of pictures with different formats otherwise
440
+ */
441
+ public function getPicturePool($service, $gallery)
442
+ {
443
+ $result = $this->call('getPicturePool', array(
444
+ 'service' => $service,
445
+ 'gallery' => $gallery,
446
+ ));
447
+ return $result !== false ? $result['pictures'] : false;
448
+ }
449
+
450
+ /**
451
+ * Get error
452
+ *
453
+ * @return string error.
454
+ */
455
+ public function getError()
456
+ {
457
+ if (!empty($this->error)) {
458
+ return "({$this->errorCode}) {$this->error}";
459
+ } else {
460
+ return "Unknown error.";
461
+ }
462
+ }
463
+
464
+ /**
465
+ * Enable debug
466
+ *
467
+ */
468
+ public function enableDebug()
469
+ {
470
+ $this->debug = true;
471
+ }
472
+
473
+ /**
474
+ * Get debug data
475
+ *
476
+ * @return array debug data
477
+ */
478
+ public function getDebugData()
479
+ {
480
+ return $this->debugData;
481
+ }
482
+
483
+ private function call($controller, $params = array(), $postFilePath = '')
484
+ {
485
+ $url = $this->apiURL . $controller;
486
+ foreach ($params as $key => $value) {
487
+ // todo: remove the json part, it's strange
488
+ if (is_array($value)) $params[$key] = json_encode($value);
489
+ elseif (is_bool($value)) $params[$key] = $value == true ? '1' : '0';
490
+ }
491
+ $postFields = array_merge($params, array(
492
+ 'apiId' => $this->apiId,
493
+ 'apiSecret' => $this->apiSecret,
494
+ 'lang' => $this->lang,
495
+ ));
496
+
497
+ if (!is_null($this->userId))
498
+ $postFields['userId'] = $this->userId;
499
+
500
+ if ($this->debug) $this->debugData = array(
501
+ 'url' => $url,
502
+ 'postFields' => $postFields,
503
+ );
504
+
505
+ switch ($this->callMethod) {
506
+ case 'ZendClient':
507
+ $responce = $this->makeZendClientRequest($url, $postFields, $postFilePath);
508
+ break;
509
+ case 'Curl':
510
+ $responce = $this->makeCurlRequest($url, $postFields, $postFilePath);
511
+ break;
512
+ }
513
+
514
+ $result = json_decode($responce, true);
515
+
516
+ if (is_null($result)) {
517
+ $e = json_last_error();
518
+ $this->error = 'JSON ERROR: '.$e;
519
+ if ($e == JSON_ERROR_SYNTAX) {
520
+ $len = strlen($responce);
521
+ $this->error = "JSON_ERROR_SYNTAX " .$len;
522
+ }
523
+ return false;
524
+ }
525
+
526
+ if ($this->debug) $this->debugData['result'] = $result;
527
+ if ($result['code'] != 200) {
528
+ $this->error = isset($result['message']) ? $result['message'] : 'Unknown error.';
529
+ $this->errorCode = isset($result['code']) ? (int) $result['code'] : -1;
530
+ return false;
531
+ }
532
+ $this->error = null;
533
+ return isset($result['result']) ? $result['result'] : array();
534
+ }
535
+
536
+ private function makeCurlRequest($url, $postFields, $postFilePath = '')
537
+ {
538
+ if ($postFilePath != '') $postFields['postFile']='@'.$postFilePath;
539
+
540
+ $ch = curl_init($url);
541
+ curl_setopt_array($ch, array(
542
+ CURLOPT_HEADER => false,
543
+ CURLOPT_RETURNTRANSFER => true,
544
+ CURLOPT_POST => true,
545
+ CURLOPT_POSTFIELDS => $postFields,
546
+ ));
547
+ if (!is_null($this->curlCookieFile)) {
548
+ curl_setopt($ch, CURLOPT_COOKIEFILE, $this->curlCookieFile);
549
+ curl_setopt($ch, CURLOPT_COOKIEJAR, $this->curlCookieFile);
550
+ }
551
+ try {
552
+ $responce = curl_exec($ch);
553
+ } catch (Exception $e) {
554
+ $this->error = 'connection error';
555
+ if ($this->debug) $this->debugData['error'] = $e->getMessage();
556
+ return false;
557
+ }
558
+ if ($this->debug) $this->debugData['response'] = $responce;
559
+ curl_close($ch);
560
+ if (!$responce) {
561
+ $this->error = 'connection error';
562
+ if ($this->debug) $this->debugData['error'] .= ' curl_exec returns false';
563
+ return false;
564
+ }
565
+ return $responce;
566
+ }
567
+
568
+ private function makeZendClientRequest($url, $postFields, $postFilePath = '')
569
+ {
570
+ $client = new Zend_Http_Client($url);
571
+ $client->setCookieJar();
572
+ $client->setParameterPost($postFields);
573
+ if ($postFilePath != '') $client->setFileUpload($postFilePath, basename($postFilePath));
574
+ try {
575
+ $response = $client->request('POST');
576
+ } catch (Zend_Http_Client_Adapter_Exception $e) {
577
+ $this->error = 'connection error';
578
+ if ($this->debug) $this->debugData['error'] = $e->getMessage();
579
+ return false;
580
+ }
581
+ if ($this->debug) $this->debugData['response'] = $response->getBody();
582
+ return $response->getBody();
583
+ }
584
+ }
app/code/community/Trivid/Clipgenerator/lib/clipgenerator/Frame.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Frame {
4
+ public $number = 0;
5
+ public $picture;
6
+ public $lowerThirds = array();
7
+ public $backgroundColor = null;
8
+ public $backgroundPicture = null;
9
+
10
+ function __construct(Picture $picture=null, $number=0) {
11
+ $this->picture = $picture;
12
+ $this->number = 0;
13
+ }
14
+
15
+ public static function withLowerThird(Picture $picture, LowerThird $lowerThird, $number = 0) {
16
+ $frame = new Frame($picture, $number);
17
+ $frame->addLowerThird($lowerThird);
18
+ return $frame;
19
+ }
20
+
21
+ public function addLowerThird(LowerThird $lowerThird) {
22
+ array_push($this->lowerThirds, $lowerThird);
23
+ }
24
+
25
+ public function getLowerThirds() {
26
+ return $this->lowerThirds;
27
+ }
28
+
29
+ public function clearLowerThirds() {
30
+ $this->lowerThirds = array();
31
+ }
32
+
33
+ public static function fromXml($xmlString) {
34
+ $frameElement = new SimpleXMLElement($xmlString);
35
+ $frame = new Frame();
36
+ $frame->number = (string) $frameElement->number;
37
+ $frame->backgroundColor = $frameElement->background ? (string)$frameElement->background->color : null;
38
+ $pictureXmlString = $frameElement->picture->asXml();
39
+ if (!empty($pictureXmlString)) {
40
+ $frame->picture = Picture::fromXml($pictureXmlString);
41
+ }
42
+
43
+ if($frameElement->lowerThirds && $frameElement->lowerThirds->count() > 0) {
44
+ foreach ($frameElement->lowerThirds->lowerThird as $lowerThirdElement) {
45
+ $lowerThirdString = $lowerThirdElement->asXml();
46
+ $lowerThird = LowerThird::fromXml($lowerThirdString);
47
+ $frame->addLowerThird($lowerThird);
48
+ }
49
+ }
50
+
51
+ return $frame;
52
+ }
53
+
54
+ public function asXml() {
55
+ $frame = new SimpleXMLElement('<frame></frame>');
56
+ $frame->addChild('number', $this->number);
57
+ if ($this->backgroundColor) {
58
+ $frame->addChild('background');
59
+ $frame->background->addChild('color', $this->backgroundColor);
60
+ }
61
+ $this->addChildFromString($frame, $this->picture->asXml());
62
+ $lowerThirds = $frame->addChild('lowerThirds');
63
+ foreach($this->lowerThirds as $lowerTrhid) {
64
+ $this->addChildFromString($lowerThirds, $lowerTrhid->asXml());
65
+ }
66
+ return $frame->asXML();
67
+ }
68
+
69
+ private function addChildFromString($parent, $childString) {
70
+ $domparent = dom_import_simplexml($parent);
71
+ $domchild = dom_import_simplexml(new SimpleXMLElement($childString));
72
+ $domchild = $domparent->ownerDocument->importNode($domchild, true);
73
+ $domparent->appendChild($domchild);
74
+ }
75
+ }
76
+ //
77
+ // <frame>
78
+ //<number>0</number>
79
+ //<picture width="1" height="1" alpha="1">
80
+ // <id></id>
81
+ //</picture>
82
+ //<lowerThirds>
83
+ // <lowerThird width="1" height="0.4" horizontalAlign="center" verticalAlign="bottom" alpha="0.7">
84
+ // <color>0</color>
85
+ // <link></link>
86
+ // <text color="16777215" fontSize="31" bold="false" italic="false" underline="false"></text>
87
+ // </lowerThird>
88
+ //</lowerThirds>
89
+ //</frame>
app/code/community/Trivid/Clipgenerator/lib/clipgenerator/Logo.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Logo {
4
+ public $id;
5
+ public $width;
6
+ public $height;
7
+ public $alpha;
8
+ public $url;
9
+ public $link;
10
+ public $verticalPosition;
11
+ public $horizontalPosition;
12
+ public $showInStartPage;
13
+ public $showInEndPage;
14
+ public $showInTimeline;
15
+
16
+ public static function fromXml($xmlString) {
17
+ $element = new SimpleXMLElement($xmlString);
18
+ $logo = new Logo();
19
+ $logo->id = (string)$element->id;
20
+ $logo->width = $element['width'];
21
+ $logo->height = $element['height'];
22
+ $logo->alpha = $element['alpha'];
23
+
24
+ $logo->verticalPosition = $element->position['verticalAlign'];
25
+ $logo->horizontalPosition = $element->position['horizontalAlign'];
26
+
27
+ $logo->url = (string) $element->url;
28
+ $logo->link = (string) $element->link;
29
+ $logo->showInEndPage = strtolower((string) $element->showInEndPage ) == 'true' ? true : false;
30
+ $logo->showInStartPage = strtolower((string) $element->showInStartPage) == 'true' ? true : false;
31
+ $logo->showInTimeline = strtolower((string) $element->showInTimeline) == 'true' ? true : false;
32
+ return $logo;
33
+ }
34
+
35
+ public function asXml() {
36
+ $logo = new SimpleXMLElement('<logo></logo>');
37
+ //print_r($logo);
38
+ $logo->id = $this->id;
39
+ $width = (string)$this->width;
40
+ if($width=='') $width = 0;
41
+ $height = (string)$this->height;
42
+ if($height=='') $width = 0;
43
+ if (!is_null($this->width))
44
+ $logo->addAttribute('width', number_format($width, 4, '.', ''));
45
+ if (!is_null($this->height))
46
+ $logo->addAttribute('height', number_format($height, 4, '.', ''));
47
+ $logo->addAttribute('alpha', number_format((string)$this->alpha, 4, '.', ''));
48
+ $logo->url = $this->url;
49
+ $logo->link = $this->link;
50
+ $position = $logo->addChild('position');
51
+ $position->addAttribute('verticalAlign', $this->verticalPosition);
52
+ $position->addAttribute('horizontalAlign', $this->horizontalPosition);
53
+ $logo->addChild('showInStartPage', $this->showInStartPage ? 'true' : 'false');
54
+ $logo->addChild('showInEndPage', $this->showInEndPage ? 'true' : 'false');
55
+ $logo->addChild('showInTimeline', $this->showInTimeline ? 'true' : 'false');
56
+ $xmlString = $logo->asXML();
57
+ return $xmlString;
58
+ }
59
+ }
60
+
61
+
62
+
63
+ //<logo width="0.2" height="0.2" alpha="1">
64
+ // <id />
65
+ // <url />
66
+ // <link />
67
+ // <position verticalAlign="top" horizontalAlign="right" />
68
+ // <showInStartPage>false</showInStartPage>
69
+ // <showInEndPage>false</showInEndPage>
70
+ // <showInTimeline>true</showInTimeline>
71
+ //</logo>
app/code/community/Trivid/Clipgenerator/lib/clipgenerator/LowerThird.php ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class LowerThird {
4
+ const ALIGN_LEFT = 'left';
5
+ const ALIGN_CENTER = 'center';
6
+ const ALIGN_RIGHT = 'right';
7
+ const ALIGN_TOP = 'top';
8
+ const ALIGN_MIDDLE = 'middle';
9
+ const ALIGN_BOTTOM = 'bottom';
10
+
11
+ const POSITION_TYPE_ABSOLUTE = 'absolute';
12
+ const POSITION_TYPE_ALIGN = 'align';
13
+
14
+ const COLOR_BLACK = 0x000000;
15
+ const COLOR_RED = 0xFF0000;
16
+ const COLOR_GREEN = 0x00FF00;
17
+ const COLOR_BLUE = 0x0000FF;
18
+ const COLOR_WHITE = 0xFFFFFF;
19
+
20
+ public $width;
21
+ public $height;
22
+ public $margin;
23
+ public $horizontalAlign;
24
+ public $verticalAlign;
25
+ public $alpha;
26
+ public $backgroundColor = LowerThird::COLOR_WHITE;
27
+ public $link = null;
28
+
29
+ public $xPosition = 0; // since 3.0.5
30
+ public $yPosition = 0; // since 3.0.5
31
+ public $positioningType = self::POSITION_TYPE_ALIGN; // since 3.0.5
32
+
33
+ public $text;
34
+ public $textColor;
35
+ public $textFontSize;
36
+ public $textFontFamily; // since 3.0.3
37
+ public $textFontWeight; // since 3.0.3
38
+ public $textFontStyle; // since 3.0.3
39
+ public $textIsBold; // replaced in 3.0.3 with fontWeight
40
+ public $textIsItalic; // replaced in 3.0.3 with fontStyle
41
+ public $textIsUnderline;
42
+ public $textIsHTML;
43
+
44
+ public $textHorizontalAlign = self::ALIGN_CENTER;
45
+ public $textVerticalAlign = self::ALIGN_MIDDLE;
46
+ public $textOutlineColor = LowerThird::COLOR_WHITE;
47
+ public $textOutlineWidth = 0;
48
+ public $textMinFontSize = 30;
49
+ public $textMargin = 0;
50
+
51
+ public $picture_id;
52
+
53
+ public $picture_width;
54
+ public $picture_height;
55
+ public $picture_alpha;
56
+
57
+ public $picture_url;
58
+ public $picture_thumbnailUrl;
59
+
60
+ public $picture_url_240p;
61
+ public $picture_url_360p;
62
+ public $picture_url_480p;
63
+ public $picture_url_720p;
64
+ public $picture_storage;
65
+
66
+ function __construct($width=1.0, $height=0.25, $horizontalAlign = LowerThird::ALIGN_CENTER, $verticalAlign = LowerThird::ALIGN_MIDDLE, $alpha = 0.6)
67
+ {
68
+ // width="0.0-1.0" height="0.0-1.0" horizontalAlign="left|center|right" verticalAlign="top|middle|bottom" alpha="0.0-1.0">
69
+ $this->width = $width;
70
+ $this->height = $height;
71
+ $this->horizontalAlign = $horizontalAlign;
72
+ $this->verticalAlign = $verticalAlign;
73
+ $this->alpha = $alpha;
74
+ $this->picture_url = '';
75
+
76
+ $this->textFontFamily = "cgFontDefault";
77
+ }
78
+
79
+ public function setText($text, $color=LowerThird::COLOR_WHITE, $size=30, $bold=false, $italic=false, $underline=false,
80
+ $horizontalAlign=LowerThird::ALIGN_CENTER, $verticalAlign=LowerThird::ALIGN_MIDDLE) {
81
+ $this->text = $text;
82
+ $this->textColor = $color;
83
+ $this->textFontSize = $size;
84
+ $this->textIsBold = $bold;
85
+ $this->textIsItalic = $italic;
86
+ $this->textIsUnderline = $underline;
87
+
88
+ $this->textFontWeight = $bold ? "bold" : "normal";
89
+ $this->textFontStyle = $italic ? "italic" : "normal";
90
+
91
+ $this->textHorizontalAlign = $horizontalAlign;
92
+ $this->textVerticalAlign = $verticalAlign;
93
+ }
94
+
95
+ public static function fromXml($xmlString) {
96
+ $element = new SimpleXMLElement($xmlString);
97
+
98
+ $lowerThird = new LowerThird();
99
+ $lowerThird->alpha = (string)$element['alpha'];
100
+ $lowerThird->width = (string)$element['width'];
101
+ $lowerThird->height = (string)$element['height'];
102
+ $xpos = (string)$element['xPosition'];
103
+ $ypos = (string)$element['yPosition'];
104
+ $lowerThird->xPosition = !empty($xpos) ? floatval($xpos) : 0.0;
105
+ $lowerThird->yPosition = !empty($ypos) ? floatval($ypos) : 0.0;
106
+ $lowerThird->positioningType = (string)$element['positioningType'];
107
+ if ($element['margin']) $lowerThird->margin = (string)$element['margin'];
108
+ $lowerThird->horizontalAlign = (string)$element['horizontalAlign'];
109
+ $lowerThird->verticalAlign = (string)$element['verticalAlign'];
110
+ $lowerThird->backgroundColor = (string)$element->color;
111
+ $lowerThird->text = (string)$element->text;
112
+ $lowerThird->link = (string)$element->link;
113
+ $lowerThird->textColor = (string)$element->text['color'];
114
+ $lowerThird->textFontSize = (string)$element->text['fontSize'];
115
+ if ($element->text['minFontSize']) $lowerThird->textMinFontSize = (string)$element->text['minFontSize'];
116
+ $lowerThird->textIsBold = (string)$element->text['bold'] == 'true' ? true : false;
117
+ $lowerThird->textIsItalic = (string)$element->text['italic'] == 'true' ? true : false;
118
+ $lowerThird->textIsUnderline = (string)$element->text['underline'] == 'true' ? true : false;
119
+ $lowerThird->textIsHTML = (string)$element->text['isHtml'] == 'false' ? false : true;
120
+
121
+ $lowerThird->textHorizontalAlign = (string)$element->text['horizontalAlign'];
122
+ $lowerThird->textVerticalAlign = (string)$element->text['verticalAlign'];
123
+ $lowerThird->textOutlineColor = (string)$element->text['outlineColor'];
124
+ $lowerThird->textOutlineWidth = (string)$element->text['outlineWidth'];
125
+
126
+ $lowerThird->textFontFamily = (string)$element->text['fontFamily'];
127
+ $lowerThird->textFontStyle = (string)$element->text['fontStyle'];
128
+ $lowerThird->textFontWeight = (string)$element->text['fontWeight'];
129
+
130
+ if ($element->text['margin']) $lowerThird->textMargin = (string)$element->text['margin'];
131
+
132
+ if($element->picture){
133
+ $lowerThird->picture_width = (string) $element->picture['width'];
134
+ $lowerThird->picture_height = (string) $element->picture['height'];
135
+ $lowerThird->picture_alpha = (string) $element->picture['alpha'];
136
+ $lowerThird->picture_url = (string) $element->picture->url;
137
+ $lowerThird->picture_thumbnailUrl = (string) $element->picture->thumb_url;
138
+ $lowerThird->picture_url_240p = (string) $element->picture->url_240p;
139
+ $lowerThird->picture_url_360p = (string) $element->picture->url_360p;
140
+ $lowerThird->picture_url_480p = (string) $element->picture->url_480p;
141
+ $lowerThird->picture_url_720p = (string) $element->picture->url_720p;
142
+ $lowerThird->picture_storage = (string) $element->picture->storage;
143
+ }
144
+
145
+ return $lowerThird;
146
+ }
147
+
148
+ public function asXml() {
149
+ $xml = new SimpleXMLElement('<lowerThird></lowerThird>');
150
+ $xml->addAttribute('positioningType', $this->positioningType);
151
+ $xml->addAttribute('xPosition', number_format($this->xPosition, 4, '.', ''));
152
+ $xml->addAttribute('yPosition', number_format($this->yPosition, 4, '.', ''));
153
+ $xml->addAttribute('width', number_format($this->width, 4, '.', ''));
154
+ $xml->addAttribute('height', number_format($this->height, 4, '.', ''));
155
+ $xml->addAttribute('alpha', number_format((float)$this->alpha, 4, '.', ''));
156
+ $xml->addAttribute('margin', number_format($this->margin, 4, '.', ''));
157
+ $xml->addAttribute('horizontalAlign', $this->horizontalAlign);
158
+ $xml->addAttribute('verticalAlign', $this->verticalAlign);
159
+ $xml->addChild('color', $this->backgroundColor);
160
+ $xml->addChild('link', $this->link);
161
+
162
+ $node = $xml->addChild('text'); // fix: add child does not automatically encode ampersands. meh.
163
+ $node = dom_import_simplexml($node);
164
+ $no = $node->ownerDocument;
165
+ $node->appendChild($no->createCDATASection($this->text));
166
+
167
+ $xml->text->addAttribute('color', $this->textColor);
168
+ $xml->text->addAttribute('fontSize', number_format(($this->textFontSize=='')?0:$this->textFontSize, 4, '.', ''));
169
+ $xml->text->addAttribute('minFontSize', number_format(($this->textMinFontSize=='')?0:$this->textMinFontSize, 4, '.', ''));
170
+ $xml->text->addAttribute('bold', $this->textIsBold ? 'true' : 'false');
171
+ $xml->text->addAttribute('italic', $this->textIsItalic ? 'true' : 'false');
172
+ $xml->text->addAttribute('underline', $this->textIsUnderline? 'true' : 'false');
173
+ $xml->text->addAttribute('isHtml', $this->textIsHTML? 'true' : 'false');
174
+
175
+ $xml->text->addAttribute('horizontalAlign', $this->textHorizontalAlign);
176
+ $xml->text->addAttribute('verticalAlign', $this->textVerticalAlign);
177
+
178
+ $xml->text->addAttribute('outlineColor', $this->textOutlineColor);
179
+ $xml->text->addAttribute('outlineWidth', number_format(($this->textOutlineWidth=='')?0:$this->textOutlineWidth, 4, '.', ''));
180
+ $xml->text->addAttribute('margin', number_format(($this->textMargin=='')?0:$this->textMargin, 4, '.', ''));
181
+
182
+ $xml->text->addAttribute('fontFamily', $this->textFontFamily);
183
+ $xml->text->addAttribute('fontWeight', $this->textFontWeight);
184
+ $xml->text->addAttribute('fontStyle', $this->textFontStyle);
185
+
186
+ if($this->picture_id > 0){
187
+ $xml->addChild('picture');
188
+ $xml->picture->addAttribute('width', number_format($this->picture_width, 4, '.', ''));
189
+ $xml->picture->addAttribute('height', number_format($this->picture_height, 4, '.', ''));
190
+ $xml->picture->addAttribute('alpha', number_format((float)$this->picture_alpha, 4, '.', ''));
191
+ $xml->picture->addChild('id', $this->picture_id);
192
+ $xml->picture->addChild('url', $this->picture_url);
193
+ $xml->picture->addChild('url_240p', $this->picture_url_240p);
194
+ $xml->picture->addChild('url_360p', $this->picture_url_360p);
195
+ $xml->picture->addChild('url_480p', $this->picture_url_480p);
196
+ $xml->picture->addChild('url_720p', $this->picture_url_720p);
197
+ $xml->picture->addChild('thumb_url', $this->picture_thumbnailUrl);
198
+ $xml->picture->addChild('storage', $this->picture_storage);
199
+ }
200
+
201
+ return $xml->asXml();
202
+ }
203
+ }
204
+
205
+ // <lowerThird width="1" height="0.4" horizontalAlign="center" verticalAlign="bottom" alpha="0.7">
206
+ // <color>0</color>
207
+ // <link></link>
208
+ // <text color="16777215" fontSize="31" bold="false" italic="false" underline="false"></text>
209
+ // </lowerThird>
app/code/community/Trivid/Clipgenerator/lib/clipgenerator/Picture.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Picture
4
+ {
5
+ // using external picture urls is not implemented yet
6
+ const INTERNAL_STORAGE = 'internal';
7
+ const EXTERNAL_STORAGE = 'external';
8
+
9
+ public $id;
10
+
11
+ public $width;
12
+ public $height;
13
+ public $alpha;
14
+
15
+ public $url;
16
+ public $thumbnailUrl;
17
+ public $webUrl;
18
+
19
+ public $url_240p;
20
+ public $url_360p;
21
+ public $url_480p;
22
+ public $url_720p;
23
+
24
+ public $storage;
25
+
26
+ function __construct($pictureId = null, $width = 1.0, $height = 1.0, $alpha = 1.0)
27
+ {
28
+ $this->id = $pictureId;
29
+ $this->width = $width;
30
+ $this->height = $height;
31
+ $this->alpha = $alpha;
32
+ $this->storage = Picture::INTERNAL_STORAGE;
33
+ }
34
+
35
+ public static function withInternalId($pictureId, $width = 1.0, $height = 1.0, $alpha = 1.0)
36
+ {
37
+ $pic = new Picture($pictureId, $width, $height, $alpha);
38
+ $pic->setStorage(Picture::INTERNAL_STORAGE);
39
+ return $pic;
40
+ }
41
+
42
+ public static function withPublicUrl($publicUrl, $width = 1.0, $height = 1.0, $alpha = 1.0)
43
+ {
44
+ $pic = new Picture(null, $width, $height, $alpha);
45
+ $pic->storage = Picture::EXTERNAL_STORAGE;
46
+ $pic->url = $publicUrl;
47
+ }
48
+
49
+ public static function fromXml($xmlString) {
50
+ $pictureXml = new SimpleXMLElement($xmlString);
51
+ $picture = new Picture();
52
+ $picture->id = (string)$pictureXml->id;
53
+ $picture->width = (string) $pictureXml['width'];
54
+ $picture->height = (string) $pictureXml['height'];
55
+ $picture->alpha = (string) $pictureXml['alpha'];
56
+ $picture->url = (string) $pictureXml->url;
57
+ $picture->webUrl = (string) $pictureXml->web_url;
58
+ $picture->thumbnailUrl = (string) $pictureXml->thumb_url;
59
+ $picture->url_240p = (string) $pictureXml->url_240p;
60
+ $picture->url_360p = (string) $pictureXml->url_360p;
61
+ $picture->url_480p = (string) $pictureXml->url_480p;
62
+ $picture->url_720p = (string) $pictureXml->url_720p;
63
+ $picture->storage = (string) $pictureXml->storage;
64
+ return $picture;
65
+ }
66
+
67
+ public function asXml() {
68
+ $xml = new SimpleXMLElement('<picture></picture>');
69
+ $xml->addChild('id', $this->id);
70
+
71
+ $xml->addChild('url', $this->url);
72
+ $xml->addChild('thumb_url', $this->thumbnailUrl);
73
+ $xml->addChild('web_url', $this->webUrl);
74
+ $xml->addChild('url_240p', $this->url_240p);
75
+ $xml->addChild('url_360p', $this->url_360p);
76
+ $xml->addChild('url_480p', $this->url_480p);
77
+ $xml->addChild('url_720p', $this->url_720p);
78
+ $xml->addChild('storage', $this->storage);
79
+
80
+ $xml->addAttribute('height', number_format($this->height, 4, '.', ''));
81
+ $xml->addAttribute('width', number_format($this->width, 4, '.', ''));
82
+ $xml->addAttribute('alpha', number_format($this->alpha, 4, '.', ''));
83
+ return $xml->asXML();
84
+ }
85
+ }
86
+
87
+ // <picture width = "0.0-1.0" height = "0.0-1.0" alpha ="0.0-1.0" >
88
+ // <id > unique_id</id >
89
+ // <url > original_image_url</url >
90
+ // <thumb_url > thumb_image_url</thumb_url >
91
+ // <web_url > web_image_url</web_url >
92
+ // <url_240p > http://user-data.clipgenerator.com/.../1c79deac_240p.jpg</url_240p>
93
+ // <url_360p > http://user-data.clipgenerator.com/.../1c79deac_240p.jpg</url_360p>
94
+ // <url_480p > http://user-data.clipgenerator.com/.../1c79deac_240p.jpg</url_480p>
95
+ // <url_720p > http://user-data.clipgenerator.com/.../1c79deac_240p.jpg</url_720p>
96
+ // <storage > external |internal </storage >
97
+ // </picture >
app/code/community/Trivid/Clipgenerator/lib/clipgenerator/Video.php ADDED
@@ -0,0 +1,572 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Video
4
+ {
5
+ const FORMAT_240p = '240p';
6
+ const FORMAT_360p = '360p';
7
+ const FORMAT_480p = '480p';
8
+ const FORMAT_720p = '720p';
9
+
10
+ const RATIO_16x9 = '16x9';
11
+ const RATIO_4x3 = '4x3';
12
+
13
+ public $id;
14
+
15
+ // video metadata
16
+ public $title;
17
+ public $producer;
18
+ public $description;
19
+ public $keywords;
20
+ public $copyright;
21
+ public $content;
22
+ public $targetAudience;
23
+
24
+ // video configuration
25
+ public $songId;
26
+ public $songUrl;
27
+
28
+ public $designId;
29
+ public $designUrl;
30
+
31
+ public $filter;
32
+ public $maxClipLength;
33
+
34
+ // default font
35
+ public $defaultFontFamily = 'cgFontDefault';
36
+ public $defaultFontWeight = 'normal';
37
+ public $defaultFontStyle = 'normal';
38
+
39
+ // start page
40
+ public $startPageEnabled;
41
+ public $startPageDuration;
42
+ public $startPageShowLowerThirds;
43
+
44
+ // end page
45
+ public $endPageEnabled;
46
+ public $endPageDuration;
47
+ public $endPageShowLowerThirds;
48
+ public $endPageOnEndActionName;
49
+ public $endPageOnEndActionParameter;
50
+
51
+ // global lower thirds (will be shown on very frame)
52
+ public $globalLowerThirds;
53
+
54
+ // logo configuration
55
+ public $logo;
56
+
57
+ // video urls
58
+ public $downloadUrl;
59
+ public $thumbnailUrl;
60
+
61
+ public $format = Video::FORMAT_360p;
62
+ public $ratio = Video::RATIO_16x9;
63
+ public $frames = array();
64
+
65
+ public $fonts = array();
66
+
67
+ function __construct($title = null, $designId = null, $songId = null, $format = Video::FORMAT_360p, $ratio = Video::RATIO_16x9)
68
+ {
69
+ $this->title = $title;
70
+ $this->songId = $songId;
71
+ $this->designId = $designId;
72
+
73
+ $this->globalLowerThirds = array();
74
+
75
+ if (!empty($format)) $this->format = $format;
76
+ if (!empty($ratio)) $this->format = $ratio;
77
+ }
78
+
79
+ public function addGlobalLowerThird(LowerThird $lowerThird) {
80
+ array_push($this->globalLowerThirds, $lowerThird);
81
+ }
82
+
83
+ public function clearGlobalLowerThirds() {
84
+ $this->globalLowerThirds = array();
85
+ }
86
+
87
+ public function addFrame(Frame $frame)
88
+ {
89
+ array_push($this->frames, $frame);
90
+ }
91
+
92
+ public function clearFrames()
93
+ {
94
+ $this->log->debug("Clearing frames");
95
+ $this->frames = array();
96
+ }
97
+
98
+ public function addFont($fontFamily, $weight='normal', $style='normal', $src='') {
99
+ $font = array(
100
+ "fontFamily" => $fontFamily,
101
+ "fontWeight" => $weight,
102
+ "fontStyle" => $style,
103
+ "src" => $src
104
+ );
105
+ array_push($this->fonts, $font);
106
+ }
107
+
108
+ public static function fromXml($xmlString) {
109
+ $element = new SimpleXMLElement($xmlString);
110
+ $video = new Video();
111
+
112
+ // video id
113
+ $video->id = (string)$element->video->id;
114
+
115
+ // video metadata
116
+ $video->title = (string)$element->video->title;
117
+ $video->producer = (string)$element->video->producer;
118
+ $video->description = (string)$element->video->description;
119
+ $video->keywords = (string)$element->video->keywords;
120
+ $video->copyright = (string)$element->video->copyright;
121
+ $video->content = (string)$element->video->content;
122
+ $video->targetAudience = (string)$element->video->targetAudience;
123
+ $video->thumbnailUrl = (string)$element->video->thumbnail['url'];
124
+ $video->downloadUrl = (string)$element->video->download['url'];
125
+
126
+ // video timeline
127
+ $timeline = $element->timeline;
128
+ $config = $timeline->config;
129
+ $video->songId = (string)$config->song['id'];
130
+ $video->songUrl = trim((string)$config->song);
131
+ $video->designId = (string)$config->variation['id'];
132
+ $video->designUrl = trim((string)$config->variation);
133
+
134
+ $video->filter = (string)$config->filter;
135
+ $video->ratio = (string)$config->ratio;
136
+ $video->format = (string)$config->format['name'];
137
+
138
+ $video->maxClipLength = (string)$config->clipMaxLenght;
139
+
140
+ // start + end page
141
+ $video->startPageEnabled = strtolower((string)$config->startPage->enabled) == 'true' ? true : false;
142
+ $video->startPageShowLowerThirds = strtolower((string)$config->startPage->showLowerThirds) == 'true' ? true : false;
143
+ $video->startPageDuration = (string)$config->startPage->duration;
144
+
145
+ $video->endPageEnabled = strtolower((string)$config->endPage->enabled) == 'true' ? true : false;
146
+ $video->endPageShowLowerThirds = strtolower((string)$config->endPage->showLowerThirds) == 'true' ? true : false;
147
+ $video->endPageDuration = (string)$config->endPage->duration;
148
+ $video->endPageOnEndActionName = (string)$config->endPage->onEndAction['name'];
149
+ $video->endPageOnEndActionParameter = (string)$config->endPage->onEndAction['parameter'];
150
+
151
+ // read global lower thirds
152
+
153
+ if(isset($timeline->lowerThirds) && $timeline->lowerThirds->count() > 0) {
154
+ foreach ($timeline->lowerThirds->lowerThird as $lt) {
155
+ $lowerThirdString = $lt->asXml();
156
+ $lowerThird = LowerThird::fromXml($lowerThirdString);
157
+ $video->addGlobalLowerThird($lowerThird);
158
+ }
159
+ }
160
+
161
+ // read frames
162
+
163
+ if(isset($timeline->frames) && $timeline->frames->count() > 0) {
164
+ foreach ($timeline->frames->frame as $f) {
165
+ $frameString = $f->asXml();
166
+ $frame = Frame::fromXml($frameString);
167
+ $video->addFrame($frame);
168
+ }
169
+ }
170
+
171
+ // read logo
172
+ if(isset($element->logo)) {
173
+ $logoString = $element->logo->asXml();
174
+ $logo = Logo::fromXml($logoString);
175
+ $video->logo = $logo;
176
+ }
177
+
178
+ // read fonts
179
+ if(isset($element->fonts)) {
180
+ foreach ($element->fonts->font as $f) {
181
+ $video->addFont(
182
+ (string) $f['fontFamily'],
183
+ (string) $f['fontWeight'],
184
+ (string) $f['fontStyle'],
185
+ (string) $f['src']
186
+ );
187
+ }
188
+ }
189
+
190
+
191
+ return $video;
192
+ }
193
+
194
+
195
+ public function asXml() {
196
+ $xml = new SimpleXMLElement('<webcart version="2.0"></webcart>');
197
+
198
+ $video = $xml->addChild('video');
199
+ $video->addChild('id', $this->id);
200
+ $video->addChild('title', $this->title);
201
+ $video->addChild('producer', $this->producer);
202
+ $video->addChild('description', $this->description);
203
+ $video->addChild('keywords', $this->keywords);
204
+ $video->addChild('copyright', $this->copyright);
205
+ $video->addChild('content', $this->content);
206
+ $video->addChild('targetAudience', $this->targetAudience);
207
+ $video->addChild('thumbnail');
208
+ $video->thumbnail->addAttribute('url', $this->thumbnailUrl);
209
+ $video->addChild('download');
210
+ $video->download->addAttribute('url', $this->downloadUrl);
211
+
212
+ $timeline = $xml->addChild('timeline');
213
+ $config = $timeline->addChild('config');
214
+ $config->addChild('song', $this->songUrl);
215
+ $config->song->addAttribute('id', $this->songId);
216
+ $config->addChild('variation', $this->designUrl);
217
+ $config->variation->addAttribute('id', $this->designId);
218
+ $config->addChild('filter', $this->filter);
219
+
220
+ $config->addChild('format');
221
+ $config->format->addAttribute('name', $this->format);
222
+ $config->addChild('ratio', $this->ratio);
223
+
224
+ $startPage = $config->addChild('startPage');
225
+ $startPage->addChild('enabled', $this->startPageEnabled ? 'true' : 'false');
226
+ $startPage->addChild('showLowerThirds', $this->startPageShowLowerThirds ? 'true' : 'false');
227
+ $startPage->addChild('duration', $this->startPageDuration);
228
+
229
+ $endPage = $config->addChild('endPage');
230
+ $endPage->addChild('enabled', $this->endPageEnabled ? 'true' : 'false');
231
+ $endPage->addChild('showLowerThirds', $this->endPageShowLowerThirds ? 'true' : 'false');
232
+ $endPage->addChild('duration', $this->endPageDuration);
233
+ $endPage->addChild('onEndAction');
234
+ $endPage->onEndAction->addAttribute('name', $this->endPageOnEndActionName);
235
+ $endPage->onEndAction->addAttribute('parameter', $this->endPageOnEndActionParameter);
236
+
237
+ $config->addChild('clipMaxLenght', $this->maxClipLength);
238
+
239
+ // add global lower thirds
240
+ $lowerThirds = $timeline->addChild('lowerThirds');
241
+ foreach($this->globalLowerThirds as $lowerThird) {
242
+ $this->addChildFromString($lowerThirds, $lowerThird->asXml());
243
+ }
244
+
245
+ // add frames
246
+ $frames = $timeline->addChild('frames');
247
+ foreach($this->frames as $frame) {
248
+ $this->addChildFromString($frames, $frame->asXml());
249
+ }
250
+
251
+ // add logo
252
+ if (isset($this->logo))
253
+ $this->addChildFromString($xml, $this->logo->asXml());
254
+
255
+ // add fonts
256
+ $fontsElement = $xml->addChild('fonts');
257
+ $fontsElement->addAttribute("defaultFontFamily", $this->defaultFontFamily);
258
+ $fontsElement->addAttribute("defaultFontWeight", $this->defaultFontWeight);
259
+ $fontsElement->addAttribute("defaultFontStyle", $this->defaultFontStyle);
260
+
261
+ if (count($this->fonts) > 0) {
262
+ foreach($this->fonts as $font) {
263
+ $fontElement = $fontsElement->addChild("font");
264
+ $fontElement->addAttribute("fontFamily", $font['fontFamily']);
265
+ $fontElement->addAttribute("fontWeight", $font['fontWeight']);
266
+ $fontElement->addAttribute("fontStyle", $font['fontStyle']);
267
+ $fontElement->addAttribute("src", $font['src']);
268
+ }
269
+ }
270
+
271
+ // ignore formats, todo: really ignore this? formats will be injected by the backend when the xml is read
272
+ // so it does not affect the creation of clips at the moment
273
+
274
+ // todo: move this function to the backend, this is the wrong place
275
+ return $xml->asXML();
276
+ }
277
+
278
+ private function addChildFromString($parent, $childString) {
279
+ $domparent = dom_import_simplexml($parent);
280
+ $domchild = dom_import_simplexml(new SimpleXMLElement($childString));
281
+ $domchild = $domparent->ownerDocument->importNode($domchild, true);
282
+ $domparent->appendChild($domchild);
283
+ }
284
+
285
+ private function compactFonts($webcartXml) {
286
+ // list of system provided fonts
287
+ $SYSTEM_FONTS = array(
288
+ array('family'=> 'cgFontDefault', 'weight'=>'normal', 'style'=>'normal', 'src'=>'http://data.clipgenerator.com/fonts/v3/DefaultRegularFont.swf'),
289
+ array('family'=> 'cgFontDefault', 'weight'=>'bold', 'style'=>'normal', 'src'=>'http://data.clipgenerator.com/fonts/v3/DefaultBoldFont.swf'),
290
+ array('family'=> 'cgFontDefault', 'weight'=>'normal', 'style'=>'italic', 'src'=>'http://data.clipgenerator.com/fonts/v3/DefaultItalicFont.swf'),
291
+ array('family'=> 'cgFontDefault', 'weight'=>'bold', 'style'=>'italic', 'src'=>'http://data.clipgenerator.com/fonts/v3/DefaultBoldItalicFont.swf'),
292
+ array('family'=> 'cgFontActionMan', 'weight'=>'normal', 'style'=>'normal', 'src'=>'http://data.clipgenerator.com/fonts/v3/ActionManRegularFont.swf'),
293
+ array('family'=> 'cgFontActionMan', 'weight'=>'bold', 'style'=>'normal', 'src'=>'http://data.clipgenerator.com/fonts/v3/ActionManBoldFont.swf'),
294
+ array('family'=> 'cgFontActionMan', 'weight'=>'normal', 'style'=>'italic', 'src'=>'http://data.clipgenerator.com/fonts/v3/ActionManItalicFont.swf'),
295
+ array('family'=> 'cgFontActionMan', 'weight'=>'bold', 'style'=>'italic', 'src'=>'http://data.clipgenerator.com/fonts/v3/ActionManBoldItalicFont.swf'),
296
+ array('family'=> 'cgFontAnonymousPro', 'weight'=>'normal', 'style'=>'normal', 'src'=>'http://data.clipgenerator.com/fonts/v3/AnonymousProRegularFont.swf'),
297
+ array('family'=> 'cgFontAnonymousPro', 'weight'=>'bold', 'style'=>'normal', 'src'=>'http://data.clipgenerator.com/fonts/v3/AnonymousProBoldFont.swf'),
298
+ array('family'=> 'cgFontAnonymousPro', 'weight'=>'normal', 'style'=>'italic', 'src'=>'http://data.clipgenerator.com/fonts/v3/AnonymousProItalicFont.swf'),
299
+ array('family'=> 'cgFontAnonymousPro', 'weight'=>'bold', 'style'=>'italic', 'src'=>'http://data.clipgenerator.com/fonts/v3/AnonymousProBoldItalicFont.swf'),
300
+ array('family'=> 'cgFontSpecialElite', 'weight'=>'normal', 'style'=>'normal', 'src'=>'http://data.clipgenerator.com/fonts/v3/SpecialEliteRegularFont.swf'),
301
+ array('family'=> 'cgFontNobile', 'weight'=>'normal', 'style'=>'normal', 'src'=>'http://data.clipgenerator.com/fonts/v3/NobileRegularFont.swf'),
302
+ array('family'=> 'cgFontNobile', 'weight'=>'bold', 'style'=>'normal', 'src'=>'http://data.clipgenerator.com/fonts/v3/NobileBoldFont.swf'),
303
+ array('family'=> 'cgFontNobile', 'weight'=>'normal', 'style'=>'italic', 'src'=>'http://data.clipgenerator.com/fonts/v3/NobileItalicFont.swf'),
304
+ array('family'=> 'cgFontNobile', 'weight'=>'bold', 'style'=>'italic', 'src'=>'http://data.clipgenerator.com/fonts/v3/NobileBoldItalicFont.swf'),
305
+ array('family'=> 'cgFontAlegreya', 'weight'=>'normal', 'style'=>'normal', 'src'=>'http://data.clipgenerator.com/fonts/v3/AlegreyaRegularFont.swf'),
306
+ array('family'=> 'cgFontAlegreya', 'weight'=>'bold', 'style'=>'normal', 'src'=>'http://data.clipgenerator.com/fonts/v3/AlegreyaBoldFont.swf'),
307
+ array('family'=> 'cgFontAlegreya', 'weight'=>'normal', 'style'=>'italic', 'src'=>'http://data.clipgenerator.com/fonts/v3/AlegreyaItalicFont.swf'),
308
+ array('family'=> 'cgFontAlegreya', 'weight'=>'bold', 'style'=>'italic', 'src'=>'http://data.clipgenerator.com/fonts/v3/AlegreyaBoldItalicFont.swf'),
309
+ array('family'=> 'cgFontLeagueGothic', 'weight'=>'normal', 'style'=>'normal', 'src'=>'http://data.clipgenerator.com/fonts/v3/LeagueGothicRegularFont.swf'),
310
+ array('family'=> 'cgFontLeagueGothic', 'weight'=>'normal', 'style'=>'italic', 'src'=>'http://data.clipgenerator.com/fonts/v3/LeagueGothicItalicFont.swf'),
311
+ array('family'=> 'cgFontDancingScript', 'weight'=>'normal', 'style'=>'normal', 'src'=>'http://data.clipgenerator.com/fonts/v3/DancingScriptRegularFont.swf'),
312
+ array('family'=> 'cgFontClaireHand', 'weight'=>'normal', 'style'=>'normal', 'src'=>'http://data.clipgenerator.com/fonts/v3/ClaireHandRegularFont.swf'),
313
+ array('family'=> 'cgFontClaireHand', 'weight'=>'bold', 'style'=>'normal', 'src'=>'http://data.clipgenerator.com/fonts/v3/ClaireHandBoldFont.swf'),
314
+ array('family'=> 'cgFontCicleGordita', 'weight'=>'normal', 'style'=>'normal', 'src'=>'http://data.clipgenerator.com/fonts/v3/CicleGorditaRegularFont.swf'),
315
+ array('family'=> 'cgFontCicleGordita', 'weight'=>'normal', 'style'=>'italic', 'src'=>'http://data.clipgenerator.com/fonts/v3/CicleGorditaItalicFont.swf'),
316
+ array('family'=> 'cgFontSortsMillGoudy', 'weight'=>'normal', 'style'=>'normal', 'src'=>'http://data.clipgenerator.com/fonts/v3/SortsMillGoudyRegularFont.swf'),
317
+ array('family'=> 'cgFontSortsMillGoudy', 'weight'=>'normal', 'style'=>'italic', 'src'=>'http://data.clipgenerator.com/fonts/v3/SortsMillGoudyItalicFont.swf'),
318
+ );
319
+
320
+ // create lookup list of system fonts
321
+ $systemFonts = array();
322
+ foreach ($SYSTEM_FONTS as $font) {
323
+ $key = $font['family'] . '.' . $font['weight'] . '.' . $font['style'] ;
324
+ $systemFonts[$key] = $font;
325
+ }
326
+
327
+ // create list of used fonts in the webcart
328
+ $usedFonts = array();
329
+ foreach ($webcartXml->xpath('//text') as $node) {
330
+ // todo: when isHTML is introduced in the backend, scan the insides of the text too.
331
+ $text = (string)$node;
332
+ $family = (string)$node['fontFamily'];
333
+ $weight = (string)$node['fontWeight'];
334
+ $style = (string)$node['fontStyle'];
335
+ $key = "$family.$weight.$style";
336
+ $font = array("family" => $family, "weight" => $weight, "style" => $style);
337
+ $usedFonts[$key] = $font;
338
+ }
339
+
340
+ // create list of already existing fonts in the webcart (may include custom fonts)
341
+ $suppliedFonts = array();
342
+ foreach ($webcartXml->xpath('/webcart/fonts//font') as $node) {
343
+ $family = (string)$node['fontFamily'];
344
+ $weight = (string)$node['fontWeight'];
345
+ $style = (string)$node['fontStyle'];
346
+ $src = (string)$node['src'];
347
+ $key = "$family.$weight.$style";
348
+ $font = array("family" => $family, "weight" => $weight, "style" => $style, "src" => $src);
349
+ $suppliedFonts[$key] = $font;
350
+ }
351
+
352
+ // check which font to include, and which not
353
+ $includeFonts = array();
354
+ foreach ($usedFonts as $key => $font) {
355
+ if (array_key_exists($key, $systemFonts)) {
356
+ array_push($includeFonts, $systemFonts[$key]);
357
+ } else if (array_key_exists($key, $suppliedFonts)) {
358
+ array_push($includeFonts, $suppliedFonts[$key]);
359
+ } else {
360
+ // ignore this case, if we cannot find the correct font, so it should be,
361
+ // in this case the player should fall back to the default font hopefully
362
+ // todo: log that a font was used that was not found
363
+ }
364
+ }
365
+
366
+ // actually modify the fonts element in webcart, to include
367
+ // new correct font list
368
+ $defaultFontFamily = $webcartXml->fonts['defaultFontFamily'];
369
+ $defaultFontWeight = $webcartXml->fonts['defaultFontWeight'];
370
+ $defaultFontStyle = $webcartXml->fonts['defaultFontStyle'];
371
+ // remove existing node
372
+ $webcartXml->fonts = null;
373
+ // add new one
374
+ $fontsNode = $webcartXml->addChild('fonts');
375
+ $fontsNode->addAttribute("defaultFontFamily", $defaultFontFamily);
376
+ $fontsNode->addAttribute("defaultFontWeight", $defaultFontWeight);
377
+ $fontsNode->addAttribute("defaultFontStyle", $defaultFontStyle);
378
+
379
+ foreach ($includeFonts as $font) {
380
+ $fontNode = $fontsNode->addChild('font');
381
+ $fontNode->addAttribute("fontFamily", $font['family']);
382
+ $fontNode->addAttribute("fontWeight", $font['weight']);
383
+ $fontNode->addAttribute("fontStyle", $font['style']);
384
+ $fontNode->addAttribute("src", $font['src']);
385
+ }
386
+
387
+ return $webcartXml;
388
+ }
389
+ }
390
+ //<webcart version="2.0">
391
+ // <video>
392
+ // <id>fzuUT5DsCG6b80xLC5B3s5iq4dfL4CLj</id>
393
+ // <title>super text</title>
394
+ // <producer>sergej</producer>
395
+ // <description>bezeichnung</description>
396
+ // <keywords>keywork</keywords>
397
+ // <copyright>copy</copyright>
398
+ // <content>inhalt</content>
399
+ // <targetAudience>zielgruppe</targetAudience>
400
+ // <thumbnail url="http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/07b0aa3f_thumb.jpg"/>
401
+ // <download url=""/>
402
+ // </video>
403
+ // <timeline>
404
+ // <config>
405
+ // <song id="Land_aus_Glas_Clipgenerator_5_27_333.mp3" copyright="">
406
+ // http://data.clipgenerator.com/music/65/SUEp1qj3837vy3GH.mp3
407
+ // </song>
408
+ // <variation id="ce_showtime">http://data.clipgenerator.com/variations/v2/xml/ce_showtime.xml</variation>
409
+ // <filter>none</filter>
410
+ // <ratio>16x9</ratio>
411
+ // <format name="360p"/>
412
+ // <startPage>
413
+ // <enabled>false</enabled>
414
+ // <duration>5</duration>
415
+ // <showLowerThirds>false</showLowerThirds>
416
+ // </startPage>
417
+ // <endPage>
418
+ // <enabled>false</enabled>
419
+ // <duration>5</duration>
420
+ // <onEndAction name="showIntro" parameter=""/>
421
+ // <showLowerThirds>false</showLowerThirds>
422
+ // </endPage>
423
+ // <clipMaxLenght>0</clipMaxLenght>
424
+ // </config>
425
+ // <lowerThirds>
426
+ // <lowerThird width="0.3" height="0.1" horizontalAlign="left" verticalAlign="top" alpha="0.7">
427
+ // <color>0</color>
428
+ // <link>http://</link>
429
+ // <text color="16777215" fontSize="14" bold="false" italic="false" underline="false">SERGEJ</text>
430
+ // </lowerThird>
431
+ // </lowerThirds>
432
+ // <frames>
433
+ // <frame>
434
+ // <number>0</number>
435
+ // <picture width="1" height="1" alpha="1">
436
+ // <id>16441</id>
437
+ // <url>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/07b0aa3f.jpg</url>
438
+ // <thumb_url>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/07b0aa3f_thumb.jpg
439
+ // </thumb_url>
440
+ // <web_url>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/07b0aa3f_web.jpg</web_url>
441
+ // <url_240p>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/07b0aa3f_240p.jpg</url_240p>
442
+ // <url_360p>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/07b0aa3f_360p.jpg</url_360p>
443
+ // <url_480p>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/07b0aa3f_480p.jpg</url_480p>
444
+ // <url_720p>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/07b0aa3f_720p.jpg</url_720p>
445
+ // </picture>
446
+ // <background>
447
+ // <color>65433</color>
448
+ // </background>
449
+ // <lowerThirds>
450
+ // <lowerThird width="0.45" height="0.39555555555556" horizontalAlign="center" verticalAlign="middle"
451
+ // alpha="0.7">
452
+ // <color>0</color>
453
+ // <link>http://</link>
454
+ // <text color="16777215" fontSize="31" bold="false" italic="false" underline="false">SUPER TEXT
455
+ // </text>
456
+ // </lowerThird>
457
+ // </lowerThirds>
458
+ // </frame>
459
+ // <frame>
460
+ // <number>1</number>
461
+ // <picture width="1" height="1" alpha="1">
462
+ // <id>18572</id>
463
+ // <url>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/28f73d63.jpg</url>
464
+ // <thumb_url>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/28f73d63_thumb.jpg
465
+ // </thumb_url>
466
+ // <web_url>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/28f73d63_web.jpg</web_url>
467
+ // <url_240p>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/28f73d63_240p.jpg</url_240p>
468
+ // <url_360p>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/28f73d63_360p.jpg</url_360p>
469
+ // <url_480p>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/28f73d63_480p.jpg</url_480p>
470
+ // <url_720p>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/28f73d63_720p.jpg</url_720p>
471
+ // </picture>
472
+ // </frame>
473
+ // <frame>
474
+ // <number>2</number>
475
+ // <picture width="1" height="1" alpha="1">
476
+ // <id>18573</id>
477
+ // <url>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/b84820f2.jpg</url>
478
+ // <thumb_url>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/b84820f2_thumb.jpg
479
+ // </thumb_url>
480
+ // <web_url>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/b84820f2_web.jpg</web_url>
481
+ // <url_240p>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/b84820f2_240p.jpg</url_240p>
482
+ // <url_360p>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/b84820f2_360p.jpg</url_360p>
483
+ // <url_480p>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/b84820f2_480p.jpg</url_480p>
484
+ // <url_720p>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/b84820f2_720p.jpg</url_720p>
485
+ // </picture>
486
+ // </frame>
487
+ // <frame>
488
+ // <number>3</number>
489
+ // <picture width="1" height="1" alpha="1">
490
+ // <id>18574</id>
491
+ // <url>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/cf4f1064.jpg</url>
492
+ // <thumb_url>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/cf4f1064_thumb.jpg
493
+ // </thumb_url>
494
+ // <web_url>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/cf4f1064_web.jpg</web_url>
495
+ // <url_240p>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/cf4f1064_240p.jpg</url_240p>
496
+ // <url_360p>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/cf4f1064_360p.jpg</url_360p>
497
+ // <url_480p>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/cf4f1064_480p.jpg</url_480p>
498
+ // <url_720p>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/cf4f1064_720p.jpg</url_720p>
499
+ // </picture>
500
+ // <background>
501
+ // <color>204</color>
502
+ // </background>
503
+ // </frame>
504
+ // <frame>
505
+ // <number>4</number>
506
+ // <picture width="1" height="1" alpha="1">
507
+ // <id>18575</id>
508
+ // <url>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/564641de.jpg</url>
509
+ // <thumb_url>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/564641de_thumb.jpg
510
+ // </thumb_url>
511
+ // <web_url>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/564641de_web.jpg</web_url>
512
+ // <url_240p>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/564641de_240p.jpg</url_240p>
513
+ // <url_360p>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/564641de_360p.jpg</url_360p>
514
+ // <url_480p>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/564641de_480p.jpg</url_480p>
515
+ // <url_720p>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/564641de_720p.jpg</url_720p>
516
+ // </picture>
517
+ // <background>
518
+ // <color>16711935</color>
519
+ // </background>
520
+ // </frame>
521
+ // <frame>
522
+ // <number>5</number>
523
+ // <picture width="1" height="1" alpha="1">
524
+ // <id>18576</id>
525
+ // <url>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/d954d811.jpg</url>
526
+ // <thumb_url>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/d954d811_thumb.jpg
527
+ // </thumb_url>
528
+ // <web_url>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/d954d811_web.jpg</web_url>
529
+ // <url_240p>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/d954d811_240p.jpg</url_240p>
530
+ // <url_360p>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/d954d811_360p.jpg</url_360p>
531
+ // <url_480p>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/d954d811_480p.jpg</url_480p>
532
+ // <url_720p>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/picture/d954d811_720p.jpg</url_720p>
533
+ // </picture>
534
+ // <background>
535
+ // <color>65382</color>
536
+ // </background>
537
+ // </frame>
538
+ // </frames>
539
+ // </timeline>
540
+ // <logo width="0.1" height="0.1" alpha="1">
541
+ // <id>18194</id>
542
+ // <url>http://user-data.clipgenerator.com/l/g/5/j/127a00f2/logo/4ad842bc.png</url>
543
+ // <link>http://</link>
544
+ // <position verticalAlign="top" horizontalAlign="right"/>
545
+ // <showInStartPage>false</showInStartPage>
546
+ // <showInEndPage>false</showInEndPage>
547
+ // <showInTimeline>true</showInTimeline>
548
+ // </logo>
549
+ // <formats>
550
+ // <format name="240p" ratio="4x3" resolution="320x240" isPreviewVisible="true" canPreview="true"
551
+ // isDownloadVisible="true" canDownload="true"/>
552
+ // <format name="360p" ratio="4x3" resolution="480x360" isPreviewVisible="true" canPreview="true"
553
+ // isDownloadVisible="true" canDownload="true"/>
554
+ // <format name="480p" ratio="4x3" resolution="640x480" isPreviewVisible="true" canPreview="true"
555
+ // isDownloadVisible="true" canDownload="true"/>
556
+ // <format name="720p" ratio="4x3" resolution="960x720" isPreviewVisible="true" canPreview="true"
557
+ // isDownloadVisible="true" canDownload="true"/>
558
+ // <format name="1080p" ratio="4x3" resolution="1440x1080" isPreviewVisible="true" canPreview="true"
559
+ // isDownloadVisible="true" canDownload="true"/>
560
+ // <format name="240p" ratio="16x9" resolution="426x240" isPreviewVisible="true" canPreview="true"
561
+ // isDownloadVisible="true" canDownload="true"/>
562
+ // <format name="360p" ratio="16x9" resolution="640x360" isPreviewVisible="true" canPreview="true"
563
+ // isDownloadVisible="true" canDownload="true"/>
564
+ // <format name="480p" ratio="16x9" resolution="853x480" isPreviewVisible="true" canPreview="true"
565
+ // isDownloadVisible="true" canDownload="true"/>
566
+ // <format name="720p" ratio="16x9" resolution="1280x720" isPreviewVisible="true" canPreview="true"
567
+ // isDownloadVisible="true" canDownload="true"/>
568
+ // <format name="1080p" ratio="16x9" resolution="1920x1080" isPreviewVisible="false" canPreview="false"
569
+ // isDownloadVisible="true" canDownload="true"/>
570
+ // </formats>
571
+ // <branding branded="false"/>
572
+ //</webcart>
app/code/community/Trivid/Clipgenerator/sql/clipgenerator_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Trivid GmbH
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://
10
+ *
11
+ * @category Trivid
12
+ * @package Trivid
13
+ * @copyright Copyright (c) 2013 Trivid GmbH (http://www.trivid.com)
14
+ */
15
+
16
+ $installer = $this;
17
+ $installer->startSetup();
18
+ $installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'clipgenerator_title', array(
19
+ 'group' => 'Clipgenerator',
20
+ 'input' => 'text',
21
+ 'type' => 'varchar',
22
+ 'label' => 'Video Titel',
23
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
24
+ 'visible' => TRUE,
25
+ 'required' => FALSE,
26
+ 'user_defined' => TRUE,
27
+ 'searchable' => FALSE,
28
+ 'filterable' => FALSE,
29
+ 'comparable' => FALSE,
30
+ 'visible_on_front' => FALSE,
31
+ 'unique' => FALSE,
32
+ 'apply_to' => 'simple,configurable,bundle,grouped',
33
+ 'is_configurable' => FALSE,
34
+ ));
35
+ $installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'clipgenerator_description', array(
36
+ 'group' => 'Clipgenerator',
37
+ 'input' => 'textarea',
38
+ 'type' => 'varchar',
39
+ 'label' => 'Beschreibung',
40
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
41
+ 'visible' => TRUE,
42
+ 'required' => FALSE,
43
+ 'user_defined' => TRUE,
44
+ 'searchable' => FALSE,
45
+ 'filterable' => FALSE,
46
+ 'comparable' => FALSE,
47
+ 'visible_on_front' => FALSE,
48
+ 'unique' => FALSE,
49
+ 'apply_to' => 'simple,configurable,bundle,grouped',
50
+ 'is_configurable' => FALSE,
51
+ ));
52
+ $installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'clipgenerator_keywords', array(
53
+ 'group' => 'Clipgenerator',
54
+ 'input' => 'text',
55
+ 'type' => 'varchar',
56
+ 'label' => 'Video Keywords',
57
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
58
+ 'visible' => TRUE,
59
+ 'required' => FALSE,
60
+ 'user_defined' => TRUE,
61
+ 'searchable' => FALSE,
62
+ 'filterable' => FALSE,
63
+ 'comparable' => FALSE,
64
+ 'visible_on_front' => FALSE,
65
+ 'unique' => FALSE,
66
+ 'apply_to' => 'simple,configurable,bundle,grouped',
67
+ 'is_configurable' => FALSE,
68
+ ));
69
+ $installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'clipgenerator_logo', array(
70
+ 'group' => 'Clipgenerator',
71
+ 'input' => 'text',
72
+ 'type' => 'varchar',
73
+ 'label' => 'Video Logo URL',
74
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
75
+ 'visible' => TRUE,
76
+ 'required' => FALSE,
77
+ 'user_defined' => TRUE,
78
+ 'searchable' => FALSE,
79
+ 'filterable' => FALSE,
80
+ 'comparable' => FALSE,
81
+ 'visible_on_front' => FALSE,
82
+ 'unique' => FALSE,
83
+ 'apply_to' => 'simple,configurable,bundle,grouped',
84
+ 'is_configurable' => FALSE,
85
+ ));
86
+ $installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'clipgenerator_show', array(
87
+ 'group' => 'Clipgenerator',
88
+ 'input' => 'boolean',
89
+ 'type' => 'int',
90
+ 'default' => 0,
91
+ 'label' => 'Video ausgeben',
92
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
93
+ 'visible' => TRUE,
94
+ 'required' => FALSE,
95
+ 'user_defined' => TRUE,
96
+ 'searchable' => FALSE,
97
+ 'filterable' => FALSE,
98
+ 'comparable' => FALSE,
99
+ 'visible_on_front' => FALSE,
100
+ 'unique' => FALSE,
101
+ 'apply_to' => 'simple,configurable,bundle,grouped',
102
+ 'is_configurable' => FALSE,
103
+ ));
104
+ $installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'clipgenerator_design', array(
105
+ 'group' => 'Clipgenerator',
106
+ 'input' => 'select',
107
+ 'type' => 'varchar',
108
+ 'label' => 'Design',
109
+ 'source' => 'trivid_clipgenerator_model_source_designs',
110
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
111
+ 'visible' => TRUE,
112
+ 'required' => FALSE,
113
+ 'user_defined' => TRUE,
114
+ 'searchable' => FALSE,
115
+ 'filterable' => FALSE,
116
+ 'comparable' => FALSE,
117
+ 'visible_on_front' => FALSE,
118
+ 'unique' => FALSE,
119
+ 'apply_to' => 'simple,configurable,bundle,grouped',
120
+ 'is_configurable' => FALSE,
121
+ ));
122
+ $installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'clipgenerator_images_select', array(
123
+ 'group' => 'Clipgenerator',
124
+ 'type' => 'text',
125
+ 'input' => 'text',
126
+ 'backend' => '',
127
+ 'input_renderer' => 'clipgenerator/catalog_product_helper_form_images', //definition of renderer
128
+ 'label' => 'Bildauswahl',
129
+ 'class' => '',
130
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
131
+ 'visible' => TRUE,
132
+ 'required' => FALSE,
133
+ 'user_defined' => TRUE,
134
+ 'searchable' => FALSE,
135
+ 'filterable' => FALSE,
136
+ 'comparable' => FALSE,
137
+ 'visible_on_front' => FALSE,
138
+ 'unique' => FALSE,
139
+ 'apply_to' => 'simple,configurable,bundle,grouped',
140
+ 'is_configurable' => FALSE,
141
+ ));
142
+ $installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'clipgenerator_song', array(
143
+ 'group' => 'Clipgenerator',
144
+ 'input' => 'select',
145
+ 'type' => 'varchar',
146
+ 'label' => 'Musik',
147
+ 'source' => 'trivid_clipgenerator_model_source_musics',
148
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
149
+ 'visible' => TRUE,
150
+ 'required' => FALSE,
151
+ 'user_defined' => TRUE,
152
+ 'searchable' => FALSE,
153
+ 'filterable' => FALSE,
154
+ 'comparable' => FALSE,
155
+ 'visible_on_front' => FALSE,
156
+ 'unique' => FALSE,
157
+ 'apply_to' => 'simple,configurable,bundle,grouped',
158
+ 'is_configurable' => FALSE,
159
+ ));
160
+ $installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'clipgenerator_music_select', array(
161
+ 'group' => 'Clipgenerator',
162
+ 'type' => 'varchar',
163
+ 'backend' => '',
164
+ 'input_renderer' => 'clipgenerator/catalog_product_helper_form_music', //definition of renderer
165
+ 'label' => 'erweiterte Auswahl',
166
+ 'class' => '',
167
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
168
+ 'visible' => TRUE,
169
+ 'required' => FALSE,
170
+ 'user_defined' => TRUE,
171
+ 'searchable' => FALSE,
172
+ 'filterable' => FALSE,
173
+ 'comparable' => FALSE,
174
+ 'visible_on_front' => FALSE,
175
+ 'unique' => FALSE,
176
+ 'apply_to' => 'simple,configurable,bundle,grouped',
177
+ 'is_configurable' => FALSE,
178
+ ));
179
+ $installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'clipgenerator_video_id', array(
180
+ 'group' => 'Clipgenerator',
181
+ 'input' => 'text',
182
+ 'type' => 'varchar',
183
+ 'label' => 'Video ID',
184
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
185
+ 'visible' => TRUE,
186
+ 'required' => FALSE,
187
+ 'user_defined' => TRUE,
188
+ 'searchable' => FALSE,
189
+ 'filterable' => FALSE,
190
+ 'comparable' => FALSE,
191
+ 'visible_on_front' => FALSE,
192
+ 'unique' => FALSE,
193
+ 'apply_to' => 'simple,configurable,bundle,grouped',
194
+ 'is_configurable' => FALSE,
195
+ ));
196
+ $installer->endSetup();
app/code/community/Trivid/Clipgenerator/sql/clipgenerator_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Install Script
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * LICENSE: is available through the world-wide-web at the following URI:
8
+ * http://www.clipgenerator.com/static/public/legal.php If you did not receive a copy of
9
+ * the Clipgenerator - End User License Agreement and are unable to obtain it through the web, please
10
+ * send a note to info@trivid.com so we can mail you a copy immediately.
11
+ *
12
+ * @package Trivid
13
+ * @author Trivid GmbH <author@example.com>
14
+ * @author Another Author <another@example.com>
15
+ * @copyright 2013 Trivid GmbH
16
+ * @license http://www.clipgenerator.com/static/public/legal.php Clipgenerator - End User License Agreement
17
+ * @version 1.0.0
18
+ * @since File available since Release 1.0.0
19
+ */
20
+ $installer = $this;
21
+ $installer->startSetup();
22
+ $installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'clipgenerator_title', array(
23
+ 'group' => 'Clipgenerator',
24
+ 'input' => 'text',
25
+ 'type' => 'varchar',
26
+ 'label' => 'Video Titel',
27
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
28
+ 'visible' => TRUE,
29
+ 'required' => FALSE,
30
+ 'user_defined' => TRUE,
31
+ 'searchable' => FALSE,
32
+ 'filterable' => FALSE,
33
+ 'comparable' => FALSE,
34
+ 'visible_on_front' => FALSE,
35
+ 'unique' => FALSE,
36
+ 'apply_to' => 'simple,configurable,bundle,grouped',
37
+ 'is_configurable' => FALSE,
38
+ ));
39
+ $installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'clipgenerator_description', array(
40
+ 'group' => 'Clipgenerator',
41
+ 'input' => 'textarea',
42
+ 'type' => 'varchar',
43
+ 'label' => 'Beschreibung',
44
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
45
+ 'visible' => TRUE,
46
+ 'required' => FALSE,
47
+ 'user_defined' => TRUE,
48
+ 'searchable' => FALSE,
49
+ 'filterable' => FALSE,
50
+ 'comparable' => FALSE,
51
+ 'visible_on_front' => FALSE,
52
+ 'unique' => FALSE,
53
+ 'apply_to' => 'simple,configurable,bundle,grouped',
54
+ 'is_configurable' => FALSE,
55
+ ));
56
+ $installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'clipgenerator_keywords', array(
57
+ 'group' => 'Clipgenerator',
58
+ 'input' => 'text',
59
+ 'type' => 'varchar',
60
+ 'label' => 'Video Keywords',
61
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
62
+ 'visible' => TRUE,
63
+ 'required' => FALSE,
64
+ 'user_defined' => TRUE,
65
+ 'searchable' => FALSE,
66
+ 'filterable' => FALSE,
67
+ 'comparable' => FALSE,
68
+ 'visible_on_front' => FALSE,
69
+ 'unique' => FALSE,
70
+ 'apply_to' => 'simple,configurable,bundle,grouped',
71
+ 'is_configurable' => FALSE,
72
+ ));
73
+ $installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'clipgenerator_logo', array(
74
+ 'group' => 'Clipgenerator',
75
+ 'input' => 'text',
76
+ 'type' => 'varchar',
77
+ 'label' => 'Video Logo URL',
78
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
79
+ 'visible' => TRUE,
80
+ 'required' => FALSE,
81
+ 'user_defined' => TRUE,
82
+ 'searchable' => FALSE,
83
+ 'filterable' => FALSE,
84
+ 'comparable' => FALSE,
85
+ 'visible_on_front' => FALSE,
86
+ 'unique' => FALSE,
87
+ 'apply_to' => 'simple,configurable,bundle,grouped',
88
+ 'is_configurable' => FALSE,
89
+ ));
90
+ $installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'clipgenerator_show', array(
91
+ 'group' => 'Clipgenerator',
92
+ 'input' => 'boolean',
93
+ 'type' => 'int',
94
+ 'default' => 0,
95
+ 'label' => 'Video ausgeben',
96
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
97
+ 'visible' => TRUE,
98
+ 'required' => FALSE,
99
+ 'user_defined' => TRUE,
100
+ 'searchable' => FALSE,
101
+ 'filterable' => FALSE,
102
+ 'comparable' => FALSE,
103
+ 'visible_on_front' => FALSE,
104
+ 'unique' => FALSE,
105
+ 'apply_to' => 'simple,configurable,bundle,grouped',
106
+ 'is_configurable' => FALSE,
107
+ ));
108
+ $installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'clipgenerator_design', array(
109
+ 'group' => 'Clipgenerator',
110
+ 'input' => 'select',
111
+ 'type' => 'varchar',
112
+ 'label' => 'Design',
113
+ 'source' => 'trivid_clipgenerator_model_source_designs',
114
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
115
+ 'visible' => TRUE,
116
+ 'required' => FALSE,
117
+ 'user_defined' => TRUE,
118
+ 'searchable' => FALSE,
119
+ 'filterable' => FALSE,
120
+ 'comparable' => FALSE,
121
+ 'visible_on_front' => FALSE,
122
+ 'unique' => FALSE,
123
+ 'apply_to' => 'simple,configurable,bundle,grouped',
124
+ 'is_configurable' => FALSE,
125
+ ));
126
+ $installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'clipgenerator_images_select', array(
127
+ 'group' => 'Clipgenerator',
128
+ 'type' => 'text',
129
+ 'input' => 'text',
130
+ 'backend' => '',
131
+ 'input_renderer' => 'clipgenerator/catalog_product_helper_form_images', //definition of renderer
132
+ 'label' => 'Bildauswahl',
133
+ 'class' => '',
134
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
135
+ 'visible' => TRUE,
136
+ 'required' => FALSE,
137
+ 'user_defined' => TRUE,
138
+ 'searchable' => FALSE,
139
+ 'filterable' => FALSE,
140
+ 'comparable' => FALSE,
141
+ 'visible_on_front' => FALSE,
142
+ 'unique' => FALSE,
143
+ 'apply_to' => 'simple,configurable,bundle,grouped',
144
+ 'is_configurable' => FALSE,
145
+ ));
146
+ $installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'clipgenerator_song', array(
147
+ 'group' => 'Clipgenerator',
148
+ 'input' => 'select',
149
+ 'type' => 'varchar',
150
+ 'label' => 'Musik',
151
+ 'source' => 'trivid_clipgenerator_model_source_musics',
152
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
153
+ 'visible' => TRUE,
154
+ 'required' => FALSE,
155
+ 'user_defined' => TRUE,
156
+ 'searchable' => FALSE,
157
+ 'filterable' => FALSE,
158
+ 'comparable' => FALSE,
159
+ 'visible_on_front' => FALSE,
160
+ 'unique' => FALSE,
161
+ 'apply_to' => 'simple,configurable,bundle,grouped',
162
+ 'is_configurable' => FALSE,
163
+ ));
164
+ $installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'clipgenerator_music_select', array(
165
+ 'group' => 'Clipgenerator',
166
+ 'type' => 'varchar',
167
+ 'backend' => '',
168
+ 'input_renderer' => 'clipgenerator/catalog_product_helper_form_music', //definition of renderer
169
+ 'label' => 'erweiterte Auswahl',
170
+ 'class' => '',
171
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
172
+ 'visible' => TRUE,
173
+ 'required' => FALSE,
174
+ 'user_defined' => TRUE,
175
+ 'searchable' => FALSE,
176
+ 'filterable' => FALSE,
177
+ 'comparable' => FALSE,
178
+ 'visible_on_front' => FALSE,
179
+ 'unique' => FALSE,
180
+ 'apply_to' => 'simple,configurable,bundle,grouped',
181
+ 'is_configurable' => FALSE,
182
+ ));
183
+ $installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'clipgenerator_video_id', array(
184
+ 'group' => 'Clipgenerator',
185
+ 'input' => 'text',
186
+ 'type' => 'varchar',
187
+ 'label' => 'Video ID',
188
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE,
189
+ 'visible' => TRUE,
190
+ 'required' => FALSE,
191
+ 'user_defined' => TRUE,
192
+ 'searchable' => FALSE,
193
+ 'filterable' => FALSE,
194
+ 'comparable' => FALSE,
195
+ 'visible_on_front' => FALSE,
196
+ 'unique' => FALSE,
197
+ 'apply_to' => 'simple,configurable,bundle,grouped',
198
+ 'is_configurable' => FALSE,
199
+ ));
200
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/clipgenerator.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <clipgenerator_adminhtml_orderform_index>
4
+ <update handle="clipgenerator_ordeform_index"/>
5
+ <reference name="content">
6
+ <block type="adminhtml/template" name="orderform"
7
+ template="clipgenerator/orderform.phtml"/>
8
+ </reference>
9
+ </clipgenerator_adminhtml_orderform_index>
10
+ </layout>
app/design/adminhtml/default/default/template/clipgenerator/contingent.phtml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $user = Mage::helper('clipgenerator')->getUser(); ?>
2
+ <?php if($user): ?>
3
+ <div>
4
+ <label><?= Mage::helper('clipgenerator')->__('Verfügbare Video Slots') ?>
5
+ :</label>
6
+ <?= (int)$user['freeVideoSlots'] . " von " . (int)$user['availableVideoSlots'] ?>
7
+ </div>
8
+ <div>
9
+ <label><?= Mage::helper('clipgenerator')->__('Verfügbare Video Downloads') ?>
10
+ :</label>
11
+ <?php if ($user['renderJobsLeft']): ?>
12
+ <?= $user['renderJobsLeft'] ?>
13
+ <?php else: ?>
14
+ <?= Mage::helper('clipgenerator')->__('keine verfügbar') ?>
15
+ <?php endif; ?>
16
+ </div>
17
+ <?php else: ?>
18
+ <div>
19
+ <a href="<?=Mage::helper("adminhtml")->getUrl("clipgenerator/adminhtml_orderform/index");?>"><?=Mage::helper('clipgenerator')->__('Bestellen Sie sich jetzt Ihr Videopaket!')?></a>
20
+ </div>
21
+ <?php endif; ?>
app/design/adminhtml/default/default/template/clipgenerator/images.phtml ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <style type="text/css">
2
+ #picchooser {
3
+ width: 600px;
4
+ overflow: scroll;
5
+ height: 110px;
6
+ border: 4px solid #e5e5e5;
7
+ }
8
+
9
+ .url, .hidden {
10
+ display: none;
11
+ }
12
+
13
+ #picchooser div {
14
+ display: inline;
15
+ position:relative;
16
+ }
17
+ .pic { border:3px solid #fff; }
18
+ .pico { border:3px solid #999; }
19
+ .nr { position:absolute; top:-55px; left:55px; font-size:30px; }
20
+ </style>
21
+ <?php
22
+ $_product = Mage::registry('current_product');
23
+ $_images = $_product->getMediaGalleryImages();
24
+ $selected = $_product->getData('clipgenerator_images_select');
25
+ $selArr = explode(';', trim($selected, ';'));
26
+ ?>
27
+
28
+ <?php if ($_images): ?>
29
+ <div id="picchooser">
30
+ <?php foreach ($_images as $_image): ?>
31
+ <?php $pos = array_search($_image->getUrl(), $selArr); ?>
32
+ <div>
33
+ <span class="nr">
34
+ <?php if($pos !== false): ?>
35
+ <?=$pos+1?>
36
+ <?php endif; ?>
37
+ </span>
38
+ <?php if (strstr($selected, $_image->getUrl())): ?>
39
+ <img class="pico" src="<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail', $_image->getFile())->resize(80, 80); ?>" />
40
+ <?php else: ?>
41
+ <img class="pic" src="<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail', $_image->getFile())->resize(80, 80); ?>" />
42
+ <?php endif; ?>
43
+ <span class="url"><?= $_image->getUrl() ?></span>
44
+ </div>
45
+ <?php endforeach; ?>
46
+ </div>
47
+ <?php else: ?>
48
+ <?= Mage::helper('clipgenerator')->__('Bitte laden Sie zuerst Bilder hoch.'); ?>
49
+ <?php endif; ?>
50
+
51
+ <script type="text/javascript">
52
+ $('clipgenerator_images_select').addClassName('hidden');
53
+ document.observe('dom:loaded', function () {
54
+ $('clipgenerator_video_id').up().up().hide();
55
+ $$('.pico').each(function (el) {
56
+ el.setOpacity(0.5);
57
+ });
58
+ $('picchooser').observe('click', function (event) {
59
+ pic = Event.element(event);
60
+ if (pic.readAttribute('class') == 'pic') {
61
+ pic.setOpacity(0.5);
62
+ pic.addClassName('pico');
63
+ pic.removeClassName('pic');
64
+ addUrl = ';' + pic.up().select('.url')[0].innerHTML;
65
+ $('clipgenerator_images_select').writeAttribute('value', $('clipgenerator_images_select').readAttribute('value') + addUrl);
66
+ reCount();
67
+ } else if (pic.readAttribute('class') == 'pico') {
68
+ pic.addClassName('pic');
69
+ pic.removeClassName('pico');
70
+ pic.setOpacity(1);
71
+ rmUrl = ';' + pic.up().select('.url')[0].innerHTML;
72
+ $('clipgenerator_images_select').writeAttribute('value', $('clipgenerator_images_select').readAttribute('value').replace(rmUrl, ''));
73
+ pic.up().select('.nr')[0].innerHTML = '';
74
+ reCount();
75
+ }
76
+ });
77
+ });
78
+
79
+ function reCount() {
80
+ var arrImg = $('clipgenerator_images_select').readAttribute('value').split(';');
81
+ counter = 0;
82
+ arrImg.each(function(el) {
83
+ if(el) {
84
+ $$('.url').each(function(nel) {
85
+ if(nel.innerHTML == el) {
86
+ counter = counter + 1;
87
+ nel.up().select('.nr')[0].innerHTML = counter;
88
+ }
89
+ });
90
+ }
91
+ });
92
+ }
93
+ </script>
app/design/adminhtml/default/default/template/clipgenerator/music.phtml ADDED
@@ -0,0 +1,225 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript" src="/js/scriptaculous/sound.js"></script>
2
+ <?php
3
+ $clipgen = Mage::helper('clipgenerator');
4
+ $music = $clipgen->getMusic();
5
+ ?>
6
+ <style type="text/css">
7
+ #musicchoose {
8
+ width: 608px;
9
+ }
10
+
11
+ #songs {
12
+ width: 608px;
13
+ height: 300px;
14
+ overflow: scroll;
15
+ background-color: #d3d3d3;
16
+ }
17
+
18
+ #songs div {
19
+ width: 275px;
20
+ float: left;
21
+ padding: 5px;
22
+ margin: 5px;
23
+ background-color: #ffffff;
24
+ height: 50px;
25
+ }
26
+
27
+ #songs div img {
28
+ width: 50px;
29
+ height: 50px;
30
+ float: left;
31
+ padding-right: 5px;
32
+ }
33
+
34
+ #select li {
35
+ display: block;
36
+ float: left;
37
+ width: 116px;
38
+ text-align: center;
39
+ margin: 0;
40
+ padding: 2px 0;
41
+ color: #666;
42
+ font-weight: bold;
43
+ border: 1px solid #d3d3d3;
44
+ }
45
+
46
+ .clear {
47
+ width: 100%;
48
+ clear: both;
49
+ height: 0px;
50
+ }
51
+
52
+ .choosesong {
53
+ cursor: pointer;
54
+ }
55
+
56
+ #songs .actsong {
57
+ color: #ffffff;
58
+ background-color: #999;
59
+ }
60
+
61
+ #contentmusic {
62
+ position: relative;
63
+ }
64
+
65
+ #musicleftmenu {
66
+ position: absolute;
67
+ left: -202px;
68
+ top: 0;
69
+ height: 298px;
70
+ width: 200px;
71
+ border: 1px solid #d3d3d3;
72
+ overflow: scroll;
73
+ }
74
+
75
+ #musicleftmenu li {
76
+ padding: 4px 10px;
77
+ color: #666;
78
+ font-weight: bold;
79
+ }
80
+
81
+ #select li:hover, #select li.act, #musicleftmenu li.act, #musicleftmenu li:hover {
82
+ cursor: pointer;
83
+ background-color: #d3d3d3;
84
+ color: #fff;
85
+ }
86
+
87
+ .control {
88
+ float: right;
89
+ display: none;
90
+ }
91
+
92
+ .actsong .control {
93
+ display: inline;
94
+ }
95
+
96
+ .cprev {
97
+ display: none;
98
+ }
99
+
100
+ .hidden {
101
+ display: none;
102
+ }
103
+ </style>
104
+ <span><?= $clipgen->__('für die Preview ist der Quicktime Player erforderlich') ?></span>
105
+ <div id="musicchoose">
106
+ <ul id="select">
107
+ <li class="genres"><?= $clipgen->__('Genre') ?></li>
108
+ <li class="moods"><?= $clipgen->__('Mood') ?></li>
109
+ <li class="instruments"><?= $clipgen->__('Instruments') ?></li>
110
+ <li class="speeds"><?= $clipgen->__('Speed') ?></li>
111
+ <li class="themes"><?= $clipgen->__('Theme') ?></li>
112
+ </ul>
113
+ <div class="clear">&nbsp;</div>
114
+ <div id="contentmusic">
115
+ <ul id="musicleftmenu">
116
+ <li class="act"><?= $clipgen->__('Alle') ?></li>
117
+ </ul>
118
+ <div id="songs">
119
+
120
+ </div>
121
+ </div>
122
+ </div>
123
+ <pre>
124
+ </pre>
125
+ <script type="text/javascript">
126
+ // music storage
127
+ var storage = <?=json_encode($music)?>;
128
+ var currentTab = 'genres';
129
+ var controlStart = 'play';
130
+ var controlStop = 'stop';
131
+
132
+ function songTimeFormat(seconds) {
133
+ var minutes = ((seconds / 60) + "").split('.');
134
+ var sec = seconds % 60;
135
+ if (sec < 10) {
136
+ sec = "0" + sec;
137
+ }
138
+ return minutes[0] + ":" + sec;
139
+ }
140
+
141
+ function addSong(song) {
142
+ $('songs').insert('<div class="choosesong"><img src="' + song['cover'] + '" /><strong class="title">' + song['title'] + '</strong><br/>' + song['label'] + '<br/> Dauer: ' + songTimeFormat(song['length']) + '<span class="control">play</span><span class="cprev">' + song['previewUrl'] + '</span></div>');
143
+ }
144
+
145
+ storage['songs'].each(function (song) {
146
+ addSong(song);
147
+ });
148
+
149
+ function findProp(arr, id) {
150
+ var found = false;
151
+ arr.some(function (e) {
152
+ if (e == id) {
153
+ found = true;
154
+ return true;
155
+ }
156
+ });
157
+ return found;
158
+ }
159
+
160
+ document.observe('dom:loaded', function () {
161
+ if($('clipgenerator_music_select')) {
162
+ $('clipgenerator_music_select').addClassName('hidden');
163
+ }
164
+ $('select').observe('click', function (event) {
165
+ var load = Event.element(event).readAttribute('class');
166
+ $$('#select li').invoke('removeClassName', 'act');
167
+ Event.element(event).addClassName('act');
168
+ currentTab = load;
169
+ if (storage[load].length != 0) {
170
+ // clear lists
171
+ $('musicleftmenu').update('');
172
+ storage[load].each(function (el) {
173
+ $('musicleftmenu').insert('<li class="' + el['id'] + '">' + el['title'] + '</li>');
174
+ });
175
+ }
176
+ });
177
+ $('musicleftmenu').observe('click', function (event) {
178
+ id = Event.element(event).readAttribute('class');
179
+ $$('#musicleftmenu li').invoke('removeClassName', 'act');
180
+ Event.element(event).addClassName('act');
181
+ if (storage[currentTab].length != 0) {
182
+ $('songs').update('');
183
+ storage['songs'].each(function (song) {
184
+ if (findProp(song[currentTab], id)) {
185
+ addSong(song);
186
+ }
187
+ });
188
+ }
189
+ });
190
+
191
+ $('songs').observe('click', function (event) {
192
+ classEl = Event.element(event).readAttribute('class');
193
+ if (classEl == 'choosesong') {
194
+ $$('.actsong').invoke('removeClassName', 'actsong');
195
+ Event.element(event).addClassName('actsong');
196
+ var elArr = Event.element(event).childElements();
197
+ var findString = elArr[1].innerHTML;
198
+ $$('#clipgenerator_settings_clipgenerator_song option, #clipgenerator_song option').each(function (el) {
199
+ if (findString == el.innerHTML) {
200
+ el.selected = true;
201
+ } else {
202
+ el.selected = false;
203
+ }
204
+ });
205
+ Sound.enable();
206
+ Sound.play('', {replace: true});
207
+ Sound.disable();
208
+ } else if (classEl == 'control') {
209
+ if (Event.element(event).innerHTML == controlStop) {
210
+ $$('.control').invoke('update', controlStart);
211
+ Sound.enable();
212
+ Sound.play('', {replace: true});
213
+ Sound.disable();
214
+ } else {
215
+ $$('.control').invoke('update', controlStart);
216
+ Event.element(event).update(controlStop);
217
+ myEl = Event.element(event);
218
+ var els = myEl.up().select('.cprev');
219
+ Sound.enable();
220
+ Sound.play(els[0].innerHTML, {replace: true});
221
+ }
222
+ }
223
+ });
224
+ });
225
+ </script>
app/design/adminhtml/default/default/template/clipgenerator/orderform.phtml ADDED
@@ -0,0 +1,288 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <style type="text/css">
2
+ .clipform {
3
+ width: 750px;
4
+ }
5
+
6
+ .cols3, .cols4 {
7
+ width: 640px;
8
+ font-family: Verdana;
9
+ }
10
+
11
+ .clipform h1 {
12
+ font-size: 17px;
13
+ }
14
+
15
+ .clipform h2 {
16
+ font-size: 16px;
17
+ }
18
+
19
+ .cols3 .col {
20
+ width: 200px;
21
+ float: left;
22
+ margin-right: 10px;
23
+ text-align: center;
24
+ }
25
+
26
+ .cols4 .col {
27
+ width: 150px;
28
+ float: left;
29
+ margin-right: 10px;
30
+ text-align: center;
31
+ font-size:10px;
32
+ }
33
+
34
+ .cols3 .col div, .cols4 .col div {
35
+ border: 1px solid #000;
36
+ }
37
+
38
+ .clear {
39
+ width: 100%;
40
+ height: 1px;
41
+ clear: both;
42
+ }
43
+
44
+ .logotrivid {
45
+ float: left;
46
+ margin: 40px 20px 0 0;
47
+ }
48
+
49
+ .welcome {
50
+ float: left;
51
+ width: 500px;
52
+ }
53
+
54
+ .inwrap {
55
+ margin: 10px 0 20px 20px;
56
+ }
57
+
58
+ .mdown {
59
+ margin-bottom: 18px;
60
+ }
61
+ .centerwrap {
62
+ text-align: center;
63
+ }
64
+ .centerwrap .clipform {
65
+ margin:0 auto;
66
+ text-align: left;
67
+ padding:0 10px;
68
+ }
69
+ .price {
70
+ font-size:16px;
71
+ font-weight:bold;
72
+ }
73
+ label {
74
+ font-size: 11px;
75
+ }
76
+ #alert { display:none; border:1px solid #ff0000; background-color:#FFB6C1; margin:20px 0 10px 0; padding:5px; }
77
+ </style>
78
+ <div class="centerwrap">
79
+ <div class="clipform">
80
+ <div>
81
+ <img class="logotrivid" src="http://www.trivid.jp/wp-content/uploads/2013/02/trivid_logo.png"
82
+ title="Trivid GmbH" alt="Trivid GmbH" />
83
+
84
+ <div class="welcome">
85
+ <h1>Sehr geehrter Shop-Betreiber,</h1>
86
+ vielen Dank für Ihr Interesse an der Clipgenerator<sup>TM</sup> simpleCOMMERCE Video-Lösung für Magento. Um Clipgenerator<sup>TM</sup> für Ihren Shop nutzen zu können, benötigen Sie einen API-Zugang den Sie nachfolgend kostenpflichtig bestellen können. Direkt im Anschluss an die Bestellung erhalten Sie von uns einen temporären API-Zugang, damit Sie sofort loslegen können.
87
+ Die Rechnungsstellung erfolgt innerhalb von 2-3 Werktagen per E-Mail an die angegebene E-Mail-Adresse.
88
+ </div>
89
+ </div>
90
+ <div class="clear mdown">&nbsp;</div>
91
+ <form action="http://magento.clipgenerator.com/" method="POST" id="orderf">
92
+ <ol>
93
+ <li>
94
+ <h2>1. Paket auswählen</h2>
95
+
96
+ <div class="inwrap">
97
+ <div class="cols4">
98
+ <div class="col">
99
+ <div>
100
+ <strong>simpleCOMMERCE 150</strong><br />
101
+ für insgesamt 150 Produktvideos<br />
102
+ <span class="price">39 EUR</span><br />
103
+ /Monat
104
+ </div>
105
+ <input type="radio" name="editor-package" value="Magento-video-150" /> <label>simpleCOMMERCE
106
+ 150</label>
107
+ </div>
108
+ <div class="col">
109
+ <div>
110
+ <strong>simpleCOMMERCE 300</strong><br />
111
+ für insgesamt 300 Produktvideos<br />
112
+ <span class="price">59 EUR</span><br />
113
+ /Monat
114
+ </div>
115
+ <input type="radio" name="editor-package" value="Magento-video-300" /> <label>simpleCOMMERCE
116
+ 300</label>
117
+ </div>
118
+ <div class="col">
119
+ <div>
120
+ <strong>simpleCOMMERCE 750</strong><br />
121
+ für insgesamt 750 Produktvideos<br />
122
+ <span class="price">139 EUR</span><br />
123
+ /Monat
124
+ </div>
125
+ <input type="radio" name="editor-package" value="Magento-video-750" /> <label>simpleCOMMERCE
126
+ 750</label>
127
+ </div>
128
+ <div class="col">
129
+ <div>
130
+ <strong>simpleCOMMERCE 1500</strong><br />
131
+ für insgesamt 1500 Produktvideos<br />
132
+ <span class="price">289 EUR</span><br />
133
+ /Monat
134
+ </div>
135
+ <input type="radio" name="editor-package" value="Magento-video-1500" /> <label>simpleCOMMERCE
136
+ 1500</label>
137
+ </div>
138
+ </div>
139
+ <div class="clear">&nbsp;</div>
140
+ <br />
141
+
142
+ <h2>In jedem Paket enthalten:</h2>
143
+ <ul>
144
+ <li>unbegrenzte Aktualisierung und Synchronisierung von Videos bei jeder Änderung</li>
145
+ <li>unbegrenzte Anzahl Aufrufe Produkt-Videos</li>
146
+ <li>nklusive Video-Hosting & Video-Streaming</li>
147
+ <li>zusätzlich statische Video-Dateien in allen Formaten</li>
148
+ <li>hohe Video-Qualität und Video-Player mit vielen Funktionen</li>
149
+ <li>wechselnde Video-Designs</li>
150
+ <li>150 Musik-Titel, voll lizensiert und abwechselnd unterlegt</li>
151
+ <li>Suchmaschinen-Optimierung (SEO) durch dynamische Sitemaps, Thumbnails, Titel und Keywords</li>
152
+ <li>Video-Ausgabe-Format als url, embed code oder Player mit Share-Funktionen für Social-Media</li>
153
+ </ul>
154
+ </div>
155
+ </li>
156
+ <li>
157
+ <h2>2. Optional: Download-Pakete</h2>
158
+
159
+ <div class="inwrap">
160
+ Damit Sie die erstellten, immer aktuellen Produkt-Videos auch an anderer Stelle verwenden können, bieten wir den Download als Video-Datei an (mp4-Format). Ausgewählte Produkt-Videos können Sie somit auch offline verwenden (z.B. für Präsentationen am POS) oder außerhalb Ihres Shops (z.B. auf YouTube oder anderen Verkaufs-oder Vergleichs-Portalen) veröffentlichen.
161
+ <div class="cols4">
162
+ <div class="col">
163
+ <div>
164
+ <br/>keine Video Downloads bestellen<br/><span class="price">&nbsp;</span>
165
+ </div>
166
+ <input type="radio" name="downloads-package" value="" /> <label>ohne</label>
167
+ </div>
168
+ <div class="col">
169
+ <div>
170
+ <strong>30 Video Downloads</strong><br />
171
+ <span class="price">59 EUR</span><br />
172
+ Gesamtpreis<br />
173
+ (1,96 EUR / Video)
174
+ </div>
175
+ <input type="radio" name="downloads-package" value="Magento-downloads-30" /> <label>30 Video
176
+ Downloads</label>
177
+ </div>
178
+ <div class="col">
179
+ <div>
180
+ <strong>50 Video Downloads</strong><br />
181
+ <span class="price">79 EUR</span><br />
182
+ Gesamtpreis<br />
183
+ (1,58 EUR / Video)
184
+ </div>
185
+ <input type="radio" name="downloads-package" value="Magento-downloads-50" /> <label>50 Video
186
+ Downloads</label>
187
+ </div>
188
+ <div class="col">
189
+ <div>
190
+ <strong>100 Video Downloads</strong><br />
191
+ <span class="price">139 EUR</span><br />
192
+ Gesamtpreis<br />
193
+ (1,39 EUR / Video)
194
+ </div>
195
+ <input type="radio" name="downloads-package" value="Magento-downloads-100" /> <label>100 Video
196
+ Downloads</label>
197
+ </div>
198
+ </div>
199
+ <div class="clear">&nbsp;</div>
200
+ </div>
201
+ </li>
202
+ <li>
203
+ <h2>3. Ihre Angaben zur Bestellung</h2>
204
+
205
+ <div class="inwrap">
206
+ <div>
207
+ Bitte geben Sie nachfolgend die Rechnungsadresse ein, die für diese Bestellung verwendet werden soll.
208
+ </div>
209
+ <div id="alert">Bitte geben Sie alle Pflichtfelder an!</div>
210
+ <div>
211
+ <label>Name (Pflichtfeld)</label><br />
212
+ <input name="name" type="text" /><br />
213
+ <label>Firma (optional)</label><br />
214
+ <input name="company" type="text" /><br />
215
+ <label>USt-IdNr (optional)</label><br />
216
+ <input name="ust-idnr" type="text" /><br />
217
+ <label>Adresse (Pflichtfeld)</label><br />
218
+ <input name="address" type="text" /><br />
219
+ <label>PLZ, Ort (Pflichtfeld)</label><br />
220
+ <input name="city" type="text" /><br />
221
+ <label>E-Mail-Adresse (Pflichtfeld)</label><br />
222
+ <input name="email" id="mailfield" type="text" /><br />
223
+ <label>Telefon (Pflichtfeld)</label><br />
224
+ <input name="phone" type="text" /><br />
225
+ <label>Raum für Anmerkungen zu Ihrer
226
+ Bestellung</label><br />
227
+ <textarea name="message"></textarea><br />
228
+ <input type="checkbox" name="confirmation" /> Hiermit
229
+ bestätige ich die Bestellung.<br />
230
+ <button id="submit">Kostenpflichtig bestellen</button>
231
+ <br /><br />
232
+
233
+ <div>
234
+ <strong>Zahlungsbedingungen:</strong><br />
235
+ Die simpleCOMMERCE-Lizenz kann jederzeit mit einer Frist von 30 Tagen zum Monatsende gekündigt werden. Eine Erst-Laufzeit von mindestens 12 Monaten wird mit einem Basispreis/Flatrate im voraus für die Laufzeit erhoben per Rechnung erhoben. Zahlbar sofort nach Rechnungsstellung ohne Abzug.
236
+ Die simpleCOMMERCE- / Clipgenerator-Lösung beinhaltet die ausschließlichen, zeitlich unbegrenzten, internationalen Nutzungsrechte für Musik, Video-Effekte und Designs. Das automatisierte Video-Verfahren mit Clipgenerator ist patentiert und rechtlich geschützt. Das Nutzungsrecht geht erst nach vollständiger Bezahlung der Leistungen auf den Kunden über.
237
+ Es gelten unsere allgemeinen Geschäftsbedingungen, die Sie auf unserer Website unter “www.trivid.com/agb” abrufen können oder auf Nachfrage zugeschickt erhalten.
238
+ </div>
239
+ </div>
240
+ </div>
241
+ </li>
242
+ </ol>
243
+ </form>
244
+ </div>
245
+ </div>
246
+ <script src="http://code.jquery.com/jquery.js"></script>
247
+
248
+ <script type="text/javascript">
249
+ // send form
250
+ jQuery.noConflict();
251
+ var adminUrl = '<?=Mage::helper("adminhtml")->getUrl("clipgenerator/adminhtml_orderform/index");?>';
252
+ var successUrl = '<?=Mage::helper("adminhtml")->getUrl("adminhtml/system_config/edit/section/clipgenerator");?>';
253
+
254
+ jQuery('#submit').click(function(event) {
255
+ jQuery.ajax({
256
+ type: 'POST',
257
+ url: 'http://magento.clipgenerator.com/',
258
+ crossDomain: true,
259
+ data: jQuery('#orderf').serialize(),
260
+ dataType: 'json',
261
+ success: function (responseData, textStatus, jqXHR) {
262
+ if(responseData['apiId'] && responseData['apiUser'] && responseData['apiSecret']) {
263
+ jQuery.ajax({
264
+ type: 'POST',
265
+ crossDomain: true,
266
+ url: adminUrl,
267
+ data: {
268
+ 'form_key': '<?=Mage::getSingleton('core/session')->getFormKey();?>',
269
+ 'isAjax': true,
270
+ 'apiId': responseData['apiId'],
271
+ 'apiUser': responseData['apiUser'],
272
+ 'apiSecret': responseData['apiSecret'],
273
+ 'email': jQuery('#mailfield').val()
274
+ },
275
+ dataType: 'json',
276
+ success: function(result) {
277
+ window.location = successUrl;
278
+ }
279
+ });
280
+ }
281
+ },
282
+ error: function (responseData, textStatus, errorThrown) {
283
+ alert('Ein Fehler ist aufgetreten! Prüfen Sie Ihre Daten.');
284
+ }
285
+ });
286
+ event.preventDefault();
287
+ });
288
+ </script>
app/etc/modules/Trivid_Clipgenerator.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Trivid_Clipgenerator>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Trivid_Clipgenerator>
8
+ </modules>
9
+ </config>
app/locale/de_DE/Trivid_Clipgenerator.csv ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ "Genre","Genre"
2
+ "Mood","Stimmung"
3
+ "Instruments","Instrumente"
4
+ "Speed","Tempo"
5
+ "Theme","Thema"
package.xml ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>clipgenerator</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.clipgenerator.com/static/public/legal.php">Clipgenerator - End User License Agreement</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Professionelle Videos aus Bildern und Daten Ihrer Artikel in einem automatisierten, patentierten Verfahren.</summary>
10
+ <description>&lt;p&gt;Erstellen Sie automatisch professionelle Video-Clips aus den Bildern Ihrer Produkte mit dem Clipgenerator&#x2122;-Plugin f&#xFC;r Magento. Ein perfekter Mix aus qualitativ hochwertigen Video-Designs und perfekt abgestimmter Musik machen aus Ihren Inhalten wie Bildern, Preisen, Logos, G&#xFC;tezeichen, Versandangaben, Kundenbewertungen u.a. in Echtzeit synchronisierte Produkt-Videos, individuelle Slide Shows, emotionale Verkaufs-Pr&#xE4;sentationen und Suchmaschinen optimierte Filme.&lt;/p&gt;&#xD;
11
+ &#xD;
12
+ &lt;h3&gt;Ihre Vorteile&lt;/h3&gt;&#xD;
13
+ &lt;p&gt;&#xD;
14
+ &#x25CF; unbegrenzte Aktualisierung und Synchronisierung von Videos bei jeder &#xC4;nderung&lt;br /&gt;&#xD;
15
+ &#x25CF; unbegrenzte Anzahl Aufrufe Produkt-Videos&lt;br /&gt;&#xD;
16
+ &#x25CF; inklusive Video-Hosting &amp; Video-Streaming&lt;br /&gt;&#xD;
17
+ &#x25CF; zus&#xE4;tzlich statische Video-Dateien in allen Formaten&lt;br /&gt;&#xD;
18
+ &#x25CF; hohe Video-Qualit&#xE4;t und Video-Player mit vielen Funktionen&lt;br /&gt;&#xD;
19
+ &#x25CF; wechselnde Video-Designs&lt;br /&gt;&#xD;
20
+ &#x25CF; 150 Musik-Titel, voll lizensiert und abwechselnd unterlegt&lt;br /&gt;&#xD;
21
+ &#x25CF; Suchmaschinen-Optimierung (SEO) durch dynamische Sitemaps, Thumbnails, Titel und Keywords&lt;br /&gt;&#xD;
22
+ &#x25CF; Video-Ausgabe-Format als url, embed code oder Player mit Share-Funktionen f&#xFC;r Social-Media&lt;br /&gt;&#xD;
23
+ &lt;/p&gt;&#xD;
24
+ &#xD;
25
+ &lt;h3&gt;Vollautomatisch&lt;/h3&gt;&#xD;
26
+ &lt;p&gt;Clipgenerator&#x2122; erstellt vollautomatisch aus den Bildern und Daten eines Produkts ein individuelles, Suchmaschinen relevantes Produktvideo. Wesentliche Daten wie Produktname, Details und Preis sowie Shop-Name, Web-Adresse und Kontaktdaten k&#xF6;nnen direkt ohne Ihr Zutun in jedes Video eingesetzt werden.&lt;/p&gt;&#xD;
27
+ &#xD;
28
+ &lt;h3&gt;Individuell&lt;/h3&gt;&#xD;
29
+ &lt;p&gt;Die automatisch aus Ihren Daten erstellten Clips k&#xF6;nnen jederzeit und ohne Aufwand von Ihnen nochmals angepasst werden. In den Artikelinformationen kann f&#xFC;r jedes Video individuelles Bildmaterial, Musik oder Video-Design ausgew&#xE4;hlt werden.&lt;/p&gt;&#xD;
30
+ &#xD;
31
+ &lt;h3&gt;Suchmaschinen-Optimierung&lt;/h3&gt;&#xD;
32
+ &lt;p&gt;Suchmaschinen bewerten Video-Inhalte h&#xF6;her als Seiten ohne Video-Content. Die Optimierung von Videos zusammen mit der korrekten Aufbereitung der Video-Daten verbessert entscheidend das Suchmaschinen-Ranking von Websites sowie das Gefunden-Werden Ihrer Produkte und Dienstleistung.&lt;/p&gt;&#xD;
33
+ &#xD;
34
+ &lt;p&gt;Individuelle Clipgenerator Videos werden f&#xFC;r relevante Suchanfragen auf den ersten R&#xE4;ngen der Suchergebnisse gelistet. Dadurch steigern optimierte Videos nicht nur den Traffic auf der Seite, sondern auch und gerade die Konversionsraten und Ums&#xE4;tze von Online Shops und E-Commerce Anbietern.&lt;/p&gt;&#xD;
35
+ &#xD;
36
+ &lt;h3&gt;Pakete / Preise&lt;/h3&gt;&#xD;
37
+ &lt;p&gt;&#xD;
38
+ &#x25CF; &lt;strong&gt;simpleCOMMERCE 150 (39 EUR pro Monat)&lt;/strong&gt;&lt;br /&gt; f&#xFC;r insgesamt 150 Produktvideos&lt;br /&gt;&#xD;
39
+ &#x25CF; &lt;strong&gt;simpleCOMMERCE 300 (59 EUR pro Monat)&lt;/strong&gt;&lt;br /&gt; f&#xFC;r insgesamt 300 Produktvideos&lt;br /&gt;&#xD;
40
+ &#x25CF; &lt;strong&gt;simpleCOMMERCE 750 (139 EUR pro Monat)&lt;/strong&gt;&lt;br /&gt; f&#xFC;r insgesamt 750 Produktvideos&lt;br /&gt;&#xD;
41
+ &#x25CF; &lt;strong&gt;simpleCOMMERCE 1500 (249 EUR pro Monat)&lt;/strong&gt;&lt;br /&gt; f&#xFC;r insgesamt 1500 Produktvideos&lt;br /&gt;&#xD;
42
+ &lt;/p&gt;&#xD;
43
+ &#xD;
44
+ &lt;h3&gt;Optional: Video-Downloads&lt;/h3&gt;&#xD;
45
+ &lt;p&gt;Damit Sie die erstellten, immer aktuellen Produkt-Videos auch an anderer Stelle verwenden k&#xF6;nnen, bieten wir den Download als Video-Datei an (mp4-Format). Ausgew&#xE4;hlte Produkt-Videos k&#xF6;nnen Sie somit auch offline verwenden (z.B. f&#xFC;r Pr&#xE4;sentationen am POS) oder au&#xDF;erhalb Ihres Shops (z.B. auf YouTube oder anderen Verkaufs-oder Vergleichs-Portalen) ver&#xF6;ffentlichen.&lt;/p&gt;&#xD;
46
+ &#xD;
47
+ &lt;p&gt;&#xD;
48
+ &#x25CF; &lt;strong&gt;simpleCOMMERCE 150 (419 EUR pro Jahr)&lt;/strong&gt;&lt;br /&gt; f&#xFC;r insgesamt 150 Produktvideos pro Jahr: Sie sparen 49 EUR!&lt;br /&gt;&#xD;
49
+ &#x25CF; &lt;strong&gt;simpleCOMMERCE 300 (632 EUR pro Jahr)&lt;/strong&gt;&lt;br /&gt; f&#xFC;r insgesamt 300 Produktvideos pro Jahr: Sie sparen 76 EUR!&lt;br /&gt;&#xD;
50
+ &#x25CF; &lt;strong&gt;simpleCOMMERCE 750 (1479 EUR pro Jahr)&lt;/strong&gt;&lt;br /&gt; f&#xFC;r insgesamt 750 Produktvideos pro Jahr: Sie sparen 189 EUR!&lt;br /&gt;&#xD;
51
+ &#x25CF; &lt;strong&gt;simpleCOMMERCE 1500 (2490 EUR pro Jahr)&lt;/strong&gt;&lt;br /&gt; f&#xFC;r insgesamt 1500 Produktvideos pro Jahr: Sie sparen 498 EUR!&lt;br /&gt;&#xD;
52
+ &lt;/p&gt;&#xD;
53
+ &#xD;
54
+ &lt;h3&gt;Anleitung&lt;/h3&gt;&#xD;
55
+ Eine Anleitung zur Nutzung des Clipgenerator&#x2122;-Plugin f&#xFC;r Magento k&#xF6;nnen Sie &lt;a href="http://www.trivid.com/wp-content/uploads/2013/10/clipgenerator-plugin-handbuch.pdf"&gt;hier&lt;/a&gt; herunterladen.</description>
56
+ <notes>* Version 1.0.0</notes>
57
+ <authors><author><name>Trivid GmbH</name><user>trivid_gmbh</user><email>magento@clipgenerator.com</email></author></authors>
58
+ <date>2013-10-29</date>
59
+ <time>19:59:07</time>
60
+ <contents><target name="magecommunity"><dir><dir name="Trivid"><dir name="Clipgenerator"><dir><dir name="Adminhtml"><file name="MassController.php" hash="6451b00d63f88c273b24bd9ffaf1dd72"/><file name="OrderformController.php" hash="1a99976446b230d2ea0636bde3889054"/></dir><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Contingentlabel.php" hash="2be82b98fe1bebd1d82d30ce1bb2d649"/><file name="Musiclightbox.php" hash="464045a595db0e91ebb181755b2a3bfa"/></dir></dir></dir></dir></dir><dir name="Catalog"><dir name="Product"><dir name="Helper"><dir name="Form"><file name="Images.php" hash="aac3ebf3fd5238a858ef3a4eddd445cb"/><file name="Music.php" hash="a07cee46c2a10843f0a80c8bd199f4c8"/><file name="music.php" hash="c52dda2e89df9b62a374f6f3df9dc7fe"/></dir></dir></dir></dir><file name="InsertVideo.php" hash="181bcd9e93a68728af6c40a4d1863ada"/><file name="Video.php" hash="dfebc08e99f9317924b0f476f0288a90"/></dir><dir name="Helper"><file name="Data.php" hash="e86c4a865ca08021606e29f4177307fd"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Source"><file name="Designs.php" hash="f9131fd5f45a57dbf3b0c9263cc49844"/><file name="Musics.php" hash="1b07117ca6537fc8104ca3a2909c53ce"/></dir></dir></dir></dir><dir name="Mysql4"><file name="Setup.php" hash="bc0481fa5386033f3ce6ac9029b82a08"/></dir><file name="Observer.php" hash="ad035f799a8b66609305e21f3f7a3644"/><dir name="Source"><file name="Designs.php" hash="cfa2f560b2d1c03a048fc1dfa8895823"/><file name="Musics.php" hash="060b151a485e30eaf586d906928a8f52"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="MassController.php" hash="05623ae1c2ee1a1952df7ade0dcc1a31"/><file name="OrderformController.php" hash="1a99976446b230d2ea0636bde3889054"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="da3eb20bfd72ff9e0e5000dcb49f5fd8"/><file name="config.xml" hash="7e9a0b4a5363b8fcdaf6e1060bf714b7"/><file name="system.xml" hash="1fbd0c008a4f9dda41ca51cfd95dce43"/></dir><dir name="lib"><dir name="clipgenerator"><file name="ClipgeneratorClient.php" hash="ee3da37d7947591dc3fc6886d8dc710d"/><file name="Frame.php" hash="9455ee512fed22039d7700b9db5b50ed"/><file name="Logo.php" hash="21c9732369bc983549cbfe525e8a327c"/><file name="LowerThird.php" hash="bfe8a3bbc65292d09dcb7384ac791413"/><file name="Picture.php" hash="b8b29fe5e1106f05281d83dc90888461"/><file name="Video.php" hash="95176448517ba383a5d30a0108dd2f49"/></dir></dir><dir name="sql"><dir name="clipgenerator_setup"><file name="mysql4-install-0.1.0.php" hash="7d8c159488c3095c2fe26ec9b9691d41"/><file name="mysql4-install-1.0.0.php" hash="63644f41ed5cf5797d3808386caafb66"/></dir></dir></dir></dir></dir></dir></target><target name="magedesign"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="clipgenerator"><file name="contingent.phtml" hash="f236a5ab0bdedf11ad6bacddd32a433b"/><file name="images.phtml" hash="6cfe794918dfcd7c9ca19d97981d0486"/><file name="music.phtml" hash="a97eb70c9626bdd7722d640a29b1182b"/><file name="orderform.phtml" hash="1139bdf2fc763fe6231dc26aae5bfd94"/></dir></dir><dir name="layout"><file name="clipgenerator.xml" hash="7070a0cd1223aabd72590fe3134be051"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir><dir name="de_DE"><file name="Trivid_Clipgenerator.csv" hash="7cb7b98981d24204016b54c821011d44"/></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Trivid_Clipgenerator.xml" hash="63ce89126d102aa43d975022570107cf"/></dir></dir></target></contents>
61
+ <compatible/>
62
+ <dependencies><required><php><min>5.2.13</min><max>5.3.24</max></php></required></dependencies>
63
+ </package>