private static function get_the_likert($form, $lead, $field, $form_array) { $id = $field['id']; $multiple_rows = rgar($field, "gsurveyLikertEnableMultipleRows"); if (!$multiple_rows) { $results = $lead[$id]; } $likert = array(); /* store the column names */ foreach ($field['choices'] as $col) { $likert['col'][$col['value']] = $col['text']; } if (is_array($field['inputs']) && sizeof($field['inputs']) > 0) { /* do our multi-row likert */ foreach ($field['inputs'] as $row) { /* pad the array with the number of columns */ foreach ($likert['col'] as $col_id => $text) { /* * Results for multi row is stored with ID.ROW# (eg $lead['1.2']) * The number is stored in $row['id'] */ $results = $lead[$row['id']]; /* user data in the $lead comes in as ROW ID:COL ID */ $comparison = $row['name'] . ':' . $col_id; /* do our comparison and update the output */ $output = $comparison == $results ? 'selected' : ''; /* assign our results to the array */ $likert['rows'][$row['label']][$text] = $output; } } } else { /* do our single row likert */ foreach ($likert['col'] as $col_id => $text) { /* single row data comes in with col value */ /* do our comparison and update the output */ $output = $col_id == $results ? 'selected' : ''; $likert['row'][$text] = $output; } } /* * Check if scoring is enabled and calculate */ if ($field['gsurveyLikertEnableScoring'] && class_exists('GFSurvey')) { $survey = GFSurvey::get_instance(); $likert['score'] = $survey->get_field_score($field, $lead); } return $likert; }
public static function display_export_field_value($value, $form_id, $field_id, $lead) { $survey = GFSurvey::get_instance(); return $survey->display_entries_field_value($value, $form_id, $field_id, $lead); }
function gf_survey() { return GFSurvey::get_instance(); }
<?php /** * Display the Quiz field type * * @package GravityView * @subpackage GravityView/templates/fields */ // Make sure the CSS file is enqueued if (class_exists('GFSurvey') && is_callable(array('GFSurvey', 'get_instance'))) { wp_register_style('gsurvey_css', GFSurvey::get_instance()->get_base_url() . '/css/gsurvey.css'); wp_print_styles('gsurvey_css'); } echo GravityView_View::getInstance()->getCurrentField('display_value');