Exemple #1
0
 /**
  * Start mocking around.
  *
  * @param ShoppingCart shoppingCart The current shopping cart.
  * @param ZenMagick\StoreBundle\Entity\Address shippingAddress Optional shipping address; default is <code>null</code>.
  */
 public static function startMock(ShoppingCart $shoppingCart, $shippingAddress = null)
 {
     global $order, $shipping_weight, $shipping_quoted, $shipping_num_boxes, $total_count, $order_total_modules;
     global $_order, $_shipping_weight, $_shipping_quoted, $_shipping_num_boxes, $_total_count, $_order_total_modules;
     if (self::$mock++) {
         // already mocking
         return;
     }
     // save originals
     $_order = $order;
     $_shipping_weight = $shipping_weight;
     $_shipping_quoted = $shipping_quoted;
     $_shipping_num_boxes = $shipping_num_boxes;
     $_total_count = $total_count;
     $_order_total_modules = $order_total_modules;
     if (!isset($_SESSION['cart'])) {
         $_SESSION['cart'] = new \ZenMagick\ZenCartBundle\Compat\ShoppingCart();
     }
     // get total number of products, not line items...
     $total_count = 0;
     foreach ($shoppingCart->getItems() as $item) {
         $total_count += $item->getQuantity();
     }
     //$order_total_modules = new ZenCartOrderTotal();
     if (null == $order || !$order instanceof ZenCartCheckoutOrder) {
         $mockOrder = new ZenCartCheckoutOrder();
         $mockOrder->setContainer(Runtime::getContainer());
         $mockOrder->setShoppingCart($shoppingCart);
         if (null != $shippingAddress) {
             $mockOrder->setShippingAddress($shippingAddress);
         }
         $order = $mockOrder;
     }
     // START: adjust boxes, weight and tare
     $shipping_quoted = '';
     $shipping_num_boxes = 1;
     $shipping_weight = $shoppingCart->getWeight();
     $za_tare_array = preg_split("/[:,]/", SHIPPING_BOX_WEIGHT);
     $zc_tare_percent = $za_tare_array[0];
     $zc_tare_weight = $za_tare_array[1];
     $za_large_array = preg_split("/[:,]/", SHIPPING_BOX_PADDING);
     $zc_large_percent = $za_large_array[0];
     $zc_large_weight = $za_large_array[1];
     switch (true) {
         // large box add padding
         case SHIPPING_MAX_WEIGHT <= $shipping_weight:
             $shipping_weight = $shipping_weight + $shipping_weight * ($zc_large_percent / 100) + $zc_large_weight;
             break;
         default:
             // add tare weight < large
             $shipping_weight = $shipping_weight + $shipping_weight * ($zc_tare_percent / 100) + $zc_tare_weight;
             break;
     }
     if ($shipping_weight > SHIPPING_MAX_WEIGHT) {
         // Split into many boxes
         $shipping_num_boxes = ceil($shipping_weight / SHIPPING_MAX_WEIGHT);
         $shipping_weight = $shipping_weight / $shipping_num_boxes;
     }
     // END: adjust boxes, weight and tare
 }
Exemple #2
0
 /**
  * Create new image info.
  *
  * @param string image The image name; default is <code>null</code>.
  * @param string alt The alt text; default is an empty string.
  */
 public function __construct($image = null, $alt = '')
 {
     parent::__construct($image, $alt);
     $this->image = $image;
     $this->formattedParameter = '';
     $plugin = Runtime::getContainer()->get('pluginService')->getPluginForId('imageHandler2');
 }
 /**
  * Create new patch.
  *
  * @param string id Id of the patch.
  */
 public function __construct($id)
 {
     parent::__construct();
     $this->container = \ZenMagick\Base\Runtime::getContainer();
     $this->id = $id;
     $this->label = $id . ' Patch';
     $this->messages = array();
 }
Exemple #4
0
 /**
  * Get a database connection by name.
  *
  * @param string name get default connection if null.
  * @return ZenMagick\Base\Database\Connection
  */
 public static function getDatabase($conf = 'default')
 {
     if (null !== Runtime::getContainer()) {
         return Runtime::getContainer()->get('doctrine.dbal.' . $conf . '_connection');
     }
     if (is_array(self::$databaseMap[$conf])) {
         self::$databaseMap[$conf] = Doctrine\DBAL\DriverManager::getConnection(self::$databaseMap[$conf]);
     }
     return self::$databaseMap[$conf];
 }
 /**
  * Create new instance.
  */
 public function __construct()
 {
     parent::__construct();
     $settingsService = Runtime::getContainer()->get('settingsService');
     $this->set('includeTax', $settingsService->get('showPricesTaxIncluded'));
     $this->set('countryId', $settingsService->get('storeCountry'));
     $this->set('zoneId', $settingsService->get('storeCountry'));
     $this->set('languageId', $settingsService->get('storeDefaultLanguageId'));
     $this->set('searchAll', false);
 }
Exemple #6
0
/**
 * zen_build_html_email_from_template wrapper that delegates to either the Zenmagick implementation or the renamed original
 * version of it.
 */
function zen_build_html_email_from_template($template, $args = array())
{
    $container = Runtime::getContainer();
    if ($container->hasParameter('zencart.use_native_email') && $container->getParameter('zencart.use_native_email')) {
        return zen_build_html_email_from_template_org($template, $args);
    }
    $messageBuilder = $container->get('messageBuilder');
    $request = $container->get('request');
    $emailContext = $GLOBALS['ZM_EMAIL_CONTEXT'];
    unset($GLOBALS['ZM_EMAIL_CONTEXT']);
    return $messageBuilder->createContents($template, true, $request, $emailContext);
}
Exemple #7
0
 /**
  * Create new instance.
  */
 public function __construct()
 {
     parent::__construct();
     $this->setFirstName('foo');
     $this->setLastName('bar');
     $this->setCompany('Doo Ltd.');
     $this->setAddressLine1('1 Street');
     $this->setSuburb('Suburb');
     $this->setPostcode('1234');
     $this->setCity('The City');
     $this->setState('Some State');
     $this->setCountry(Runtime::getContainer()->get('countryService')->getCountryForId('NZ'));
 }
 /**
  * Create new instance.
  */
 public function __construct()
 {
     parent::__construct('prfilter', Runtime::getContainer()->get('translator')->trans('Price Range'));
     $this->ranges = array();
     if (!empty($this->filterValues) && is_array($this->filterValues)) {
         // values are in the form of from-to
         foreach ($this->filterValues as $value) {
             $range = explode('-', $value);
             if (!empty($value)) {
                 $this->ranges[$value] = $range;
             }
         }
     }
 }
/**
 * zen_href_link wrapper that delegates to the Zenmagick implementation (for storefront).
 */
function zen_href_link($page = '', $params = '', $transport = 'NONSSL', $addSessionId = true, $seo = true, $isStatic = false, $useContext = true)
{
    $router = Runtime::getContainer()->get('router');
    $page = str_replace('.php', '', $page);
    if (false !== strpos($page, '?')) {
        list($page, $pageParams) = explode('?', $page);
        $params .= $pageParams;
    }
    parse_str($params, $tmp);
    $params = $tmp;
    try {
        return $router->generate('zc_admin_' . $page, $params);
    } catch (\Symfony\Component\Routing\Exception\RouteNotFoundException $e) {
    }
    // try without
    return $router->generate($page, $params);
}
 /**
  * Get a list of all available editors.
  *
  * @return array A class/name map of editors.
  */
 public static function getEditorMap()
 {
     $container = Runtime::getContainer();
     $editorMap = array();
     foreach ($container->get('containerTagService')->findTaggedServiceIds('zenmagick.apps.store.editor') as $id => $args) {
         $label = $id;
         foreach ($args as $elem) {
             foreach ($elem as $key => $value) {
                 if ('label' == $key) {
                     $label = $value;
                     break;
                 }
             }
         }
         $editorMap[$id] = $label;
     }
     return $editorMap;
 }
Exemple #11
0
/**
 * Redirect to a url (safely)
 *
 * This function safely shuts down Symfony by making sure the
 * response and terminate kernel events are called.
 *
 * @param string $url The url to redirect to
 * @param int $response_code http response code (defaults to 302)
 */
function zen_redirect($url, $responseCode = 302)
{
    // fix accidental ampersands
    $url = str_replace(array('&amp;', '&&'), '&', $url);
    $container = Runtime::getContainer();
    $request = $container->get('request');
    if (ENABLE_SSL == 'true' && $request->isSecure()) {
        $url = str_replace('http://', 'https://', $url);
    }
    $response = new RedirectResponse($url, $responseCode);
    $httpKernel = $container->get('http_kernel');
    $event = new FilterResponseEvent($httpKernel, $request, HttpKernelInterface::MASTER_REQUEST, $response);
    $dispatcher = $container->get('event_dispatcher');
    $dispatcher->dispatch(KernelEvents::RESPONSE, $event);
    $response->send();
    $httpKernel->terminate($request, $response);
    exit;
}
Exemple #12
0
 /**
  * Execute this patch.
  *
  * @param boolean force If set to <code>true</code> it will force patching even if
  *  disabled as per settings.
  * @return boolean <code>true</code> if patching was successful, <code>false</code> if not.
  */
 public function patch($force = false)
 {
     $configService = Runtime::getContainer()->get('configService');
     // Create configuration groups
     $group = $configService->getConfigGroupForName('ZenMagick Configuration');
     if (null == $group) {
         $group = $configService->createConfigGroup('ZenMagick Configuration', 'ZenMagick Configuration', false);
     }
     $pluginGroup = $configService->getConfigGroupForName('ZenMagick Plugins');
     if (null == $pluginGroup) {
         $pluginGroup = $configService->createConfigGroup('ZenMagick Plugins', 'ZenMagick Plugins', false);
     }
     $groupId = $group->getId();
     $pluginGroupId = $pluginGroup->getId();
     // create configuration values
     if (null == $configService->getConfigValue('ZENMAGICK_CONFIG_GROUP_ID')) {
         $configService->createConfigValue('ZenMagick Configuration Group Id', 'ZENMAGICK_CONFIG_GROUP_ID', $groupId, $groupId);
     }
     if (null == $configService->getConfigValue('ZENMAGICK_PLUGIN_STATUS')) {
         $configService->createConfigValue('ZenMagick Plugin Status', 'ZENMAGICK_PLUGIN_STATUS', '', $groupId);
     }
     if (null == $configService->getConfigValue('ZENMAGICK_PLUGIN_GROUP_ID')) {
         $configService->createConfigValue('ZenMagick Plugins Group Id', 'ZENMAGICK_PLUGIN_GROUP_ID', $pluginGroupId, $groupId);
     }
     $modulesGroup = $configService->getConfigGroupForName('Module Options')->getId();
     if (null == $configService->getConfigValue('PRODUCTS_OPTIONS_TYPE_SELECT')) {
         $title = 'Product option type Select';
         $description = 'Numeric value of the text product option type.';
         $configService->createConfigValue($title, 'PRODUCTS_OPTIONS_TYPE_SELECT', 0, $modulesGroup, $description);
     }
     if (null == $configService->getConfigValue('TEXT_PREFIX')) {
         $title = 'Text Prefix';
         $description = 'Prefix used to differentiate between text option values and other option values';
         $configService->createConfigValue($title, 'TEXT_PREFIX', 'txt_', $modulesGroup, $description);
     }
     if (null == $configService->getConfigValue('UPLOAD_PREFIX')) {
         $title = 'Upload Prefix';
         $description = 'Prefix used to differentiate between upload option values and other option values';
         $configService->createConfigValue($title, 'UPLOAD_PREFIX', 'upload_', $modulesGroup, $description);
     }
     return true;
 }
Exemple #13
0
 /**
  * ZenMagick implementation of zen-cart's zen_href_link function.
  *
  * @todo improve this entirely!
  */
 public static function zenHrefLink($page, $params = '', $transport = 'NONSSL', $addSessionId = true, $seo = true, $isStatic = false, $useContext = true)
 {
     $container = Runtime::getContainer();
     $request = $container->get('request');
     $page = trim($page, '&?');
     $page = str_replace('&amp;', '&', $page);
     $params = trim(trim($params), '&?');
     $params = str_replace('&amp;', '&', $params);
     if ('index.php' == $page) {
         $page = 'index';
     }
     if ('ipn_main_handler.php' == $page) {
         $page = 'ipn_main_handler';
     }
     $requestId = $page;
     parse_str($params, $parameters);
     if (0 === strpos($page, 'index.php?')) {
         // EZPage altUrl
         $page = str_replace('index.php?', '', $page);
         parse_str($page, $extra);
         if (array_key_exists('main_page', $extra)) {
             $requestId = $extra['main_page'];
             unset($extra['main_page']);
         }
         $parameters = array_merge($extra, $parameters);
     }
     // @todo if we still keep someting like this.. wrong place!
     if (array_key_exists('products_id', $parameters)) {
         $parameters['productId'] = $parameters['products_id'];
         unset($parameters['products_id']);
     }
     if ('login' == $requestId) {
         if (array_key_exists('action', $parameters) && 'process' == $parameters['action']) {
             unset($parameters['action']);
             $requestId = 'login_check';
         }
     }
     return $container->get('router')->generate($requestId, $parameters);
 }
Exemple #14
0
 /**
  * Get the formatted attribute string.
  *
  * @param ZenMagick\Http\Request request The current request.
  * @param boolean addValue Optional flag to include/exclude the value; default is <code>true</code>.
  * @param boolean addName Optional flag to include/exclude the name; default is <code>true</code>.
  * @return string All set (and allowed) attributes as formatted HTML string.
  */
 public function getAttributeString($request, $addValue = true, $addName = true)
 {
     $html = Runtime::getContainer()->get('htmlTool');
     $attr = '';
     if ($addName) {
         $attr = ' name="' . $this->getName() . ($this->isMultiValue() ? '[]' : '') . '"';
     }
     $class = $this->getClass();
     if (!empty($class)) {
         $attr .= ' class="' . $class . '"';
     }
     foreach ($this->getProperties() as $name => $value) {
         if (in_array($name, $this->attributeNames)) {
             if (in_array($name, self::$NO_VAL_ATTR)) {
                 if (Toolbox::asBoolean($this->get($name))) {
                     $attr .= ' ' . $name . '="' . $name . '"';
                 }
             } else {
                 $value = $this->encode ? $html->encode($value) : $value;
                 $attr .= ' ' . $name . '="' . $value . '"';
             }
         }
     }
     if ($addValue) {
         $value = $this->encode ? $html->encode($this->getValue()) : $this->getValue();
         $attr .= ' value="' . $value . '"';
     }
     return $attr;
 }
 /**
  * Create new instance.
  */
 public function __construct()
 {
     parent::__construct('psort', '', Runtime::getContainer()->get('request')->query->getAlnum('sort_id'));
 }
Exemple #16
0
 public function getContainer()
 {
     return \ZenMagick\Base\Runtime::getContainer();
 }
 /**
  * Create new instance.
  */
 public function __construct()
 {
     parent::__construct('cfilter', Runtime::getContainer()->get('translator')->trans('Category'), Runtime::getContainer()->get('request')->query->get('cfilter'));
     $this->productIds = null;
 }
Exemple #18
0
 /**
  * Check if a follow up url exists that should be loaded (after a login).
  *
  * @param boolean clear Optional flag to keep or clear the follow up url; default is <code>true</code> to clear.
  * @return string The url to go to or <code>null</code>.
  */
 public function getFollowUpUrl($clear = true)
 {
     if (null != ($data = $this->getSession()->get('http.followUpUrl'))) {
         if ($clear) {
             $this->getSession()->set('http.followUpUrl', null);
         }
         $router = \ZenMagick\Base\Runtime::getContainer()->get('router');
         return $router->generate($data['requestId'], $data['params']);
     }
     return null;
 }
 /**
  * Create new instance.
  */
 public function __construct()
 {
     parent::__construct('ofilter', Runtime::getContainer()->get('translator')->trans('Order Status'), Runtime::getContainer()->get('request')->query->get('ofilter'));
 }
Exemple #20
0
 /**
  * Build an object based on the bean definition.
  *
  * <p>The syntax for bean definitions is: <em>[class name]#[property1=value1&property2=value2&...]<em>.</p>
  *
  * @param string definition The bean definition.
  * @return mixed An object or <code>null</code>.
  */
 public static function getBean($definition, $container = null)
 {
     if (empty($definition)) {
         return null;
     }
     $container = $container ?: Runtime::getContainer();
     $isRef = false;
     $isPlugin = false;
     if (0 === strpos($definition, 'bean::')) {
         $definition = substr($definition, 6);
         if ('null' == $definition) {
             return null;
         }
     } elseif (0 === strpos($definition, 'plugin::')) {
         $definition = substr($definition, 8);
         $isPlugin = true;
     } elseif (0 === strpos($definition, 'ref::')) {
         $definition = substr($definition, 5);
         $isRef = true;
     }
     // got a valid definition, so let's look that up in the context, just in case
     $tokens = explode('#', $definition, 2);
     if (1 < count($tokens)) {
         parse_str($tokens[1], $properties);
     } else {
         $properties = array();
     }
     if (null != ($obj = self::getobj($tokens[0], $container))) {
         self::setAll($obj, $properties);
         return $obj;
     }
 }
Exemple #21
0
 /**
  * Execute a query.
  *
  * <p>If <code>$resultClass</code> is <code>null</code>, the returned
  * list will contain a map of <em>columns</em> =&gt; <em>value</em> for each selected row.</p>
  *
  * <p><code>$modelClass</code> may be set to the magic value of <code>Connection::MODEL_RAW</code> to force
  * returning the raw data without applying any mappings or conversions.</p>
  *
  * @param string sql The query.
  * @param array params Optional query parameters; default is an empty array.
  * @param mixed mapping The field mappings or table name (list); default is <code>null</code>.
  * @param string modelClass The class name to be used to build result obects; default is <code>null</code>.
  * @return array List of populated objects of class <code>$resultClass</code> or map if <em>modelClass</em> is <code>null</code>.
  */
 public function fetchAll($sql, array $params = array(), $mapping = null, $modelClass = null)
 {
     $mapping = $this->getMapper()->ensureMapping($mapping);
     $stmt = $this->prepareStatement($sql, $params, $mapping);
     $stmt->execute();
     $rows = $stmt->fetchAll(\PDO::FETCH_ASSOC);
     $stmt->closeCursor();
     if (self::MODEL_RAW == $modelClass) {
         return $rows;
     }
     $results = array();
     foreach ($rows as $result) {
         if (null !== $mapping) {
             $result = $this->translateRow($result, $mapping);
         }
         if (null != $modelClass) {
             if (null != ($obj = new $modelClass())) {
                 if ($obj instanceof \Symfony\Component\DependencyInjection\ContainerAwareInterface) {
                     $obj->setContainer(Runtime::getContainer());
                 }
             }
             $result = Beans::setAll($obj, $result);
         }
         $results[] = $result;
     }
     return $results;
 }
Exemple #22
0
 /**
  * Get the best matching currency.
  *
  * @return Currency A currency.
  */
 protected function getCurrency()
 {
     $currencyService = $this->container->get('currencyService');
     //TODO: decouple price calculations from product, etc into a place where language/currency/etc are provided in a sane way!
     $session = Runtime::getContainer()->get('session');
     $currency = $currencyService->getCurrencyForCode($session->get('currency'));
     if (null == $currency) {
         Runtime::getLogging()->warn('no currency found - using default currency');
         $currency = $currencyService->getCurrencyForCode($this->container->get('settingsService')->get('defaultCurrency'));
     }
     return $currency;
 }
Exemple #23
0
 /**
  * Get a price group.
  *
  * @return ZenMagick\StoreBundle\Entity\Account\PriceGroup The group or <code>null</code>.
  */
 public function getPriceGroup()
 {
     return Runtime::getContainer()->get('groupPricingService')->getPriceGroupForId($this->priceGroupId);
 }
Exemple #24
0
 /**
  * Look up additional product images.
  *
  * @param string image The image to look up.
  * @return array An array of <code>ZMImageInfo</code> instances.
  */
 public static function getAdditionalImages($image)
 {
     $comp = ZMImageInfo::splitImageName($image);
     $subdir = $comp[0];
     $ext = $comp[1];
     $realImageBase = basename($comp[2]);
     // directory to scan
     $dirname = Runtime::getContainer()->getParameter('zencart.root_dir') . '/images/' . $subdir;
     $imageList = array();
     if (is_dir($dirname) && ($dir = dir($dirname))) {
         while ($file = $dir->read()) {
             if (!is_dir($dirname . $file)) {
                 if (Toolbox::endsWith($file, $ext)) {
                     if (1 == preg_match("/" . $realImageBase . "/i", $file)) {
                         if ($file != basename($image)) {
                             if ($realImageBase . preg_replace('/' . $realImageBase . '/', '', $file) == $file) {
                                 array_push($imageList, $file);
                             }
                         }
                     }
                 }
             }
         }
         $dir->close();
         sort($imageList);
     }
     // create ZMImageInfo list...
     $imageInfoList = array();
     foreach ($imageList as $aimg) {
         $imageInfo = Beans::getBean('ZMImageInfo');
         $imageInfo->setDefaultImage($subdir . $aimg);
         $imageInfoList[] = $imageInfo;
     }
     return $imageInfoList;
 }
 /**
  * {@inheritDoc}
  */
 public function render($request, TemplateView $templateView)
 {
     if (!$this->container->get('settingsService')->get('apps.store.banners.enabled', true)) {
         return '';
     }
     $bannerService = $this->container->get('bannerService');
     // try to load banners for the given group
     if (empty($this->group) || null == ($banners = $bannerService->getBannersForGroupName($this->group, $request->isSecure()))) {
         return '';
     }
     // make random
     shuffle($banners);
     // first or all
     if (!$this->showAll) {
         $banners = array(array_pop($banners));
     }
     // render banner(s)
     $bannerContentList = array();
     foreach ($banners as $banner) {
         $content = '';
         if (!Toolbox::isEmpty($banner->getText())) {
             // use text if not empty
             $content .= $banner->getText();
         } else {
             $toolbox = Runtime::getContainer()->get('toolbox');
             $html = $toolbox->html;
             $net = $toolbox->net;
             $img = '<img src="' . $net->image($banner->getImage()) . '" alt="' . $html->encode($banner->getTitle()) . '" />';
             if (Toolbox::isEmpty($banner->getUrl())) {
                 // if we do not have a url try our luck with the image...
                 $content .= $img;
             } else {
                 $class = '';
                 if ($banner->isNewWin()) {
                     $class = ' class="new-win" ';
                 }
                 $content .= '<a href="' . $net->trackLink('banner', $banner->getId()) . '"' . $class . '>' . $img . '</a>';
             }
         }
         if ($this->isTrackDisplay()) {
             $bannerService->updateBannerDisplayCount($banner->getId());
         }
         if (!Toolbox::isEmpty($this->getFormat()) && !empty($content)) {
             $content = sprintf($this->getFormat(), $content);
         }
         $bannerContentList[] = $content;
     }
     // always set
     $this->set('bannerContentList', $bannerContentList);
     if (!Toolbox::isEmpty($this->getTemplate())) {
         // leave formatting to template rather than just concatenating
         return parent::render($request, $engine);
     }
     return implode('', $bannerContentList);
 }
Exemple #26
0
 /**
  * Remove module.
  */
 public function remove()
 {
     $configService = Runtime::getContainer()->get('configService');
     $configService->removeConfigValue('MODULE_ORDER_TOTAL_ZENMAGICK_STATUS');
     $configService->removeConfigValue('MODULE_ORDER_TOTAL_ZENMAGICK_SORT_ORDER');
 }
 /**
  * Create new instance.
  */
 public function __construct()
 {
     parent::__construct('mfilter', Runtime::getContainer()->get('translator')->trans('Manufacturer'), Runtime::getContainer()->get('request')->query->get('mfilter'));
 }
 /**
  * {@inheritDoc}
  */
 public function getOrderFormUrl($request)
 {
     $this->prepare();
     return isset($this->module->form_action_url) ? $this->module->form_action_url : Runtime::getContainer()->get('router')->generate('checkout_process');
 }
 /**
  * {@inheritDoc}
  */
 public function render($request, TemplateView $templateView)
 {
     $value = $this->isEncode() ? Runtime::getContainer()->get('htmlTool')->encode($this->getValue()) : $this->getValue();
     return '<textarea' . $this->getAttributeString($request, false) . '>' . $value . '</textarea>';
 }
 /**
  * Render as group of radio buttons.
  *
  * @param ZenMagick\Http\Request request The current request.
  */
 public function renderRadio($request)
 {
     $values = $this->getValue();
     if (!is_array($values)) {
         $values = array($values);
     }
     $html = Runtime::getContainer()->get('htmlTool');
     $idBase = $html->encode($this->get('id'));
     if (empty($idBase)) {
         // default to name; we need this to make label work
         $idBase = $this->getName();
     }
     $value = $this->getValue();
     ob_start();
     $index = 0;
     foreach ($this->getOptions($request) as $oval => $name) {
         echo '<input type="radio" id="' . $idBase . '-' . $index . '" class="' . $this->getClass() . '" name="' . $this->getName() . '" value="' . $html->encode($oval) . '"' . ($oval == $value ? ' checked="checked"' : '') . ' />';
         echo ' <label for="' . $idBase . '-' . $index . '">' . $html->encode($name) . '</label>';
         ++$index;
     }
     return ob_get_clean();
 }