本文整理汇总了PHP中GFExport::add_default_export_fields方法的典型用法代码示例。如果您正苦于以下问题:PHP GFExport::add_default_export_fields方法的具体用法?PHP GFExport::add_default_export_fields怎么用?PHP GFExport::add_default_export_fields使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GFExport
的用法示例。
在下文中一共展示了GFExport::add_default_export_fields方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: form_settings_fields
/**
* Add form settings page with schedule export options.
*
* TODO: Add default email address - admin email if empty?
*
* @since 1.0.0
*
*/
public function form_settings_fields($form)
{
if (!GFCommon::current_user_can_any('gravityforms_edit_forms')) {
wp_die('You do not have permission to access this page');
}
//collect the form id from the schedule export settings page url for the current form
$form_id = $_REQUEST['id'];
$form = apply_filters("gform_form_export_page_{$form_id}", apply_filters('gform_form_export_page', $form));
//collect filter settings TODO: these are currently not used.
$filter_settings = GFCommon::get_field_filter_settings($form);
$filter_settings_json = json_encode($filter_settings);
//collect and add the default export fields
$form = GFExport::add_default_export_fields($form);
$form_fields = $form['fields'];
$choices[] = array('label' => 'Select All', 'name' => '', 'default_value' => 1);
//loop through the fields and format all the inputs in to an array to be rendered as checkboxes
foreach ($form_fields as $field) {
$inputs = $field->get_entry_inputs();
if (is_array($inputs)) {
foreach ($inputs as $input) {
$choices[] = array('label' => GFCommon::get_label($field, $input['id']), 'name' => $input['id'], 'default_value' => 1);
}
} else {
if (!$field->displayOnly) {
$choices[] = array('label' => GFCommon::get_label($field), 'name' => $field->id, 'default_value' => 1);
}
}
}
$inputs = array(array('title' => "Scheduled Entries Export", 'description' => "The settings below will automatically export new entries and send them to the emails below based on the set time frame.", 'fields' => array(array('label' => "Activate the Schedule", 'type' => "checkbox", 'name' => "enabled", 'tooltip' => "Enabling the schedule based on the sets below. This runs off WP Cron.", 'choices' => array(array('label' => "", 'name' => "enabled"))), array('label' => "Time Frame", 'type' => "select", 'name' => "time_frame", 'tooltip' => "Set how frequently it the entries are exported and emailed", 'choices' => array(array('label' => "Hourly", 'value' => "hourly"), array('label' => "Twice Daily", 'value' => "twicedaily"), array('label' => "Daily", 'value' => "daily"), array('label' => "Weekly", 'value' => "weekly"), array('label' => "Monthly - Every 30 Days", 'value' => "monthly"))), array('type' => "text", 'name' => "email", 'label' => "Email Address", 'class' => "medium", 'tooltip' => "Enter a comma separated list of emails you would like to receive the exported entries file."), array('label' => "Form Fields", 'type' => "checkbox", 'name' => "fields", 'tooltip' => "Select the fields you would like to include in the export. Caution: Make sure you are not sending any sensitive information.", 'choices' => $choices))));
return $inputs;
}
示例2: select_export_form
public static function select_export_form()
{
check_ajax_referer('rg_select_export_form', 'rg_select_export_form');
$form_id = intval($_POST['form_id']);
$form = RGFormsModel::get_form_meta($form_id);
/**
* Filters through the Form Export Page
*
* @param int $form_id The ID of the form to export
* @param int $form The Form Object of the form to export
*/
$form = gf_apply_filters('gform_form_export_page', $form_id, $form);
$filter_settings = GFCommon::get_field_filter_settings($form);
$filter_settings_json = json_encode($filter_settings);
$fields = array();
$form = GFExport::add_default_export_fields($form);
if (is_array($form['fields'])) {
/* @var GF_Field $field */
foreach ($form['fields'] as $field) {
$inputs = $field->get_entry_inputs();
if (is_array($inputs)) {
foreach ($inputs as $input) {
$fields[] = array($input['id'], GFCommon::get_label($field, $input['id']));
}
} else {
if (!$field->displayOnly) {
$fields[] = array($field->id, GFCommon::get_label($field));
}
}
}
}
$field_json = GFCommon::json_encode($fields);
die("EndSelectExportForm({$field_json}, {$filter_settings_json});");
}
示例3: select_export_form
public static function select_export_form()
{
check_ajax_referer("rg_select_export_form", "rg_select_export_form");
$form_id = intval($_POST["form_id"]);
$form = RGFormsModel::get_form_meta($form_id);
$fields = array();
$form = GFExport::add_default_export_fields($form);
if (is_array($form["fields"])) {
foreach ($form["fields"] as $field) {
if (is_array(rgar($field, "inputs"))) {
foreach ($field["inputs"] as $input) {
$fields[] = array($input["id"], GFCommon::get_label($field, $input["id"]));
}
} else {
if (!rgar($field, "displayOnly")) {
$fields[] = array($field["id"], GFCommon::get_label($field));
}
}
}
}
$field_json = GFCommon::json_encode($fields);
die("EndSelectExportForm({$field_json});");
}