/**
  * Get an instance of this class.
  *
  * @return GFQuiz
  */
 public static function get_instance()
 {
     if (self::$_instance == null) {
         self::$_instance = new GFQuiz();
     }
     return self::$_instance;
 }
Exemple #2
0
<?php

/**
 * Display Gravity Forms Quiz output
 *
 * @package GravityView
 * @subpackage GravityView/templates/fields
 */
$gravityview_view = GravityView_View::getInstance();
$field = $gravityview_view->getCurrentField();
// If there's no grade, don't continue
if (gv_empty($field['value'])) {
    return;
}
if (!class_exists('GFQuiz')) {
    do_action('gravityview_log_error', __FILE__ . ': GFQuiz class does not exist.');
    return;
}
// Get the setting for show/hide explanation
$show_answer = rgars($field, 'field_settings/quiz_show_explanation');
// Update the quiz field so GF generates the output properly
$field['field']->gquizShowAnswerExplanation = !empty($show_answer);
// Generate the output
echo GFQuiz::get_instance()->display_quiz_on_entry_detail($field['value'], $field['field'], $field['entry'], $field['form']);
Exemple #3
0
function gf_quiz()
{
    return GFQuiz::get_instance();
}
Exemple #4
0
 private static function get_quiz_overalls($form)
 {
     /* we need to tap into functions GF Quiz has so only run if it is active */
     if (class_exists('GFQuiz')) {
         /* GFQuiz is a singleton. Get the instance */
         $quiz = GFQuiz::get_instance();
         /* create our callback to add additional data to the array specific to the quiz plugin */
         $options['callbacks']['calculation'] = array($quiz, 'results_calculation');
         $fields = self::get_related_fields($form["fields"], 'quiz');
         $quiz_results = self::get_addon_global_data($form, $options, $fields);
         return $quiz_results;
     }
     return array(__('Activate Gravity Forms Quiz Add On to see global quiz statistics for this form', 'pdfextended'));
 }
Exemple #5
0
<?php

/**
 * Display Gravity Forms Quiz value Pass/Fail
 *
 * @package GravityView
 * @subpackage GravityView/templates/fields
 */
$gravityview_view = GravityView_View::getInstance();
$field = $gravityview_view->getCurrentField();
// If there's no grade, don't continue
if (empty($field['value'])) {
    return;
}
if (class_exists('GFQuiz') && $gravityview_view->getCurrentFieldSetting('quiz_use_max_score')) {
    $max_score = GFQuiz::get_instance()->get_max_score($gravityview_view->getForm());
    printf('%d/%d', $field['value'], $max_score);
} else {
    echo $field['value'];
}
 public static function display_export_field_value($value, $form_id, $field_id, $lead)
 {
     $quiz = GFQuiz::get_instance();
     return $quiz->display_entries_field_value($value, $form_id, $field_id, $lead);
 }