コード例 #1
0
ファイル: wall.php プロジェクト: hzhou9/coupon_deal
if (me()) {
    echo '<div class="left">';
    echo '<ul class="letters">';
    foreach (array_merge(range('A', 'Z'), array('0-9')) as $l) {
        echo '<li' . (isset($_GET['firstchar']) && $_GET['firstchar'] == $l ? ' class="active"' : '') . '><a href="' . tlink('user/wall', 'firstchar=' . $l . (isset($_GET['type']) && $_GET['type'] === 'products' ? '&amp;type=products' : '')) . '">' . $l . '</a></li>';
    }
    echo '<li><a href="' . tlink('user/wall') . (isset($_GET['type']) && $_GET['type'] === 'products' ? '&amp;type=products' : '') . '">ALL</a></li>';
    echo '</ul>';
    if (isset($_GET['type']) && $_GET['type'] === 'products') {
        $pagination = have_wall_products(array('firstchar' => isset($_GET['firstchar']) ? $_GET['firstchar'] : ''));
        echo '<div class="title">My Wall <span style="float: right;">' . ($pagination['results'] ? $pagination['results'] . ' ' . (is_first($pagination['results']) ? 'product' : 'products') : 'Nothing found yet') . '</span></div>';
        echo '<div style="margin-bottom: 20px;">

<ul class="category">
<li><a href="' . get_remove(array('type', 'page')) . '">Coupons</a></li>';
        if (theme_has_products()) {
            echo '<li class="active">Products</li>';
        }
        echo '</ul>

</div>';
        if ($pagination['results']) {
            foreach (wall_products(array('firstchar' => isset($_GET['firstchar']) ? $_GET['firstchar'] : '')) as $item) {
                echo '<article class="array_item product">

<div class="table">

<div class="left">
<img src="' . product_avatar($item->image) . '" alt="">
<span class="rating"><span style="width:' . $item->stars * 16 . 'px;"></span></span>
コード例 #2
0
 public function endHasManyChild()
 {
     ob_start();
     $templateTag = $this->factory->containerTag ? $this->factory->containerTag : 'div';
     $templateOptions = $this->factory->containerOptions;
     prepend_class($templateOptions, 'if-group');
     prepend_class($templateOptions, 'if-template');
     $templateOptions['data-model'] = $this->factory->model;
     $templateOptions['data-id'] = '##id##';
     $dummyData = [$this->factory->model => ['id' => '##id##']];
     $callback = get_remove($templateOptions, 'callback');
     if (is_callable($callback)) {
         $callback($templateOptions, $dummyData);
     }
     echo $this->Html->tag($templateTag, null, $templateOptions);
     $factory = new InlineForm2ControlFactory($this->Html, $dummyData, $this->factory->model, $this->factory->options, $this->factory->valueOptions, $this->factory->inputOptions);
     $template = $this->template;
     $template = preg_replace_callback("|<hasmanychild>(.*)</hasmanychild>|", function ($matches) use($factory) {
         $args = unserialize($matches[1]);
         $field = $args['field'];
         $options = $args['options'];
         $this->factory->restore_options($options);
         $valueOptions = $args['valueOptions'];
         $inputOptions = $args['inputOptions'];
         $path = strpos($args['field'], '.') === FALSE ? "{$factory->model}.{$args['field']}" : $args['field'];
         $factory->data = Hash::insert($factory->data, $path, '##hasmanychild-data##');
         return $factory->control($field, $options, $valueOptions, $inputOptions);
     }, $template);
     $template = preg_replace_callback("|<deletebutton>(.*)</deletebutton>|", function ($matches) use($factory) {
         $args = unserialize($matches[1]);
         return $factory->deleteButton($args['text'], $args['options']);
     }, $template);
     echo $this->factory->execute_callbacks($template, $factory->data);
     echo "</{$templateTag}>";
     $tag = $this->factory->tag;
     $this->factory = array_pop($this->factoryStack);
     echo $this->Html->tag("/{$tag}");
     return ob_get_clean();
 }