Example #1
0
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $blockData = Mage::registry(AW_Autorelated_Adminhtml_ShoppingcartblockController::BLOCK_REGISTRY_KEY);
     if (!$blockData instanceof Varien_Object) {
         $blockData = new Varien_Object();
     }
     $fieldset = $form->addFieldset('general', array('legend' => $this->__('General')));
     $fieldset->addField('name', 'text', array('name' => 'name', 'label' => $this->__('Name'), 'required' => true));
     if ($blockData->getData('status') === null) {
         $blockData->setData('status', 1);
     }
     $fieldset->addField('status', 'select', array('name' => 'status', 'label' => $this->__('Status'), 'required' => true, 'values' => Mage::getModel('awautorelated/source_status')->toOptionArray()));
     if (!Mage::app()->isSingleStoreMode()) {
         $fieldset->addField('store', 'multiselect', array('name' => 'store[]', 'label' => $this->__('Store View'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true)));
     } else {
         $blockData->setStore(Mage::app()->getStore(true)->getId());
         $fieldset->addField('store', 'hidden', array('name' => 'store[]'));
     }
     if ($blockData->getData('customer_groups') === null) {
         $blockData->setData('customer_groups', array(Mage_Customer_Model_Group::CUST_GROUP_ALL));
     }
     $fieldset->addField('customer_groups', 'multiselect', array('name' => 'customer_groups[]', 'label' => $this->__('Customer groups'), 'title' => $this->__('Customer groups'), 'required' => true, 'values' => Mage::getModel('awautorelated/source_customer_groups')->toOptionArray()));
     $fieldset->addField('priority', 'text', array('name' => 'priority', 'label' => $this->__('Priority'), 'title' => $this->__('Priority'), 'required' => false));
     $dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
     $fieldset->addField('date_from', 'date', array('name' => 'date_from', 'label' => $this->__('Date From'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'input_format' => Varien_Date::DATE_INTERNAL_FORMAT, 'format' => $dateFormatIso));
     $fieldset->addField('date_to', 'date', array('name' => 'date_to', 'label' => $this->__('Date To'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'input_format' => Varien_Date::DATE_INTERNAL_FORMAT, 'format' => $dateFormatIso));
     $positionSourceModel = Mage::getModel('awautorelated/source_position');
     $fieldset->addField('position', 'select', array('name' => 'position', 'label' => $this->__('Position'), 'title' => $this->__('Position'), 'required' => true, 'values' => $positionSourceModel->toOptionArray(AW_Autorelated_Model_Source_Type::SHOPPING_CART_BLOCK)));
     $form->setValues($blockData->toArray());
     $this->setForm($form);
 }
Example #2
0
 protected function _prepareForm()
 {
     $_form = new Varien_Data_Form();
     $this->setForm($_form);
     $_data = Mage::helper('awautorelated/forms')->getFormData($this->getRequest()->getParam('id'));
     if (!is_object($_data)) {
         $_data = new Varien_Object($_data);
     }
     $_fieldset = $_form->addFieldset('general_fieldset', array('legend' => $this->__('General')));
     $_fieldset->addField('name', 'text', array('name' => 'name', 'label' => $this->__('Name'), 'required' => true));
     if ($_data->getData('status') === null) {
         $_data->setData('status', 1);
     }
     $_fieldset->addField('status', 'select', array('name' => 'status', 'label' => $this->__('Status'), 'required' => TRUE, 'values' => Mage::getModel('awautorelated/source_status')->toOptionArray()));
     if (!Mage::app()->isSingleStoreMode()) {
         $_fieldset->addField('store', 'multiselect', array('name' => 'store[]', 'label' => $this->__('Store View'), 'required' => TRUE, 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(FALSE, TRUE)));
     } else {
         if ($_data->getStore() && is_array($_data->getStore())) {
             $_stores = $_data->getStore();
             if (isset($_stores[0]) && $_stores[0] != '') {
                 $_stores = $_stores[0];
             } else {
                 $_stores = 0;
             }
             $_data->setStore($_stores);
         }
         $_fieldset->addField('store', 'hidden', array('name' => 'store[]'));
     }
     if (!$_data->getStore()) {
         $_data->setStore(0);
     }
     if ($_data->getData('customer_groups') === null) {
         $_data->setData('customer_groups', array(Mage_Customer_Model_Group::CUST_GROUP_ALL));
     }
     $_fieldset->addField('customer_groups', 'multiselect', array('name' => 'customer_groups[]', 'label' => $this->__('Customer groups'), 'title' => $this->__('Customer groups'), 'required' => true, 'values' => Mage::getModel('awautorelated/source_customer_groups')->toOptionArray()));
     $_fieldset->addField('priority', 'text', array('name' => 'priority', 'label' => $this->__('Priority'), 'title' => $this->__('Priority'), 'required' => false));
     $dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
     $_fieldset->addField('date_from', 'date', array('name' => 'date_from', 'label' => $this->__('Date From'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'input_format' => Varien_Date::DATE_INTERNAL_FORMAT, 'format' => $dateFormatIso));
     $_fieldset->addField('date_to', 'date', array('name' => 'date_to', 'label' => $this->__('Date To'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'input_format' => Varien_Date::DATE_INTERNAL_FORMAT, 'format' => $dateFormatIso));
     $_fieldset->addField('position', 'select', array('name' => 'position', 'label' => $this->__('Position'), 'title' => $this->__('Position'), 'required' => true, 'values' => Mage::getModel('awautorelated/source_position')->toOptionArray(AW_Autorelated_Model_Source_Type::CATEGORY_PAGE_BLOCK)));
     $_form->setValues($_data);
 }
Example #3
0
 protected function _prepareForm()
 {
     $_form = new Varien_Data_Form();
     $this->setForm($_form);
     $_data = Mage::getSingleton('adminhtml/session')->getData(AW_Featured_Helper_Data::FORM_DATA_KEY);
     if (!is_object($_data)) {
         $_data = new Varien_Object($_data);
     }
     $_fieldset = $_form->addFieldset('block_fieldset', array('legend' => $this->__('General')));
     $_fieldset->addField('block_name', 'text', array('name' => 'block_name', 'label' => $this->__('Name'), 'required' => TRUE));
     $_fieldset->addField('block_id', 'text', array('name' => 'block_id', 'label' => $this->__('Block ID'), 'required' => TRUE));
     if (is_null($_data->getIsActive())) {
         $_data->setIsActive(TRUE);
     }
     $_fieldset->addField('is_active', 'select', array('name' => 'is_active', 'label' => $this->__('Status'), 'required' => TRUE, 'values' => Mage::getModel('awfeatured/source_status')->toOptionArray()));
     if (!Mage::app()->isSingleStoreMode()) {
         $_fieldset->addField('store', 'multiselect', array('name' => 'store[]', 'label' => $this->__('Store View'), 'required' => TRUE, 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(FALSE, TRUE)));
     } else {
         if ($_data->getStore() && is_array($_data->getStore())) {
             $_stores = $_data->getStore();
             if (isset($_stores[0]) && $_stores[0] != '') {
                 $_stores = $_stores[0];
             } else {
                 $_stores = 0;
             }
             $_data->setStore($_stores);
         }
         $_fieldset->addField('store', 'hidden', array('name' => 'store[]'));
     }
     if (!$_data->getStore()) {
         $_data->setStore(0);
     }
     $_fieldset->addField('type', 'select', array('name' => 'type', 'label' => $this->__('Representation'), 'values' => Mage::getModel('awfeatured/source_representation')->toOptionArray()));
     $_fieldset->addField('autoposition', 'select', array('name' => 'autoposition', 'label' => $this->__('Automatic layout position'), 'values' => Mage::getModel('awfeatured/source_autoposition')->toOptionArray()));
     $_fieldset = $_form->addFieldset('types_data_fset', array('legend' => $this->__('Representation settings')));
     $_fieldset->setFieldsetContainerId('awf_types_settings');
     $_fieldset->addField('types_data', 'note', array('text' => $this->__('No representation has been selected')));
     $_form->setValues($_data);
 }
Example #4
0
 /**
  * Prepare html output
  *
  * @return string
  */
 protected function _toHtml()
 {
     $previewModel = Mage::getModel('hackathon_emailpreview/emailPreview');
     $storeId = $this->getRequest()->getParam('storeId');
     $templateId = $this->getRequest()->getParam('templateId');
     $templateType = $this->getRequest()->getParam('templateType');
     $templateParams = new Varien_Object();
     $templateParams->setRequestParams($this->getRequest()->getParams());
     $templateParams->setStoreId($storeId);
     $eventData = array('templateParams' => $templateParams, 'templateType' => $templateType);
     Mage::dispatchEvent('hackathon_emailpreview_render_email_before', $eventData);
     $storeId = $templateParams->getStoreId();
     $templateParams->setStore(Mage::app()->getStore($storeId));
     $html = $previewModel->renderEmail($templateId, $templateParams->getData());
     return $html;
 }
Example #5
0
 protected function _renderInvoice($pdf, $invoice, $locale)
 {
     if ($invoice->getStoreId()) {
         Mage::app()->getLocale()->emulate($invoice->getStoreId());
         Mage::app()->setCurrentStore($invoice->getStoreId());
         Mage::getSingleton('core/translate')->setLocale($locale)->init('frontend', true);
     }
     $this->_invoice = $invoice;
     $settings = new Varien_Object();
     $order = $invoice->getOrder();
     $settings->setStore($invoice->getStore());
     $page = $this->newPage($settings);
     /* Add image */
     $this->insertLogo($page, $invoice->getStore());
     $this->setSubject($page, Mage::helper('sales')->__('Invoice'));
     /* Add head */
     $this->insertOrder($page, $order, Mage::helper('invoicepdf')->getSalesPdfInvoiceConfigFlag(self::PDF_INVOICE_PUT_ORDER_ID, $order->getStoreId()));
     /* Add body */
     foreach ($invoice->getAllItems() as $item) {
         if ($item->getOrderItem()->getParentItem()) {
             continue;
         }
         /* Draw item */
         $page = $this->_drawItem($item, $page, $order);
     }
     $font = $this->_setFontRegular($page);
     $this->_newLine($font, 10);
     /* Add additional info */
     $page = $this->_insertAdditionalInfo($page, $order);
     /* Add totals */
     $page = $this->insertTotals($page, $invoice);
     $this->_newLine($font, 20);
     /* Insert info text */
     $page = $this->_insertInfoText($page, $order);
     /* Insert info box */
     $page = $this->_insertInfoBlock($page, $order);
     if ($invoice->getStoreId()) {
         Mage::app()->getLocale()->revert();
     }
 }