当前位置: 首页>>代码示例>>PHP>>正文


PHP Comment::getAuthor方法代码示例

本文整理汇总了PHP中Comment::getAuthor方法的典型用法代码示例。如果您正苦于以下问题:PHP Comment::getAuthor方法的具体用法?PHP Comment::getAuthor怎么用?PHP Comment::getAuthor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Comment的用法示例。


在下文中一共展示了Comment::getAuthor方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save

 public function save(Comment $comment)
 {
     DB::db()->query('INSERT INTO comments (`theme_id`, `date`, `comment`, `author`) VALUES(?, ?, ?, ?)', [$comment->getThemeId(), $comment->getDate(), $comment->getComment(), $comment->getAuthor()]);
 }
开发者ID:sedvis,项目名称:mysql-nd,代码行数:4,代码来源:CommentRep.php

示例2: save

 /**
  * Guarda un comentario en la base de datos
  *
  * @param Comment $coment
  *        	El comentario a ser guardado
  * @throws PDOException Si ocurre un error de base de datos
  * @return void
  */
 public function save(Comment $comment)
 {
     $stmt = $this->db->prepare("INSERT INTO comments(`dateComment`,`content`,`numLikes`,`author`,`idPost`) values(?,?,?,?,?)");
     $stmt->execute(array($comment->getDate(), $comment->getContent(), 0, $comment->getAuthor(), $comment->getIdPost()));
 }
开发者ID:adri229,项目名称:TSW_Proyect,代码行数:13,代码来源:CommentDAO.php

示例3: if

             $response[2] .= '<input class="btn btn-primary" type="submit" value="'.$langSubmit.'" onclick="xmlhttpPost(\''.$urlServer.'modules/comments/comments_perso_blog.php\', \'editSave\','.$comment->getRid().', \''.$comment->getRtype().'\', \''.$langCommentsSaveConfirm.'\', '.$comment->getId().');"/>';
         } else {
             $response[0] = 'ERROR';
             $response[1] = "<div class='alert alert-warning'>".$langCommentsEditNoPerm."</div>";
         }
     } else {
         $response[0] = 'ERROR';
         $response[1] = "<div class='alert alert-warning'>".$langCommentsLoadFail."</div>";
     }
     echo json_encode($response);
 } else if ($_POST['action'] == 'editSave') {
     $comment = new Comment();
     if ($comment->loadFromDB(intval($_POST['cid']))) {
         $permEdit = false;
         if (isset($_SESSION['uid'])) {
             if ($comment->getAuthor() == $uid) {
                 $permEdit = true;
             }
             $blog_user = Database::get()->querySingle("SELECT user_id FROM blog_post WHERE id = ?d", $comment->getRid());
             if ($blog_user->user_id == $uid) {
                 $permEdit = true;
             }
             if (isset($is_admin) && $is_admin) {
                 $permEdit = true;
             }
         }
         if ($permEdit) {
             if ($comment->edit($_POST['commentText'])) {
                 $response[0] = 'OK';
                 $response[1] = "<div class='alert alert-success'>".$langCommentsSaveSuccess."</div>";
                 $response[2] = '<div id="comment_content-'.$comment->getId().'">'.q($comment->getContent()).'</div>';
开发者ID:nikosv,项目名称:openeclass,代码行数:31,代码来源:comments_perso_blog.php

示例4: icon

        $post_actions = '<div class="pull-right">';
        $post_actions .= '<a href="javascript:void(0)" onclick="xmlhttpPost(\''.$urlServer.'modules/comments/comments.php?course='.$course_code.'\', \'editLoad\', '.$_POST['rid'].', \''.$_POST['rtype'].'\', \'\', '.$comment->getId().')">';
        $post_actions .= icon('fa-edit', $langModify).'</a> ';
        $post_actions .= '<a href="javascript:void(0)" onclick="xmlhttpPost(\''.$urlServer.'modules/comments/comments.php?course='.$course_code.'\', \'delete\', '.$_POST['rid'].', \''.$_POST['rtype'].'\', \''.$langCommentsDelConfirm.'\', '.$comment->getId().')">';
        $post_actions .= icon('fa-times', $langDelete).'</a>';
        $post_actions .='</div>';   
        
        $response[0] = 'OK';
        $response[1] = "<div class='alert alert-success'>".$langCommentsSaveSuccess."</div>";
        $response[2] = $comment->getId();
        $response[3] = "
 <div class='row margin-bottom-thin margin-top-thin comment' id='comment-".$comment->getId()."'>
            <div class='col-xs-12'>
                <div class='media'>
                    <a class='media-left' href='#'>
                        ". profile_image($comment->getAuthor(), IMAGESIZE_SMALL) ."
                    </a>
                    <div class='media-body bubble'>
                        <div class='label label-success media-heading'>".nice_format($comment->getTime(), true).'</div>'.
                            "<small>".$langBlogPostUser.display_user($comment->getAuthor(), false, false)."</small>".
                            $post_actions
                            ."<div class='margin-top-thin' id='comment_content-".$comment->getId()."'>". q($comment->getContent()) ."</div>
                    </div>
                </div>
            </div>
        </div>                    
        ";
    } else {
        $response[0] = 'ERROR';
        $response[1] = "<div class='alert alert-warning'>".$langCommentsSaveFail."</div>";
    }
开发者ID:nikosv,项目名称:openeclass,代码行数:31,代码来源:comments.php

示例5: array

 //[0] -> status, [1] -> message, other positions -> other data
 $response = array();
 if ($_POST['action'] == 'new') {
     if (Commenting::permCreate($is_editor, $uid, $course_id)) {
         $comment = new Comment();
         if ($comment->create($_POST['commentText'], $uid, $_POST['rtype'], intval($_POST['rid']))) {
             $post_actions = '<div class="pull-right">';
             $post_actions .= '<a href="javascript:void(0)" onclick="xmlhttpPost(\'' . $urlServer . 'modules/comments/comments.php?course=' . $course_code . '\', \'editLoad\', ' . $_POST['rid'] . ', \'' . $_POST['rtype'] . '\', \'\', ' . $comment->getId() . ')">';
             $post_actions .= icon('fa-edit', $langModify) . '</a> ';
             $post_actions .= '<a href="javascript:void(0)" onclick="xmlhttpPost(\'' . $urlServer . 'modules/comments/comments.php?course=' . $course_code . '\', \'delete\', ' . $_POST['rid'] . ', \'' . $_POST['rtype'] . '\', \'' . $langCommentsDelConfirm . '\', ' . $comment->getId() . ')">';
             $post_actions .= icon('fa-times', $langDelete) . '</a>';
             $post_actions .= '</div>';
             $response[0] = 'OK';
             $response[1] = "<div class='alert alert-success'>" . $langCommentsSaveSuccess . "</div>";
             $response[2] = $comment->getId();
             $response[3] = "\r\n         <div class='row margin-bottom-thin margin-top-thin comment' id='comment-" . $comment->getId() . "'>\r\n                    <div class='col-xs-12'>\r\n                        <div class='media'>\r\n                            <a class='media-left' href='#'>\r\n                                " . profile_image($comment->getAuthor(), IMAGESIZE_SMALL) . "\r\n                            </a>\r\n                            <div class='media-body bubble'>\r\n                                <div class='label label-success media-heading'>" . nice_format($comment->getTime(), true) . '</div>' . "<small>" . $langBlogPostUser . display_user($comment->getAuthor(), false, false) . "</small>" . $post_actions . "<div class='margin-top-thin' id='comment_content-" . $comment->getId() . "'>" . q($comment->getContent()) . "</div>\r\n                            </div>\r\n                        </div>\r\n                    </div>\r\n                </div>                    \r\n                ";
         } else {
             $response[0] = 'ERROR';
             $response[1] = "<div class='alert alert-warning'>" . $langCommentsSaveFail . "</div>";
         }
     } else {
         $response[0] = 'ERROR';
         $response[1] = "<div class='alert alert-warning'>" . $langCommentsNewNoPerm . "</div>";
     }
     echo json_encode($response);
 } else {
     if ($_POST['action'] == 'delete') {
         $comment = new Comment();
         if ($comment->loadFromDB(intval($_POST['cid']))) {
             if ($comment->permEdit($is_editor, $uid)) {
                 if ($comment->delete()) {
开发者ID:kostastzo,项目名称:openeclass,代码行数:31,代码来源:comments.php

示例6: save

 /**
  * Saves a comment
  * 
  * @param Comment $comment The comment to save
  * @throws PDOException if a database error occurs
  * @return void
  */
 public function save(Comment $comment)
 {
     $stmt = $this->db->prepare("INSERT INTO comments(content, author, post) values (?,?,?)");
     $stmt->execute(array($comment->getContent(), $comment->getAuthor()->getUsername(), $comment->getPost()->getId()));
 }
开发者ID:ragomez,项目名称:abp2015,代码行数:12,代码来源:CommentMapper.php

示例7: _writeComment

 /**
  * Write comment to XML format
  *
  * @param 	Shared_XMLWriter		$objWriter 			XML Writer
  * @param	string							$pCellReference		Cell reference
  * @param 	Comment				$pComment			Comment
  * @param	array							$pAuthors			Array of authors
  * @throws 	Exception
  */
 public function _writeComment(Shared_XMLWriter $objWriter = null, $pCellReference = 'A1', Comment $pComment = null, $pAuthors = null)
 {
     // comment
     $objWriter->startElement('comment');
     $objWriter->writeAttribute('ref', $pCellReference);
     $objWriter->writeAttribute('authorId', $pAuthors[$pComment->getAuthor()]);
     // text
     $objWriter->startElement('text');
     $this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $pComment->getText());
     $objWriter->endElement();
     $objWriter->endElement();
 }
开发者ID:kamaludinnur,项目名称:toko-baju,代码行数:21,代码来源:Comments.php

示例8: Comment

require_once '../database_access.php';
$comment = new Comment();
if (isset($_POST['creation_date'])) {
    $comment->setCreationDate($_POST['creation_date']);
}
if (isset($_POST['edit_date'])) {
    $comment->setEditDate($_POST['edit_date']);
}
if (isset($_POST['author_user_id'])) {
    $comment->setAuthorUserId($_POST['author_user_id']);
}
if (isset($_POST['target_event_id'])) {
    $comment->setTargetEventId($_POST['target_event_id']);
}
if (isset($_POST['comment_text'])) {
    $comment->setCommentText($_POST['comment_text']);
}
if (!$comment->validate()) {
    foreach ($comment->getValidationFailures() as $failure) {
        echo '<p><strong>Error in ' . $failure->getPropertyPath() . ' field!</strong> ' . $failure->getMessage() . '</p>';
    }
    unset($failure);
} else {
    $comment->save();
    // add the author name and return the JSON
    $comment_json = json_decode($comment->toJSON());
    $author = $comment->getAuthor();
    $comment_json->authorFirstName = $author->getFirstName();
    $comment_json->authorLastName = $author->getLastName();
    echo json_encode($comment_json);
}
开发者ID:Web-Systems-Development-Team,项目名称:RPIwannahangout,代码行数:31,代码来源:create_comment_ajax.php


注:本文中的Comment::getAuthor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。