protected function render_inner_html()
    {
        $html = parent::render_inner_html();
        $value = $this['value'] ?: $this[self::DEFAULT_VALUE];
        $value = json_decode($value, true);
        $input = new Element('input', array('name' => $this['name'], 'type' => 'hidden', 'value' => $value ? json_encode($value) : ''));
        $content = '';
        if ($value) {
            $value += array('w' => null, 'h' => null, 'no-upscale' => false, 'method' => 'fill', 'format' => 'jpeg', 'interlace' => false);
            $options = array();
            $w = $value['w'] ?: '<em>auto</em>';
            $h = $value['h'] ?: '<em>auto</em>';
            $method = $value['method'];
            $format = '.' . $value['format'];
            /*
            if ($value['no-upscale'])
            {
            	$options[] = 'ne pas agrandir';
            }
            */
            if ($options) {
                $options = '&ndash; ' . implode(', ', $options);
            } else {
                $options = '';
            }
            $content = <<<EOT
{$w}×{$h} {$method} {$format} <span class="small light">{$options}</span>
EOT;
        }
        $placeholder = 'Version non définie';
        return <<<EOT
{$input} <span class="spinner-content">{$content}</span> <em class="spinner-placeholder">{$placeholder}</em> {$html}
EOT;
    }
示例#2
0
 protected function render_inner_html()
 {
     global $core;
     $rc = parent::render_inner_html();
     $constructor = $this[self::T_CONSTRUCTOR];
     $value = $this['value'] ?: $this[self::DEFAULT_VALUE];
     $record = null;
     if ($value) {
         $model = $core->models[$constructor];
         try {
             $record = is_numeric($value) ? $model[$value] : $this->getEntry($model, $value);
         } catch (\Exception $e) {
             \ICanBoogie\log_error('Missing record %nid', ['%nid' => $value]);
         }
     }
     if (!$record) {
         $this->add_class('placeholder');
         $value = null;
     }
     $rc .= new Element('input', ['type' => 'hidden', 'name' => $this['name'], 'value' => $value]);
     $placeholder = $this['placeholder'];
     if ($placeholder) {
         $rc .= '<em class="spinner-placeholder">' . \ICanBoogie\escape($placeholder) . '</em>';
     }
     $rc .= '<span class="spinner-content">' . $this->getPreview($record) . '</span>';
     return $rc;
 }
示例#3
0
 protected function render_inner_html()
 {
     global $core;
     $slug = $this->slug_el['value'];
     $tease = '<strong>Slug&nbsp;:</strong> ';
     $tease .= '<a href="#slug-edit" title="' . I18n\t('edit', [], ['scope' => 'titleslugcombo.element']) . '">' . ($slug ? \ICanBoogie\escape(\ICanBoogie\shorten($slug)) : $this->dataset['auto-label']) . '</a>';
     $tease .= ' <span>&ndash; <a href="slug-delete" class="warn">' . I18n\t('reset', [], ['scope' => 'titleslugcombo.element']) . '</a></span>';
     $this->slug_tease->inner_html = $tease;
     $rc = parent::render_inner_html();
     $nid = $this[self::T_NODEID];
     if ($nid) {
         $node = $core->models['nodes'][$nid];
         if ($node && $node->url && $node->url[0] != '#') {
             $url = $node->url;
             $url_label = \ICanBoogie\shorten($url, 64);
             $rc .= '<p class="small light">';
             $rc .= '<strong>URL&nbsp;:</strong> ' . $url_label;
         }
     }
     return $rc;
 }
示例#4
0
 public function render_inner_html()
 {
     return '<input type="hidden" value="' . \Brickrouge\escape($this['value']) . '" />' . parent::render_inner_html() . '<div class="more"><i class="icon-cog"></i></div>';
 }