<?php if ($user_logged_in) { //check if user logged in, if yes, show rating and report part ?> <div class="entry_record"> <div class="entry_record_title">Do you like this entry?</div> <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; ?>
//define ids for html tags in the loop $edit_icon_id = "editIcon_" . $id; $edit_area_id = "edit_area_" . $id; $edit_comment_text_id = "comment_text_id_" . $id; $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 . ":"; ?>
$user_logged_in = false; //redirect to homepage header("Location: http://localhost/tarboz/"); } if ($user_logged_in) { //print_r($_POST); //echo "==========\n"; if ($_POST) { $comment_id = isset($_POST['commentId']) && $_POST['commentId'] != 'undefined' ? $_POST['commentId'] : ""; $user_id = isset($_POST['userId']) && $_POST['userId'] != 'undefined' ? $_POST['userId'] : ""; $is_like = isset($_POST['isLike']) && $_POST['isLike'] != 'undefined' ? $_POST['isLike'] : ""; $entity_id = "com" . $comment_id; if ($comment_id != "" && $user_id != "" && $user_id > 0) { $rm = new RatingManager(); $rating_like_exist = $rm->hasRatingByEntityLikeUser($entity_id, $user_id); $rating_dislike_exist = $rm->hasRatingByEntityDislikeUser($entity_id, $user_id); //echo "rating like exist id: ".$rating_like_exist; //$rm->hasRatingByEntityLikeUser($entity_id, $user_id); //echo "rating dislike exist id: ".$rating_dislike_exist; //add new rating if ($rating_like_exist == 0 && $rating_dislike_exist == 0) { if ($is_like == "Y") { $like_user_id = $user_id; $dislike_user_id = NULL; } else { if ($is_like == "N") { $dislike_user_id = $user_id; $like_user_id = NULL; } } //if ($comment_id != "" && $user_id !="") { $new_rating = new Rating();
<?php if ($user_logged_in) { //check if user logged in, if yes, show rating and report part ?> <div class="entry_record"> <div class="entry_record_title">Do you like this entry?</div> <div class="entry_record_value"> <?php //get the like number $rm = new RatingManager(); $like_entry = ""; if ($rm->hasRatingByEntityLikeUser("ent" . $entryId, $user_id) == 1) { $like_entry = "Unlike"; } else { if ($rm->hasRatingByEntityDislikeUser("ent" . $entryId, $user_id) == 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 $user_id . "_entryLike_" . $entryId; ?>