public static function play() { $play = new Brick('div'); $play->addClass('play'); $play->append('<img src="' . url('assets/oembed/oembed-play.png') . '" alt="Play">'); return $play; }
public function headline() { if (!$this->readonly) { /* $fieldName = $this->name; $blueprint = $this->page()->blueprint(); $fieldsets = $blueprint->fields($this)->$fieldName->fieldsets;*/ $fieldsets = $this->fieldsets(); $add = new Brick('a'); $add->html('<i class="icon icon-left fa fa-chevron-circle-down"></i>' . l('fields.structure.add')); $add->addClass('structure-add-button label-option'); $add->data('modal', true); $dropDown = new Brick("div"); $dropDown->addClass('builder-drop-down'); $addList = new Brick('ul'); $addList->addClass('builder-add-list'); foreach ($fieldsets as $fieldsetName => $fieldsetFields) { $addListItem = new Brick('li'); $addListItemLink = new Brick('a'); $addListItemLink->html('<i class="icon icon-left fa fa-plus-circle"></i>' . $fieldsetFields['label']); $addListItemLink->addClass('builder-add-button'); $addListItemLink->data('modal', true); $addListItemLink->attr('href', purl($this->page, 'field/' . $this->name . '/builder/add?fieldset=' . $fieldsetName)); $addListItem->append($addListItemLink); $addList->append($addListItem); } $dropDown->append($addList); } else { $addList = null; $add = null; } $label = BaseField::label(); $label->append($add); $label->append($dropDown); return $label; }
protected function template($class = false) { $output = new Brick('div'); $output->addClass('oembed'); if ($class !== false) { $output->addClass($class); } else { $output->addClass('oembed-' . substr(md5($this->url), 0, 6)); } if ($this->media->get('type') === 'video') { $output = OembedTemplate::ratio($output, $this->media); if (c::get('oembed.lazyvideo', false)) { $output->addClass('oembed-lazyvideo'); } $play = OembedTemplate::play(); $output->append($play); $thumb = OembedTemplate::thumb($this->thumb->get($this->media())); $output->append($thumb); $html = OembedTemplate::embed($this->media, $this->autoplay); } else { $html = $this->media->get('html'); } $html = OembedTemplate::validation($html); $output->append($html); return $output; }
public function content() { $html = '<ul class="input-list field-grid cf">'; switch ($this->columns()) { case 2: $width = ' field-grid-item-1-2'; break; case 3: $width = ' field-grid-item-1-3'; break; case 4: $width = ' field-grid-item-1-4'; break; case 5: $width = ' field-grid-item-1-5'; break; default: $width = ''; break; } foreach ($this->options() as $key => $value) { $html .= '<li class="input-list-item field-grid-item' . $width . '">'; $html .= $this->item($key, $value); $html .= '</li>'; } $html .= '</ul>'; $content = new Brick('div'); $content->addClass('field-content'); $content->append($html); return $content; }
public function icon() { $icon = new Brick('div'); $icon->addClass('field-icon'); $icon->append('<span>.' . $this->extension . '</span>'); return $icon; }
public static function time($timestamp, $format = 'short', $classes = '') { $brick = new Brick('time'); $brick->datetime = Date::format($timestamp, 'iso'); $brick->text(Date::format($timestamp, $format)); $brick->addClass($classes); return $brick; }
public function template() { $wrapper = new Brick('div', null); $wrapper->data('tab-name', $this->i18n($this->label)); $wrapper->data('field', 'tabs'); $wrapper->addClass('tab-placeholder'); return $wrapper; }
public function element() { $element = parent::element(); $script = new Brick('script', false); $script->append('previewImagesFromSidebar()'); $element->append($script); return $element; }
public function content() { $content = new Brick('div'); $content->addClass('field-content'); $content->append($this->input()); $content->append($this->icon()); return $content; }
public function displayEditBox($sType, Brick $oBrick, $bIsUpload = false) { $this->_sContentTemplate = 'edit.' . $sType; $this->_addTemplateVar('bListManager', $oBrick->isInAList()); $this->_addTemplateVar('bHistoryManager', true); $this->_addTemplateVar('sFormAction', '/admin/save.' . $sType . '.html'); $this->_addTemplateVar('bIsUpload', $bIsUpload); $this->_addTemplateVar('sModalType', $sType . '.edit'); $this->_addTemplateVar('brick', $oBrick); $this->_render(); }
public function headline() { $add = new Brick('a'); $add->html('<i class="icon icon-left fa fa-plus-circle"></i>' . l('fields.structure.add')); $add->addClass('structure-add-button label-option'); $add->attr('#'); $label = parent::label(); $label->addClass('structure-label'); $label->append($add); return $label; }
public function preview() { $figure = new Brick('figure'); if ($image = $this->image()) { $figure->attr('style', 'background-image: url(' . $image->crop(75)->url() . ')'); $url = $image->url('edit'); } else { $figure->attr('style', 'background-image: url(' . $this->value() . ')'); $url = ''; } return '<a href="' . $url . '" class="input-preview">' . $figure . '</a>'; }
public function input() { $input = new Brick('input', null); $input->addClass('tabfield'); $input->attr(array('id' => $this->id(), 'name' => $this->name(), 'required' => $this->required(), 'autofocus' => $this->autofocus(), 'autocomplete' => $this->autocomplete(), 'readonly' => $this->readonly(), 'type' => 'checkbox', 'checked' => v::accepted($this->value()))); $wrapper = parent::input(); $wrapper->tag('label'); $wrapper->text($this->i18n($this->text())); $wrapper->attr('for', $this->id()); $wrapper->removeAttr('id'); $wrapper->addClass('tabfield'); $wrapper->prepend($input); return $wrapper; }
/** * Generate field content markup * * @return string */ public function content() { $wrapper = new Brick('div'); $wrapper->addClass('subpagelist'); $children = $this->subpages(); // add pagination to the subpages $limit = $this->limit() ? $this->limit() : 10000; $children = $children->paginate($limit, array('page' => get('page'))); // use existing snippet to build the list // @see panel/app/controllers/views/pages.php $subpages = new Snippet('pages/sidebar/subpages', array('title' => l('pages.show.subpages.title'), 'page' => $this->page(), 'subpages' => $children, 'addbutton' => !api::maxPages($this, $this->subpages()->max()), 'pagination' => $children->pagination())); // use template with defined vars $wrapper->html(tpl::load(__DIR__ . DS . 'template.php', array('subpages' => $subpages))); return $wrapper; }
protected function _getPropertyWhen($sProperty, $iTimestamp, $bExact = false) { switch ($sProperty) { case 'path': $sSrc = parent::_getPropertyWhen('src', $iTimestamp, $bExact); return substr($sSrc, 0, 4) == 'http' ? $sSrc : '/' . str_replace(ROOT, '', dirname(DATA_PATH)) . '/' . $sSrc; break; case 'gallery': $aGallery = array(); $aGalleryOrder = parent::_getPropertyWhen('gallery_order', $iTimestamp, $bExact); if (is_array($aGalleryOrder) && sizeof($aGalleryOrder)) { foreach ($aGalleryOrder as $sKey) { $sPropertyName = 'gal_' . $sKey; $sPropertyValue = parent::_getPropertyWhen($sPropertyName, $iTimestamp, $bExact); if (!is_null($sPropertyValue)) { $aGallery[] = $sPropertyValue; } } } return $aGallery; break; default: return parent::_getPropertyWhen($sProperty, $iTimestamp, $bExact); break; } }
public function headline() { if (!$this->readonly) { $add = new Brick('a'); $add->html('<i class="icon icon-left fa fa-plus-circle"></i>' . l('fields.structure.add')); $add->addClass('structure-add-button label-option'); $add->data('modal', true); $add->attr('href', purl($this->model, 'field/' . $this->name . '/structure/add')); } else { $add = null; } $label = parent::label(); $label->addClass('structure-label'); $label->append($add); return $label; }
/** * Generate field content markup * * @return string */ public function content() { $wrapper = new Brick('div'); $wrapper->addClass('subpagelist'); $children = $this->subpages(); // add pagination to the subpages $limit = $this->limit() ? $this->limit() : 10000; $children = $children->paginated('sidebar'); $pagination = new Snippet('pagination', array('pagination' => $children->pagination(), 'nextUrl' => $children->pagination()->nextPageUrl(), 'prevUrl' => $children->pagination()->prevPageUrl())); // use existing snippet to build the list // @see /panel/app/src/panel/models/page/sidebar.php $subpages = new Snippet('pages/sidebar/subpages', array('title' => $this->i18n($this->label), 'page' => $this->page(), 'subpages' => $children, 'addbutton' => $this->page->addButton(), 'pagination' => $pagination)); // use template with defined vars $wrapper->html(tpl::load(__DIR__ . DS . 'template.php', array('subpages' => $subpages))); return $wrapper; }
public function __set($sName, $mValue) { switch ($sName) { default: parent::__set($sName, $mValue); break; } }
public function input() { $color = new Brick('input'); $color->addClass('colorpicker'); if ($this->value() == "" && $this->default() !== "") { $value = $this->default(); } elseif ($this->value() == "" && $this->default() == "") { $value = ""; } else { $value = $this->value(); } $color->attr(array('name' => $this->name(), 'id' => $this->id(), 'type' => "text", 'data-defaultvalue' => $value, 'value' => $value)); $color->append($this->option('', '', $this->value() == '')); $wrapper = new Brick('div'); $wrapper->addClass('input color-wrapper'); $wrapper->append($color); return $color; }
public function __get($sName) { switch ($sName) { case 'size': return sizeof(parent::__get('content')); break; default: return parent::__get($sName); break; } }
public function __set($sName, $mValue) { switch ($sName) { case 'content': parent::__set($sName, $this->_cleanContent($mValue)); break; default: parent::__set($sName, $mValue); break; } }
public function __set($sName, $mValue) { switch ($sName) { case 'content': parent::__set($sName, htmlspecialchars($mValue)); break; default: parent::__set($sName, $mValue); break; } }
public function content() { $relation = new Brick('div'); $relation->addClass('input input-display'); if ($this->readonly()) { $relation->addClass('input-is-readonly'); } $relation->data(array('field' => 'relation', 'search' => $this->search ? 1 : 0, 'readonly' => ($this->readonly or $this->disabled) ? 1 : 0)); $relation->append('<div class="placeholder"> </div>'); $content = new Brick('div'); $content->addClass('field-content input-with-relationbox'); $content->append($relation); // list with options $html = '<div class="input-list">'; if ($this->search) { $html .= '<input class="relationbox-search" placeholder="Type to filter options">'; } $html .= '<ul>'; foreach ($this->options() as $key => $value) { $html .= '<li class="input-list-item">'; $html .= $this->item($key, $value); $html .= '</li>'; } $html .= '</ul>'; $html .= '</div>'; $content->append($html); $content->append($this->icon()); return $content; }
public function input() { $select = new Brick('select'); $select->addClass('selectbox'); $select->attr(array('name' => $this->name(), 'id' => $this->id(), 'required' => $this->required(), 'autocomplete' => $this->autocomplete(), 'autofocus' => $this->autofocus(), 'readonly' => $this->readonly(), 'disabled' => $this->disabled())); $id = $this->id(); $select->append($this->option('', '', $this->value() == '')); if ($this->readonly()) { $select->attr('tabindex', '-1'); } foreach ($this->options() as $value => $text) { $select->append($this->option($value, $text, $this->value() == $value)); } $inner = new Brick('div'); $inner->addClass('selectbox-wrapper'); $inner->append($select); $wrapper = new Brick('div'); $wrapper->addClass('input input-with-selectbox'); $wrapper->append($inner); if ($this->readonly()) { $wrapper->addClass('input-is-readonly'); } else { $wrapper->attr('data-focus', 'true'); } echo "<script>console.log('layout " . $id . "');</script>"; echo "<script>buildLayout(" . $id . ");</script>"; return $wrapper; }
public function input() { $select = new Brick('select'); $select->addClass('selectbox'); $select->attr(array('name' => $this->name(), 'id' => $this->id(), 'required' => $this->required(), 'autocomplete' => $this->autocomplete(), 'autofocus' => $this->autofocus(), 'readonly' => $this->readonly(), 'disabled' => $this->disabled())); $default = $this->default(); if (!$this->required() or empty($default)) { $select->append($this->option('', '', $this->value() == '')); } if ($this->readonly()) { $select->attr('tabindex', '-1'); } foreach ($this->options() as $value => $text) { $select->append($this->option($value, $text, $this->value() == $value)); } $inner = new Brick('div'); $inner->addClass('selectbox-wrapper'); $inner->append($select); $wrapper = new Brick('div'); $wrapper->addClass('input input-with-selectbox'); $wrapper->append($inner); if ($this->readonly()) { $wrapper->addClass('input-is-readonly'); } else { $wrapper->attr('data-focus', 'true'); } return $wrapper; }
public function __get($sName) { switch ($sName) { case 'path': if (substr($this->src, 0, 4) == 'http') { return $this->src; } else { return '/' . str_replace(ROOT, '', dirname(DATA_PATH)) . '/' . $this->src; } break; default: return parent::__get($sName); break; } }
public function input() { $input = new Brick('input', null); $input->addClass('input'); $input->attr(array('type' => $this->type(), 'value' => '', 'required' => $this->required(), 'name' => $this->name(), 'autocomplete' => $this->autocomplete() === false ? 'off' : 'on', 'autofocus' => $this->autofocus(), 'placeholder' => $this->i18n($this->placeholder()), 'readonly' => $this->readonly(), 'disabled' => $this->disabled(), 'id' => $this->id())); if (!is_array($this->value())) { $input->val(html($this->value(), false)); } if ($this->readonly()) { $input->attr('tabindex', '-1'); $input->addClass('input-is-readonly'); } return $input; }
public function item($value, $text) { $input = $this->input($value); $label = new Brick('input', $this->i18n($text)); $label->addClass('input'); $label->attr('data-focus', 'true'); $label->prepend($input); if ($this->readonly) { $label->addClass('input-is-readonly'); } return $label; }
public function counter() { if (!$this->minLength() && !$this->maxLength() || $this->readonly()) { return null; } $counter = new Brick('div'); $counter->addClass('field-counter marginalia text'); $length = str::length(trim($this->value())); if ($this->outsideRange($length)) { $counter->addClass('outside-range'); } $counter->data('field', 'counter'); $counter->html($length . ($this->maxLength() ? '/' . $this->maxLength() : '')); return $counter; }
public function __set($sName, $mValue) { switch ($sName) { case 'zoom': if (!is_numeric($mValue)) { return; } $mValue = intval($mValue); if (0 > $mValue || $mValue > 21) { return; } parent::__set('zoom', $mValue); break; case 'lat': case 'marker_lat': if (!is_numeric($mValue)) { return; } $mValue = floatval($mValue); if (-90 > $mValue || $mValue > 90) { return; } parent::__set($sName, $mValue); break; case 'lng': case 'marker_lng': if (!is_numeric($mValue)) { return; } $mValue = floatval($mValue); if (-180 > $mValue || $mValue > 180) { return; } parent::__set($sName, $mValue); break; default: parent::__set($sName, $mValue); break; } }