コード例 #1
0
 protected function configureView()
 {
     $this->view->attachEventHandler('PostComment', function ($commentText, $imageID, $commentID = 0) {
         if ($commentText != "") {
             $comment = new Comment();
             $comment->ImageID = $imageID;
             $comment->Comment = $commentText;
             $comment->InReplyTo = $commentID;
             $comment->PostedBy = CustomLoginProvider::getLoggedInUser()->UserID;
             $comment->save();
         }
     });
     $this->view->attachEventHandler('GetComments', function ($imageID) {
         return ImageCommentsPanoramaView::getCommentsForImageID($imageID, false);
     });
     return parent::configureView();
 }
コード例 #2
0
    public static function getCommentsForCommentID($id)
    {
        if (is_int($id) || is_string($id)) {
            $comment = new Comment($id);
        } else {
            $comment = $id;
        }
        $builder = "";
        $user = new CustomUser($comment->PostedBy);
        $fullname = ucwords($user->getFullName());
        $subCommentBuilder = "";
        $comments = Comment::find(new Equals('InReplyTo', $comment->UniqueIdentifier));
        foreach ($comments as $c) {
            $subCommentBuilder .= self::getCommentsForCommentID($c->CommentID);
        }
        $com = nl2br($comment->Comment);
        $builder .= <<<HTML
                        <div class="comment-outer">
                            <div class="comment-background-underlay"></div>
                            <div class="comment-outer-image">
                                <img src="{$user->Image}">
                            </div>
                            <div class="comment-outer-text">
                                <div class="comment-outer-title">
                                    <span class="comment-inner-name">{$fullname}</span><span class="comment-inner-date">{$comment->PostedAt}</span>
                                </div>
                                <div class="delete">
                                    X
                                </div>
                                <div class="comment-inner-text">{$com}</div>
                                <a href="#" comId="{$comment->UniqueIdentifier}" class="comment-reply">Atbildēt</a>
                            </div>
                            <div class="__clear-floats"></div>
                            {$subCommentBuilder}
                         </div>
                         <div class="__clear-floats"></div>
HTML;
        return $builder;
    }