log_debug( __METHOD__ . '() $permission_granted: ' . ( $permission_granted ? 'yes' : 'no' ) ); if ( ! $permission_granted ) { $permission_denied_message = esc_attr__( "You don't have permission to view this entry.", 'gravityflow' ); $permission_denied_message = apply_filters( 'gravityflow_permission_denied_message_entry_detail', $permission_denied_message, $current_step ); echo $permission_denied_message; return; } $url = remove_query_arg( array( 'gworkflow_token', 'new_status' ) ); $classes = self::get_classes( $args ); ?>
get_editable_fields() : array(); self::maybe_show_instructions( $can_update, $display_instructions, $current_step, $form, $entry ); } self::entry_detail_grid( $form, $entry, $display_empty_fields, $editable_fields, $current_step ); do_action( 'gravityflow_entry_detail', $form, $entry, $current_step ); if ( ! $sidebar ) { gravity_flow()->workflow_entry_detail_status_box( $form, $entry, $current_step, $args ); self::print_button( $entry, $show_timeline, $check_view_entry_permissions ); } ?>
workflow_entry_detail_status_box( $form, $entry, $current_step, $args ); self::print_button( $entry, $show_timeline, $check_view_entry_permissions ); } ?>
true, 'check_permissions' => true, 'show_header' => true, 'timeline' => true, 'display_instructions' => true, 'sidebar' => true, 'step_status' => true, 'workflow_info' => true, ); $args = array_merge( $defaults, $args ); gravity_flow()->log_debug( __METHOD__ . '() args: ' . print_r( $args, true ) ); return $args; } /** * Outputs the inline scripts. */ public static function include_scripts() { ?>

ID:

ID; if ( empty( $user_id ) ) { if ( $token = gravity_flow()->decode_access_token() ) { $assignee_key = sanitize_text_field( $token['sub'] ); list( $type, $user_id ) = rgexplode( '|', $assignee_key, 2 ); } } else { $assignee_key = 'user_id|' . $user_id; } gravity_flow()->log_debug( __METHOD__ . '() checking permissions. $current_user->ID: ' . $current_user->ID . ' created_by: ' . $entry['created_by'] . ' assignee key: ' . $assignee_key ); if ( ! empty( $user_id ) && $entry['created_by'] == $user_id ) { $permission_granted = true; } else { $is_assignee = $current_step ? $current_step->is_assignee( $assignee_key ) : false; gravity_flow()->log_debug( __METHOD__ . '() $is_assignee: ' . ( $is_assignee ? 'yes' : 'no' ) ); $full_access = GFAPI::current_user_can_any( array( 'gform_full_access', 'gravityflow_status_view_all', ) ); gravity_flow()->log_debug( __METHOD__ . '() $full_access: ' . ( $full_access ? 'yes' : 'no' ) ); if ( $is_assignee || $full_access ) { $permission_granted = true; } } return $permission_granted; } /** * Determines if the role or status permits the user to update field values on this step. * * @param Gravity_Flow_Step $current_step The step this entry is currently on. * * @return bool */ public static function can_update( $current_step ) { $assignees = $current_step->get_assignees(); $can_update = false; foreach ( $assignees as $assignee ) { if ( $assignee->is_current_user() ) { $can_update = true; break; } } return $can_update; } /** * Displays the step instructions, if appropriate. * * @param bool $can_update Indicates if the user can edit field values on this step. * @param bool $display_instructions Indicates if the step instructions should be displayed. * @param Gravity_Flow_Step $current_step The step this entry is currently on. * @param array $form The current form. * @param array $entry The current entry. */ public static function maybe_show_instructions( $can_update, $display_instructions, $current_step, $form, $entry ) { if ( $can_update && $display_instructions && $current_step->instructionsEnable ) { $nl2br = apply_filters( 'gravityflow_auto_format_instructions', true ); $nl2br = apply_filters( 'gravityflow_auto_format_instructions_' . $form['id'], $nl2br ); $instructions = $current_step->instructionsValue; $instructions = GFCommon::replace_variables( $instructions, $form, $entry, false, true, $nl2br ); $instructions = do_shortcode( $instructions ); $instructions = self::maybe_sanitize_instructions( $instructions ); ?>

get_icon_url() : gravity_flow()->get_base_url() . '/images/gravityflow-icon-blue.svg'; /** * Allows the step icon to be filtered for the timeline. * * @param string $step_icon The step icon HTML or image URL. * @param Gravity_Flow_Step|bool $step A step object or false if the type of step which added the note no longer exists. */ $step_icon = apply_filters( 'gravityflow_timeline_step_icon', $step_icon, $step ); if ( strpos( $step_icon, 'http' ) !== false ) { $avatar = sprintf( '', $step_icon ); } else { $avatar = sprintf( '%s', $step_icon ); } } return sprintf( '
%s
', $avatar ); } /** * Format the note body for display. * * @since 1.7.1-dev * * @param object $note The note properties. * @param string $display_name The user display name, step or workflow label. * * @return string */ public static function get_note_body( $note, $display_name ) { return sprintf( '
%s
%s
', self::get_note_header( $display_name, $note->date_created ), nl2br( esc_html( $note->value ) ) ); } /** * Format the note display name and creation date for display. * * @since 1.7.1-dev * * @param string $display_name The assignee display name, step or workflow label. * @param string $date_created The date and time the note was created. * * @return string */ public static function get_note_header( $display_name, $date_created ) { return sprintf( '
%s
%s
', esc_html( $display_name ), esc_html( Gravity_Flow_Common::format_date( $date_created ) ) ); } /** * Display the workflow notes for the current entry. * * @since 1.7.1-dev Updated for notes stored in the entry meta. * * @param array $notes The workflow notes. * @param bool $is_editable Unused. * @param null $emails Unused. * @param string $subject Unused. */ public static function notes_grid( $notes, $is_editable = false, $emails = null, $subject = '' ) { if ( empty( $notes ) ) { return; } foreach ( $notes as $note ) { $user_id = $note->user_id; $step = Gravity_Flow_Common::get_timeline_note_step( $note ); $display_name = Gravity_Flow_Common::get_timeline_note_display_name( $note, $step ); $step_type = $step ? $step->get_type() : $display_name; echo sprintf( '
%s%s
', esc_attr( $note->id ), esc_attr( $step_type ), self::get_avatar( $user_id, $step ), self::get_note_body( $note, $display_name ) ); } } /** * Display the detail grid, the table which will contain the fields. * * @param array $form The current form. * @param array $entry The current entry. * @param bool|false $allow_display_empty_fields Indicates if empty fields should be displayed. * @param array $editable_fields An array of field IDs which the user can edit. * @param Gravity_Flow_Step|null $current_step Null or the current step. */ public static function entry_detail_grid( $form, $entry, $allow_display_empty_fields = false, $editable_fields = array(), $current_step = null ) { $form_id = absint( $form['id'] ); $display_empty_fields = false; if ( $allow_display_empty_fields ) { $display_empty_fields = rgget( 'gf_display_empty_fields', $_COOKIE ); } $display_empty_fields = (bool) apply_filters( 'gravityflow_entry_detail_grid_display_empty_fields', $display_empty_fields, $form, $entry ); $step_class = empty( $current_step ) ? 'gravityflow-workflow-complete' : 'gravityflow-step-' . $current_step->get_type(); ?>
onclick="ToggleShowEmptyFields();" />  
render_edit_form(); ?> has_product_fields ) { self::maybe_show_products_summary( $form, $entry, $current_step ); } ?> get_feed_meta(); if ( isset( $meta['display_order_summary'] ) && ! $current_step->display_order_summary ) { $summary_enabled = false; } } if ( $summary_enabled ) { $products = GFCommon::get_product_fields( $form, $entry ); if ( ! empty( $products['products'] ) ) { $form_id = $form['id']; $product_summary_label = apply_filters( 'gform_order_label', __( 'Order', 'gravityflow' ), $form_id ); $product_summary_label = apply_filters( "gform_order_label_{$form_id}", $product_summary_label, $form_id ); ?> adminOnly = false; $is_product_field = GFCommon::is_product_field( $field->type ); $display_field = self::is_display_field( $field, $current_step, $form, $entry, $is_product_field ); $field->gravityflow_is_display_field = $display_field; switch ( RGFormsModel::get_input_type( $field ) ) { case 'section' : if ( ! self::is_section_empty( $field, $current_step, $form, $entry, $display_empty_fields ) ) { $count ++; $is_last = $count >= $field_count ? true : false; ?> label ) ?> content, $form, $entry, false, true, false, 'html' ); $content = do_shortcode( $content ); ?> = $field_count && ! $has_product_fields ? true : false; $last_row = $is_last ? ' lastrow' : ''; $display_value = empty( $display_value ) && $display_value !== '0' ? ' ' : $display_value; $content = ' ' . esc_html( self::get_label( $field ) ) . ' ' . $display_value . ' '; $content = apply_filters( 'gform_field_content', $content, $field, $value, $entry['id'], $form['id'] ); echo $content; } break; } } if ( $has_product_fields && $format == 'table' ) { self::maybe_show_products_summary( $form, $entry, $current_step ); } } /** * Determine if the current section is empty. * * @param GF_Field $section_field The section field properties. * @param Gravity_Flow_Step|null $current_step The current step for this entry. * @param array $form The form for the current entry. * @param array $entry The entry being processed for display. * @param bool $display_empty_fields Indicates if empty fields should be displayed. * * @return bool */ public static function is_section_empty( $section_field, $current_step, $form, $entry, $display_empty_fields ) { $cache_key = "Gravity_Flow_Entry_Detail::is_section_empty_{$form['id']}_{$section_field->id}_{$display_empty_fields}"; $value = GFCache::get( $cache_key ); if ( $value !== false ) { return $value == true; } $section_fields = GFCommon::get_section_fields( $form, $section_field->id ); foreach ( $section_fields as $field ) { if ( $field->type == 'section' ) { continue; } $is_product_field = GFCommon::is_product_field( $field->type ); $display_field = self::is_display_field( $field, $current_step, $form, $entry, $is_product_field ); if ( ! $display_field ) { continue; } $value = RGFormsModel::get_lead_field_value( $entry, $field ); $display_value = self::get_display_value( $value, $field, $entry, $form ); if ( rgblank( $display_value ) && ! $display_empty_fields ) { continue; } GFCache::set( $cache_key, 0 ); return false; } GFCache::set( $cache_key, 1 ); return true; } /** * Determine if the field should be displayed. * * @param GF_Field $field The field properties. * @param Gravity_Flow_Step|null $current_step The current step for this entry. * @param array $form The form for the current entry. * @param array $entry The entry being processed for display. * @param bool $is_product_field Is the current field one of the product field types. * * @return bool */ public static function is_display_field( $field, $current_step, $form, $entry, $is_product_field ) { return Gravity_Flow_Common::is_display_field( $field, $current_step, $form, $entry, $is_product_field ); } /** * Get the field value to be displayed. * * @param mixed $value The field value from the entry. * @param GF_Field $field The field properties. * @param array $entry The entry being processed for display. * @param array $form The form for the current entry. * * @return string */ public static function get_display_value( $value, $field, $entry, $form ) { if ( $field->type == 'product' && $field->has_calculation() ) { $product_name = trim( $value[ $field->id . '.1' ] ); $price = trim( $value[ $field->id . '.2' ] ); $quantity = trim( $value[ $field->id . '.3' ] ); if ( empty( $product_name ) ) { $value[ $field->id . '.1' ] = $field->get_field_label( false, $value ); } if ( empty( $price ) ) { $value[ $field->id . '.2' ] = '0'; } if ( empty( $quantity ) ) { $value[ $field->id . '.3' ] = '0'; } } $input_type = $field->get_input_type(); if ( $input_type == 'hiddenproduct' ) { $display_value = $value[ $field->id . '.2' ]; } else { $display_value = GFCommon::get_lead_field_display( $field, $value, $entry['currency'] ); } $display_value = apply_filters( 'gform_entry_field_value', $display_value, $field, $entry, $form ); return $display_value; } /** * Get the label to display for this field. Uses the admin label if the main label is not configured. * * @param GF_Field $field The field properties. * * @return string */ public static function get_label( $field ) { return empty( $field->label ) ? $field->adminLabel : $field->label; } /** * Displays the product summary table. * * @param array $form The current form. * @param array $entry The current entry. * @param array $products The product info for this entry. */ public static function products_summary( $form, $entry, $products ) { $form_id = absint( $form['id'] ); ?>
    >