Example #1
0
 protected function getPreview($entry)
 {
     if (!$entry) {
         return '';
     }
     $title = $entry->title;
     $label = \ICanBoogie\shorten($title, 32, 0.75, $shortened);
     $rc = '<span class="title"' . ($shortened ? ' title="' . \Brickrouge\escape($title) . '"' : '') . '>';
     $rc .= \Brickrouge\escape($label) . '</span>';
     return $rc;
 }
Example #2
0
    public function render_cell($record)
    {
        static $labels = array(Site::STATUS_OK => 'Ok (online)', Site::STATUS_UNAUTHORIZED => 'Unauthorized', Site::STATUS_NOT_FOUND => 'Not found (offline)', Site::STATUS_UNAVAILABLE => 'Unavailable');
        static $classes = array(Site::STATUS_OK => 'btn-success', Site::STATUS_UNAUTHORIZED => 'btn-warning', Site::STATUS_NOT_FOUND => 'btn-danger', Site::STATUS_UNAVAILABLE => 'btn-warning');
        $status = $record->status;
        $status_label = isset($labels[$status]) ? $labels[$status] : "<em>Invalid status code: {$status}</em>";
        $status_class = isset($classes[$status]) ? $classes[$status] : 'btn-danger';
        $site_id = $record->siteid;
        $menu = new DropdownMenu(array(DropdownMenu::OPTIONS => $labels, 'value' => $status));
        $classes_json = \Brickrouge\escape(json_encode($classes));
        return <<<EOT
<div class="btn-group" data-property="status" data-site-id="{$site_id}" data-classes="{$classes_json}">
\t<span class="btn {$status_class} dropdown-toggle" data-toggle="dropdown"><span class="text">{$status_label}</span> <span class="caret"></span></span>
\t{$menu}
</div>
EOT;
    }
Example #3
0
    public function __toString()
    {
        global $core;
        try {
            $site = $core->site;
            $value = (int) $this['value'];
            $options = $core->models['forms']->select('nid, title')->where('nid = ? OR ((siteid = 0 OR siteid = ?) AND (language = "" OR language = ?))', $value, $site->siteid, $site->language)->order('title')->pairs;
            if (!$options) {
                $url = \Brickrouge\escape($core->site->path . '/admin/forms/new');
                return <<<EOT
<a href="{$url}" class="btn btn-info">Créer un premier formulaire...</a>
EOT;
            }
            if ($this->type == 'select') {
                $options = array(null => '') + $options;
            }
            $this[self::OPTIONS] = $options;
        } catch (\Exception $e) {
            return \Brickrouge\render_exception($e);
        }
        return parent::__toString();
    }
Example #4
0
    public function render_cell($record)
    {
        static $labels = array(Comment::STATUS_APPROVED => 'Approved', Comment::STATUS_PENDING => 'Pending', Comment::STATUS_SPAM => 'Spam');
        static $classes = array(Comment::STATUS_APPROVED => 'btn-success', Comment::STATUS_PENDING => 'btn-warning', Comment::STATUS_SPAM => 'btn-danger');
        $status = $record->status;
        $status_label = isset($labels[$status]) ? $labels[$status] : "<em>Invalid status code: {$status}</em>";
        $status_class = isset($classes[$status]) ? $classes[$status] : 'btn-danger';
        $commentid = $record->commentid;
        $menu = new DropdownMenu(array(DropdownMenu::OPTIONS => $labels, 'value' => $status));
        $classes_json = \Brickrouge\escape(json_encode($classes));
        return <<<EOT
<div class="btn-group" data-property="status" data-key="{$commentid}" data-classes="{$classes_json}">
\t<span class="btn {$status_class} dropdown-toggle" data-toggle="dropdown"><span class="text">{$status_label}</span> <span class="caret"></span></span>
\t{$menu}
</div>
EOT;
    }
    protected function render_page_recursive(array $children, $pages, $depth, $relative_depth)
    {
        $html = '';
        foreach ($children as $blueprint_child) {
            $child = $pages[$blueprint_child->nid];
            $html .= '<li class="' . $child->css_class('active trail') . '"><a href="' . \Brickrouge\escape($child->url) . '">' . \Brickrouge\escape($child->label) . '</a>';
            if ($blueprint_child->children) {
                $html .= $this->render_page_recursive($blueprint_child->children, $pages, $depth + 1, $relative_depth + 1);
            }
            $html .= '</li>';
        }
        if ($html) {
            return <<<EOT
<ul class="nav nav-depth-{$depth} nav-relative-depth-{$relative_depth}">{$html}</ul>
EOT;
        }
    }
Example #6
0
 protected function render_inner_html()
 {
     $page = $node = $this[self::PAGE];
     $slices = array();
     while ($node) {
         $url = $node->url;
         $label = $node->label;
         $label = \ICanBoogie\shorten($label, 48);
         $label = \Brickrouge\escape($label);
         $slices[] = array('url' => $url, 'label' => $label, 'class' => $node->css_class('-type -slug -template -constructor -node-id -node-constructor'), 'page' => $node);
         if (!$node->parent && !$node->is_home) {
             $node = $node->home;
         } else {
             $node = $node->parent;
         }
     }
     $slices = array_reverse($slices);
     $divider = $this[self::DIVIDER] ?: self::DEFAULT_DIVIDER;
     new BreadcrumbElement\BeforeRenderInnerHTMLEvent($this, array('slices' => &$slices, 'divider' => &$divider, 'page' => $page));
     $html = '';
     $slices = array_values($slices);
     $last = count($slices) - 1;
     foreach ($slices as $i => $slice) {
         $html .= '<li class="' . $slice['class'] . '">';
         if ($i) {
             $html .= '<span class="divider">' . $divider . '</span>';
         }
         $class = \Brickrouge\escape($slice['class']);
         $label = \Brickrouge\escape($slice['label']);
         if ($i != $last) {
             $html .= '<a href="' . \Brickrouge\escape($slice['url']) . '" class="' . $class . '">' . $label . '</a>';
         } else {
             $html .= '<strong class="' . $class . '">' . $label . '</strong>';
         }
         $html .= '</li>';
     }
     new BreadcrumbElement\RenderInnerHTMLEvent($this, array('html' => &$html, 'page' => $page));
     return $html;
 }
Example #7
0
    protected function render_inner_html()
    {
        global $core;
        $photo = $this['value'];
        $thumbnail = $photo->image->thumbnail('w:128;h:128');
        $name = \Brickrouge\escape($this['name']);
        $value = $photo->id;
        return <<<EOT
{$thumbnail}
<input type="hidden" name="{$name}" value="{$value}" />
EOT;
    }
Example #8
0
			<h3>Exemple markup</h3>

			<p>This is a markup exemple for a separated month/year</p>
		</div>

		<div class="span8">

			<pre class="prettyprint linenums"><?php 
echo Brickrouge\escape(<<<EOT
<caption>
\t<span class="month">
\t\t<span class="browse prev" data-decrement="month">←</span>
\t\t<span class="name" data-edit="month">&nbsp;</span>
\t\t<span class="browse next" data-increment="month">→</span>
\t</span>

\t<span class="year">
\t\t<span class="browse prev" data-decrement="year">←</span>
\t\t<span class="name" data-edit="year">&nbsp;</span>
\t\t<span class="browse next" data-increment="year">→</span>
\t</span>
</caption>
EOT
);
?>
</pre>
		</div>
	</div>

</section>

<section id="calendar" class="container">
Example #9
0
function display_source($filename)
{
    $filename = resolve_filename($filename);
    echo '<pre class="code php prettyprint linenums">' . str_replace("\t", "    ", Brickrouge\escape(trim(file_get_contents($filename)))) . '</pre>';
}
Example #10
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>';
 }