function settings_row($ds)
    {
        ?>
		<table class="form-table">
			<caption>Scroller</caption>
			<tr valign="top">
				<td colspan="2">
					<?php 
        echo GravityView_Render_Settings::render_field_option('datatables_settings[scroller]', array('label' => __('Enable Scroller', 'gv-datatables'), 'type' => 'checkbox', 'value' => 1, 'tooltip' => 'gv_datatables_scroller'), $ds['scroller']);
        ?>
				</td>
			</tr>
			<tr valign="top">
				<td scope="row">
					<label for="gravityview_dt_scrollerheight"><?php 
        esc_html_e('Table Height', 'gv-datatables');
        ?>
</label>
				</td>
				<td>
					<input name="datatables_settings[scrolly]" id="gravityview_dt_scrollerheight" type="number" step="1" min="50" value="<?php 
        empty($ds['scrolly']) ? print 500 : (print $ds['scrolly']);
        ?>
" class="small-text">
				</td>
			</tr>
		</table>
	<?php 
    }
    function settings_row($ds)
    {
        ?>
		<table class="form-table">
			<caption>
				FixedHeader &amp; FixedColumns
				<p class="description"><?php 
        esc_html_e('Keep headers or columns in place and visible while scrolling a table.', 'gv-datatables');
        ?>
</p>
			</caption>
			<tr valign="top">
				<td colspan="2">
					<?php 
        echo GravityView_Render_Settings::render_field_option('datatables_settings[fixedheader]', array('label' => __('Enable FixedHeader', 'gv-datatables'), 'type' => 'checkbox', 'value' => 1, 'tooltip' => 'gv_datatables_fixedheader'), $ds['fixedheader']);
        ?>
				</td>
			</tr>
			<tr valign="top">
				<td colspan="2">
					<?php 
        echo GravityView_Render_Settings::render_field_option('datatables_settings[fixedcolumns]', array('label' => __('Enable FixedColumns', 'gv-datatables'), 'type' => 'checkbox', 'value' => 1, 'tooltip' => 'gv_datatables_fixedcolumns'), $ds['fixedcolumns']);
        ?>
				</td>
			</tr>
		</table>
	<?php 
    }
    function settings_row($ds)
    {
        ?>
		<table class="form-table">
			<caption>Responsive</caption>
			<tr valign="top">
				<td colspan="2">
					<?php 
        echo GravityView_Render_Settings::render_field_option('datatables_settings[responsive]', array('label' => __('Enable Responsive Tables', 'gv-datatables'), 'type' => 'checkbox', 'value' => 1, 'tooltip' => 'gv_datatables_responsive'), $ds['responsive']);
        ?>
				</td>
			</tr>
		</table>
	<?php 
    }
    function settings_row($ds)
    {
        $tt_buttons_labels = GV_Extension_DataTables_TableTools::tabletools_button_labels();
        ?>
		<table class="form-table">
			<caption>TableTools</caption>
			<tr valign="top">
				<td colspan="2">
					<?php 
        echo GravityView_Render_Settings::render_field_option('datatables_settings[tabletools]', array('label' => __('Enable TableTools', 'gv-datatables'), 'type' => 'checkbox', 'value' => 1, 'tooltip' => 'gv_datatables_tabletools'), $ds['tabletools']);
        ?>
				</td>
			</tr>
			<tr valign="top" id="gv_dt_tt_buttons">
				<td colspan="2">

				<h3><?php 
        esc_html_e('Display Buttons', 'gv-datatables');
        ?>
</h3>
				</p>
					<ul class="ul-square">
				<?php 
        foreach ($ds['tt_buttons'] as $b_key => $b_value) {
            if (empty($tt_buttons_labels[$b_key])) {
                continue;
            }
            echo '<li>' . GravityView_Render_Settings::render_field_option('datatables_settings[tt_buttons][' . $b_key . ']', array('label' => $tt_buttons_labels[$b_key], 'type' => 'checkbox', 'value' => 1), $ds['tt_buttons'][$b_key]) . '</li>';
        }
        ?>
					</ul>
				</td>
			</tr>
		</table>
		<?php 
    }
    /**
     * Generic function to render rows and columns of active areas for widgets & fields
     * @param  string $template_id The current slug of the selected View template
     * @param  string $type   Either 'widget' or 'field'
     * @param  string $zone   Either 'single', 'directory', 'header', 'footer'
     * @param  array $rows    The layout structure: rows, columns and areas
     * @param  array $values  Saved objects
     * @return void
     */
    function render_active_areas($template_id, $type, $zone, $rows, $values)
    {
        global $post;
        if ($type === 'widget') {
            $button_label = __('Add Widget', 'gravityview');
        } else {
            $button_label = __('Add Field', 'gravityview');
        }
        $available_items = array();
        // if saved values, get available fields to label everyone
        if (!empty($values) && (!empty($post->ID) || !empty($_POST['template_id']))) {
            if (!empty($_POST['template_id'])) {
                $form = GravityView_Ajax::pre_get_form_fields($_POST['template_id']);
            } else {
                $form = gravityview_get_form_id($post->ID);
            }
            if ('field' === $type) {
                $available_items = $this->get_available_fields($form, $zone);
            } else {
                $available_items = $this->get_registered_widgets();
            }
        }
        foreach ($rows as $row) {
            foreach ($row as $col => $areas) {
                $column = $col == '2-2' ? '1-2' : $col;
                ?>

				<div class="gv-grid-col-<?php 
                echo esc_attr($column);
                ?>
">

					<?php 
                foreach ($areas as $area) {
                    ?>

						<div class="gv-droppable-area">
							<div class="active-drop active-drop-<?php 
                    echo esc_attr($type);
                    ?>
" data-areaid="<?php 
                    echo esc_attr($zone . '_' . $area['areaid']);
                    ?>
">

								<?php 
                    // render saved fields
                    if (!empty($values[$zone . '_' . $area['areaid']])) {
                        foreach ($values[$zone . '_' . $area['areaid']] as $uniqid => $field) {
                            $input_type = NULL;
                            $original_item = isset($available_items[$field['id']]) ? $available_items[$field['id']] : false;
                            if (!$original_item) {
                                do_action('gravityview_log_error', 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array('available_items' => $available_items, 'field' => $field));
                                $original_item = $field;
                            } else {
                                $input_type = isset($original_item['type']) ? $original_item['type'] : NULL;
                            }
                            // Field options dialog box
                            $field_options = GravityView_Render_Settings::render_field_options($type, $template_id, $field['id'], $original_item['label'], $zone . '_' . $area['areaid'], $input_type, $uniqid, $field, $zone, $original_item);
                            $item = array('input_type' => $input_type, 'settings_html' => $field_options, 'label_type' => $type);
                            // Merge the values with the current item to pass things like widget descriptions and original field names
                            if ($original_item) {
                                $item = wp_parse_args($item, $original_item);
                            }
                            switch ($type) {
                                case 'widget':
                                    echo new GravityView_Admin_View_Widget($item['label'], $field['id'], $item, $field);
                                    break;
                                default:
                                    echo new GravityView_Admin_View_Field($item['label'], $field['id'], $item, $field);
                            }
                            //endif;
                        }
                    }
                    // End if zone is not empty
                    ?>

								<span class="drop-message"><?php 
                    echo sprintf(esc_attr__('"+ %s" or drag existing %ss here.', 'gravityview'), $button_label, $type);
                    ?>
</span>
							</div>
							<div class="gv-droppable-area-action">
								<a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php 
                    echo esc_attr($type);
                    ?>
" data-areaid="<?php 
                    echo esc_attr($zone . '_' . $area['areaid']);
                    ?>
" data-context="<?php 
                    echo esc_attr($zone);
                    ?>
"><?php 
                    echo '+ ' . esc_html($button_label);
                    ?>
</a>
								<p class="gv-droppable-area-title"><strong><?php 
                    echo esc_html($area['title']);
                    ?>
</strong><?php 
                    if (!empty($area['subtitle'])) {
                        ?>
<span class="gv-droppable-area-subtitle"> &ndash; <?php 
                        echo esc_html($area['subtitle']);
                        ?>
</span><?php 
                    }
                    ?>
</p>
							</div>
						</div>

					<?php 
                }
                ?>

				</div>
			<?php 
            }
        }
    }
    /**
     * Add shortcode popup div
     *
     * @access public
     * @return void
     */
    function add_shortcode_popup()
    {
        global $post;
        if (!$this->is_post_editor_screen()) {
            return;
        }
        $post_type = get_post_type_object($post->post_type);
        $views = get_posts(array('post_type' => 'gravityview', 'posts_per_page' => -1));
        // If there are no views set up yet, we get outta here.
        if (empty($views)) {
            echo '<div id="select_gravityview_view"><div class="wrap">' . GravityView_Post_Types::no_views_text() . '</div></div>';
            return;
        }
        ?>
		<div id="select_gravityview_view">
			<form action="#" method="get" id="select_gravityview_view_form">
				<div class="wrap">

					<h2 class=""><?php 
        esc_html_e('Embed a View', 'gravityview');
        ?>
</h2>
					<p class="subtitle"><?php 
        printf(esc_attr(__('Use this form to embed a View into this %s. %sLearn more about using shortcodes.%s', 'gravityview')), $post_type->labels->singular_name, '<a href="http://gravityview.co/support/documentation/202934188/" target="_blank">', '</a>');
        ?>
</p>

					<div>
						<h3><label for="gravityview_id"><?php 
        esc_html_e('Select a View', 'gravityview');
        ?>
</label></h3>

						<select name="gravityview_id" id="gravityview_id">
							<option value=""><?php 
        esc_html_e('&mdash; Select a View to Insert &mdash;', 'gravityview');
        ?>
</option>
							<?php 
        foreach ($views as $view) {
            $title = empty($view->post_title) ? __('(no title)', 'gravityview') : $view->post_title;
            echo '<option value="' . $view->ID . '">' . esc_html(sprintf('%s #%d', $title, $view->ID)) . '</option>';
        }
        ?>
						</select>
					</div>

					<table class="form-table hide-if-js">

						<caption><?php 
        esc_html_e('View Settings', 'gravityview');
        ?>
</caption>

						<?php 
        $settings = GravityView_View_Data::get_default_args(true);
        foreach ($settings as $key => $setting) {
            if (empty($setting['show_in_shortcode'])) {
                continue;
            }
            GravityView_Render_Settings::render_setting_row($key, array(), NULL, 'gravityview_%s', 'gravityview_%s');
        }
        ?>

					</table>

					<div class="submit">
						<input type="submit" class="button button-primary button-large alignleft hide-if-js" value="<?php 
        esc_attr_e('Insert View', 'gravityview');
        ?>
" id="insert_gravityview_view" />
						<input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php 
        esc_attr_e("Cancel", 'gravityview');
        ?>
" />
					</div>

				</div>
			</form>
		</div>
		<?php 
    }
 /**
  * Add "Delete Link Text" setting to the edit_link field settings
  *
  * @since  1.5.1
  * @param  [type] $field_options [description]
  * @param  [type] $template_id   [description]
  * @param  [type] $field_id      [description]
  * @param  [type] $context       [description]
  * @param  [type] $input_type    [description]
  * @return [type]                [description]
  */
 function delete_link_field_options($field_options, $template_id, $field_id, $context, $input_type)
 {
     // Always a link, never a filter
     unset($field_options['show_as_link'], $field_options['search_filter']);
     // Delete Entry link should only appear to visitors capable of editing entries
     unset($field_options['only_loggedin'], $field_options['only_loggedin_cap']);
     $add_option['delete_link'] = array('type' => 'text', 'label' => __('Delete Link Text', 'gravityview'), 'desc' => NULL, 'value' => __('Delete Entry', 'gravityview'), 'merge_tags' => true);
     $field_options['allow_edit_cap'] = array('type' => 'select', 'label' => __('Allow the following users to delete the entry:', 'gravityview'), 'choices' => GravityView_Render_Settings::get_cap_choices($template_id, $field_id, $context, $input_type), 'tooltip' => 'allow_edit_cap', 'class' => 'widefat', 'value' => 'read');
     return array_merge($add_option, $field_options);
 }
 /**
  * Returns field options - called by ajax when dropping fields into active areas
  * AJAX callback
  *
  * @access public
  * @return void
  */
 function get_field_options()
 {
     $this->check_ajax_nonce();
     if (empty($_POST['template']) || empty($_POST['area']) || empty($_POST['field_id']) || empty($_POST['field_type'])) {
         do_action('gravityview_log_error', '[get_field_options] Required fields were not set in the $_POST request. ');
         exit(false);
     }
     // Fix apostrophes added by JSON response
     $post = array_map('stripslashes_deep', $_POST);
     // Sanitize
     $post = array_map('esc_attr', $post);
     // The GF type of field: `product`, `name`, `creditcard`, `id`, `text`
     $input_type = isset($post['input_type']) ? esc_attr($post['input_type']) : NULL;
     $context = isset($post['context']) ? esc_attr($post['context']) : NULL;
     $response = GravityView_Render_Settings::render_field_options($post['field_type'], $post['template'], $post['field_id'], $post['field_label'], $post['area'], $input_type, '', '', $context);
     $response = gravityview_strip_whitespace($response);
     exit($response);
 }
Exemple #9
0
<?php

/**
 * @package GravityView
 * @subpackage Gravityview/admin/metaboxes/views
 * @global $post
 */
global $post;
// View template settings
$current_settings = gravityview_get_template_settings($post->ID);
?>

<table class="form-table striped"><?php 
GravityView_Render_Settings::render_setting_row('single_title', $current_settings);
GravityView_Render_Settings::render_setting_row('back_link_label', $current_settings);
?>
</table>
Exemple #10
0
 */
global $post;
$curr_form = gravityview_get_form_id($post->ID);
// View template settings
$current_settings = gravityview_get_template_settings($post->ID);
?>

<table class="form-table striped">

	<?php 
GravityView_Render_Settings::render_setting_row('page_size', $current_settings);
GravityView_Render_Settings::render_setting_row('lightbox', $current_settings);
GravityView_Render_Settings::render_setting_row('show_only_approved', $current_settings);
/**
 * @since 1.5.4
 */
GravityView_Render_Settings::render_setting_row('hide_until_searched', $current_settings);
GravityView_Render_Settings::render_setting_row('hide_empty', $current_settings);
GravityView_Render_Settings::render_setting_row('user_edit', $current_settings);
/**
 * @since  1.5.1
 */
GravityView_Render_Settings::render_setting_row('user_delete', $current_settings);
/**
 * @since 1.15.2
 */
GravityView_Render_Settings::render_setting_row('embed_only', $current_settings);
do_action('gravityview_admin_directory_settings', $current_settings);
?>

</table>
Exemple #11
0
/**
 * @package GravityView
 * @subpackage Gravityview/admin/metaboxes/views
 * @global $post
 */
global $post;
$curr_form = gravityview_get_form_id($post->ID);
// View template settings
$current_settings = gravityview_get_template_settings($post->ID);
?>

<table class="form-table striped">

	<?php 
GravityView_Render_Settings::render_setting_row('page_size', $current_settings);
GravityView_Render_Settings::render_setting_row('lightbox', $current_settings);
GravityView_Render_Settings::render_setting_row('show_only_approved', $current_settings);
/**
 * @since 1.5.4
 */
GravityView_Render_Settings::render_setting_row('hide_until_searched', $current_settings);
GravityView_Render_Settings::render_setting_row('hide_empty', $current_settings);
GravityView_Render_Settings::render_setting_row('user_edit', $current_settings);
/**
 * @since  1.5.1
 */
GravityView_Render_Settings::render_setting_row('user_delete', $current_settings);
do_action('gravityview_admin_directory_settings', $current_settings);
?>

</table>
 /**
  * Manipulate the fields' options for the EDIT ENTRY screen
  * @param  [type] $field_options [description]
  * @param  [type] $template_id   [description]
  * @param  [type] $field_id      [description]
  * @param  [type] $context       [description]
  * @param  [type] $input_type    [description]
  * @return [type]                [description]
  */
 function field_options($field_options, $template_id, $field_id, $context, $input_type)
 {
     // We only want to modify the settings for the edit context
     if ('edit' !== $context) {
         /**
          * @since 1.8.4
          */
         $field_options['new_window'] = array('type' => 'checkbox', 'label' => __('Open link in a new tab or window?', 'gravityview'), 'value' => false);
         return $field_options;
     }
     //  Entry field is only for logged in users
     unset($field_options['only_loggedin'], $field_options['only_loggedin_cap']);
     $add_options = array('allow_edit_cap' => array('type' => 'select', 'label' => __('Make field editable to:', 'gravityview'), 'choices' => GravityView_Render_Settings::get_cap_choices($template_id, $field_id, $context, $input_type), 'tooltip' => 'allow_edit_cap', 'class' => 'widefat', 'value' => 'read'));
     return array_merge($field_options, $add_options);
 }
Exemple #13
0
 */
global $post;
$curr_form = gravityview_get_form_id($post->ID);
// View template settings
$current_settings = gravityview_get_template_settings($post->ID);
?>
<table class="form-table striped">

	<?php 
do_action('gravityview_metabox_sort_filter_before', $current_settings);
// Begin Sort fields
do_action('gravityview_metabox_sort_before', $current_settings);
/**
 * @since 1.7
 */
GravityView_Render_Settings::render_setting_row('sort_columns', $current_settings);
$sort_fields_input = '<select name="template_settings[sort_field]" id="gravityview_sort_field">' . gravityview_get_sortable_fields($curr_form, $current_settings['sort_field']) . '</select>';
GravityView_Render_Settings::render_setting_row('sort_field', $current_settings, $sort_fields_input);
GravityView_Render_Settings::render_setting_row('sort_direction', $current_settings);
// End Sort fields
do_action('gravityview_metabox_sort_after', $current_settings);
// Begin Filter fields
do_action('gravityview_metabox_filter_before', $current_settings);
GravityView_Render_Settings::render_setting_row('start_date', $current_settings);
GravityView_Render_Settings::render_setting_row('end_date', $current_settings);
// End Filter fields
do_action('gravityview_metabox_filter_after', $current_settings);
do_action('gravityview_metabox_sort_filter_after', $current_settings);
?>

</table>