public function showOverviewTable() { ?> <table class="wp-list-table widefat"> <thead> <tr> <th scope="col"><?php _e('User', 'wp-pro-quiz'); ?> </th> <th scope="col" style="width: 100px;"><?php _e('Points', 'wp-pro-quiz'); ?> </th> <th scope="col" style="width: 100px;"><?php _e('Correct', 'wp-pro-quiz'); ?> </th> <th scope="col" style="width: 100px;"><?php _e('Incorrect', 'wp-pro-quiz'); ?> </th> <th scope="col" style="width: 100px;"><?php _e('Hints used', 'wp-pro-quiz'); ?> </th> <th scope="col" style="width: 100px;"><?php _e('Time', 'wp-pro-quiz'); ?> <span style="font-size: x-small;">(hh:mm:ss)</span></th> <th scope="col" style="width: 60px;"><?php _e('Results', 'wp-pro-quiz'); ?> </th> </tr> </thead> <tbody> <?php if (!count($this->statisticModel)) { ?> <tr> <td colspan="7" style="text-align: center; font-weight: bold; padding: 10px;"><?php _e('No data available', 'wp-pro-quiz'); ?> </td> </tr> <?php } else { ?> <?php foreach ($this->statisticModel as $model) { /** @var WpProQuiz_Model_StatisticOverview $model **/ $sum = $model->getCorrectCount() + $model->getIncorrectCount(); if (!$model->getUserId()) { $model->setUserName(__('Anonymous', 'wp-pro-quiz')); } if ($sum) { $points = $model->getPoints(); $correct = $model->getCorrectCount() . ' (' . round(100 * $model->getCorrectCount() / $sum, 2) . '%)'; $incorrect = $model->getIncorrectCount() . ' (' . round(100 * $model->getIncorrectCount() / $sum, 2) . '%)'; $hintCount = $model->getHintCount(); $time = WpProQuiz_Helper_Until::convertToTimeString($model->getQuestionTime()); $result = round(100 * $points / $model->getGPoints(), 2) . '%'; } else { $result = $time = $hintCount = $incorrect = $correct = $points = '---'; } ?> <tr> <th> <?php if ($sum) { ?> <a href="#" class="user_statistic" data-user_id="<?php echo $model->getUserId(); ?> "><?php echo esc_html($model->getUserName()); ?> </a> <?php } else { echo esc_html($model->getUserName()); } ?> <div <?php echo $sum ? 'class="row-actions"' : 'style="visibility: hidden;"'; ?> > <span> <a style="color: red;" class="wpProQuiz_delete" href="#"><?php _e('Delete', 'wp-pro-quiz'); ?> </a> </span> </div> </th> <th><?php echo $points; ?> </th> <th style="color: green;"><?php echo $correct; ?> </th> <th style="color: red;"><?php echo $incorrect; ?> </th> <th><?php echo $hintCount; ?> </th> <th><?php echo $time; ?> </th> <th style="font-weight: bold;"><?php echo $result; ?> </th> </tr> <?php } } ?> </tbody> </table> <?php }