showHistoryTable();
$content = ob_get_contents();
ob_end_clean();
return $content;
}
public function showHistoryTable()
{
?>
|
forms as $form) {
/* @var $form WpAdvQuiz_Model_Form */
if ($form->isShowInStatistic()) {
echo '' . $form->getFieldname() . ' | ';
}
} ?>
|
|
|
|
|
|
historyModel)) { ?>
|
historyModel as $model) {
/* @var $model WpAdvQuiz_Model_StatisticHistory */ ?>
|
getUserName()); ?>
|
getFormOverview() as $form) {
echo '' . esc_html($form) . ' | ';
} ?>
getFormatTime()); ?> |
getFormatCorrect()); ?> |
getFormatIncorrect()); ?> |
getSolvedCount()) < 0 ? '---' : sprintf(__('%d of %d', 'wp-adv-quiz'),
$model->getSolvedCount(),
$model->getCorrectCount() + $model->getIncorrectCount()); ?> |
getPoints()); ?> |
getResult()); ?>% |
showUserTable();
$content = ob_get_contents();
ob_end_clean();
return $content;
}
public function showUserTable()
{
?>
userName)); ?>
avg) { ?>
statisticModel->getMinCreateTime()); ?>
-
statisticModel->getMaxCreateTime()); ?>
statisticModel->getCreateTime()); ?>
formTable(); ?>
|
|
|
|
|
|
|
(hh:mm:ss) |
|
|
userStatistic as $cat) {
$cCorrect = $cIncorrect = $cHintCount = $cPoints = $cGPoints = $cTime = $cSolvedCount = 0;
?>
|
:
|
|
avg && $q['statistcAnswerData'] !== null) {
echo '' . esc_html($q['questionName']) . '';
} else {
echo esc_html($q['questionName']);
} ?>
|
|
|
|
|
|
|
|
|
avg && $q['statistcAnswerData'] !== null) { ?>
|
showUserAnswer($q['questionAnswerData'], $q['statistcAnswerData'],
$q['answerType']); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$v) {
$matrix[$k][] = $k;
foreach ($qAnswerData as $k2 => $v2) {
if ($k != $k2) {
if ($v->getAnswer() == $v2->getAnswer()) {
$matrix[$k][] = $k2;
} else {
if ($v->getSortString() == $v2->getSortString()) {
$matrix[$k][] = $k2;
}
}
}
}
}
}
?>
isHtml() ? $qAnswerData[$i]->getAnswer() : esc_html($qAnswerData[$i]->getAnswer());
$correct = '';
?>
isCorrect()) {
$correct = 'wpAdvQuiz_answerCorrect';
} else {
if (isset($sAnswerData[$i]) && $sAnswerData[$i]) {
$correct = 'wpAdvQuiz_answerIncorrect';
}
}
?>
-
getAnswer()));
$t = str_replace("\r", "\n", $t);
$t = explode("\n", $t);
$t = array_values(array_filter(array_map('trim', $t)));
if (isset($sAnswerData[0]) && in_array(strtolower(trim($sAnswerData[0])), $t)) {
$correct = 'wpAdvQuiz_answerCorrect';
} else {
$correct = 'wpAdvQuiz_answerIncorrect';
}
?>
-
:
isHtml() ? $v->getAnswer() : esc_html($v->getAnswer());
}
?>
-
isSortStringHtml() ? $v->getSortString() : esc_html($v->getSortString());
}
?>
-
fetchCloze($qAnswerData[$i]->getAnswer(), $sAnswerData);
$this->_clozeTemp = $clozeData['data'];
$cloze = $clozeData['replace'];
echo preg_replace_callback('#@@wpAdvQuizCloze@@#im', array($this, 'clozeCallback'),
$cloze);
} else {
if ($anserType == 'assessment_answer') {
$assessmentData = $this->fetchAssessment($qAnswerData[$i]->getAnswer(),
$sAnswerData);
$assessment = do_shortcode(apply_filters('comment_text',
$assessmentData['replace']));
echo preg_replace_callback('#@@wpAdvQuizAssessment@@#im',
array($this, 'assessmentCallback'), $assessment);
}
}
}
}
}
} ?>
_assessmetTemp);
return $a === null ? '' : $a;
}
private function fetchAssessment($answerText, $answerData)
{
preg_match_all('#\{(.*?)\}#im', $answerText, $matches);
$this->_assessmetTemp = array();
$data = array();
for ($i = 0, $ci = count($matches[1]); $i < $ci; $i++) {
$match = $matches[1][$i];
preg_match_all('#\[([^\|\]]+)(?:\|(\d+))?\]#im', $match, $ms);
$a = '';
$checked = isset($answerData[$i]) ? ((int)$answerData[$i]) - 1 : -1;
for ($j = 0, $cj = count($ms[1]); $j < $cj; $j++) {
$v = $ms[1][$j];
$a .= '';
}
$this->_assessmetTemp[] = $a;
}
$data['replace'] = preg_replace('#\{(.*?)\}#im', '@@wpAdvQuizAssessment@@', $answerText);
return $data;
}
private $_clozeTemp = array();
private function fetchCloze($answer_text, $answerData)
{
preg_match_all('#\{(.*?)(?:\|(\d+))?(?:[\s]+)?\}#im', $answer_text, $matches, PREG_SET_ORDER);
$data = array();
$index = 0;
foreach ($matches as $k => $v) {
$text = $v[1];
$points = !empty($v[2]) ? (int)$v[2] : 1;
$rowText = $multiTextData = array();
$len = array();
if (preg_match_all('#\[(.*?)\]#im', $text, $multiTextMatches)) {
foreach ($multiTextMatches[1] as $multiText) {
$x = mb_strtolower(trim(html_entity_decode($multiText, ENT_QUOTES)));
$len[] = strlen($x);
$multiTextData[] = $x;
$rowText[] = $multiText;
}
} else {
$x = mb_strtolower(trim(html_entity_decode($text, ENT_QUOTES)));
$len[] = strlen($x);
$multiTextData[] = $x;
$rowText[] = $text;
}
$correct = 'wpAdvQuiz_answerIncorrect';
if (isset($answerData[$index]) && in_array($answerData[$index], $rowText)) {
$correct = 'wpAdvQuiz_answerCorrect';
}
// $a = ' ';
// $a .= '('.implode(', ', $rowText).')';
$a = '' . esc_html(isset($answerData[$index]) ? empty($answerData[$index]) ? '---' : $answerData[$index]
: '---') . ' ';
$a .= '(' . implode(', ', $rowText) . ')';
$data['correct'][] = $multiTextData;
$data['points'][] = $points;
$data['data'][] = $a;
$index++;
}
$data['replace'] = preg_replace('#\{(.*?)(?:\|(\d+))?(?:[\s]+)?\}#im', '@@wpAdvQuizCloze@@', $answer_text);
return $data;
}
private function clozeCallback($t)
{
$a = array_shift($this->_clozeTemp);
return $a === null ? '' : $a;
}
private function formTable()
{
if ($this->forms === null || $this->statisticModel === null) {
return;
}
$formData = $this->statisticModel->getFormData();
if ($formData === null) {
return;
}
?>
showOverviewTable();
$content = ob_get_contents();
ob_end_clean();
return $content;
}
public function showOverviewTable()
{
?>
|
|
|
|
|
(hh:mm:ss) |
|
statisticModel)) { ?>
|
statisticModel as $model) {
/** @var WpAdvQuiz_Model_StatisticOverview $model * */
$sum = $model->getCorrectCount() + $model->getIncorrectCount();
if (!$model->getUserId()) {
$model->setUserName(__('Anonymous', 'wp-adv-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 = WpAdvQuiz_Helper_Until::convertToTimeString($model->getQuestionTime());
$result = round((100 * $points / $model->getGPoints()), 2) . '%';
} else {
$result = $time = $hintCount = $incorrect = $correct = $points = '---';
}
?>
|
getUserName()); ?>
getUserName());
} ?>
|
|
|
|
|
|
|