GravityView  1.19.4
The best, easiest way to display Gravity Forms entries on your website.
gquiz_grade.php
Go to the documentation of this file.
1 <?php
2 /**
3  * Display Gravity Forms Quiz value letter grade
4  *
5  * @package GravityView
6  * @subpackage GravityView/templates/fields
7  */
8 
10 
11 $field = $gravityview_view->getCurrentField();
12 
13 // If there's no grade, don't continue
14 if( gv_empty( $field['value'], false, false ) ) {
15  return;
16 }
17 
18 // Check if grading is enabled for the form. If not set, default to false.
19 $grading_type_enabled = !empty( $field['form']['gravityformsquiz']['grading'] ) ? $field['form']['gravityformsquiz']['grading'] : 'none';
20 
21 if( 'letter' === $grading_type_enabled ) {
22  echo $field['value'];
23 } elseif( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) {
24  $grade_type = __( 'Letter', 'gravityview' );
25  printf( esc_html_x( '%s grading is disabled for this form. %sChange the setting%s', '%s is the current Quiz field type ("Letter" or "Pass/Fail")', 'gravityview' ), $grade_type, '<a href="'. admin_url('admin.php?page=gf_edit_forms&amp;view=settings&amp;subview=gravityformsquiz&amp;id='.$gravityview_view->getFormId() ) . '">', '</a>' );
26 }
gv_empty($value, $zero_is_empty=true, $allow_string_booleans=true)
Is the value empty?
$gravityview_view
Definition: gquiz_grade.php:9
static has_cap($caps= '', $object_id=null, $user_id=null)
Alias of GravityView_Roles_Capabilities::has_cap()
if(gv_empty($field['value'], false, false)) $grading_type_enabled
Definition: gquiz_grade.php:19
static getInstance($passed_post=NULL)
$field
Definition: gquiz_grade.php:11