コード例 #1
0
ファイル: 2block.php プロジェクト: viking2000/web-antarix
function list__2block(array $options = array())
{
    if (empty($options)) {
        return '';
    }
    $left = '';
    $right = '';
    $parity = 0;
    foreach ($options as $item) {
        ++$parity;
        $body = '';
        $header = '';
        $footer = '';
        $image = '';
        if (isset($item['header'])) {
            $key = rand(0, 2);
            $header .= "<header class=\"lb-bite{$key}\"><h1>{$item['header']}</h1></header>";
        }
        if (isset($item['image'])) {
            $body .= '<img width="100%" src="' . img_link($item['image']) . '" /><br />';
        }
        if (isset($item['content'])) {
            $body .= "<p>{$item['content']}</p>";
        }
        if (isset($item['footer'])) {
            $footer .= $item['footer'];
        }
        if (isset($item['link'])) {
            $link = base_url($item['link']);
            $footer .= '<a class="lb-button right" href="' . $link . '">' . get_string('widgets', 'read more') . '</a>';
        }
        $body .= "<footer>{$footer}</footer>";
        if ($parity % 2 != 0) {
            $left .= "<section class=\"lb-wrapper_body\">{$header}<div class=\"lb-cbm_wrap\">{$body}</div></section>";
        } else {
            $right .= "<section class=\"lb-wrapper_body\">{$header}<div class=\"lb-cbm_wrap\">{$body}</div></section>";
        }
    }
    return "<div class=\"list-2block\"><div class=\"lb-2block-left\">{$left}</div><div class=\"lb-2block-right\">{$right}</div><div class=\"lb-end\"></div></div><script>if (window.screen.width < 1200) {\$(\".lb-2block-left, .lb-2block-right\").css({\"display\":\"block\", \"width\":\"100%\"});}</script>";
}
コード例 #2
0
ファイル: comments.php プロジェクト: viking2000/web-antarix
    function list__comments_build($list, $color)
    {
        $color -= 15;
        if ($color < 0) {
            $color = 0;
        }
        $body = '';
        $reply = get_string('widgets', 'reply');
        $odd = false;
        foreach ($list as $item) {
            if ($odd) {
                $class = 'list-comments-color1';
            } else {
                $class = 'list-comments-color2';
            }
            $odd = !$odd;
            $next = '';
            $checked = '';
            if (isset($item['next'])) {
                $next = list__comments_build($item['next'], $color);
            }
            if (!(bool) $item['checked']) {
                $checked = '<span style="color:red;">' . get_string('widgets', 'checking_comments') . '</span>';
            }
            //style="background:linear-gradient(to right, rgb({$color}, {$color}, {$color}), rgba(0,0,0,0));
            $avatar = img_link('avatars/' . $item['avatar']);
            $body .= <<<EOT
            <section class="list-comments-item" id="comment-{$item['id']}">
                <div class="list-comments-body">
                    <header class="list-comments-avatar">
                        <div class="list-comments-line {$class}"></div>
                        <img src="{$avatar}" class="list-comments-avatar-img {$class}"/>
                        <br />
                        {$checked}
                        <div class="list-comments-subtitle">
                            <strong class="{$class}">{$item['name']}</strong><br />
                            <small class="{$class}">{$item['creation']}</small>
                            <button style="color:#FFF; border-radius:10px;" onclick="show_quote({$item['id']});" class="{$class}">{$reply}</button>
                        </div>
                    </header>
                    <div class="list-comments-text {$class}">
                        <p>{$item['text']}</p>
                    </div>

                </div>
                {$next}
                <br class="clear" />
            </section>
EOT;
        }
        return $body;
    }