$form_name = "formEditComment_" . $id; $edit_comment_textarea = "editCommentText_" . $id; $edit_comment_input_hidden = "editCommentId_" . $id; $edit_comment_submit = "editCommentSub_" . $id; $delete_icon_id = "deleteIcon_" . $id; $comment_like_id = $user_id . "_commentLike_" . $id; $ratingManager = new RatingManager(); $rating_content = ""; if ($ratingManager->hasRatingByEntityLikeUser("com" . $id, $created_by) == 1) { $rating_content = "Unlike"; } else { if ($ratingManager->hasRatingByEntityDislikeUser("com" . $id, $created_by) == 1 || $ratingManager->hasRatingByEntityLikeUser("com" . $id, $created_by) == 0 || $ratingManager->hasRatingByEntityDislikeUser("com" . $id, $created_by) == 0) { $rating_content = "Like"; } } $likeRating = $ratingManager->CountRatingByLikeEntity("com" . $id); $likeRating = $likeRating > 0 ? $likeRating : ""; $comment_report_id = $user_id . "_reportCommentId_" . $id; ?> <div> <div> <div style="display:table;"> <div style="display:table-row;"> <div style="display:table-cell;width:110px;"><?php echo $created_user_name . ":"; ?> </div> <div style="display:table-cell; width:200px;"> <span id="<?php echo $edit_comment_text_id;
<div class="entry_record_value"> <?php //get the like number $rm = new RatingManager(); $like_entry = ""; if ($rm->hasRatingByEntityLikeUser("ent" . $entryId, $loggedIn_userId) == 1) { $like_entry = "Unlike"; } else { if ($rm->hasRatingByEntityDislikeUser("ent" . $entryId, $loggedIn_userId) == 1) { $like_entry = "Like"; } else { $like_entry = ""; } } $likeRating = $rm->CountRatingByLikeEntity("ent" . $entryId); $likeRating = $likeRating > 0 ? $likeRating : 0; $dislikeRating = $rm->CountRatingByDislikeEntity("ent" . $entryId); $dislikeRating = $dislikeRating > 0 ? $dislikeRating : 0; if ($like_entry != "") { ?> <div style="display:inline-block; width: 280px;"> <span id ="<?php echo $loggedIn_userId . "_entryLike_" . $entryId; ?> " name="<?php echo $loggedIn_userId . "_entryLike_" . $entryId; ?> " class="entry_like" style="cursor: pointer; color: #0066cc;"><?php echo $like_entry . " ";
} //if($comment_id != "" && $user_id !="") { $edited_rating = isset($edited_rating) ? $edited_rating : ""; $edited_rating->setLikeUserId($like_user_id); $edited_rating->setDislikeUserId($dislike_user_id); //echo "Updating rating #".$edited_rating->getId() ."\n"; //echo "Updating rating like id".$edited_rating->getLikeUserId() ."\n"; //echo "Updating rating dislike id".$edited_rating->getDislikeUserId() ."\n"; $updated_rating = $ratingManager->updateRating($edited_rating); if (!$updated_rating) { echo "Updating rating #" . $edited_rating->getId() . " failed."; } else { //$_SESSION["updated_rating"] = $edited_rating; //print "edited comment text: ". $_SESSION["updated_comment"]->getText()."<br/>\n"; echo "Updating rating #" . $edited_rating->getId() . " succeeded."; echo "like_num=" . $ratingManager->CountRatingByLikeEntity($entity_id); } /* } else { echo "Passing comment id and user id are failed."; }*/ } } //end else update a rating } else { echo "Passing comment id and user id are failed."; } //end if ($comment_id != "" && $user_id !="") } else { echo "Post a rating is failed."; } //end if($_POST)