Example #1
0
 public function getMenuItemLinkElement()
 {
     $a = new Link();
     $a->setValue('');
     if ($this->menuItem->getIcon()) {
         $icon = new Element('i');
         $icon->addClass('fa fa-' . $this->menuItem->getIcon());
         $a->appendChild($icon);
     }
     if ($this->menuItem->getLink()) {
         $a->href($this->menuItem->getLink());
     }
     foreach ($this->menuItem->getLinkAttributes() as $key => $value) {
         $a->setAttribute($key, $value);
     }
     // Set styling for accessiblity options
     if (Config::get('concrete.accessibility.toolbar_large_font')) {
         $spacing = 'padding-top: 15px';
         $height = 'line-height:17px;';
     } else {
         $spacing = 'padding: 16px 5px;';
         $height = 'line-height:14px;';
     }
     $wbTitle = new Element('div');
     $wbTitle->style($height . $spacing);
     $wbTitle->addClass('wb-fourms')->setValue($this->menuItem->getLabel());
     $a->appendChild($wbTitle);
     return $a;
 }
Example #2
0
 public function getColumnHtmlObjectEditMode()
 {
     $column = $this->getColumnHtmlObject();
     $inner = new Element('div');
     $inner->addClass('ccm-layout-column-inner ccm-layout-column-highlight');
     $column->appendChild($inner);
     return $column;
 }
 public function getListIconElement()
 {
     $env = \Environment::get();
     $type = $this->controller->getAttributeType();
     $url = $env->getURL(implode('/', array(DIRNAME_ATTRIBUTES . '/' . $type->getAttributeTypeHandle() . '/' . FILENAME_BLOCK_ICON)), $type->getPackageHandle());
     $img = new Element('img');
     $img->addClass('ccm-attribute-icon')->src($url)->width(16)->height(16);
     return $img;
 }
Example #4
0
 /**
  * Render element view with data.
  *
  * @param $data
  * @return string
  */
 public function view($data)
 {
     if (array_key_exists('current', $data)) {
         $this->current = $data['current'];
     }
     if (array_key_exists('title_formatter', $data)) {
         $tf = $data['title_formatter'];
     }
     if (array_key_exists('descr_formatter', $data)) {
         $df = $data['descr_formatter'];
     }
     $i = 1;
     foreach ($this->steps as $step) {
         $sdiv = new Element('div');
         $sstyle = $this->getStyle('step');
         if ($i == $this->current) {
             $sdiv->addClass($this->getClass('current'));
             $sstyle .= $this->getStyle('current');
         } elseif ($i < $this->current) {
             $sdiv->addClass($this->getClass('completed'));
             $sstyle .= $this->getStyle('completed');
         }
         $sdiv->addClass($this->getClass('step'))->setAttribute('style', $sstyle);
         $title = array_key_exists('title', $step) ? $step['title'] : '';
         $descr = array_key_exists('descr', $step) ? $step['descr'] : '';
         if (isset($tf) && is_callable($tf)) {
             $title = $tf($title);
         }
         if (isset($df) && is_callable($df)) {
             $descr = $df($descr);
         }
         $contdiv = new Element('div');
         $contdiv->addClass($this->getClass('content'))->setAttribute('style', $this->getStyle('content'));
         $tdiv = new Element('div', new Text($title));
         $tdiv->addClass($this->getClass('title'))->setAttribute('style', $this->getStyle('title'));
         $ddiv = new Element('div', new Text($descr));
         $ddiv->addClass($this->getClass('descr'))->setAttribute('style', $this->getStyle('descr'));
         $contdiv->appendChild($tdiv)->appendChild($ddiv);
         $sdiv->appendChild($contdiv);
         $this->appendChild($sdiv);
         $i++;
     }
     return $this->render();
 }
 protected function getColumnElement($contents)
 {
     $element = new Element('div');
     $element->addClass($this->getAreaLayoutColumnClass())->id('ccm-layout-column-' . $this->arLayoutColumnID);
     $inner = new Element('div');
     $inner->addClass('ccm-layout-column-inner');
     $inner->setValue($contents);
     $element->appendChild($inner);
     return $element;
 }
 public function getColumnHtmlObjectEditMode()
 {
     $column = $this->getPresetColumnObject();
     if ($column) {
         $html = $column->getColumnHtmlObject();
         $inner = new Element('div');
         $inner->addClass('ccm-layout-column-inner ccm-layout-column-highlight');
         $inner->setValue($this->getContents(true));
         $html->appendChild($inner);
         return $html;
     }
 }
Example #7
0
 /**
  * Prints out the current label
  *
  * @param  string $field The field to create a label for
  *
  * @return string        A <label> tag
  */
 protected function getLabel($field = null)
 {
     // Don't create a label if none exist
     if (!$field or !$this->label) {
         return null;
     }
     // Wrap label in framework classes
     $this->label->addClass($this->app['former.framework']->getLabelClasses());
     $this->label = $this->app['former.framework']->createLabelOf($field, $this->label);
     $this->label = $this->app['former.framework']->wrapLabel($this->label);
     return $this->label;
 }
 public function getMenuElement()
 {
     if ($this->items->count() > $this->minItemThreshold) {
         $menu = new Element('div', null, $this->menuAttributes);
         $menu->addClass('popover')->addClass('fade');
         $menu->appendChild((new Element('div'))->addClass('arrow'));
         $inner = (new Element('div'))->addClass('popover-inner');
         $list = (new Element('ul'))->addClass('dropdown-menu');
         /**
          * @var $item ItemInterface
          */
         foreach ($this->items as $item) {
             $list->appendChild($item->getItemElement());
         }
         $inner->appendChild($list);
         $menu->appendChild($inner);
         return $menu;
     }
 }
Example #9
0
 public function getMenuItemLinkElement()
 {
     $a = new Link();
     $a->setValue('');
     if ($this->menuItem->getIcon()) {
         $icon = new Element('i');
         $icon->addClass('fa fa-' . $this->menuItem->getIcon());
         $a->appendChild($icon);
     }
     if ($this->menuItem->getLink()) {
         $a->href($this->menuItem->getLink());
     }
     foreach ($this->menuItem->getLinkAttributes() as $key => $value) {
         $a->setAttribute($key, $value);
     }
     $label = new Element('span');
     $label->addClass('ccm-toolbar-accessibility-title')->setValue($this->menuItem->getLabel());
     $a->appendChild($label);
     return $a;
 }
 public function getMenuItemLinkElement()
 {
     $link = new Link('#', '');
     $link->setAttribute('data-panel-url', \URL::to('/ccm/system/panels/page/relations'));
     $link->setAttribute('title', t('View related pages'));
     $link->setAttribute('data-launch-panel', 'page_relations');
     if (is_object($this->multilingualSection)) {
         $icon = $this->flagService->getFlagIcon($this->multilingualSection->getIcon());
         $accessibility = new Element('span', $this->multilingualSection->getLanguageText());
         $accessibility->addClass('ccm-toolbar-accessibility-title');
         $link->appendChild($icon);
         $link->appendChild($accessibility);
     } else {
         $icon = new Element('i', '');
         $icon->addClass('fa fa-sitemap');
         $accessibility = new Element('span', t('Related Pages'));
         $accessibility->addClass('ccm-toolbar-accessibility-title');
         $link->appendChild($icon);
         $link->appendChild($accessibility);
     }
     return $link;
 }
Example #11
0
 public function getLayoutContainerHtmlObject()
 {
     $element = new Element('div');
     $element->addClass('ccm-layout-column-wrapper')->id('ccm-layout-column-wrapper-' . $this->layout->getAreaLayoutID());
     return $element;
 }
 public function getRequestIconElement()
 {
     if (!$this->isNewPageRequest()) {
         return parent::getRequestIconElement();
     }
     $span = new Element('i');
     $span->addClass('fa fa-file');
     return $span;
 }
 public function renderIcon()
 {
     $element = new Element('i');
     $element->addClass($this->getIconClass());
     return $element;
 }
Example #14
0
 protected function getColumnElement($contents)
 {
     $element = new Element('div');
     $element->addClass($this->getAreaLayoutColumnClass());
     $gf = $this->arLayout->getThemeGridFrameworkObject();
     if ($gf->hasPageThemeGridFrameworkOffsetClasses() && $this->getAreaLayoutColumnOffset()) {
         $element->addClass($this->getAreaLayoutColumnOffsetClass());
     }
     $element->setValue($contents);
     if ($this->getAreaLayoutColumnOffset() > 0 && !$gf->hasPageThemeGridFrameworkOffsetClasses()) {
         $collection = new Collection();
         $offset = new Element('div');
         $offset->addClass($this->getAreaLayoutColumnOffsetClass())->addClass('ccm-theme-grid-offset-column');
         $collection[0] = $offset;
         $collection[1] = $element;
         return $collection;
     } else {
         return $element;
     }
 }
 public function getListIconElement()
 {
     $span = new Element('i');
     $span->addClass('ccm-attribute-icon fa fa-' . $this->icon);
     return $span;
 }
Example #16
0
 public function getRequestIconElement()
 {
     $span = new Element('i');
     $span->addClass('fa fa-file-text-o');
     return $span;
 }
Example #17
0
 /**
  * Render element view with data.
  *
  * @param $data
  * @return string
  */
 public function view($data)
 {
     //align
     switch ($this->align) {
         case 'center':
             $a = ['text-align' => 'center'];
             break;
         case 'right':
             $a = ['text-align' => 'right'];
             break;
         case 'left':
         default:
             $a = ['text-align' => 'left'];
     }
     $this->styles['list_div'] = array_merge($this->styles['list_div'], $a);
     //width
     $wid = floor(100 / $this->columns) - 1;
     //data and formatter
     $this->styles['list_item'] = array_merge($this->styles['list_item'], ['width' => "{$wid}%"]);
     if (array_key_exists('data', $data)) {
         $d = $data['data'];
     } else {
         $d = $data;
     }
     if (array_key_exists('label_formatter', $data)) {
         $lf = $data['label_formatter'];
     }
     if (array_key_exists('text_formatter', $data)) {
         $tf = $data['text_formatter'];
     }
     foreach ($d as $k => $v) {
         $ltext = $k;
         if (isset($lf) && is_callable($lf)) {
             $ltext = $lf($k);
         }
         $label = new Element('label', new Text($ltext));
         $label->addClass($this->getClass('list_label'))->setAttribute('style', $this->getStyle('list_label'));
         $ttext = $v;
         if (isset($tf) && is_callable($tf)) {
             $ttext = $tf($v);
         }
         $text = new Element('span', new Text($ttext));
         $text->addClass($this->getClass('list_text'))->setAttribute('style', $this->getStyle('list_text'));
         $item = new Element('div');
         $item->addClass('list_item')->setAttribute('style', $this->getStyle('list_item'));
         $item->appendChild($label)->appendChild($text);
         $this->appendChild($item);
         $this->addClass('list_div')->setAttribute('style', $this->getStyle('list_div'));
     }
     return $this->render();
 }