/** * @param Open_Gallery_Model_Item $object * @param null $width * @param null $height * @return string */ public function getItemBoxUrl(Open_Gallery_Model_Item $object, $width = null, $height = null) { switch ($object->getData('type')) { case Open_Gallery_Model_Item::TYPE_IMAGE: return Mage::helper('open_gallery')->getBoxImageUrl($object, 'value', $width, $height); break; default: return $this->getItemUrl($object); break; } }
/** * @param Open_Gallery_Model_Item $item * @param Varien_Data_Form $form * @return $this|Open_Gallery_Helper_Item_Interface */ public function prepareEditForm(Open_Gallery_Model_Item $item, Varien_Data_Form $form) { $isReadonlyMode = false; foreach ($form->getElements() as $element) { /** @var Varien_Data_Form_Element_Abstract $element */ if ($element instanceof Varien_Data_Form_Element_Fieldset && 'general_information' == $element->getId()) { $fieldSet = $element; $fieldSet->addField('value', 'image', array('name' => 'item[value]', 'label' => $this->__('Image File'), 'title' => $this->__('Image File'), 'required' => !$item->getData('value'), 'disabled' => $isReadonlyMode, 'note' => $this->__('Allowed format(s): <strong>%s</strong>', implode(', ', $item->getAllowedFormats())) . '<br/>' . $this->__('Your server allow you to upload files not more than <strong>%s</strong>. You can modify <strong>post_max_size</strong> (currently is %s) and <strong>upload_max_filesize</strong> (currently is %s) values in php.ini if you want to upload larger files.', $this->getDataMaxSize(), $this->getPostMaxSize(), $this->getUploadMaxSize()))); break; } } return $this; }
/** * @param Open_Gallery_Model_Item $item * @param Varien_Data_Form $form * @return $this|Open_Gallery_Helper_Item_Interface */ public function prepareEditForm(Open_Gallery_Model_Item $item, Varien_Data_Form $form) { $isReadonlyMode = false; foreach ($form->getElements() as $element) { /** @var Varien_Data_Form_Element_Abstract $element */ if ($element instanceof Varien_Data_Form_Element_Fieldset && 'general_information' == $element->getId()) { $fieldSet = $element; $fieldSet->addField('additional_type', 'select', array('name' => 'item[additional][type]', 'label' => $this->__('Source Type'), 'title' => $this->__('Source Type'), 'required' => true, 'disabled' => $isReadonlyMode, 'options' => Mage::getModel('open_gallery/config_system_source_type')->toOptionArray())); $fieldSet->addField('additional_value_file', 'file', array('name' => 'item[additional_value_file]', 'label' => $this->__('Video File'), 'title' => $this->__('Video File'), 'required' => !strlen($item->getData('value')), 'disabled' => $isReadonlyMode, 'container_id' => 'container_value_file', 'note' => $this->__('Allowed format(s): <strong>%s</strong>', implode(', ', $item->getAllowedFormats())) . '<br/>' . $this->__('Your server allow you to upload files not more than <strong>%s</strong>. You can modify <strong>post_max_size</strong> (currently is %s) and <strong>upload_max_filesize</strong> (currently is %s) values in php.ini if you want to upload larger files.', $this->getDataMaxSize(), $this->getPostMaxSize(), $this->getUploadMaxSize()))); $fieldSet->addField('additional_value_youtube', 'text', array('name' => 'item[additional][value_youtube]', 'label' => $this->__('YouTube ID'), 'title' => $this->__('YouTube ID'), 'required' => true, 'disabled' => $isReadonlyMode, 'container_id' => 'container_value_youtube')); $fieldSet->addField('additional_value_embedded', 'textarea', array('name' => 'item[additional][value_embedded]', 'label' => $this->__('Embed Code'), 'title' => $this->__('Embed Code'), 'required' => true, 'disabled' => $isReadonlyMode, 'container_id' => 'container_value_embedded')); break; } } return $this; }
/** * @param Open_Gallery_Model_Item $item * @param Mage_Core_Controller_Varien_Action $controller * @return Open_Gallery_Helper_Item_Interface|void */ public function prepareAndRenderView(Open_Gallery_Model_Item $item, Mage_Core_Controller_Varien_Action $controller) { $controller->loadLayout(array('default', strtolower($controller->getFullActionName() . '_' . $item->getData('type')))); $controller->renderLayout(); return $this; }