AnsPress_Dashboard::anspress_attn()
Description #
Show items which need attention.
Source #
File: admin/views/dashboard.php
public static function anspress_attn() {
$q_flagged_count = ap_total_posts_count( 'question', 'flag' );
$a_flagged_count = ap_total_posts_count( 'answer', 'flag' );
$question_count = wp_count_posts( 'question', 'readable' );
$answer_count = wp_count_posts( 'answer', 'readable' );
?>
<div class="main attn">
<?php
if ( ! $q_flagged_count->total && ! $question_count->moderate && ! $a_flagged_count->total && ! $answer_count->moderate ) :
esc_attr_e( 'All looks fine', 'anspress-question-answer' );
endif;
?>
<?php if ( $q_flagged_count->total || $question_count->moderate ) : ?>
<strong><?php esc_attr_e( 'Questions', 'anspress-question-answer' ); ?></strong>
<ul>
<?php if ( $q_flagged_count->total ) : ?>
<li>
<a href="<?php echo esc_url( admin_url( 'edit.php?flagged=true&post_type=question' ) ); ?>"><i class="apicon-flag"></i>
<?php
// translators: Placeholder contains total flagged question count.
echo esc_attr( sprintf( __( '%d Flagged questions', 'anspress-question-answer' ), $q_flagged_count->total ) );
?>
</a>
</li>
<?php endif; ?>
<?php if ( $question_count->moderate ) : ?>
<li>
<a href="<?php echo esc_url( admin_url( 'edit.php?post_status=moderate&post_type=question' ) ); ?>"><i class="apicon-stop"></i>
<?php
echo esc_attr(
// translators: placeholder contains total question awaiting moderation.
sprintf( __( '%d questions awaiting moderation', 'anspress-question-answer' ), $question_count->moderate )
);
?>
</a>
</li>
<?php endif; ?>
</ul>
<?php endif; ?>
<?php if ( $a_flagged_count->total || $answer_count->moderate ) : ?>
<strong><?php esc_attr_e( 'Answers', 'anspress-question-answer' ); ?></strong>
<ul>
<?php if ( $a_flagged_count->total ) : ?>
<li>
<a href="<?php echo esc_url( admin_url( 'edit.php?flagged=true&post_type=answer' ) ); ?>">
<i class="apicon-flag"></i>
<?php
echo esc_attr(
sprintf(
// translators: placeholder contains total flagged answers count.
__( '%d Flagged answers', 'anspress-question-answer' ),
$a_flagged_count->total
)
);
?>
</a>
</li>
<?php endif; ?>
<?php if ( $answer_count->moderate ) : ?>
<li>
<a href="<?php echo esc_url( admin_url( 'edit.php?post_status=moderate&post_type=answer' ) ); ?>">
<i class="apicon-stop"></i>
<?php
echo esc_attr(
sprintf(
// translators: placeholder contains total awaiting moderation question/answer.
__( '%d answers awaiting moderation', 'anspress-question-answer' ),
$answer_count->moderate
)
);
?>
</a>
</li>
<?php endif; ?>
</ul>
<?php endif; ?>
</div>
<?php
}
Expand full source code Collapse full source code View on GitHub: admin/views/dashboard.php:195
Add your comment