public static function ajaxLoadQuizData($data)
 {
     $quizId = (int) $data['quizId'];
     $quizMapper = new WpProQuiz_Model_QuizMapper();
     $toplistController = new WpProQuiz_Controller_Toplist();
     $statisticController = new WpProQuiz_Controller_Statistics();
     $quiz = $quizMapper->fetch($quizId);
     $data = array();
     if ($quiz === null || $quiz->getId() <= 0) {
         return json_encode(array());
     }
     $data['toplist'] = $toplistController->getAddToplist($quiz);
     $data['averageResult'] = $statisticController->getAverageResult($quizId);
     return json_encode($data);
 }
 public function loadQuizData()
 {
     $quizId = (int) $_POST['quizId'];
     $userId = get_current_user_id();
     $quizMapper = new WpProQuiz_Model_QuizMapper();
     $toplistController = new WpProQuiz_Controller_Toplist();
     $statisticController = new WpProQuiz_Controller_Statistics();
     $quiz = $quizMapper->fetch($quizId);
     $data = array();
     if ($quiz === null || $quiz->getId() <= 0) {
         return array();
     }
     $data['toplist'] = $toplistController->getAddToplist($quiz);
     $data['averageResult'] = $statisticController->getAverageResult($quizId);
     return $data;
 }