本文整理汇总了PHP中FrmForm::getAll方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmForm::getAll方法的具体用法?PHP FrmForm::getAll怎么用?PHP FrmForm::getAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrmForm
的用法示例。
在下文中一共展示了FrmForm::getAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
function prepare_items()
{
global $wpdb, $per_page, $frm_settings;
$paged = $this->get_pagenum();
$default_orderby = 'name';
$default_order = 'ASC';
$orderby = isset($_REQUEST['orderby']) ? $_REQUEST['orderby'] : $default_orderby;
$order = isset($_REQUEST['order']) ? $_REQUEST['order'] : $default_order;
$page = $this->get_pagenum();
$default_count = empty($this->page_name) ? 20 : 10;
$per_page = $this->get_items_per_page('formidable_page_formidable' . str_replace('-', '_', $this->page_name) . '_per_page', $default_count);
$start = isset($_REQUEST['start']) ? $_REQUEST['start'] : ($page - 1) * $per_page;
$s = isset($_REQUEST['s']) ? stripslashes($_REQUEST['s']) : '';
$fid = isset($_REQUEST['fid']) ? $_REQUEST['fid'] : '';
if ($s != '') {
preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches);
$search_terms = array_map('trim', $matches[0]);
}
$s_query = " (status is NULL OR status = '' OR status = 'published') AND default_template=0 AND is_template = " . (int) $this->params['template'];
if ($s != '') {
foreach ((array) $search_terms as $term) {
if (!empty($s_query)) {
$s_query .= " AND";
}
$term = FrmAppHelper::esc_like($term);
$s_query .= $wpdb->prepare(" (name like %s OR description like %s OR created_at like %s)", '%' . $term . '%', '%' . $term . '%', '%' . $term . '%');
unset($term);
}
}
$frm_form = new FrmForm();
$this->items = $frm_form->getAll($s_query, " ORDER BY {$orderby} {$order}", " LIMIT {$start}, {$per_page}", true, false);
$total_items = FrmAppHelper::getRecordCount($s_query, $this->table_name);
$this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page));
}
示例2: form
public static function form($errors = array(), $message = '')
{
$where = array('parent_form_id' => array(null, 0), 'status' => array(null, '', 'published'));
$forms = FrmForm::getAll($where, 'name');
$export_types = apply_filters('frm_xml_export_types', array('forms' => __('Forms', 'formidable'), 'items' => __('Entries', 'formidable')));
$export_format = apply_filters('frm_export_formats', array('xml' => array('name' => 'XML', 'support' => 'forms', 'count' => 'multiple'), 'csv' => array('name' => 'CSV', 'support' => 'items', 'count' => 'single')));
include FrmAppHelper::plugin_path() . '/classes/views/xml/import_form.php';
}
示例3: form
public static function form($errors = array(), $message = '')
{
$forms = FrmForm::getAll(array('status' => array(null, '', 'published')), 'name');
$export_types = apply_filters('frm_xml_export_types', array('forms' => __('Forms', 'formidable')));
$export_format = apply_filters('frm_export_formats', array('xml' => array('name' => 'XML', 'support' => 'forms', 'count' => 'multiple')));
if (FrmAppHelper::pro_is_installed()) {
$frmpro_settings = new FrmProSettings();
$csv_format = $frmpro_settings->csv_format;
} else {
$csv_format = 'UTF-8';
}
include FrmAppHelper::plugin_path() . '/classes/views/xml/import_form.php';
}
示例4: form
public static function form($errors = array(), $message = '')
{
//wp_enqueue_script('jquery-chosen');
//wp_enqueue_style('formidable');
$frm_form = new FrmForm();
$forms = $frm_form->getAll("status is NULL OR status = '' OR status = 'published'", ' ORDER BY name');
unset($frm_form);
$export_types = apply_filters('frm_xml_export_types', array('forms' => __('Forms', 'formidable')));
$export_format = apply_filters('frm_export_formats', array('xml' => array('name' => 'XML', 'support' => 'forms', 'count' => 'multiple')));
global $frmpro_settings;
$csv_format = $frmpro_settings ? $frmpro_settings->csv_format : 'UTF-8';
include FrmAppHelper::plugin_path() . '/classes/views/xml/import_form.php';
}
示例5: test_destroy
/**
* @covers FrmForm::destroy
*/
function test_destroy()
{
$forms = FrmForm::getAll();
$this->assertNotEmpty(count($forms));
foreach ($forms as $form) {
if ($form->is_template) {
continue;
}
$id = FrmForm::destroy($form->id);
$form_exists = FrmForm::getOne($form->id);
$this->assertEmpty($form_exists, 'Failed to delete form ' . $form->form_key);
$subforms_exist = FrmForm::getAll(array('parent_form_id' => $form->id));
$this->assertEmpty($subforms_exist, 'Failed to delete child forms for parent form ' . $form->form_key);
}
}
示例6: prepare_items
public function prepare_items()
{
global $wpdb, $per_page, $mode;
$mode = empty($_REQUEST['mode']) ? 'list' : $_REQUEST['mode'];
$default_orderby = 'name';
$default_order = 'ASC';
$orderby = isset($_REQUEST['orderby']) ? $_REQUEST['orderby'] : $default_orderby;
$order = isset($_REQUEST['order']) ? $_REQUEST['order'] : $default_order;
$page = $this->get_pagenum();
$per_page = $this->get_items_per_page('formidable_page_formidable_per_page');
$start = isset($_REQUEST['start']) ? $_REQUEST['start'] : ($page - 1) * $per_page;
$s_query = array();
$s_query[] = array('or' => 1, 'parent_form_id' => null, 'parent_form_id <' => 1);
switch ($this->status) {
case 'template':
$s_query['is_template'] = 1;
$s_query['status !'] = 'trash';
break;
case 'draft':
$s_query['is_template'] = 0;
$s_query['status'] = 'draft';
break;
case 'trash':
$s_query['status'] = 'trash';
break;
default:
$s_query['is_template'] = 0;
$s_query['status !'] = 'trash';
break;
}
$s = isset($_REQUEST['s']) ? stripslashes($_REQUEST['s']) : '';
if ($s != '') {
preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches);
$search_terms = array_map('trim', $matches[0]);
foreach ((array) $search_terms as $term) {
$s_query[] = array('or' => true, 'name LIKE' => $term, 'description LIKE' => $term, 'created_at LIKE' => $term);
unset($term);
}
}
$this->items = FrmForm::getAll($s_query, $orderby . ' ' . $order, $start . ',' . $per_page);
$total_items = FrmDb::get_count('frm_forms', $s_query);
$this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page));
}
示例7: popup_opts_frm_graph
private static function popup_opts_frm_graph(array &$opts, $shortcode)
{
$form_list = FrmForm::getAll(array('status' => 'published', 'is_template' => 0), 'name');
?>
<h4 class="frm_left_label"><?php
_e('Select a field:', 'formidable');
?>
</h4>
<select class="frm_get_field_selection" id="frm_form_frmsc_<?php
echo esc_attr($shortcode);
?>
_id">
<option value="">— <?php
_e('Select Form', 'formidable');
?>
—</option>
<?php
foreach ($form_list as $form_opts) {
?>
<option value="<?php
echo esc_attr($form_opts->id);
?>
"><?php
echo '' == $form_opts->name ? __('(no title)', 'formidable') : esc_html(FrmAppHelper::truncate($form_opts->name, 30));
?>
</option>
<?php
}
?>
</select>
<span id="frm_form_frmsc_<?php
echo esc_attr($shortcode);
?>
_id_fields">
</span>
<div class="frm_box_line"></div>
<?php
$opts = array('type' => array('val' => 'default', 'label' => __('Graph Type', 'formidable'), 'type' => 'select', 'opts' => array('default' => __('Default', 'formidable'), 'bar' => __('Bar', 'formidable'), 'column' => __('Column', 'formidable'), 'pie' => __('Pie', 'formidable'), 'line' => __('Line', 'formidable'), 'area' => __('Area', 'formidable'), 'SteppedArea' => __('Stepped Area', 'formidable'), 'geo' => __('Geolocation Map', 'formidable'))), 'data_type' => array('val' => 'count', 'label' => __('Data Type', 'formidable'), 'type' => 'select', 'opts' => array('count' => __('The number of entries', 'formidable'), 'total' => __('Add the field values together', 'formidable'), 'average' => __('Average the totaled field values', 'formidable'))), 'height' => array('val' => '', 'label' => __('Height', 'formidable'), 'type' => 'text'), 'width' => array('val' => '', 'label' => __('Width', 'formidable'), 'type' => 'text'), 'bg_color' => array('val' => '', 'label' => __('Background color', 'formidable'), 'type' => 'text'), 'truncate_label' => array('val' => '', 'label' => __('Truncate graph labels', 'formidable'), 'type' => 'text'), 'truncate' => array('val' => '', 'label' => __('Truncate title', 'formidable'), 'type' => 'text'), 'title' => array('val' => '', 'label' => __('Graph title', 'formidable'), 'type' => 'text'), 'title_size' => array('val' => '', 'label' => __('Title font size', 'formidable'), 'type' => 'text'), 'title_font' => array('val' => '', 'label' => __('Title font name', 'formidable'), 'type' => 'text'), 'is3d' => array('val' => 1, 'label' => __('Turn your pie graph three-dimensional', 'formidable'), 'show' => array('type' => 'pie')), 'include_zero' => array('val' => 1, 'label' => __('When using dates for the x_axis parameter, you can also fill in dates with a zero value. This will also apply to dropdown, radio, and checkbox fields with no x_axis defined.', 'formidable')), 'show_key' => array('val' => 1, 'label' => __('Include the key with the graph', 'formidable')));
/*
'ids' => false,
'colors' => '', 'grid_color' => '#CCC',
'response_count' => 10, 'user_id' => false, 'entry_id' => false,
'x_axis' => false, 'limit' => '',
'x_start' => '', 'x_end' => '', 'min' => '', 'max' => '', 'y_title' => '', 'x_title' => '',
'field' => false, 'tooltip_label' => '',
'start_date' => '', 'end_date' => '', 'group_by' => '', 'x_order' => '1',
any field id in this form => value
*/
}
示例8: form
function form()
{
$forms = FrmForm::getAll("is_template=0 AND (status is NULL OR status = '' OR status = 'published')", ' ORDER BY name');
include_once FRMPRO_VIEWS_PATH . '/shared/import_form.php';
}
示例9: import_xml_forms
public static function import_xml_forms($forms, $imported)
{
// Keep track of repeating sections and child forms that are imported
$repeat_fields = $child_forms_missing_parent = array();
foreach ($forms as $item) {
$form = array('id' => (int) $item->id, 'form_key' => (string) $item->form_key, 'name' => (string) $item->name, 'description' => (string) $item->description, 'options' => (string) $item->options, 'logged_in' => (int) $item->logged_in, 'is_template' => (int) $item->is_template, 'default_template' => (int) $item->default_template, 'editable' => (int) $item->editable, 'status' => (string) $item->status, 'parent_form_id' => isset($item->parent_form_id) ? (int) $item->parent_form_id : 0, 'created_at' => date('Y-m-d H:i:s', strtotime((string) $item->created_at)));
$form['options'] = FrmAppHelper::maybe_json_decode($form['options']);
// if template, allow to edit if form keys match, otherwise, creation date must also match
$edit_query = array('form_key' => $form['form_key'], 'is_template' => $form['is_template']);
if (!$form['is_template']) {
$edit_query['created_at'] = $form['created_at'];
}
$old_parent_form_id = self::maybe_replace_parent_form_id($imported['forms'], $form['parent_form_id']);
$edit_query = apply_filters('frm_match_xml_form', $edit_query, $form);
$this_form = FrmForm::getAll($edit_query, '', 1);
unset($edit_query);
if (!empty($this_form)) {
$old_id = $form_id = $this_form->id;
FrmForm::update($form_id, $form);
$imported['updated']['forms']++;
// Keep track of whether this specific form was updated or not
$imported['form_status'][$form_id] = 'updated';
$form_fields = FrmField::get_all_for_form($form_id);
$old_fields = array();
foreach ($form_fields as $f) {
$old_fields[$f->id] = $f;
$old_fields[$f->field_key] = $f->id;
unset($f);
}
$form_fields = $old_fields;
unset($old_fields);
} else {
$old_id = false;
//form does not exist, so create it
$form_id = FrmForm::create($form);
if ($form_id) {
$imported['imported']['forms']++;
// Keep track of whether this specific form was updated or not
$imported['form_status'][$form_id] = 'imported';
self::track_child_forms_missing_parent((int) $form_id, $old_parent_form_id, $child_forms_missing_parent);
}
}
self::import_xml_fields($item->field, $form_id, $this_form, $form_fields, $imported, $repeat_fields);
// Delete any fields attached to this form that were not included in the template
if (isset($form_fields) && !empty($form_fields)) {
foreach ($form_fields as $field) {
if (is_object($field)) {
FrmField::destroy($field->id);
}
unset($field);
}
unset($form_fields);
}
// Update field ids/keys to new ones
do_action('frm_after_duplicate_form', $form_id, $form, array('old_id' => $old_id));
$imported['forms'][(int) $item->id] = $form_id;
// Send pre 2.0 form options through function that creates actions
self::migrate_form_settings_to_actions($form['options'], $form_id, $imported, $switch = true);
unset($form, $item);
}
self::update_repeat_field_options($repeat_fields, $imported['forms']);
self::update_child_form_parents($child_forms_missing_parent, $imported['forms']);
return $imported;
}
示例10: get_params
public static function get_params($form = null)
{
global $frm_vars;
$frm_form = new FrmForm();
if (!$form) {
$form = $frm_form->getAll(array(), 'name', 1);
} else {
if (!is_object($form)) {
$form = $frm_form->getOne($form);
}
}
if (isset($frm_vars['form_params']) && is_array($frm_vars['form_params']) && isset($frm_vars['form_params'][$form->id])) {
return $frm_vars['form_params'][$form->id];
}
$action_var = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
$action = apply_filters('frm_show_new_entry_page', FrmAppHelper::get_param($action_var, 'new'), $form);
$default_values = array('id' => '', 'form_name' => '', 'paged' => 1, 'form' => $form->id, 'form_id' => $form->id, 'field_id' => '', 'search' => '', 'sort' => '', 'sdir' => '', 'action' => $action);
$values['posted_form_id'] = FrmAppHelper::get_param('form_id');
if (!is_numeric($values['posted_form_id'])) {
$values['posted_form_id'] = FrmAppHelper::get_param('form');
}
if ($form->id == $values['posted_form_id']) {
//if there are two forms on the same page, make sure not to submit both
foreach ($default_values as $var => $default) {
if ($var == 'action') {
$values[$var] = FrmAppHelper::get_param($action_var, $default);
} else {
$values[$var] = FrmAppHelper::get_param($var, $default);
}
unset($var);
unset($default);
}
} else {
foreach ($default_values as $var => $default) {
$values[$var] = $default;
unset($var);
unset($default);
}
}
if (in_array($values['action'], array('create', 'update')) and (!isset($_POST) or !isset($_POST['action']) and !isset($_POST['frm_action']))) {
$values['action'] = 'new';
}
return $values;
}
示例11: upgrade
function upgrade()
{
global $wpdb, $frmdb;
$db_version = FrmAppHelper::$pro_db_version;
// this is the version of the database we're moving to
$old_db_version = get_option('frmpro_db_version');
if ($db_version == $old_db_version) {
return;
}
// update rewrite rules for views
flush_rewrite_rules();
if ($old_db_version) {
if ($db_version >= 3 && $old_db_version < 3) {
//migrate hidden field data into the parent field
global $frm_field;
$wpdb->update($frmdb->fields, array('type' => 'scale'), array('type' => '10radio'));
$fields = $frm_field->getAll();
foreach ($fields as $field) {
$field->field_options = maybe_unserialize($field->field_options);
if (isset($field->field_options['hide_field']) and is_numeric($field->field_options['hide_field']) and (isset($field->field_options['hide_opt']) and !empty($field->field_options['hide_opt']) or isset($field->field_options['form_select']) and !empty($field->field_options['form_select']))) {
global $frm_field;
//save hidden fields to parent field
$parent_field = $frm_field->getOne($field->field_options['hide_field']);
if ($parent_field) {
$parent_options = maybe_unserialize($parent_field->field_options);
if (!isset($parent_options['dependent_fields'])) {
$parent_options['dependent_fields'] = array();
} else {
foreach ($parent_options['dependent_fields'] as $child_id => $child_opt) {
if (empty($child_opt) or $child_opt == '') {
unset($parent_options['dependent_fields'][$child_id]);
} else {
if ($child_id != $field->id) {
//check to make sure this field is still dependent
$check_field = $frm_field->getOne($child_id);
$check_options = maybe_unserialize($check_field->field_options);
if (!is_numeric($check_options['hide_field']) or $check_options['hide_field'] != $parent_field->id or empty($check_options['hide_opt']) and empty($check_options['form_select'])) {
unset($parent_options['dependent_fields'][$child_id]);
}
}
}
}
}
$dep_fields = array();
if ($field->type == 'data' and isset($field->field_options['form_select']) and is_numeric($field_options['form_select'])) {
$dep_fields[] = $field->field_options['form_select'];
$dep_fields[] = $field->field_options['data_type'];
} else {
if (isset($field->field_options['hide_opt']) and !empty($field->field_options['hide_opt'])) {
$dep_fields[] = $field->field_options['hide_opt'];
}
}
if (!empty($dep_fields)) {
$parent_options['dependent_fields'][$field->id] = $dep_fields;
}
$frm_field->update($parent_field->id, array('field_options' => $parent_options));
}
}
}
}
if ($db_version >= 16 and $old_db_version < 16) {
//migrate table into wp_posts
$display_posts = array();
if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}frm_display'")) {
//only migrate if table exists
$dis = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}frm_display");
} else {
$dis = array();
}
foreach ($dis as $d) {
$post = array('post_title' => $d->name, 'post_content' => $d->content, 'post_date' => $d->created_at, 'post_excerpt' => $d->description, 'post_name' => $d->display_key, 'post_status' => 'publish', 'post_type' => 'frm_display');
$post_ID = wp_insert_post($post);
unset($post);
update_post_meta($post_ID, 'frm_old_id', $d->id);
if (!isset($d->show_count) or empty($d->show_count)) {
$d->show_count = 'none';
}
foreach (array('dyncontent', 'param', 'form_id', 'post_id', 'entry_id', 'param', 'type', 'show_count', 'insert_loc') as $f) {
update_post_meta($post_ID, 'frm_' . $f, $d->{$f});
unset($f);
}
$d->options = maybe_unserialize($d->options);
update_post_meta($post_ID, 'frm_options', $d->options);
if (isset($d->options['insert_loc']) and $d->options['insert_loc'] != 'none' and is_numeric($d->options['post_id']) and !isset($display_posts[$d->options['post_id']])) {
$display_posts[$d->options['post_id']] = $post_ID;
}
unset($d);
unset($post_ID);
}
unset($dis);
global $frmdb, $frmpro_display;
//get all post_ids from frm_entries
$entry_posts = $wpdb->get_results("SELECT id, post_id, form_id FROM {$frmdb->entries} WHERE post_id > 0");
$form_display = array();
foreach ($entry_posts as $ep) {
if (isset($form_display[$ep->form_id])) {
$display_posts[$ep->post_id] = $form_display[$ep->form_id];
} else {
$d = $frmpro_display->get_auto_custom_display(array('post_id' => $ep->post_id, 'form_id' => $ep->form_id, 'entry_id' => $ep->id));
$display_posts[$ep->post_id] = $form_display[$ep->form_id] = $d ? $d->ID : 0;
//.........这里部分代码省略.........
示例12: add_default_templates
public static function add_default_templates($path, $default = true, $template = true)
{
_deprecated_function(__FUNCTION__, '1.07.05', 'FrmXMLController::add_default_templates()');
global $frm_field;
$path = untrailingslashit(trim($path));
$templates = glob($path . "/*.php");
$frm_form = new FrmForm();
for ($i = count($templates) - 1; $i >= 0; $i--) {
$filename = str_replace('.php', '', str_replace($path . '/', '', $templates[$i]));
$template_query = array('form_key' => $filename);
if ($template) {
$template_query['is_template'] = 1;
}
if ($default) {
$template_query['default_template'] = 1;
}
$form = $frm_form->getAll($template_query, '', 1);
$values = FrmFormsHelper::setup_new_vars();
$values['form_key'] = $filename;
$values['is_template'] = $template;
$values['status'] = 'published';
if ($default) {
$values['default_template'] = 1;
}
include $templates[$i];
//get updated form
if (isset($form) && $form) {
$form = $frm_form->getOne($form->id);
} else {
$form = $frm_form->getAll($template_query, '', 1);
}
if ($form) {
do_action('frm_after_duplicate_form', $form->id, (array) $form);
}
}
}
示例13: form_switcher
public static function form_switcher()
{
$where = apply_filters('frm_forms_dropdown', "is_template=0 AND (status is NULL OR status = '' OR status = 'published')", '');
$frm_form = new FrmForm();
$forms = $frm_form->getAll($where, ' ORDER BY name');
unset($frm_form);
$args = array('id' => 0, 'form' => 0);
if (isset($_GET['id']) and !isset($_GET['form'])) {
unset($args['form']);
} else {
if (isset($_GET['form']) and !isset($_GET['id'])) {
unset($args['id']);
}
}
if (isset($_GET['page']) and $_GET['page'] == 'formidable-entries' and isset($_GET['frm_action']) and in_array($_GET['frm_action'], array('edit', 'show', 'destroy_all'))) {
$args['frm_action'] = 'list';
$args['form'] = 0;
} else {
if (isset($_GET['page']) and $_GET['page'] == 'formidable' and isset($_GET['frm_action']) and $_GET['frm_action'] == 'new') {
$args['frm_action'] = 'edit';
} else {
if (isset($_GET['post'])) {
$args['form'] = 0;
$base = admin_url('edit.php?post_type=frm_display');
}
}
}
?>
<li class="dropdown last" id="frm_bs_dropdown">
<a href="#" id="frm-navbarDrop" class="frm-dropdown-toggle" data-toggle="dropdown"><?php
_e('Switch Form', 'formidable');
?>
<b class="caret"></b></a>
<ul class="frm-dropdown-menu" role="menu" aria-labelledby="frm-navbarDrop">
<?php
foreach ($forms as $form) {
if (isset($args['id'])) {
$args['id'] = $form->id;
}
if (isset($args['form'])) {
$args['form'] = $form->id;
}
?>
<li><a href="<?php
echo isset($base) ? add_query_arg($args, $base) : add_query_arg($args);
?>
" tabindex="-1"><?php
echo empty($form->name) ? __('(no title)') : FrmAppHelper::truncate($form->name, 33);
?>
</a></li>
<?php
unset($form);
}
?>
</ul>
</li>
<?php
}
示例14: FrmForm
echo $field['id'];
?>
]" id="dyn_default_value_<?php
echo $field['id'];
?>
" value="<?php
echo esc_attr($field['dyn_default_value']);
?>
" class="dyn_default_value frm_long_input" /></td>
</tr>
<?php
}
if ($field['type'] == 'data') {
global $frm_field;
$frm_form = new FrmForm();
$form_list = $frm_form->getAll(array('status' => 'published', 'is_template' => 0), 'name');
$selected_field = '';
$current_field_id = $field['id'];
if (isset($field['form_select']) && is_numeric($field['form_select'])) {
$selected_field = $frm_field->getOne($field['form_select']);
if ($selected_field) {
$fields = $frm_field->getAll(array('fi.form_id' => $selected_field->form_id));
} else {
$selected_field = '';
}
} else {
if (isset($field['form_select'])) {
$selected_field = $field['form_select'];
}
}
require FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-fields/dynamic-options.php';
示例15: test_imported_forms
function test_imported_forms()
{
$imported_forms = FrmForm::getAll();
self::_check_parent_form_id($imported_forms);
}