Ejemplo n.º 1
1
/**
 * Get all available gravity forms
 */
function crb_get_forms()
{
    $forms = array();
    if (!class_exists('RGFormsModel')) {
        return;
    }
    $available_forms = RGFormsModel::get_forms(null, 'title');
    foreach ($available_forms as $form) {
        $forms[$form->id] = $form->title;
    }
    return $forms;
}
Ejemplo n.º 2
0
function partners_sub_page_metaboxes()
{
    $prefix = '_partners_page_';
    $options[0] = 'Please select...';
    if (class_exists('RGFormsModel')) {
        foreach (RGFormsModel::get_forms(null, 'title') as $form) {
            $options[$form->id] = $form->title;
        }
    }
    /**
     * Initiate the metabox
     */
    $cmb = new_cmb2_box(array('id' => 'partners_page_form_meta', 'title' => __('Partners Page Form', 'cmb2'), 'object_types' => array('page'), 'context' => 'normal', 'priority' => 'high', 'show_names' => true, 'show_on' => array('key' => 'page-template', 'value' => 'templates/partners.php')));
    // Regular text field
    $cmb->add_field(array('name' => __('Pick a Form', 'cmb2'), 'id' => $prefix . 'form_dropdown', 'type' => 'select', 'options' => $options));
    /**
     * Initiate the metabox
     */
    $cmb = new_cmb2_box(array('id' => 'partners_page_file_meta', 'title' => __('Partners Page File Downloads', 'cmb2'), 'object_types' => array('page'), 'context' => 'normal', 'priority' => 'high', 'show_names' => true, 'show_on' => array('key' => 'page-template', 'value' => 'templates/partners.php')));
    $group_field_id = $cmb->add_field(array('id' => 'partners_file_download_group', 'type' => 'group', 'options' => array('group_title' => __('File {#}', 'cmb2'), 'add_button' => __('Add Another File', 'cmb2'), 'remove_button' => __('Remove File', 'cmb2'), 'sortable' => true)));
    // Id's for group's fields only need to be unique for the group. Prefix is not needed.
    $cmb->add_group_field($group_field_id, array('name' => 'File Title', 'id' => 'title', 'type' => 'text'));
    $cmb->add_group_field($group_field_id, array('name' => 'File Upload', 'id' => 'link', 'type' => 'file'));
    $cmb->add_group_field($group_field_id, array('name' => 'File Image', 'id' => 'image', 'type' => 'file'));
}
Ejemplo n.º 3
0
 public function run($arguments)
 {
     if (class_exists('RGFormsModel') && is_callable(array('RGFormsModel', 'get_forms'))) {
         return RGFormsModel::get_forms();
     }
     return false;
 }
    /**
     * render_field()
     *
     * Create the HTML interface for your field
     *
     * @param $field (array) the $field being rendered
     *
     * @type  action
     * @since 3.6
     * @date  23/01/13
     *
     * @param  $field (array) the $field being edited
     * @return n/a
     */
    function render_field($field)
    {
        $field = array_merge($this->defaults, $field);
        $choices = array();
        if (class_exists('RGFormsModel')) {
            $forms = RGFormsModel::get_forms(1);
        } else {
            echo '<font style="color:red; font-weight:bold;">Warning: Gravity Forms is not installed or activated. This field does not function without Gravity Forms!</font>';
        }
        if (isset($forms)) {
            foreach ($forms as $form) {
                $choices[intval($form->id)] = ucfirst($form->title);
            }
        }
        $field['choices'] = $choices;
        $field['type'] = 'select';
        $multiple = '';
        if ($field['allow_multiple']) {
            $multiple = 'multiple="multiple" data-multiple="1"';
            echo '<input type="hidden" name="' . $field['name'] . '">';
        }
        ?>
        <select id="<?php 
        echo str_replace(array('[', ']'), array('-', ''), $field['name']);
        ?>
" name="<?php 
        echo $field['name'] . ($field['allow_multiple'] ? '[]' : '');
        ?>
" <?php 
        echo $multiple;
        ?>
>
            <?php 
        if ($field['allow_null']) {
            ?>
            <option value="">Select ...</option>
            <?php 
        }
        ?>
            <?php 
        foreach ($field['choices'] as $key => $value) {
            ?>
            <option value="<?php 
            echo $key;
            ?>
" <?php 
            echo (is_array($field['value']) && in_array($key, $field['value']) or $field['value'] == $key) ? 'selected="selected"' : '';
            ?>
><?php 
            echo $value;
            ?>
</option>
            <?php 
        }
        ?>
        </select>
<?php 
    }
 public function get_gravity_forms()
 {
     $forms = RGFormsModel::get_forms(null, 'title');
     $form_array = array();
     foreach ($forms as $form) {
         $form_array[$form->id] = $form->title;
     }
     return $form_array;
 }
Ejemplo n.º 6
0
 function get_forms()
 {
     $forms = RGFormsModel::get_forms();
     $options = array('' => '&ndash; Select a Form &ndash;');
     foreach ($forms as $form) {
         $options[$form->id] = $form->title;
     }
     return $options;
 }
Ejemplo n.º 7
0
 /**
  * Get all forms and return in a simple array for output.
  *
  * @since WP Job Manager - Contact Listing 1.0.0
  *
  * @return void
  */
 public function get_forms()
 {
     $forms = array(0 => __('Please select a form', 'wp-job-manager-contact-listing'));
     $_forms = RGFormsModel::get_forms(null, 'title');
     if (!empty($_forms)) {
         foreach ($_forms as $_form) {
             $forms[$_form->id] = $_form->title;
         }
     }
     return $forms;
 }
    function render_field($field)
    {
        /*
         *  Review the data of $field.
         *  This will show what data is available
         */
        // vars
        $field = array_merge($this->defaults, $field);
        $choices = array();
        $forms = RGFormsModel::get_forms(1);
        if ($forms) {
            foreach ($forms as $form) {
                $choices[$form->id] = ucfirst($form->title);
            }
        }
        // override field settings and render
        $field['choices'] = $choices;
        $field['type'] = 'select';
        ?>
      <select name="<?php 
        echo $field['name'];
        ?>
" id="<?php 
        echo $field['name'];
        ?>
" <?php 
        if ($field['multiple']) {
            echo 'multiple';
        }
        ?>
>
        <?php 
        foreach ($field['choices'] as $key => $value) {
            $selected = '';
            if ($field['value'] == $key) {
                $selected = ' selected="selected"';
            }
            ?>
            <option value="<?php 
            echo $key;
            ?>
"<?php 
            echo $selected;
            ?>
><?php 
            echo $value;
            ?>
</option>
          <?php 
        }
        ?>
      </select>
    <?php 
    }
 function initialize()
 {
     $forms = RGFormsModel::get_forms(1, 'title');
     $options = [];
     $default = 0;
     foreach ($forms as $form) {
         if (!$default) {
             $default = $form->id;
         }
         $options[$form->id] = $form->title;
     }
     $this->settings = ['form_id' => ['#title' => 'Gravity form ID', '#type' => 'select', '#default_value' => $default, '#description' => 'The gravity form ID to be printed in the dropdown', '#to_js_settings' => false, '#options' => $options], 'dropdown' => ['#title' => 'Display as dropdown?', '#type' => 'checkbox', '#description' => 'Display as dropdown?', '#return_value' => '1', '#label_above' => true, '#replace_title' => 'Yes', '#default_value' => false]];
 }
Ejemplo n.º 10
0
function cspv4_get_gravityforms_forms()
{
    if (class_exists('RGFormsModel')) {
        $forms = array();
        $gforms = RGFormsModel::get_forms(null, "title");
        foreach ($gforms as $k => $v) {
            $forms[$v->id] = $v->title;
        }
    } else {
        $forms = array('-1' => 'No Forms Found');
    }
    return $forms;
}
Ejemplo n.º 11
0
/**
 * Outputs the GFORMS options metabox in action box edit screen
 * @param  object $post the current post
 * @return html
 */
function mab_gforms_meta_box($post)
{
    $MabBase = MAB();
    $data['meta'] = $MabBase->get_mab_meta($post->ID);
    $type = $MabBase->get_action_box_type($post->ID);
    //Get gravity forms stuff
    $forms = RGFormsModel::get_forms(null, 'title');
    $data['forms'] = is_array($forms) ? $forms : array();
    //error_log();
    $filename = 'metabox/metabox.php';
    $box = mab_gforms_get_view($filename, $data);
    echo $box;
}
Ejemplo n.º 12
0
function vc_vendor_gravityforms_load()
{
    $gravity_forms_array[__('No Gravity forms found.', 'js_composer')] = '';
    if (class_exists('RGFormsModel')) {
        $gravity_forms = RGFormsModel::get_forms(1, 'title');
        if ($gravity_forms) {
            $gravity_forms_array = array(__('Select a form to display.', 'js_composer') => '');
            foreach ($gravity_forms as $gravity_form) {
                $gravity_forms_array[$gravity_form->title] = $gravity_form->id;
            }
        }
    }
    vc_map(array('name' => __('Gravity Form', 'js_composer'), 'base' => 'gravityform', 'icon' => 'icon-wpb-vc_gravityform', 'category' => __('Content', 'js_composer'), 'description' => __('Place Gravity form', 'js_composer'), 'params' => array(array('type' => 'dropdown', 'heading' => __('Form', 'js_composer'), 'param_name' => 'id', 'value' => $gravity_forms_array, 'save_always' => true, 'description' => __('Select a form to add it to your post or page.', 'js_composer'), 'admin_label' => true), array('type' => 'dropdown', 'heading' => __('Display Form Title', 'js_composer'), 'param_name' => 'title', 'value' => array(__('No', 'js_composer') => 'false', __('Yes', 'js_composer') => 'true'), 'save_always' => true, 'description' => __('Would you like to display the forms title?', 'js_composer'), 'dependency' => array('element' => 'id', 'not_empty' => true)), array('type' => 'dropdown', 'heading' => __('Display Form Description', 'js_composer'), 'param_name' => 'description', 'value' => array(__('No', 'js_composer') => 'false', __('Yes', 'js_composer') => 'true'), 'save_always' => true, 'description' => __('Would you like to display the forms description?', 'js_composer'), 'dependency' => array('element' => 'id', 'not_empty' => true)), array('type' => 'dropdown', 'heading' => __('Enable AJAX?', 'js_composer'), 'param_name' => 'ajax', 'value' => array(__('No', 'js_composer') => 'false', __('Yes', 'js_composer') => 'true'), 'save_always' => true, 'description' => __('Enable AJAX submission?', 'js_composer'), 'dependency' => array('element' => 'id', 'not_empty' => true)), array('type' => 'textfield', 'heading' => __('Tab Index', 'js_composer'), 'param_name' => 'tabindex', 'description' => __('(Optional) Specify the starting tab index for the fields of this form. Leave blank if you\'re not sure what this is.', 'js_composer'), 'dependency' => array('element' => 'id', 'not_empty' => true)))));
}
 public static function register_form_settings()
 {
     $settings = array();
     $error = false;
     // Settings
     if (class_exists('RGFormsModel') && method_exists('RGFormsModel', 'get_forms')) {
         $gravity_options = array(0 => self::__('No forms found'));
         if (class_exists('RGFormsModel') && method_exists('RGFormsModel', 'get_forms')) {
             $all_grav_forms = RGFormsModel::get_forms(1, 'title');
             $gravity_options = array();
             foreach ($all_grav_forms as $form) {
                 $gravity_options[absint($form->id)] = esc_html($form->title);
             }
         }
         $settings = array(self::GRAVITY_FORM_ID => array('label' => self::__('GravityForms ID'), 'option' => array('type' => 'select', 'options' => $gravity_options, 'default' => self::$gravity_form_id, 'description' => sprintf(self::__('Select the submission form built with <a href="%s">Gravity Forms</a>.'), 'https://sproutapps.co/link/gravity-forms'))));
     } elseif (function_exists('ninja_forms_get_all_forms')) {
         $ninja_options = array(0 => self::__('No forms found'));
         if (function_exists('ninja_forms_get_all_forms')) {
             $all_ninja_forms = ninja_forms_get_all_forms();
             $ninja_options = array();
             foreach ($all_ninja_forms as $form) {
                 $ninja_options[$form['id']] = $form['data']['form_title'];
             }
         }
         // Settings
         $settings = array(self::NINJA_FORM_ID => array('label' => self::__('NinjaForms ID'), 'option' => array('type' => 'select', 'options' => $ninja_options, 'default' => self::$ninja_form_id, 'description' => sprintf(self::__('Select the submission form built with <a href="%s">Ninja Forms</a>.'), 'https://sproutapps.co/link/ninja-forms'))));
     } elseif (function_exists('frm_forms_autoloader')) {
         $frdbl_options = array(0 => self::__('No forms found'));
         $forms = FrmForm::get_published_forms();
         if (!empty($forms)) {
             $frdbl_options = array();
             foreach ($forms as $form) {
                 $frdbl_options[$form->id] = !isset($form->name) ? __('(no title)', 'formidable') : esc_attr(FrmAppHelper::truncate($form->name, 33));
             }
         }
         // Settings
         $settings = array(self::FORMIDABLE_FORM_ID => array('label' => self::__('Formidable ID'), 'option' => array('type' => 'select', 'options' => $frdbl_options, 'default' => self::$frdbl_form_id, 'description' => sprintf(self::__('Select the submission form built with <a href="%s">Formidable</a>.'), 'https://sproutapps.co/link/formidable'))));
     } else {
         // Settings
         $settings = array(self::NINJA_FORM_ID => array('label' => self::__('Integration Error'), 'option' => array('type' => 'bypass', 'output' => sprintf(self::__('It looks like neither <a href="%s">Gravity Forms</a> or <a href="%s">Ninja Forms</a> or <a href="%s">Formidable</a> is active.'), 'https://sproutapps.co/link/gravity-forms', 'https://sproutapps.co/link/ninja-forms', 'https://sproutapps.co/link/formidable'))));
         $error = true;
     }
     $map_settings = array();
     if (!$error) {
         // Settings
         $map_settings = array(self::FORM_ID_MAPPING => array('label' => self::__('Form ID Mapping'), 'option' => array(__CLASS__, 'show_form_field_mapping'), 'sanitize_callback' => array(__CLASS__, 'save_form_field_mapping')));
     }
     return array_merge($settings, $map_settings);
 }
Ejemplo n.º 14
0
 /**
  * Set the available forms as field options
  */
 public function setup_gravity_form_options()
 {
     if (!$this->is_plugin_active()) {
         return;
     }
     $forms = \RGFormsModel::get_forms(null, 'title');
     if (!is_array($forms) || empty($forms)) {
         return;
     }
     $options = array('0' => __('No form', 'carbon-fields'));
     foreach ($forms as $form) {
         $options[$form->id] = $form->title;
     }
     $this->set_options($options);
 }
Ejemplo n.º 15
0
 static function select_box($name = '', $form = '')
 {
     $name = $name ? $name : 'gravity_form';
     if (class_exists('RGFormsModel') && method_exists('RGFormsModel', 'get_forms')) {
         $forms = \RGFormsModel::get_forms(null, 'title');
         echo "<select class='plugin_admin_form' name='" . $name . "' >";
         echo '<option value="">Choose a Form</option>';
         foreach ($forms as $formid) {
             echo '<option ' . ($formid->id == $form ? 'selected="true"' : '') . ' value="' . $formid->id . '">' . $formid->title . '</option>';
         }
         echo '</select>';
     } else {
         echo "<input class='plugin_admin_form' name='" . $name . "' type='text' value='" . esc_attr($form) . "' />";
     }
 }
Ejemplo n.º 16
0
    public static function show_salesforce_status()
    {
        global $pagenow;
        if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'gf_edit_forms' && !isset($_REQUEST['id'])) {
            $activeforms = array();
            $forms = RGFormsModel::get_forms();
            if (!is_array($forms)) {
                return;
            }
            foreach ($forms as $form) {
                $form = RGFormsModel::get_form_meta($form->id);
                if (is_array($form) && !empty($form['enableSalesforce'])) {
                    $activeforms[] = $form['id'];
                }
            }
            if (!empty($activeforms)) {
                ?>
<style type="text/css">
	td a.row-title span.salesforce_enabled {
		position: absolute;
		background: url('<?php 
                echo WP_PLUGIN_URL . '/' . str_replace(basename(__FILE__), "", plugin_basename(__FILE__));
                ?>
/salesforce-16x16.png') right top no-repeat;
		height: 16px;
		width: 16px;
		margin-left: 10px;
	}
</style>
<script type="text/javascript">
	jQuery(document).ready(function($) {
		$('table tbody.user-list tr').each(function() {
			if($('td.column-id', $(this)).text() == <?php 
                echo implode('||', $activeforms);
                ?>
) {
				$('td a.row-title', $(this)).append('<span class="salesforce_enabled" title="<?php 
                _e('Salesforce integration is enabled for this Form', "gravity-forms-salesforce");
                ?>
"></span>');
			}
		});		
	});
</script>
<?php 
            }
        }
    }
Ejemplo n.º 17
0
/**
 * Define the metabox and field configurations.
 */
function jobs_form_metaboxes()
{
    // Start with an underscore to hide fields from custom fields list
    $prefix = '_rh_jobs_';
    $options[0] = 'Please select...';
    if (class_exists(RGFormsModel)) {
        foreach (RGFormsModel::get_forms(null, 'title') as $form) {
            $options[$form->id] = $form->title;
        }
    }
    /**
     * Initiate the metabox
     */
    $cmb = new_cmb2_box(array('id' => 'form_meta', 'title' => __('Form Select', 'cmb2'), 'object_types' => array('jobs'), 'context' => 'normal', 'priority' => 'high', 'show_names' => true));
    // Regular text field
    $cmb->add_field(array('name' => __('Pick a Form', 'cmb2'), 'id' => $prefix . 'form_dropdown', 'type' => 'select', 'options' => $options));
    // Add other metaboxes as needed
}
Ejemplo n.º 18
0
 public function controls()
 {
     $forms = array();
     $choices = array();
     if (class_exists('RGFormsModel')) {
         $forms = RGFormsModel::get_forms(null, 'title');
     }
     foreach ($forms as $form) {
         $choices[] = array('value' => $form->id, 'label' => $form->title);
     }
     if (empty($choices)) {
         $choices[] = array('value' => 'none', 'label' => __('No Forms available', csl18n()), 'disabled' => true);
     }
     $this->addControl('form_id', 'select', __('Form'), __('Select which form you would like to display.'), $choices[0]['value'], array('choices' => $choices));
     $this->addControl('show_title', 'toggle', __('Show Title'), '', false);
     $this->addControl('show_description', 'toggle', __('Show Description'), '', false);
     $this->addControl('enable_ajax', 'toggle', __('Enable AJAX'), '', true);
 }
 /**
  * Field dropdown Gravity Forms
  *
  * @param array $args
  */
 function pronamic_field_dropdown_gravityforms($args)
 {
     $name = $args['label_for'];
     $forms = array();
     if (method_exists('RGFormsModel', 'get_forms')) {
         $forms = RGFormsModel::get_forms();
     }
     if (empty($forms)) {
         _e('You don\'t have any Gravity Forms forms.', 'pronamic_client');
     } else {
         $form_id = get_option($name);
         printf('<select name="%s" id="%s">', $name, $name);
         printf('<option value="%s" %s>%s</option>', '', selected($form_id, '', false), __('&mdash; Select a form &mdash;', 'pronamic_client'));
         foreach ($forms as $form) {
             printf('<option value="%s" %s>%s</option>', $form->id, selected($form_id, $form->id, false), $form->title);
         }
         printf('</select>');
     }
 }
Ejemplo n.º 20
0
Archivo: main.php Proyecto: jekv/devia
 /**
  * Constructor: setup callbacks and plugin-specific options
  *
  * @author James Inman
  */
 public function __construct()
 {
     parent::__construct();
     // Set the plugin's Clockwork SMS menu to load the contact forms
     $this->plugin_callback = array($this, 'clockwork_gravityforms');
     $this->plugin_dir = basename(dirname(__FILE__));
     // Convert the old settings
     $this->convert_old_settings();
     // Setup all forms into a local variable
     if (!class_exists('RGForms')) {
         require_once dirname(dirname(__FILE__)) . '/gravityforms/gravityforms.php';
     }
     if (!class_exists('RGFormsModel')) {
         require_once dirname(dirname(__FILE__)) . '/gravityforms/forms_model.php';
     }
     $active = RGForms::get('active') == '' ? null : RGForms::get('active');
     $this->forms = RGFormsModel::get_forms($active, 'title');
     // Options and callbacks
     add_action('gform_post_submission', array(&$this, 'do_form_processing'), 10, 2);
 }
Ejemplo n.º 21
0
 public static function all_leads_page()
 {
     if (!GFCommon::ensure_wp_version()) {
         return;
     }
     $forms = RGFormsModel::get_forms(null, "title");
     $id = RGForms::get("id");
     if (sizeof($forms) == 0) {
         ?>
         <div style="margin:50px 0 0 10px;">
             <?php 
         echo sprintf(__("You don't have any active forms. Let's go %screate one%s", "gravityforms"), '<a href="?page=gf_new_form">', '</a>');
         ?>
         </div>
         <?php 
     } else {
         if (empty($id)) {
             $id = $forms[0]->id;
         }
         self::leads_page($id);
     }
 }
Ejemplo n.º 22
0
    public static function all_leads_page()
    {
        if (!GFCommon::ensure_wp_version()) {
            return;
        }
        $forms = RGFormsModel::get_forms(null, 'title');
        $form_id = RGForms::get('id');
        if (sizeof($forms) == 0) {
            ?>
			<div style="margin:50px 0 0 10px;">
				<?php 
            echo sprintf(esc_html__("You don't have any active forms. Let's go %screate one%s", 'gravityforms'), '<a href="?page=gf_new_form">', '</a>');
            ?>
			</div>
			<?php 
        } else {
            if (empty($form_id)) {
                $form_id = $forms[0]->id;
            }
            /**
             * Fires before the entry list content is generated.
             *
             * Echoed content would appear above the page title.
             *
             * int $form_id The ID of the form the entry list is being displayed for.
             */
            do_action('gform_pre_entry_list', $form_id);
            self::leads_page($form_id);
            /**
             * Fires after the entry list content is generated.
             *
             * Echoed content would appear after the bulk actions/paging links below the entry list table.
             *
             * int $form_id The ID of the form the entry list is being displayed for.
             */
            do_action('gform_post_entry_list', $form_id);
        }
    }
Ejemplo n.º 23
0
    function form_id_box_content()
    {
        $form_id = get_post_meta(get_the_ID(), 'form_id', true);
        $gForms = RGFormsModel::get_forms(null, 'title');
        if (!$gForms) {
            echo '<p>Não encontramos nenhum formulário cadastrado, entre no seu plugin de formulário de contato ou <a href="admin.php?page=gf_new_form">clique aqui para criar um novo.</a></p>';
        } else {
            ?>
		    	<div class="rd-select-form">
			        <select name="form_id">
			            <option value=""> </option>
			            <?php 
            foreach ($gForms as $gForm) {
                echo "<option value=" . $gForm->id . selected($form_id, $gForm->id, false) . ">" . $gForm->title . "</option>";
            }
            ?>
			        </select>
			    </div>
		    <?php 
            $gf_forms = GFAPI::get_forms();
            $form_map = get_post_meta(get_the_ID(), 'gf_mapped_fields', true);
            foreach ($gf_forms as $form) {
                if ($form['id'] == $form_id) {
                    echo '<h4>Como os campos abaixo irão se chamar no RD Station?</h4>';
                    foreach ($form['fields'] as $field) {
                        if (!empty($form_map[$field['id']])) {
                            $value = $form_map[$field['id']];
                        } else {
                            $value = '';
                        }
                        echo '<p class="rd-fields-mapping"><span class="rd-fields-mapping-label">' . $field['label'] . '</span> <span class="dashicons dashicons-arrow-right-alt"></span> <input type="text" name="gf_mapped_fields[' . $field['id'] . ']" value="' . $value . '">';
                    }
                }
            }
        }
    }
Ejemplo n.º 24
0
        public function results_page($form_id, $page_title, $gf_page, $gf_view)
        {
            if (empty($form_id)) {
                $forms = RGFormsModel::get_forms();
                if (!empty($forms)) {
                    $form_id = $forms[0]->id;
                }
            }
            $form = GFFormsModel::get_form_meta($form_id);
            $form = gf_apply_filters(array('gform_form_pre_results', $form_id), $form);
            // set up filter vars
            $start_date = rgget('start');
            $end_date = rgget('end');
            $all_fields = $form['fields'];
            $filter_settings = GFCommon::get_field_filter_settings($form);
            $filter_settings = apply_filters('gform_filters_pre_results', $filter_settings, $form);
            $filter_settings = array_values($filter_settings);
            // reset the numeric keys in case some filters have been unset
            $filter_fields = rgget('f');
            $filter_operators = rgget('o');
            $filter_values = rgget('v');
            $filters = array();
            $init_vars = array();
            if (!empty($filter_fields)) {
                $init_vars['mode'] = rgget('mode');
                foreach ($filter_fields as $i => $filter_field) {
                    $filters[$i]['field'] = $filter_field;
                    $filters[$i]['operator'] = $filter_operators[$i];
                    $filters[$i]['value'] = $filter_values[$i];
                }
                $init_vars['filters'] = $filters;
            }
            ?>
			<script type="text/javascript">
				var gresultsFields = <?php 
            echo json_encode($all_fields);
            ?>
;
				var gresultsFilterSettings = <?php 
            echo json_encode($filter_settings);
            ?>
;
				var gresultsInitVars = <?php 
            echo json_encode($init_vars);
            ?>
;

				<?php 
            GFCommon::gf_global();
            ?>
				<?php 
            GFCommon::gf_vars();
            ?>
			</script>

			<link rel="stylesheet"
			      href="<?php 
            echo GFCommon::get_base_url();
            ?>
/css/admin.css?ver=<?php 
            echo GFCommon::$version;
            ?>
"
			      type="text/css"/>
			<div class="wrap gforms_edit_form <?php 
            echo GFCommon::get_browser_class();
            ?>
">

				<h2 class="gf_admin_page_title">
					<span><?php 
            echo empty($form_id) ? $page_title : $page_title . ' : ' . esc_html($form['title']);
            ?>
</span><span
						class="gf_admin_page_subtitle"><span
							class="gf_admin_page_formid">ID: <?php 
            echo $form['id'];
            ?>
</span><span
							class="gf_admin_page_formname"><?php 
            esc_html_e('Form Name', 'gravityforms');
            ?>
							: <?php 
            echo $form['title'];
            ?>
</span></span>
				</h2>
				<?php 
            RGForms::top_toolbar();
            ?>
				<?php 
            if (false === empty($all_fields)) {
                ?>

					<div id="poststuff" class="metabox-holder has-right-sidebar">
						<div id="side-info-column" class="inner-sidebar">
							<div id="gresults-results-filter" class="postbox">
								<h3 style="cursor: default;"><?php 
                echo $this->_search_title;
                ?>
</h3>

								<div id="gresults-results-filter-content">
									<form id="gresults-results-filter-form" action="" method="GET">
										<input type="hidden" id="gresults-page-slug" name="page"
										       value="<?php 
                echo esc_attr($gf_page);
                ?>
">
										<input type="hidden" id="gresults-view-slug" name="view"
										       value="<?php 
                echo esc_attr($gf_view);
                ?>
">
										<input type="hidden" id="gresults-form-id" name="id"
										       value="<?php 
                echo esc_attr($form_id);
                ?>
">

										<?php 
                $filter_ui = array('fields' => array('label' => esc_attr__('Filters', 'gravityforms'), 'tooltip' => 'gresults_filters', 'markup' => '<div id="gresults-results-field-filters-container">
																<!-- placeholder populated by js -->
															 </div>'), 'date_range' => array('label' => esc_attr__('Date Range', 'gravityforms'), 'tooltip' => 'gresults_date_range', 'markup' => '<div style="width:90px; float:left; ">
																	<label
																		for="gresults-results-filter-date-start">' . esc_html__('Start', 'gravityforms') . '</label>
																	<input type="text" id="gresults-results-filter-date-start" name="start"
																		   style="width:80px"
																		   class="gresults-datepicker"
																		   value="' . $start_date . '"/>
																</div>
																<div style="width:90px; float:left; ">
																	<label
																		for="gresults-results-filter-date-end">' . esc_html__('End', 'gravityforms') . '</label>
																	<input type="text" id="gresults-results-filter-date-end" name="end"
																		   style="width:80px"
																		   class="gresults-datepicker"
																		   value="' . $end_date . '"/>
																</div>'));
                $filter_ui = apply_filters('gform_filter_ui', $filter_ui, $form_id, $page_title, $gf_page, $gf_view);
                foreach ($filter_ui as $name => $filter) {
                    ?>
											<div class='gresults-results-filter-section-label'>
												<?php 
                    echo $filter['label'];
                    ?>
												&nbsp;<?php 
                    gform_tooltip(rgar($filter, 'tooltip'), 'tooltip_bottomleft');
                    ?>
											</div>
											<?php 
                    echo $filter['markup'];
                }
                ?>

										<br style="clear:both"/>

										<div id="gresults-results-filter-buttons">
											<input type="submit" id="gresults-results-filter-submit-button"
											       class="button button-primary button-large"
											       value="<?php 
                esc_attr_e('Apply filters', 'gravityforms');
                ?>
">
											<input type="button" id="gresults-results-filter-clear-button"
											       class="button button-secondary button-large"
											       value="<?php 
                esc_attr_e('Clear', 'gravityforms');
                ?>
"
											       onclick="gresults.clearFilterForm();">

											<div class="gresults-filter-loading"
											     style="display:none; float:right; margin-top:5px;">
												<i class='gficon-gravityforms-spinner-icon gficon-spin'></i> <?php 
                esc_html_e('Loading', 'gravityforms');
                ?>
											</div>
										</div>
									</form>
								</div>
							</div>
						</div>
					</div>
					<div class="gresults-filter-loading" style="display:none;margin:0 5px 10px 0;">
						<i class='gficon-gravityforms-spinner-icon gficon-spin'></i>&nbsp;
						<a href="javascript:void(0);"
						   onclick="javascript:gresultsAjaxRequest.abort()"><?php 
                esc_html_e('Cancel', 'gravityforms');
                ?>
</a>
					</div>

					<div id="gresults-results-wrapper">
						<div id="gresults-results">&nbsp;
						</div>
					</div>

				<?php 
            } else {
                _e('This form does not have any fields that can be used for results', 'gravityforms');
            }
            ?>
			</div>


		<?php 
        }
Ejemplo n.º 25
0
 public static function get_shortcodes()
 {
     $forms = RGFormsModel::get_forms(1, 'title');
     $forms_options[''] = __('Select a Form', 'gravityforms');
     foreach ($forms as $form) {
         $forms_options[absint($form->id)] = esc_html($form->title);
     }
     $default_attrs = array(array('label' => __('Select a form below to add it to your post or page.', 'gravityforms'), 'tooltip' => __('Select a form from the list to add it to your post or page.', 'gravityforms'), 'attr' => 'id', 'type' => 'select', 'section' => 'required', 'description' => __("Can't find your form? Make sure it is active.", 'gravityforms'), 'options' => $forms_options), array('label' => __('Display form title', 'gravityforms'), 'attr' => 'title', 'default' => 'true', 'section' => 'standard', 'type' => 'checkbox', 'tooltip' => __('Whether or not do display the form title.', 'gravityforms')), array('label' => __('Display form description', 'gravityforms'), 'attr' => 'description', 'default' => 'true', 'section' => 'standard', 'type' => 'checkbox', 'tooltip' => __('Whether or not do display the form description.', 'gravityforms')), array('label' => __('Enable AJAX', 'gravityforms'), 'attr' => 'ajax', 'section' => 'standard', 'type' => 'checkbox', 'tooltip' => __('Specify whether or not to use AJAX to submit the form.', 'gravityforms')), array('label' => 'Tabindex', 'attr' => 'tabindex', 'type' => 'number', 'tooltip' => __('Specify the starting tab index for the fields of this form.', 'gravityforms')));
     /**
      * Filters through the shortcode builder actions (ajax, tabeindex, form title) for adding a new form to a post, page, etc.
      */
     $add_on_actions = apply_filters('gform_shortcode_builder_actions', array());
     if (!empty($add_on_actions)) {
         $action_options = array('' => __('Select an action', 'gravityforms'));
         foreach ($add_on_actions as $add_on_action) {
             foreach ($add_on_action as $key => $array) {
                 $action_options[$key] = $array['label'];
             }
         }
         $default_attrs[] = array('label' => 'Action', 'attr' => 'action', 'type' => 'select', 'options' => $action_options, 'tooltip' => __('Select an action for this shortcode. Actions are added by some add-ons.', 'gravityforms'));
     }
     $shortcode = array('shortcode_tag' => 'gravityform', 'action_tag' => '', 'label' => 'Gravity Forms', 'attrs' => $default_attrs);
     $shortcodes[] = $shortcode;
     if (!empty($add_on_actions)) {
         foreach ($add_on_actions as $add_on_action) {
             foreach ($add_on_action as $key => $array) {
                 $attrs = array_merge($default_attrs, $array['attrs']);
                 $shortcode = array('shortcode_tag' => 'gravityform', 'action_tag' => $key, 'label' => rgar($array, 'label'), 'attrs' => $attrs);
             }
         }
         $shortcodes[] = $shortcode;
     }
     return $shortcodes;
 }
Ejemplo n.º 26
0
    $rs = $wpdb->get_results("\n  \tSELECT id, title, alias\n  \tFROM " . $wpdb->prefix . "revslider_sliders\n  \tORDER BY id ASC LIMIT 100\n  \t");
    $revsliders = array();
    if ($rs) {
        foreach ($rs as $slider) {
            $revsliders[$slider->title] = $slider->alias;
        }
    } else {
        $revsliders["No sliders found"] = 0;
    }
    vc_map(array("base" => "rev_slider_vc", "name" => __("Revolution Slider", "js_composer"), "icon" => "icon-wpb-revslider", "category" => __('Content', 'js_composer'), "params" => array(array("type" => "textfield", "heading" => __("Widget title", "js_composer"), "param_name" => "title", "description" => __("What text use as a widget title. Leave blank if no title is needed.", "js_composer")), array("type" => "dropdown", "heading" => __("Revolution Slider", "js_composer"), "param_name" => "alias", "admin_label" => true, "value" => $revsliders, "description" => __("Select your Revolution Slider.", "js_composer")), array("type" => "textfield", "heading" => __("Extra class name", "js_composer"), "param_name" => "el_class", "description" => __("If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.", "js_composer")))));
}
// if revslider plugin active
if (is_plugin_active('gravityforms/gravityforms.php')) {
    $gravity_forms_array[__("No Gravity forms found.", "js_composer")] = '';
    if (class_exists('RGFormsModel')) {
        $gravity_forms = RGFormsModel::get_forms(1, "title");
        if ($gravity_forms) {
            $gravity_forms_array = array(__("Select a form to display.", "js_composer") => '');
            foreach ($gravity_forms as $gravity_form) {
                $gravity_forms_array[$gravity_form->title] = $gravity_form->id;
            }
        }
    }
    vc_map(array("name" => __("Gravity Form", "js_composer"), "base" => "gravityform", "icon" => "icon-wpb-vc_gravityform", "category" => __("Content", "js_composer"), "params" => array(array("type" => "dropdown", "heading" => __("Form", "js_composer"), "param_name" => "id", "value" => $gravity_forms_array, "description" => __("Select a form to add it to your post or page.", "js_composer"), "admin_label" => true), array("type" => "dropdown", "heading" => __("Display Form Title", "js_composer"), "param_name" => "title", "value" => array(__("No", "js_composer") => 'false', __("Yes", "js_composer") => 'true'), "description" => __("Would you like to display the forms title?", "js_composer"), "dependency" => array('element' => "id", 'not_empty' => true)), array("type" => "dropdown", "heading" => __("Display Form Description", "js_composer"), "param_name" => "description", "value" => array(__("No", "js_composer") => 'false', __("Yes", "js_composer") => 'true'), "description" => __("Would you like to display the forms description?", "js_composer"), "dependency" => array('element' => "id", 'not_empty' => true)), array("type" => "dropdown", "heading" => __("Enable AJAX?", "js_composer"), "param_name" => "ajax", "value" => array(__("No", "js_composer") => 'false', __("Yes", "js_composer") => 'true'), "description" => __("Enable AJAX submission?", "js_composer"), "dependency" => array('element' => "id", 'not_empty' => true)), array("type" => "textfield", "heading" => __("Tab Index", "js_composer"), "param_name" => "tabindex", "description" => __("(Optional) Specify the starting tab index for the fields of this form. Leave blank if you're not sure what this is.", "js_composer"), "dependency" => array('element' => "id", 'not_empty' => true)))));
}
// if gravityforms active
/* WordPress default Widgets (Appearance->Widgets)
---------------------------------------------------------- */
vc_map(array("name" => 'WP ' . __("Search"), "base" => "vc_wp_search", "icon" => "icon-wpb-wp", "category" => __("WordPress Widgets", "js_composer"), "class" => "wpb_vc_wp_widget", "params" => array(array("type" => "textfield", "heading" => __("Widget title", "js_composer"), "param_name" => "title", "description" => __("What text use as a widget title. Leave blank to use default widget title.", "js_composer")), array("type" => "textfield", "heading" => __("Extra class name", "js_composer"), "param_name" => "el_class", "description" => __("If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.", "js_composer")))));
vc_map(array("name" => 'WP ' . __("Meta"), "base" => "vc_wp_meta", "icon" => "icon-wpb-wp", "category" => __("WordPress Widgets", "js_composer"), "class" => "wpb_vc_wp_widget", "params" => array(array("type" => "textfield", "heading" => __("Widget title", "js_composer"), "param_name" => "title", "description" => __("What text use as a widget title. Leave blank to use default widget title.", "js_composer")), array("type" => "textfield", "heading" => __("Extra class name", "js_composer"), "param_name" => "el_class", "description" => __("If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.", "js_composer")))));
vc_map(array("name" => 'WP ' . __("Recent Comments"), "base" => "vc_wp_recentcomments", "icon" => "icon-wpb-wp", "category" => __("WordPress Widgets", "js_composer"), "class" => "wpb_vc_wp_widget", "params" => array(array("type" => "textfield", "heading" => __("Widget title", "js_composer"), "param_name" => "title", "description" => __("What text use as a widget title. Leave blank to use default widget title.", "js_composer")), array("type" => "textfield", "heading" => __("Number of comments to show", "js_composer"), "param_name" => "number", "admin_label" => true), array("type" => "textfield", "heading" => __("Extra class name", "js_composer"), "param_name" => "el_class", "description" => __("If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.", "js_composer")))));
Ejemplo n.º 27
0
				<tr>
					<td colspan='2' style='text-align:left;'><span style="color:red;"><?php 
_e('Note:Form and Email setiings has to be  handled from Third Party Pluign itself.', 'dvinwcql');
?>
</span></td>
				</tr>
				<tr>
					<td><input type='checkbox' name='use_gravity_forms'/></td>
					<td><?php 
_e('Use Gravity Forms', 'dvinwcql');
?>
 - <select name='gravity_form_select' id='gravity_form_select'>
						<option value=''>Select Form</option>
						<?php 
if (class_exists('RGFormsModel')) {
    $forms = RGFormsModel::get_forms(null, 'title');
} else {
    $forms = array();
}
foreach ($forms as $form) {
    ?>
								<option value='<?php 
    echo $form->id;
    ?>
'><?php 
    echo $form->title;
    ?>
</option>
					<?php 
}
?>
Ejemplo n.º 28
0
 /**
  * Saves form meta. Note the special requirements for the meta string.
  *
  * @param        $id
  * @param string $form_json A valid JSON string. The JSON is manipulated before decoding and is designed to work together with jQuery.toJSON() rather than json_encode. Avoid using json_encode as it will convert unicode characters into their respective entities with slashes. These slashes get stripped so unicode characters won't survive intact.
  *
  * @return array
  */
 public static function save_form_info($id, $form_json)
 {
     global $wpdb;
     $form_json = stripslashes($form_json);
     $form_json = nl2br($form_json);
     GFCommon::log_debug('GFFormDetail::save_form_info(): Form meta json: ' . $form_json);
     $form_meta = json_decode($form_json, true);
     $form_meta = GFFormsModel::convert_field_objects($form_meta);
     GFCommon::log_debug('GFFormDetail::save_form_info(): Form meta => ' . print_r($form_meta, true));
     if (!$form_meta) {
         return array('status' => 'invalid_json', 'meta' => null);
     }
     $form_table_name = $wpdb->prefix . 'rg_form';
     //Making sure title is not duplicate
     $forms = RGFormsModel::get_forms();
     foreach ($forms as $form) {
         if (strtolower($form->title) == strtolower($form_meta['title']) && rgar($form_meta, 'id') != $form->id) {
             return array('status' => 'duplicate_title', 'meta' => $form_meta);
         }
     }
     if ($id > 0) {
         $form_meta = GFFormsModel::trim_form_meta_values($form_meta);
         RGFormsModel::update_form_meta($id, $form_meta);
         //updating form title
         $wpdb->query($wpdb->prepare("UPDATE {$form_table_name} SET title=%s WHERE id=%d", $form_meta['title'], $form_meta['id']));
         $form_meta = RGFormsModel::get_form_meta($id);
         do_action('gform_after_save_form', $form_meta, false);
         return array('status' => $id, 'meta' => $form_meta);
     } else {
         //inserting form
         $id = RGFormsModel::insert_form($form_meta['title']);
         //updating object's id property
         $form_meta['id'] = $id;
         //creating default notification
         if (apply_filters('gform_default_notification', true)) {
             $default_notification = array('id' => uniqid(), 'to' => '{admin_email}', 'name' => __('Admin Notification', 'gravityforms'), 'event' => 'form_submission', 'toType' => 'email', 'subject' => __('New submission from', 'gravityforms') . ' {form_title}', 'message' => '{all_fields}');
             $notifications = array($default_notification['id'] => $default_notification);
             //updating notifications form meta
             RGFormsModel::save_form_notifications($id, $notifications);
         }
         // add default confirmation when saving a new form
         $confirmation_id = uniqid();
         $confirmations = array();
         $confirmations[$confirmation_id] = array('id' => $confirmation_id, 'name' => __('Default Confirmation', 'gravityforms'), 'isDefault' => true, 'type' => 'message', 'message' => __('Thanks for contacting us! We will get in touch with you shortly.', 'gravityforms'), 'url' => '', 'pageId' => '', 'queryString' => '');
         GFFormsModel::save_form_confirmations($id, $confirmations);
         //updating form meta
         RGFormsModel::update_form_meta($id, $form_meta);
         $form_meta = RGFormsModel::get_form_meta($id);
         do_action('gform_after_save_form', $form_meta, true);
         return array('status' => $id * -1, 'meta' => $form_meta);
     }
 }
Ejemplo n.º 29
0
    public static function export_lead_page()
    {
        if (!GFCommon::current_user_can_any('gravityforms_export_entries')) {
            wp_die('You do not have permission to access this page');
        }
        self::page_header(__('Export Entries', 'gravityforms'));
        ?>

		<script type="text/javascript">

			var gfSpinner;

			<?php 
        GFCommon::gf_global();
        ?>
			<?php 
        GFCommon::gf_vars();
        ?>

			function SelectExportForm(formId) {

				if (!formId)
					return;

				gfSpinner = new gfAjaxSpinner(jQuery('select#export_form'), gf_vars.baseUrl + '/images/spinner.gif', 'position: relative; top: 2px; left: 5px;');

				var mysack = new sack("<?php 
        echo admin_url('admin-ajax.php');
        ?>
");
				mysack.execute = 1;
				mysack.method = 'POST';
				mysack.setVar("action", "rg_select_export_form");
				mysack.setVar("rg_select_export_form", "<?php 
        echo wp_create_nonce('rg_select_export_form');
        ?>
");
				mysack.setVar("form_id", formId);
				mysack.onError = function () {
					alert(<?php 
        echo json_encode(__('Ajax error while selecting a form', 'gravityforms'));
        ?>
)
				};
				mysack.runAJAX();

				return true;
			}

			function EndSelectExportForm(aryFields, filterSettings) {

				gfSpinner.destroy();

				if (aryFields.length == 0) {
					jQuery("#export_field_container, #export_date_container, #export_submit_container").hide()
					return;
				}

				var fieldList = "<li><input id='select_all' type='checkbox' onclick=\"jQuery('.gform_export_field').attr('checked', this.checked); jQuery('#gform_export_check_all').html(this.checked ? '<strong><?php 
        echo esc_js(__('Deselect All', 'gravityforms'));
        ?>
</strong>' : '<strong><?php 
        echo esc_js(__('Select All', 'gravityforms'));
        ?>
</strong>'); \"> <label id='gform_export_check_all' for='select_all'><strong><?php 
        esc_html_e('Select All', 'gravityforms');
        ?>
</strong></label></li>";
				for (var i = 0; i < aryFields.length; i++) {
					fieldList += "<li><input type='checkbox' id='export_field_" + i + "' name='export_field[]' value='" + aryFields[i][0] + "' class='gform_export_field'> <label for='export_field_" + i + "'>" + aryFields[i][1] + "</label></li>";
				}
				jQuery("#export_field_list").html(fieldList);
				jQuery("#export_date_start, #export_date_end").datepicker({dateFormat: 'yy-mm-dd', changeMonth: true, changeYear: true});

				jQuery("#export_field_container, #export_filter_container, #export_date_container, #export_submit_container").hide().show();

				gf_vars.filterAndAny = <?php 
        echo json_encode(esc_html__('Export entries if {0} of the following match:', 'gravityforms'));
        ?>
;
				jQuery("#export_filters").gfFilterUI(filterSettings);
			}
			jQuery(document).ready(function () {
				jQuery("#gform_export").submit(function () {
					if (jQuery(".gform_export_field:checked").length == 0) {
						alert(<?php 
        echo json_encode(__('Please select the fields to be exported', 'gravityforms'));
        ?>
);
						return false;
					}
				});
			});


		</script>

		<p class="textleft"><?php 
        esc_html_e('Select a form below to export entries. Once you have selected a form you may select the fields you would like to export and then define optional filters for field values and the date range. When you click the download button below, Gravity Forms will create a CSV file for you to save to your computer.', 'gravityforms');
        ?>
</p>
		<div class="hr-divider"></div>
		<form id="gform_export" method="post" style="margin-top:10px;">
			<?php 
        echo wp_nonce_field('rg_start_export', 'rg_start_export_nonce');
        ?>
			<table class="form-table">
				<tr valign="top">

					<th scope="row">
						<label for="export_form"><?php 
        esc_html_e('Select A Form', 'gravityforms');
        ?>
</label> <?php 
        gform_tooltip('export_select_form');
        ?>
					</th>
					<td>

						<select id="export_form" name="export_form" onchange="SelectExportForm(jQuery(this).val());">
							<option value=""><?php 
        esc_html_e('Select a form', 'gravityforms');
        ?>
</option>
							<?php 
        $forms = RGFormsModel::get_forms(null, 'title');
        foreach ($forms as $form) {
            ?>
								<option value="<?php 
            echo absint($form->id);
            ?>
"><?php 
            echo esc_html($form->title);
            ?>
</option>
							<?php 
        }
        ?>
						</select>

					</td>
				</tr>
				<tr id="export_field_container" valign="top" style="display: none;">
					<th scope="row">
						<label for="export_fields"><?php 
        esc_html_e('Select Fields', 'gravityforms');
        ?>
</label> <?php 
        gform_tooltip('export_select_fields');
        ?>
					</th>
					<td>
						<ul id="export_field_list">
						</ul>
					</td>
				</tr>
				<tr id="export_filter_container" valign="top" style="display: none;">
					<th scope="row">
						<label><?php 
        esc_html_e('Conditional Logic', 'gravityforms');
        ?>
</label> <?php 
        gform_tooltip('export_conditional_logic');
        ?>
					</th>
					<td>
						<div id="export_filters">
							<!--placeholder-->
						</div>

					</td>
				</tr>
				<tr id="export_date_container" valign="top" style="display: none;">
					<th scope="row">
						<label for="export_date"><?php 
        esc_html_e('Select Date Range', 'gravityforms');
        ?>
</label> <?php 
        gform_tooltip('export_date_range');
        ?>
					</th>
					<td>
						<div>
                            <span style="width:150px; float:left; ">
                                <input type="text" id="export_date_start" name="export_date_start" style="width:90%" />
                                <strong><label for="export_date_start" style="display:block;"><?php 
        esc_html_e('Start', 'gravityforms');
        ?>
</label></strong>
                            </span>

                            <span style="width:150px; float:left;">
                                <input type="text" id="export_date_end" name="export_date_end" style="width:90%" />
                                <strong><label for="export_date_end" style="display:block;"><?php 
        esc_html_e('End', 'gravityforms');
        ?>
</label></strong>
                            </span>

							<div style="clear: both;"></div>
							<?php 
        esc_html_e('Date Range is optional, if no date range is selected all entries will be exported.', 'gravityforms');
        ?>
						</div>
					</td>
				</tr>
			</table>
			<ul>
				<li id="export_submit_container" style="display:none; clear:both;">
					<br /><br />
					<input type="submit" name="export_lead" value="<?php 
        esc_attr_e('Download Export File', 'gravityforms');
        ?>
" class="button button-large button-primary" />
                    <span id="please_wait_container" style="display:none; margin-left:15px;">
                        <i class='gficon-gravityforms-spinner-icon gficon-spin'></i> <?php 
        esc_html_e('Exporting entries. Please wait...', 'gravityforms');
        ?>
                    </span>

					<iframe id="export_frame" width="1" height="1" src="about:blank"></iframe>
				</li>
			</ul>
		</form>

		<?php 
        self::page_footer();
    }
Ejemplo n.º 30
0
        public function results_page($form_id, $page_title, $gf_page, $gf_view)
        {
            if (empty($form_id)) {
                $forms = RGFormsModel::get_forms();
                if (!empty($forms)) {
                    $form_id = $forms[0]->id;
                }
            }
            $form = GFFormsModel::get_form_meta($form_id);
            $form = apply_filters("gform_form_pre_results_{$form_id}", apply_filters("gform_form_pre_results", $form));
            // set up filter vars
            $start_date = rgget("start");
            $end_date = rgget("end");
            $all_fields = $form["fields"];
            $filter_settings = GFCommon::get_field_filter_settings($form);
            $filter_settings = apply_filters("gform_filters_pre_results", $filter_settings, $form);
            $filter_settings = array_values($filter_settings);
            // reset the numeric keys in case some filters have been unset
            $filter_fields = rgget("f");
            $filter_operators = rgget("o");
            $filter_values = rgget("v");
            $filters = array();
            $init_vars = array();
            if (!empty($filter_fields)) {
                $init_vars["mode"] = rgget("mode");
                foreach ($filter_fields as $i => $filter_field) {
                    $filters[$i]["field"] = $filter_field;
                    $filters[$i]["operator"] = $filter_operators[$i];
                    $filters[$i]["value"] = $filter_values[$i];
                }
                $init_vars["filters"] = $filters;
            }
            ?>
            <script type="text/javascript">
                var gresultsFields = <?php 
            echo json_encode($all_fields);
            ?>
;
                var gresultsFilterSettings = <?php 
            echo json_encode($filter_settings);
            ?>
;
                var gresultsInitVars = <?php 
            echo json_encode($init_vars);
            ?>
;

                <?php 
            GFCommon::gf_global();
            ?>
                <?php 
            GFCommon::gf_vars();
            ?>
            </script>

            <link rel="stylesheet"
                  href="<?php 
            echo GFCommon::get_base_url();
            ?>
/css/admin.css?ver=<?php 
            echo GFCommon::$version;
            ?>
"
                  type="text/css"/>
            <div class="wrap gforms_edit_form <?php 
            echo GFCommon::get_browser_class();
            ?>
">

                <div class="icon32" id="gravity-entry-icon"><br></div>

                <h2><?php 
            echo empty($form_id) ? $page_title : $page_title . " : " . esc_html($form["title"]);
            ?>
</h2>

                <?php 
            RGForms::top_toolbar();
            ?>
                <?php 
            if (false === empty($all_fields)) {
                ?>

                    <div id="poststuff" class="metabox-holder has-right-sidebar">
                        <div id="side-info-column" class="inner-sidebar">
                            <div id="gresults-results-filter" class="postbox">
                                <h3 style="cursor: default;"><?php 
                echo $this->_search_title;
                ?>
</h3>

                                <div id="gresults-results-filter-content">
                                    <form id="gresults-results-filter-form" action="" method="GET">
                                        <input type="hidden" id="gresults-page-slug" name="page"
                                               value="<?php 
                echo esc_attr($gf_page);
                ?>
">
                                        <input type="hidden" id="gresults-view-slug" name="view"
                                               value="<?php 
                echo esc_attr($gf_view);
                ?>
">
                                        <input type="hidden" id="gresults-form-id" name="id"
                                               value="<?php 
                echo esc_attr($form_id);
                ?>
">

                                        <?php 
                $filter_ui = array("fields" => array("label" => __("Filters", "gravityforms"), "tooltip" => "gresults_filters", "markup" => '<div id="gresults-results-field-filters-container">
                                                                                <!-- placeholder populated by js -->
                                                                             </div>'), "date_range" => array("label" => __("Date Range", "gravityforms"), "tooltip" => "gresults_date_range", "markup" => '<div style="width:90px; float:left; ">

                                                                                    <label
                                                                                        for="gresults-results-filter-date-start">' . __("Start", "gravityforms") . '</label>
                                                                                    <input type="text" id="gresults-results-filter-date-start" name="start"
                                                                                           style="width:80px"
                                                                                           class="gresults-datepicker"
                                                                                           value="' . $start_date . '"/>
                                                                                </div>
                                                                                <div style="width:90px; float:left; ">
                                                                                    <label
                                                                                        for="gresults-results-filter-date-end">' . __("End", "gravityforms") . '</label>
                                                                                    <input type="text" id="gresults-results-filter-date-end" name="end"
                                                                                           style="width:80px"
                                                                                           class="gresults-datepicker"
                                                                                           value="' . $end_date . '"/>
                                                                                </div>'));
                $filter_ui = apply_filters("gform_filter_ui", $filter_ui, $form_id, $page_title, $gf_page, $gf_view);
                foreach ($filter_ui as $name => $filter) {
                    ?>
                                            <div class='gresults-results-filter-section-label'>
                                                <?php 
                    echo $filter["label"];
                    ?>
                                                &nbsp;<?php 
                    gform_tooltip(rgar($filter, "tooltip"), "tooltip_bottomleft");
                    ?>
                                            </div>
                                            <?php 
                    echo $filter["markup"];
                }
                ?>

                                        <br style="clear:both"/>

                                        <div id="gresults-results-filter-buttons">
                                            <input type="submit" id="gresults-results-filter-submit-button"
                                                   class="button button-primary button-large" value="<?php 
                _e('Apply filters', 'gravityforms');
                ?>
">
                                            <input type="button" id="gresults-results-filter-clear-button"
                                                   class="button button-secondary button-large" value="<?php 
                _e('Clear', 'gravityforms');
                ?>
"
                                                   onclick="gresults.clearFilterForm();">

                                            <div class="gresults-filter-loading"
                                                 style="display:none; float:right; margin-top:5px;">
                                                <img
                                                    src="<?php 
                echo GFCommon::get_base_url();
                ?>
/images/spinner.gif"
                                                    alt="loading..."/>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="gresults-filter-loading" style="display:none;margin:0 5px 10px 0;">
                        <img style="vertical-align:middle;"
                             src="<?php 
                echo GFCommon::get_base_url();
                ?>
/images/spinner.gif"
                             alt="loading..."/>&nbsp;
                        <a href="javascript:void(0);" onclick="javascript:gresultsAjaxRequest.abort()">Cancel</a>
                    </div>

                    <div id="gresults-results-wrapper">
                        <div id="gresults-results">&nbsp;
                        </div>
                    </div>

                <?php 
            } else {
                _e("This form does not have any fields that can be used for results", "gravityforms");
            }
            ?>
            </div>


        <?php 
        }