Ejemplo n.º 1
0
 protected function buildQuizResponseMessages()
 {
     $locale = SwatI18NLocale::get();
     $correct = $this->response->getCorrectCount();
     $total = count($this->quiz->question_bindings);
     $grade = $this->response->getGrade();
     ob_start();
     // quiz grade
     echo '<p class="quiz-response-grade">';
     printf(CME::ngettext('You got %s out of %s answer correct for a grade of %s%%.', 'You got %s out of %s answers correct for a grade of %s%%.', $total), SwatString::minimizeEntities($locale->formatNumber($correct)), SwatString::minimizeEntities($locale->formatNumber($total)), SwatString::minimizeEntities($locale->formatNumber(round($grade * 1000) / 10)));
     echo '</p>';
     echo '<p class="quiz-response-status">';
     $complete_date = clone $this->response->complete_date;
     $complete_date->convertTZ($this->app->default_time_zone);
     echo SwatString::minimizeEntities(sprintf(CME::_('You completed this quiz on %s.'), $complete_date->formatLikeIntl(CME::_('MMMM d, yyyy'))));
     if (!$this->front_matter->resettable) {
         echo ' ';
         echo SwatString::minimizeEntities(CME::_('Once you’ve taken the quiz, it may not be taken again.'));
     }
     echo '</p>';
     if ($this->response->isPassed()) {
         $account = $this->app->session->account;
         if ($account->isEvaluationComplete($this->credits->getFirst())) {
             echo '<p>';
             echo SwatString::minimizeEntities(CME::_('You’ve already completed the evaluation.'));
             echo '</p>';
             $certificate_link = new SwatHtmlTag('a');
             $certificate_link->class = 'btn btn-primary';
             $certificate_link->href = $this->getCertificateURI();
             $certificate_link->setContent(CME::_('Print Certificate'));
             $certificate_link->display();
         } else {
             $evaluation_link = new SwatHtmlTag('a');
             $evaluation_link->class = 'btn btn-primary';
             $evaluation_link->href = $this->getEvaluationURI();
             $evaluation_link->setContent(CME::_('Complete Evaluation'));
             $evaluation_link->display();
         }
     } else {
         // quiz failed message
         $p_tag = new SwatHtmlTag('p');
         $p_tag->class = 'quiz-response-failed';
         $p_tag->setContent(sprintf(CME::_('A grade of %s%% is required to qualify for CME ' . 'credit.'), $locale->formatNumber($this->front_matter->passing_grade * 100)));
         $p_tag->display();
     }
     $content_block = $this->ui->getWidget('quiz_response_description');
     $content_block->content .= ob_get_clean();
     $content_block->content_type = 'text/xml';
 }
Ejemplo n.º 2
0
 protected function init()
 {
     parent::init();
     $this->registerInternalProperty('account', SwatDBClassMap::get('CMEAccount'));
 }