Exemple #1
0
function print_discussion($comments, $image_id, $nested = false)
{
    foreach ($comments as $key => $comment) {
        ?>
            <?php 
        if (!$nested) {
            ?>
            <li class="media">                
            <?php 
        } else {
            ?>
            <div class="media">
            <?php 
        }
        ?>
                <div class="col-xs-12 col-sm-2 col-md-1 col-lg-1">
                    <!-- Place for an image.  -->
                </div>
                <div class="media-body col-xs-12 col-sm-10 col-md-11 col-lg-11" id="comment<?php 
        echo $comment->id;
        ?>
">
                    <div class="panel panel-default">
                        <div class="panel-body">
                            <h4 class="media-heading"><?php 
        echo $comment->user->email . $comment->author_visitor . " • <span class='datetime'>" . Date::process($comment->created) . "</span>";
        ?>
</h4>
                            <p><?php 
        echo nl2br($comment->text);
        ?>
</p>                            
                            <?php 
        echo HTML::anchor('#', __("Reply"), array("class" => "reply"));
        ?>
                        </div>
                    </div>
                    <div class="media reply">                        
                        <form method="post" action="<?php 
        echo URL::site('/share/' . Request::current()->param('hash') . '/images/addcomment/' . $image_id . '?replyfor=' . $comment->id);
        ?>
">                        
                            <div class="col-xs-12 col-sm-2 col-md-1 col-lg-1">
                                <!-- Place for an image.  -->
                            </div>
                            <div class="media-body col-xs-12 col-sm-10 col-md-11 col-lg-11">                    
                                <?php 
        echo Form::input('author_visitor', '', array("required", "class" => "form-control", "placeholder" => __('Your e-mail address')));
        ?>
            
                                <?php 
        echo Form::textarea('text', "", array("required", "class" => "form-control", "rows" => "2", "placeholder" => __('Your comment')));
        ?>
      
                              <button class="btn btn-lg btn-primary btn-block" type="submit"><?php 
        echo __('Post');
        ?>
</button>
                            </div>                        
                        </form>
                    </div>                    
                    <?php 
        print_discussion($comment->replies->order_by("created", 'desc')->find_all(), $image_id, true);
        ?>
                </div>            
            <?php 
        if (!$nested) {
            ?>
            </li>            
            <?php 
        } else {
            ?>
            </div>
            <?php 
        }
        ?>
            
      <?php 
    }
}
Exemple #2
0
function print_discussion($comments, $image_id, $nested = false)
{
    foreach ($comments as $key => $comment) {
        ?>
            <?php 
        if (!$nested) {
            ?>
            <li class="media">                
            <?php 
        } else {
            ?>
            <div class="media">
            <?php 
        }
        ?>
                <div class="col-xs-12 col-sm-2 col-md-1 col-lg-1">
                    <!-- Place for an image.  -->
                </div>
                <div class="media-body col-xs-12 col-sm-10 col-md-11 col-lg-11" id="comment<?php 
        echo $comment->id;
        ?>
">
                    <div class="panel panel-default">
                        <div class="panel-body">
                            <h4 class="media-heading"><?php 
        echo $comment->user->email . $comment->author_visitor . " • <span class='datetime'>" . Date::process($comment->created) . "</span>";
        if (Auth::instance()->logged_in("admin")) {
            ?>
<a href="/comments/delete/<?php 
            echo $comment->id;
            ?>
" class="confirm-modal-dialog" data-message="Do you really want to delete this?"><button type="button" class="close" aria-hidden="true">×</button></a><?php 
        }
        ?>
</h4>
                            <p><?php 
        echo nl2br($comment->text);
        ?>
</p>                            
                            <?php 
        echo HTML::anchor('#', __("Reply"), array("class" => "reply"));
        ?>
                        </div>
                    </div>
                    <div class="media reply">                
                        <form method="post" action="<?php 
        echo URL::site('/admin/images/addcomment/' . $image_id . '?replyfor=' . $comment->id);
        ?>
">
                            <div class="col-xs-12 col-sm-2 col-md-1 col-lg-1">
                                <!-- Place for an image.  -->
                            </div>
                            <div class="media-body col-xs-12 col-sm-10 col-md-11 col-lg-11">                    
                              <?php 
        echo Form::textarea('text', "", array("required", "class" => "form-control", "rows" => "2", "placeholder" => __('Your comment')));
        ?>
      
                              <button class="btn btn-lg btn-primary btn-block" type="submit"><?php 
        echo __('Post');
        ?>
</button>
                            </div>                        
                        </form>
                    </div>                    
                    <?php 
        print_discussion($comment->replies->order_by("created", 'desc')->find_all(), $image_id, true);
        ?>
                </div>            
            <?php 
        if (!$nested) {
            ?>
            </li>            
            <?php 
        } else {
            ?>
            </div>
            <?php 
        }
        ?>
            
      <?php 
    }
}