public function getRetinaData($data, $_item = 0, $_itemparameter = 0) { $helpImg = MAGE::helper('ThemeOptionsHarbour/images'); if (Mage::getStoreConfig('meigee_harbour_general/retina/status')) { $appearance = MAGE::helper('ThemeOptionsHarbour')->getThemeOptionsHarbour('meigee_harbour_appearance'); $logo = $appearance['logo']; $html = ''; switch ($data) { case 'default_logo': $html = 'data-srcX2="' . Mage::getDesign()->getSkinUrl('images/@x2/logo@x2.png') . '"'; break; case 'logo': $mediaurl = MAGE::helper('ThemeOptionsHarbour')->getThemeOptionsHarbour('mediaurl'); $html = 'data-srcX2="' . $mediaurl . $logo['logo_retina'] . '"'; break; case 'second_logo': $mediaurl = MAGE::helper('ThemeOptionsHarbour')->getThemeOptionsHarbour('mediaurl'); $html = 'data-srcX2="' . $mediaurl . $logo['second_logo_retina'] . '"'; break; case 'default_small_logo': $html = 'data-srcX2="' . Mage::getDesign()->getSkinUrl('images/@x2/small_logo@x2.png') . '"'; break; case 'small_logo': $mediaurl = MAGE::helper('ThemeOptionsHarbour')->getThemeOptionsHarbour('mediaurl'); $html = 'data-srcX2="' . $mediaurl . $logo['small_logo_retina'] . '"'; break; default: # code... break; } return $html; } else { return false; } }
public function getRetinaData($data, $_item = 0, $_itemparameter = 0) { $helpImg = MAGE::helper('ThemeOptionsIndigo/images'); if (Mage::getStoreConfig('meigee_indigo_general/retina/status')) { switch ($data) { case 'logo': $html = 'data-srcX2="' . Mage::getDesign()->getSkinUrl('images/@x2/logo@x2.png') . '"'; break; case 'logo_custom': $customlogo = MAGE::helper('ThemeOptionsIndigo')->getThemeOptionsIndigo('customlogo'); $mediaurl = MAGE::helper('ThemeOptionsIndigo')->getThemeOptionsIndigo('mediaurl'); $html = 'data-srcX2="' . $mediaurl . $customlogo['logo_retina'] . '"'; break; case 'small_logo': $html = 'data-srcX2="' . Mage::getDesign()->getSkinUrl('images/@x2/small_logo@x2.png') . '"'; break; case 'small_logo_custom': $customlogo = MAGE::helper('ThemeOptionsIndigo')->getThemeOptionsIndigo('customlogo'); $mediaurl = MAGE::helper('ThemeOptionsIndigo')->getThemeOptionsIndigo('mediaurl'); $html = 'data-srcX2="' . $mediaurl . $customlogo['logo_retina'] . '"'; break; default: # code... break; } return $html; } else { return false; } }
/** * Validate value * * @throws Mage_Core_Exception if there is no field value, search value is empty or regular expression is not valid */ protected function _beforeSave() { $design = clone Mage::getDesign(); // For value validations $exceptions = $this->getValue(); foreach ($exceptions as $rowKey => $row) { if ($rowKey === '__empty') { continue; } // Validate that all values have come foreach (array('search', 'value') as $fieldName) { if (!isset($row[$fieldName])) { Mage::throwException(Mage::helper('Mage_Core_Helper_Data')->__("Exception does not contain field '{$fieldName}'")); } } // Empty string (match all) is not supported, because it means setting a default theme. Remove such entries. if (!strlen($row['search'])) { unset($exceptions[$rowKey]); continue; } // Validate the theme value $design->setDesignTheme($row['value'], Mage_Core_Model_App_Area::AREA_FRONTEND); // Compose regular exception pattern $exceptions[$rowKey]['regexp'] = $this->_composeRegexp($row['search']); } $this->setValue($exceptions); return parent::_beforeSave(); }
/** * Override method to output wrapper * * @param Varien_Data_Form_Element_Abstract $element * @param Array $option * @param String $selected * @return String */ protected function _optionToHtml($element, $option, $selected) { $float = $option['value'] == 'fixed' ? 'right' : 'left'; $html = '<div class="' . $float . ' a-center">'; $html .= '<img src="' . Mage::getDesign()->getSkinUrl('images/magik/lamby/appearance_width_' . $option['value'] . '.jpg') . '" alt="" /><br/>'; $html .= '<input type="radio"' . $element->serialize(array('name', 'class', 'style')); if (is_array($option)) { $html .= 'value="' . htmlspecialchars($option['value'], ENT_COMPAT) . '" id="' . $element->getHtmlId() . $option['value'] . '"'; if ($option['value'] == $selected) { $html .= ' checked="checked"'; } $html .= ' />'; $html .= '<label class="inline" for="' . $element->getHtmlId() . $option['value'] . '"> ' . $option['label'] . '</label>'; } elseif ($option instanceof Varien_Object) { $html .= 'id="' . $element->getHtmlId() . $option->getValue() . '"' . $option->serialize(array('label', 'title', 'value', 'class', 'style')); if (in_array($option->getValue(), $selected)) { $html .= ' checked="checked"'; } $html .= ' />'; $html .= '<label class="inline" for="' . $element->getHtmlId() . $option->getValue() . '">' . $option->getLabel() . '</label>'; } $html .= '</div>'; $html .= $element->getSeparator() . "\n"; return $html; }
/** * @param string $designDir * @param Mage_Core_Model_Design_Package $design * @param Mage_Core_Model_Theme_Registration $registration * @param Mage_Core_Model_Theme $theme */ public function __construct($designDir = null, Mage_Core_Model_Design_Package $design = null, Mage_Core_Model_Theme_Registration $registration, Mage_Core_Model_Theme $theme) { $this->_designDir = $designDir; $this->_design = $design ? $design : Mage::getDesign(); $this->_register = $registration; $this->_theme = $theme; }
/** * Retrieve View URL directive * * @param array $construction * @return string * @see Mage_Core_Model_Email_Template_Filter::viewDirective() method has been copypasted */ public function viewDirective($construction) { $params = $this->_getIncludeParameters($construction[2]); $params['_absolute'] = $this->_useAbsoluteLinks; $url = Mage::getDesign()->getViewFileUrl($params['url'], $params); return $url; }
protected function _construct() { parent::_construct(); Mage::getDesign()->setArea('install')->setPackageName('default')->setTheme('default'); $this->getLayout()->setArea('install'); $this->setFlag('', self::FLAG_NO_CHECK_INSTALLATION, true); }
public function getHtml() { $htmlId = $this->_getHtmlId() . microtime(true); $format = $this->getLocale()->getDateStrFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT); $html = '<div class="range"><div class="range-line date"> <span class="label">' . Mage::helper('adminhtml')->__('From') . ':</span> <input type="text" name="' . $this->_getHtmlName() . '[from]" id="' . $htmlId . '_from" value="' . $this->getEscapedValue('from') . '" class="input-text no-changes"/> <img src="' . Mage::getDesign()->getSkinUrl('images/grid-cal.gif') . '" alt="" class="v-middle" id="' . $htmlId . '_from_trig" title="' . $this->htmlEscape(Mage::helper('adminhtml')->__('Date selector')) . '"/> </div>'; $html .= '<div class="range-line date"> <span class="label">' . Mage::helper('adminhtml')->__('To') . ' :</span> <input type="text" name="' . $this->_getHtmlName() . '[to]" id="' . $htmlId . '_to" value="' . $this->getEscapedValue('to') . '" class="input-text no-changes"/> <img src="' . Mage::getDesign()->getSkinUrl('images/grid-cal.gif') . '" alt="" class="v-middle" id="' . $htmlId . '_to_trig" title="' . $this->htmlEscape(Mage::helper('adminhtml')->__('Date selector')) . '"/> </div></div>'; $html .= '<input type="hidden" name="' . $this->_getHtmlName() . '[locale]" value="' . $this->getLocale()->getLocaleCode() . '"/>'; $html .= '<script type="text/javascript"> Calendar.setup({ inputField : "' . $htmlId . '_from", ifFormat : "' . $format . '", button : "' . $htmlId . '_from_trig", align : "Bl", singleClick : true }); Calendar.setup({ inputField : "' . $htmlId . '_to", ifFormat : "' . $format . '", button : "' . $htmlId . '_to_trig", align : "Bl", singleClick : true }); </script>'; return $html; }
function addCss($css_info) { $param_data_arr = $this->processingParams($css_info); sort($param_data_arr); $css_info['data_name'] = Mage::getDesign()->getSkinUrl($css_info['name'], array()); $this->css_info[] = array_merge(array_map('htmlspecialchars', $css_info), array('params_data' => $param_data_arr)); }
protected function setUp() { parent::setUp(); $theme = Mage::getDesign()->setDefaultDesignTheme()->getDesignTheme(); $this->getRequest()->setParam('type', 'Mage_Cms_Block_Widget_Page_Link'); $this->getRequest()->setParam('theme_id', $theme->getId()); }
public function beforeGenerateBlocks(Varien_Event_Observer $observer) { if (Mage::getSingleton('core/design_package')->getPackageName() == 'default' && Mage::getDesign()->getTheme('frontend') == 'galayomarket') { # Disable default magento navigation if (Mage::helper('yomarketsettings')->getGeneral_DisableDefaultNav() && Mage::getConfig()->getModuleConfig('EM_Megamenupro')->is('active', 'true')) { $blocks = $observer->getLayout()->getXpath('//block[@name="galayomarket.catalog.topnav"]'); if (!empty($blocks)) { $blocks[0]->addAttribute('ignore', true); } } if (Mage::helper('yomarketsettings')->getGeneral_DisableDefaultNav() && Mage::getConfig()->getModuleConfig('EM_Megamenupro')->is('active', 'true')) { $blocks = $observer->getLayout()->getXpath('//block[@name="galayomarket.catalog.topnav.left"]'); if (!empty($blocks)) { $blocks[0]->addAttribute('ignore', true); } } # Disable Gala variation module on frontend if (Mage::helper('yomarketsettings')->getGeneral_DisableFrontendVariation()) { $blocks = $observer->getLayout()->getXpath('//block[@name="em_variation_tpl" or @name="mobile_view"]'); foreach ($blocks as $block) { $block->addAttribute('ignore', true); } } # Disable default Magento footer links if (Mage::helper('yomarketsettings')->getGeneral_DisableFooterLinks()) { $blocks = $observer->getLayout()->getXpath('//block[@name="footer_links"]'); if (!empty($blocks)) { $blocks[0]->addAttribute('ignore', true); } } } }
/** * Get date block * * @return Mage_Core_Block_Html_Date */ protected function _getDateFieldRenderer() { if (!$this->_dateFieldRenderer) { $this->_dateFieldRenderer = $this->getLayout()->createBlock('core/html_date')->setIsRenderToJsTemplate(true)->setClass('datetime-picker input-text require')->setTime(true)->setExtraParams('style="width:150px"')->setImage(Mage::getDesign()->getSkinUrl('images/grid-cal.gif'))->setFormat(Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT)); } return $this->_dateFieldRenderer; }
/** * Generates that the user can click on to apply or remove rules * * @param int $rule_id * @param bool $is_add * @param bool $is_cart * @param int $item_id * @return TBT_Rewards_Block_Checkout_Cart_Rulectrlimg $this */ public function init($rule_id, $is_add = true, $is_cart = true, $item_id = 0, $redemption_instance_id = 0, $callback = "true") { $this->unsetData("callback"); $this->unsetData("url"); $this->unsetData("src"); $rule_type = $is_cart ? 'cart' : 'catalog'; $src = Mage::getDesign()->getSkinUrl('images/rewards/' . ($is_add ? 'add' : 'remove') . '.gif'); $url_key = 'rewards/cart_redeem/' . ($is_add ? $rule_type . 'add' : $rule_type . 'remove'); $params = array('rids' => $rule_id); if (!empty($redemption_instance_id)) { $params['inst_id'] = $redemption_instance_id; } if (!$is_cart) { $params['item_id'] = $item_id; } $url = $this->getUrl($url_key, $params); if (empty($callback)) { $callback = "true"; } $this->setCallback($callback); $this->setActionUrl($url); $this->setUrl($url); $this->setSrc($src); return $this; }
public function getRateOriginRequest($store = null) { if (Mage::app()->getStore()->isAdmin() || Mage::getDesign()->getArea() == 'adminhtml') { $this->adminSession = true; // creating order in the backend } $session = $this->getSession(); if ($session->hasQuote() || $this->adminSession) { // getQuote() would lead to infinite loop here when switching currency $quote = $session->getQuote(); if ($quote->getIsActive() || $this->adminSession) { // use destination of the existing quote as origin if quote exists $request = $this->getRateRequest($quote->getShippingAddress(), $quote->getBillingAddress(), $quote->getCustomerTaxClassId(), $store); return $request; } if (Mage::getSingleton('customer/session')->isLoggedIn()) { $customer = Mage::getSingleton('customer/session')->getCustomer(); if (($billingAddress = $customer->getDefaultBillingAddress()) && ($shippingAddress = $customer->getDefaultShippingAddress())) { // use customer addresses as origin if customer is logged in $request = $this->getRateRequest($shippingAddress, $billingAddress, $customer->getTaxClassId(), $store); return $request; } } return $this->getDefaultDestination(); } // quote is not available when switching the currency return $this->getDefaultDestination(); }
/** * @param string $application * @param string $package * @param string $theme * @param string $skin * @param string $file * @dataProvider skinFilesFromThemesDataProvider */ public function testSkinFilesFromThemes($application, $package, $theme, $skin, $file) { $params = array('area' => $application, 'package' => $package, 'theme' => $theme, 'skin' => $skin); $skinFile = Mage::getDesign()->getSkinFile($file, $params); $this->assertFileExists($skinFile); $fileParts = explode(Mage_Core_Model_Design_Package::SCOPE_SEPARATOR, $file); if (count($fileParts) > 1) { $params['module'] = $fileParts[0]; } if (pathinfo($file, PATHINFO_EXTENSION) == 'css') { $errors = array(); $content = file_get_contents($skinFile); preg_match_all(Mage_Core_Model_Design_Package::REGEX_CSS_RELATIVE_URLS, $content, $matches); foreach ($matches[1] as $relativePath) { $path = $this->_addCssDirectory($relativePath, $file); $pathFile = Mage::getDesign()->getSkinFile($path, $params); if (!is_file($pathFile)) { $errors[] = $relativePath; } } if (!empty($errors)) { $this->fail('Can not find file(s): ' . implode(', ', $errors)); } } }
function getLayoutJsCss(&$result) { $layout = Mage::app()->getLayout(); $js_css_html = $layout->getBlock("head")->getCssJsHtml(); $js_css_html_arr = explode("\n", trim($js_css_html)); $result['head_html'] = ''; $result['head_js_css'] = array(); $baseJsUrl = Mage::getBaseUrl('js'); $designPackage = Mage::getDesign(); foreach ($layout->getBlock("head")->getItems() as $item) { if (empty($item['if'])) { switch ($item['type']) { case 'js_css': $result['head_js_css'][] = array('name' => 'link', 'attributes' => array('href' => $baseJsUrl . $item['name'])); break; case 'js': $result['head_js_css'][] = array('name' => 'script', 'attributes' => array('src' => $baseJsUrl . $item['name'])); break; case 'skin_css': $result['head_js_css'][] = array('name' => 'link', 'attributes' => array('href' => $designPackage->getSkinUrl($item['name'], array()))); break; case 'skin_js': $result['head_js_css'][] = array('name' => 'script', 'attributes' => array('src' => $designPackage->getSkinUrl($item['name'], array()))); break; default: continue; break; } } } return $result; }
public function perform($storeId = 1, $apply = false) { $this->_storeId = $storeId; $this->_apply = $apply; $this->_existingUmask = 0777; //umask(); $appEmulation = Mage::getSingleton('core/app_emulation'); $initial = $appEmulation->startEnvironmentEmulation($this->_storeId, Mage_Core_Model_App_Area::AREA_FRONTEND, true); $this->_skinDefaultDir = Mage::getDesign()->getSkinBaseDir(); $this->_recommendations['settings']['store_id'] = $storeId; $this->_recommendations['settings']['package_name'] = Mage::getDesign()->getPackageName(); $this->_recommendations['settings']['theme'] = Mage::getDesign()->getTheme('layout'); $this->_localXmlFilename = Mage::getBaseDir('design') . DS . 'frontend' . DS . Mage::getDesign()->getPackageName() . DS . Mage::getDesign()->getTheme('layout') . DS . 'layout' . DS . 'local.xml'; $layout = Mage::app()->getLayout(); $update = $layout->getUpdate(); //reset needed since otherwise only packages related to adminhtml are loaded $update->resetPackageLayout(); $xml = $update->getFileLayoutUpdatesXml('frontend', 'base', 'default'); Mage::app()->removeCache($update->getCacheId()); $update->resetHandles(); $update->resetUpdates(); $this->loadDefault(); foreach ($xml->children() as $handle => $node) { Mage::log($handle); try { $this->processHandle($handle); } catch (Exception $e) { $this->_recommendations['skipped'][$handle] = true; } } $appEmulation->stopEnvironmentEmulation($initial); $this->convertRecommendationsToLocalXml(); //umask($this->_existingUmask); return $this->_recommendations; }
public function __toString() { try { if ($this->getImageFile()) { $this->_getModel()->setBaseFile($this->getImageFile(), $this->getBaseDir()); } else { $this->_getModel()->setBaseFile($this->getProduct()->getData($this->_getModel()->getDestinationSubdir())); } if ($this->_getModel()->isCached()) { return $this->_getModel()->getUrl(); } else { if ($this->_scheduleResize) { $this->_getModel()->resize(); } if ($this->_scheduleRotate) { $this->_getModel()->rotate($this->getAngle()); } if ($this->getWatermark()) { $this->_getModel()->setWatermark($this->getWatermark()); } $url = $this->_getModel()->saveFile()->getUrl(); } } catch (Exception $e) { $url = Mage::getDesign()->getSkinUrl($this->getPlaceholder()); } return $url; }
/** * Get Key pieces for caching block content * * @return array */ public function getCacheKeyInfo() { if (NULL === $this->_cacheKeyArray) { $this->_cacheKeyArray = array('INFORTIS_ULTRASLIDESHOW', Mage::app()->getStore()->getId(), Mage::getDesign()->getPackageName(), Mage::getDesign()->getTheme('template'), Mage::getSingleton('customer/session')->getCustomerGroupId(), 'template' => $this->getTemplate(), 'name' => $this->getNameInLayout(), (int) Mage::app()->getStore()->isCurrentlySecure(), implode(".", $this->getSlideIds()), $this->getBanner(), $this->_isPredefinedHomepageSlideshow); } return $this->_cacheKeyArray; }
/** * @param string $application * @param string $file * @dataProvider getSkinImagesUrlDataProvider */ public function testGetSkinImagesUrl($application, $file) { $helper = new Mage_XmlConnect_Helper_Image(); //Mage::getDesign()->setDesignTheme('default/default/default', $application); $this->assertStringMatchesFormat("http://%s/media/skin/{$application}/%s/%s/%s/%s/Mage_XmlConnect/images/{$file}", $helper->getSkinImagesUrl($file)); $this->assertFileExists(Mage::getDesign()->getSkinFile("Mage_XmlConnect::/images/{$file}")); }
/** * prevAction Preview Assign product controller action * @var Int $id Assign product id * @var Object $model Assign product model object * @var Object $products Catalog product model object * @var String $mediDir Conatines Media deirectory path * @var String $imagesdir Conatines Assign product image directory path * @var String $url Assign product image url * @var Array $products Assign product details * @return JSON $products Assign product detail in json format */ public function prevAction() { $id = $this->getRequest()->getParam('id'); $model = Mage::getModel('mpassignproduct/mpassignproduct')->load($id); $products = Mage::getModel('catalog/product')->load($model->getProductId())->toArray(); $mediDir = Mage::getBaseDir('media'); $imagesdir = $mediDir . '/mpassignproduct/' . $id . '/'; $url = 0; if (file_exists($imagesdir)) { foreach (new DirectoryIterator($imagesdir) as $fileInfo) { if ($fileInfo->isDot() || $fileInfo->isDir()) { continue; } if ($fileInfo->isFile()) { $url = Mage::getBaseUrl('media') . 'mpassignproduct/' . $id . '/' . $fileInfo; break; } } } if (!$url) { $url = Mage::getDesign()->getSkinUrl('images/catalog/product/placeholder/', array('_area' => 'frontend')) . "image.jpg"; } $products['price'] = $model->getPrice(); $products['description'] = $model->getProductDescription(); $products['url'] = $url; echo json_encode($products); }
protected function getCheckoutSession() { if (Mage::getDesign()->getArea() == 'adminhtml') { return Mage::getSingleton('adminhtml/session_quote'); } return Mage::getSingleton('checkout/session'); }
public function getCacheKeyInfo() { if (NULL === $this->_cacheKeyArray) { $this->_cacheKeyArray = array(Mage::app()->getStore()->getId(), Mage::getDesign()->getPackageName(), Mage::getDesign()->getTheme('template'), $this->getCategoryId(), $this->getProductsCount(), $this->getBlockTitle(), $this->getBlockTitleSize(), $this->getProductColumns(), $this->getIsRandom(), $this->getTemplate()); } return $this->_cacheKeyArray; }
public function editAction() { $id = $this->getRequest()->getParam('id'); $model = Mage::getModel('qquoteadv/qqadvcustomer')->load($id); if ($model->getId() || $id == 0) { $data = Mage::getSingleton('adminhtml/session')->getFormData(true); if (!empty($data)) { $model->setData($data); } Mage::register('qquote_data', $model); $skinUrl = Mage::getDesign()->getSkinUrl(); $this->loadLayout(); $this->_setActiveMenu('qquoteadv/items'); $head = $this->getLayout()->getBlock('head'); $head->setCanLoadExtJs(true); $access = $this->getAccessLevel(); if (is_null($access) || $this->isTrialVersion()) { $msgUpgrade = $this->getMsgToUpgrade(); $this->_addContent($this->getLayout()->createBlock('core/text', 'example-block')->setText($msgUpgrade)); } $this->_addContent($this->getLayout()->createBlock('qquoteadv/adminhtml_qquoteadv_edit'))->_addLeft($this->getLayout()->createBlock('qquoteadv/adminhtml_qquoteadv_edit_tabs')); $this->renderLayout(); } else { Mage::getSingleton('adminhtml/session')->addError($this->__('Item does not exist')); $this->_redirect('*/*/'); } }
public function isAdmin() { if (Mage::app()->getStore()->isAdmin() || Mage::getDesign()->getArea() == 'adminhtml') { return true; } return false; }
/** * Controller predispatch method for check login all action * @return Magestore_Simisalestrackingapi_Controller_Adminhtml_Action */ public function preDispatch() { // override admin store design settings via stores section Mage::getDesign()->setArea($this->_currentArea)->setPackageName((string) Mage::getConfig()->getNode('stores/admin/design/package/name'))->setTheme((string) Mage::getConfig()->getNode('stores/admin/design/theme/default')); foreach (array('layout', 'template', 'skin', 'locale') as $type) { if ($value = (string) Mage::getConfig()->getNode("stores/admin/design/theme/{$type}")) { Mage::getDesign()->setTheme($type, $value); } } $this->getLayout()->setArea('adminhtml'); //check login $session = Mage::getSingleton('admin/session'); if (!$session->isLoggedIn()) { $request = Mage::app()->getRequest(); $request->initForward()->setModuleName('simisalestrackingapi')->setControllerName('login')->setActionName('index')->setDispatched(false); } else { if (!$session->isAllowed('simisalestrackingapi/' . $this->getRequest()->getControllerName()) && $this->getRequest()->getControllerName() !== 'changestore') { Mage::getSingleton('admin/session', array('name' => 'adminhtml'))->getCookie()->delete(Mage::getSingleton('admin/session', array('name' => 'adminhtml'))->getSessionName()); Mage::getSingleton('admin/session', array('name' => 'adminhtml'))->unsetAll(); Mage::getSingleton('adminhtml/session')->unsetAll(); Mage::getSingleton('core/session')->setLoginMessage(Mage::helper('simisalestrackingapi')->__('Access denied.')); $request = Mage::app()->getRequest(); $request->initForward()->setModuleName('simisalestrackingapi')->setControllerName('login')->setActionName('index')->setDispatched(false); } } return $this; }
public function getPeriod($point) { $str = ""; $date_day = "d "; $date_month = "M"; if (Mage::helper('dpdfrrelais')->isBetweenClosingPeriod($point, 1)) { $start = strtotime(Mage::helper('dpdfrrelais')->convertdateformat($point['closing_period_start_date_1'])); $end = strtotime(Mage::helper('dpdfrrelais')->convertdateformat($point['closing_period_end_date_1'])); $str .= date($date_day, $start) . __(date($date_month, $start)) . " au " . date($date_day, $end) . __(date($date_month, $end)); } if (Mage::helper('dpdfrrelais')->isBetweenClosingPeriod($point, 2)) { $start = strtotime(Mage::helper('dpdfrrelais')->convertdateformat($point['closing_period_start_date_2'])); $end = strtotime(Mage::helper('dpdfrrelais')->convertdateformat($point['closing_period_end_date_2'])); if ($str) { $str .= " and "; } $str .= date($date_day, $start) . __(date($date_month, $start)) . " au " . date($date_day, $end) . __(date($date_month, $end)); } if (Mage::helper('dpdfrrelais')->isBetweenClosingPeriod($point, 3)) { $start = strtotime(Mage::helper('dpdfrrelais')->convertdateformat($point['closing_period_start_date_3'])); $end = strtotime(Mage::helper('dpdfrrelais')->convertdateformat($point['closing_period_end_date_3'])); if ($str) { $str .= " and "; } $str .= date($date_day, $start) . __(date($date_month, $start)) . " au " . date($date_day, $end) . __(date($date_month, $end)); } if ($str) { $img = Mage::getDesign()->getSkinUrl('images/i_notice.gif'); $words = __('Attention, this Pickup point will not be available from') . " " . $str; $this->_result = <<<EOT <div class="noticeICI"><img src="{$img}" />{$words}</div> EOT; } return $this; }
public function testApplyCustomDesign() { $this->_model->applyCustomDesign('package/theme/skin'); $this->assertEquals('package', Mage::getDesign()->getPackageName()); $this->assertEquals('theme', Mage::getDesign()->getTheme()); $this->assertEquals('skin', Mage::getDesign()->getSkin()); }
/** * Controller pre-dispatch method * * @return Mage_XmlConnect_Controller_AdminAction */ public function preDispatch() { Mage::getSingleton('adminhtml/url')->turnOffSecretKey(); // override admin store design settings via stores section Mage::getDesign()->setArea($this->_currentArea)->setPackageName((string) Mage::getConfig()->getNode('stores/admin/design/package/name'))->setTheme((string) Mage::getConfig()->getNode('stores/admin/design/theme/default')); foreach (array('layout', 'template', 'skin', 'locale') as $type) { $value = (string) Mage::getConfig()->getNode("stores/admin/design/theme/{$type}"); if ($value) { Mage::getDesign()->setTheme($type, $value); } } $this->getLayout()->setArea($this->_currentArea); Mage::dispatchEvent('adminhtml_controller_action_predispatch_start', array()); Mage_Core_Controller_Varien_Action::preDispatch(); if ($this->getRequest()->isDispatched() && $this->getRequest()->getActionName() !== 'denied' && !$this->_isAllowed()) { $this->_forward('denied'); $this->setFlag('', self::FLAG_NO_DISPATCH, true); return $this; } if (is_null(Mage::getSingleton('adminhtml/session')->getLocale())) { Mage::getSingleton('adminhtml/session')->setLocale(Mage::app()->getLocale()->getLocaleCode()); } $this->getResponse()->setHeader('Content-type', 'text/xml; charset=UTF-8'); if ($this->_isCheckCookieRequired()) { $this->_checkCookie(); } return $this; }
/** * @param string $type * @param string $expectedFile * @dataProvider getPlaceholderImageUrlDataProvider * @magentoAppIsolation enabled * * @group module:Mage_Catalog */ public function testGetPlaceholderImageUrl($type, $expectedFile) { Mage::getDesign()->setDesignTheme('default/default/default', 'adminhtml'); $url = $this->_model->getPlaceholderImageUrl($type); $this->assertStringEndsWith($expectedFile, $url); $this->assertFileExists(Mage::getBaseDir('media') . "/skin/adminhtml/default/default/default/en_US/{$expectedFile}"); }