Ejemplo n.º 1
0
 /**
  * Create new instance.
  */
 public function __construct()
 {
     parent::__construct();
     $this->sortOrder = 0;
     $this->template = null;
     $this->format = null;
 }
Ejemplo n.º 2
0
 /**
  * Create new instance.
  */
 public function __construct()
 {
     parent::__construct();
     $this->name = '';
     $this->classes = array();
     $this->value = null;
     $this->setAttributeNames(array('id'));
     $this->encode = true;
 }
Ejemplo n.º 3
0
 /**
  * Create new user.
  *
  * @param string title The title; default is <code>null</code> to use the id.
  */
 public function __construct($title = null)
 {
     parent::__construct();
     // default
     $this->id = get_class($this);
     $this->setTitle(null != $title ? $title : $this->id);
     $this->minimize = true;
     $this->maximize = false;
     $this->options = null;
     $this->open = true;
     $this->status = self::STATUS_DEFAULT;
 }
Ejemplo n.º 4
0
 /**
  * {@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);
 }
 /**
  * Create new instance.
  */
 public function __construct()
 {
     parent::__construct();
     $this->setTitle('PayPal EC Button');
 }