<?php

$comments = new wpad_advance_comment();
?>
<div class="wrap">
    <h2><?php 
_e('WP Advanced Comment', 'wpad');
?>
</h2>    
    <?php 
$comments->trash_comment_edit_page();
?>
    <ul class="subsubsub">
		<li class="all">
			<a class="current" href="javascript:void(0)" onclick="get_comments('all')"><?php 
_e('All', 'wpad');
?>
</a> |
		</li>
		<li class="moderated">
			<a id="hold" href="javascript:void(0)" onclick="get_comments('hold')"><?php 
_e('Pending', 'wpad');
?>
 <span class="count">(<span class="pending_count">0</span>)</span></a> |
		</li>
		<li class="approved">
			<a id="approve" href="javascript:void(0)" onclick="get_comments('approve')"><?php 
_e('Approved', 'wpad');
?>
 <span class="count">(<span class="approve_count">0</span>)</span></a> |
		</li>
    function get_reported_comments($results)
    {
        $count_flag = 0;
        foreach ($results as $value) {
            $comment_id = $value['comment_ID'];
            // Check for the flagged commets
            $flagged_reports = get_comment_meta($comment_id, 'comment_flagged_reports', true);
            if (!empty($flagged_reports)) {
                $count_flag = $count_flag + count($flagged_reports);
            }
            if (!empty($flagged_reports)) {
                foreach ($flagged_reports as $key1 => $value1) {
                    ?>

					<tr>
						
						<td class="author column-author">
							
							<strong>

								<?php 
                    $comment_form = new wpad_frontend_comment_form();
                    $option = get_option('wpad_comment_form');
                    $commnet_form_id = get_comment_meta($comment_id, 'wpad_comment_form_id', true);
                    $form_ids = !empty($option[$commnet_form_id]) ? $option[$commnet_form_id] : '';
                    $wpad_advance_comment = new wpad_advance_comment();
                    $object = $wpad_advance_comment->get_comment_in_array($comment_id);
                    echo $comment_form->validate_gravatar($value['comment_author_email'], $form_ids, $object, 32);
                    ?>

								<?php 
                    echo $value['comment_author'];
                    ?>

							</strong>

							<br>

							<a href="mailto:<?php 
                    echo $value['comment_author_email'];
                    ?>
">

								<?php 
                    echo $value['comment_author_email'];
                    ?>

							</a>

							<br>	

							<?php 
                    echo $value['comment_author_IP'];
                    ?>

						</td>

						<td class="comment column-comment">

							<div class="submitted-on">

								<?php 
                    _e("Submitted on", 'wpad');
                    $post_link = $wpad_advance_comment->get_comment_link($value['comment_post_ID'], $value['comment_ID']);
                    ?>

								<a href="<?php 
                    echo $post_link;
                    ?>
" target="blank" >

									<?php 
                    echo date('d M, Y \\a\\t g:i a', strtotime($value['comment_date_gmt']));
                    ?>

								</a> 

							</div>

							<p><?php 
                    echo $value['comment_content'];
                    ?>
</p>

						</td>
					
						<td class="report column-report">
							<strong><?php 
                    _e("Option Selected :", 'wpad');
                    ?>
 </strong>
							<br>
							<p><?php 
                    echo $value1['option'];
                    ?>
</p>

							<?php 
                    if (!empty($value1['message'])) {
                        ?>

								<br><strong><?php 
                        _e("User Message : ", 'wpad');
                        ?>
</strong>
								<br>
								<p><?php 
                        echo $value1['message'];
                        ?>
</p>
								
								<?php 
                    }
                    ?>

						</td>

						<td class="response column-response">

							<div class="response-links">

								<span class="post-com-count-wrapper">

									<a href="<?php 
                    echo get_edit_post_link($value['comment_post_ID']);
                    ?>
" class="comments-edit-item-link">

										<?php 
                    echo get_the_title($value['comment_post_ID']);
                    ?>
 

									</a>

									<?php 
                    $wpad_advance_comment->view_page($value['comment_post_ID']);
                    ?>

									<span class="post-com-count-wrapper">

										<a class="post-com-count post-com-count-approved" href="javascript:void(0)">

											<span class="comment-count-approved"><?php 
                    $wpad_advance_comment->comment_count($value['comment_post_ID']);
                    ?>
</span>

										</a>

									</span>

								</span> 
								
							</div>

						</td>

					</tr>

					<?php 
                }
            }
        }
        if ($count_flag < 1) {
            ?>

			<tr>
				<td colspan="4" style="text-align:center">
					<?php 
            _e('No flagged comments found for this post.', 'wpad');
            ?>
				</td>
			</tr>

			<?php 
        }
    }
    function get_comment_details($results)
    {
        ?>

		<table class="form-table editcomment">

			<tbody>

				<tr>

					<td class="first"><?php 
        _e("Profile Pic :", 'wpad');
        ?>
</td>

					<td>
						<?php 
        $comment_form = new wpad_frontend_comment_form();
        $wpad_advance_comment = new wpad_advance_comment();
        $object = $wpad_advance_comment->get_comment_in_array($_GET['parentid']);
        $option = get_option('wpad_comment_form');
        $commnet_form_id = $_GET['formid'];
        if (!empty($option[$commnet_form_id])) {
            echo $comment_form->validate_gravatar($results[0]['comment_author_email'], $option[$commnet_form_id], $object, 150);
        } else {
            echo $comment_form->validate_gravatar($results[0]['comment_author_email'], null, $object, 150);
        }
        ?>
					</td>

				</tr>

				<tr>

					<td class="first"><?php 
        _e("Name :", 'wpad');
        ?>
</td>

					<td><?php 
        echo $results[0]['comment_author'];
        ?>
</td>

				</tr>

				<tr>

					<td class="first">

					<?php 
        _e("E-mail", 'wpad');
        ?>
 ( <a href="mailto:<?php 
        echo $results[0]['comment_author_email'];
        ?>
"><?php 
        _e("Send E-mail", 'wpad');
        ?>
</a> ) :</td>

					<td><?php 
        echo $results[0]['comment_author_email'];
        ?>
</td>

				</tr>

				<tr>

					<td class="first">

					<?php 
        _e("Comment :", 'wpad');
        ?>
</td>

					<td><p><?php 
        echo $results[0]['comment_content'];
        ?>
</p></td>

				</tr>

				<tr>

					<td class="first">

						<?php 
        _e("IP Address :", 'wpad');
        ?>
 

					</td>

					<td>

						<a href="http://whois.arin.net/rest/ip/<?php 
        echo $results[0]['comment_author_IP'];
        ?>
">

							<?php 
        echo $results[0]['comment_author_IP'];
        ?>

						</a>

					</td>

				</tr>

				<tr>

					<td class="first">

					<?php 
        _e("Submitted On :", 'wpad');
        ?>
</td>

					<td><p><?php 
        echo date('M d, Y \\a\\t g:i A', strtotime($results[0]['comment_date']));
        ?>
</p></td>

				</tr>

				<?php 
        if ($results[0]['comment_parent'] != 0) {
            ?>

					<tr>

						<td class="first"><?php 
            _e("In Reply To :", 'wpad');
            ?>
</td>

						<td><a href="#"><?php 
            echo get_comment_author($results[0]['comment_parent']);
            ?>
</a></td>

					</tr>

					<?php 
        }
        ?>

			</tbody>

		</table>

		<?php 
    }