本文整理汇总了PHP中FrmAppHelper::setup_edit_vars方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmAppHelper::setup_edit_vars方法的具体用法?PHP FrmAppHelper::setup_edit_vars怎么用?PHP FrmAppHelper::setup_edit_vars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrmAppHelper
的用法示例。
在下文中一共展示了FrmAppHelper::setup_edit_vars方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_edit_vars
function get_edit_vars($id, $errors = '', $message = '')
{
if (!current_user_can('frm_edit_entries')) {
return $this->show($id);
}
global $frm_form, $frm_entry, $frm_field, $frm_next_page, $frmpro_settings, $frm_editing_entry;
$title = $description = true;
$record = $frm_entry->getOne($id, true);
$frm_editing_entry = $id;
$form = $frm_form->getOne($record->form_id);
$fields = FrmFieldsHelper::get_form_fields($form->id, !empty($errors));
$values = FrmAppHelper::setup_edit_vars($record, 'entries', $fields);
$submit = isset($frm_next_page[$form->id]) ? $frm_next_page[$form->id] : (isset($values['edit_value']) ? $values['edit_value'] : $frmpro_settings->update_value);
require FRMPRO_VIEWS_PATH . '/frmpro-entries/edit.php';
}
示例2: get_settings_vars
public static function get_settings_vars($id, $errors = array(), $message = '')
{
FrmAppHelper::permission_check('frm_edit_forms');
global $frm_vars;
$form = FrmForm::getOne($id);
$fields = FrmField::get_all_for_form($id);
$values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
if (isset($values['default_template']) && $values['default_template']) {
wp_die(__('That template cannot be edited', 'formidable'));
}
$action_controls = FrmFormActionsController::get_form_actions();
$sections = apply_filters('frm_add_form_settings_section', array(), $values);
$pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"';
$styles = apply_filters('frm_get_style_opts', array());
require FrmAppHelper::plugin_path() . '/classes/views/frm-forms/settings.php';
}
示例3: get_settings_vars
public static function get_settings_vars($id, $errors = '', $message = '')
{
global $frm_entry, $frm_field, $frm_vars;
$frm_form = new FrmForm();
$form = $frm_form->getOne($id);
$fields = $frm_field->getAll(array('fi.form_id' => $id), 'field_order');
$values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
$sections = apply_filters('frm_add_form_settings_section', array(), $values);
$pro_feature = $frm_vars['pro_is_installed'] ? '' : ' class="pro_feature"';
if (isset($values['default_template']) && $values['default_template']) {
wp_die(__('That template cannot be edited', 'formidable'));
} else {
require FrmAppHelper::plugin_path() . '/classes/views/frm-forms/settings.php';
}
}
示例4: get_edit_vars
private static function get_edit_vars($id, $errors = array(), $message = '')
{
global $frm_vars;
$description = true;
$title = false;
$record = FrmEntry::getOne($id, true);
if (!$record) {
wp_die(__('You are trying to access an entry that does not exist.', 'formidable'));
return;
}
$frm_vars['editing_entry'] = $id;
$form = FrmForm::getOne($record->form_id);
$form = apply_filters('frm_pre_display_form', $form);
$fields = FrmFieldsHelper::get_form_fields($form->id, !empty($errors));
$values = FrmAppHelper::setup_edit_vars($record, 'entries', $fields);
$frmpro_settings = new FrmProSettings();
$edit_create = $record->is_draft ? isset($values['submit_value']) ? $values['submit_value'] : $frmpro_settings->submit_value : (isset($values['edit_value']) ? $values['edit_value'] : $frmpro_settings->update_value);
$submit = isset($frm_vars['next_page'][$form->id]) ? $frm_vars['next_page'][$form->id] : $edit_create;
unset($edit_create);
if (is_object($submit)) {
$submit = $submit->name;
}
require FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-entries/edit.php';
}
示例5: get_edit_vars
private static function get_edit_vars($id, $errors = '', $message = '')
{
global $frm_entry, $frm_field, $frmpro_settings, $frm_vars;
$description = true;
$title = false;
$record = $frm_entry->getOne($id, true);
$frm_vars['editing_entry'] = $id;
$frm_form = new FrmForm();
$form = $frm_form->getOne($record->form_id);
$form = apply_filters('frm_pre_display_form', $form);
$fields = FrmFieldsHelper::get_form_fields($form->id, !empty($errors));
$values = FrmAppHelper::setup_edit_vars($record, 'entries', $fields);
$edit_create = $record->is_draft ? isset($values['submit_value']) ? $values['submit_value'] : $frmpro_settings->submit_value : (isset($values['edit_value']) ? $values['edit_value'] : $frmpro_settings->update_value);
$submit = isset($frm_vars['next_page'][$form->id]) ? $frm_vars['next_page'][$form->id] : $edit_create;
unset($edit_create);
if (is_object($submit)) {
$submit = $submit->name;
}
require FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-entries/edit.php';
}
示例6: repeat_field_set
public static function repeat_field_set($field_name, $args = array())
{
$defaults = array('i' => 0, 'entry_id' => false, 'form' => false, 'fields' => array(), 'errors' => array(), 'parent_field' => 0, 'repeat' => 0, 'row_count' => false, 'value' => '', 'field_name' => '');
$args = wp_parse_args($args, $defaults);
if (empty($args['parent_field'])) {
return;
}
if (is_numeric($args['parent_field'])) {
$args['parent_field'] = (array) FrmField::getOne($args['parent_field']);
$args['parent_field']['format'] = isset($args['parent_field']['field_options']['format']) ? $args['parent_field']['field_options']['format'] : '';
}
FrmForm::maybe_get_form($args['form']);
if (empty($args['fields'])) {
$args['fields'] = FrmField::get_all_for_form($args['form']->id);
}
$values = array();
if ($args['fields']) {
// Get the ID of the form that houses the embedded form or repeating section
$parent_form_id = $args['parent_field']['form_id'];
if (empty($args['entry_id'])) {
$values = FrmEntriesHelper::setup_new_vars($args['fields'], $args['form'], false, array('parent_form_id' => $parent_form_id));
} else {
$entry = FrmEntry::getOne($args['entry_id'], true);
if ($entry && $entry->form_id == $args['form']->id) {
$values = FrmAppHelper::setup_edit_vars($entry, 'entries', $args['fields'], false, array(), array('parent_form_id' => $parent_form_id));
} else {
return;
}
}
}
$format = isset($args['parent_field']['format']) ? $args['parent_field']['format'] : '';
$end = false;
$count = 0;
foreach ($values['fields'] as $subfield) {
if ('end_divider' == $subfield['type']) {
$end = $subfield;
} else {
if (!in_array($subfield['type'], array('hidden', 'user_id'))) {
if (isset($subfield['conf_field']) && $subfield['conf_field']) {
$count = $count + 2;
} else {
$count++;
}
}
}
unset($subfield);
}
if ($args['repeat']) {
$count++;
}
$classes = array(2 => 'half', 3 => 'third', 4 => 'fourth', 5 => 'fifth', 6 => 'sixth', 7 => 'seventh', 8 => 'eighth');
$field_class = !empty($format) && isset($classes[$count]) ? $classes[$count] : '';
echo '<div id="frm_section_' . $args['parent_field']['id'] . '-' . $args['i'] . '" class="frm_repeat_' . (empty($format) ? 'sec' : $format) . ' frm_repeat_' . $args['parent_field']['id'] . ($args['row_count'] === 0 ? ' frm_first_repeat' : '') . '">' . "\n";
self::add_hidden_repeat_entry_id($args);
self::add_default_item_meta_field($args);
$label_pos = 'top';
$field_num = 1;
foreach ($values['fields'] as $subfield) {
$subfield_name = $field_name . '[' . $args['i'] . '][' . $subfield['id'] . ']';
$subfield_plus_id = '-' . $args['i'];
$subfield_id = $subfield['id'] . '-' . $args['parent_field']['id'] . $subfield_plus_id;
if ($args['parent_field'] && !empty($args['parent_field']['value']) && isset($args['parent_field']['value']['form']) && isset($args['parent_field']['value'][$args['i']]) && isset($args['parent_field']['value'][$args['i']][$subfield['id']])) {
// this is a posted value from moving between pages, so set the POSTed value
$subfield['value'] = $args['parent_field']['value'][$args['i']][$subfield['id']];
}
if (!empty($field_class)) {
if (1 == $field_num) {
$subfield['classes'] .= ' frm_first frm_' . $field_class;
} else {
$subfield['classes'] .= ' frm_' . $field_class;
}
}
$field_num++;
if ('top' == $label_pos && in_array($subfield['label'], array('top', 'hidden', ''))) {
// add placeholder label if repeating
$label_pos = 'hidden';
}
$field_args = array('field_name' => $subfield_name, 'field_id' => $subfield_id, 'field_plus_id' => $subfield_plus_id, 'section_id' => $args['parent_field']['id']);
if (apply_filters('frm_show_normal_field_type', true, $subfield['type'])) {
echo FrmFieldsHelper::replace_shortcodes($subfield['custom_html'], $subfield, $args['errors'], $args['form'], $field_args);
} else {
do_action('frm_show_other_field_type', $subfield, $args['form'], $field_args);
}
unset($subfield_name, $subfield_id);
do_action('frm_get_field_scripts', $subfield, $args['form'], $args['parent_field']['form_id']);
}
if (!$args['repeat']) {
// Close frm_repeat div
echo '</div>' . "\n";
return;
}
$args['format'] = $format;
$args['label_pos'] = $label_pos;
$args['field_class'] = $field_class;
echo self::repeat_buttons($args, $end);
// Close frm_repeat div
echo '</div>' . "\n";
}
示例7: translate
function translate($form, $action)
{
global $frm_field, $wpdb, $sitepress;
if (!function_exists('icl_t')) {
_e('You do not have WPML installed', 'formidable');
return;
}
if ($action == 'update_translate' and isset($_POST) and isset($_POST['frm_wpml'])) {
foreach ($_POST['frm_wpml'] as $tkey => $t) {
$st = array('value' => $t['value']);
$st['status'] = isset($t['status']) ? $t['status'] : ICL_STRING_TRANSLATION_NOT_TRANSLATED;
if (is_numeric($tkey)) {
$wpdb->update("{$wpdb->prefix}icl_string_translations", $st, array('id' => $tkey));
} else {
if (!empty($t['value'])) {
$info = explode('_', $tkey);
if (!is_numeric($info[0])) {
continue;
}
$st['string_id'] = $info[0];
$st['language'] = $info[1];
$st['translator_id'] = get_current_user_id();
$st['translation_date'] = current_time('mysql');
$wpdb->insert("{$wpdb->prefix}icl_string_translations", $st);
}
}
unset($t);
unset($tkey);
}
}
$id = $form->id;
$langs = $sitepress->get_active_languages();
ksort($langs);
$lang_count = count($langs) - 1;
if (class_exists('FormidableWPML')) {
$formidable_wpml = new FormidableWPML();
$formidable_wpml->get_translatable_items(array(), 'formidable', '');
}
$strings = $wpdb->get_results("SELECT id, name, value, language FROM {$wpdb->prefix}icl_strings\n WHERE context='formidable' AND name LIKE '{$id}_%' ORDER BY name DESC", OBJECT_K);
if ($strings) {
$translations = $wpdb->get_results("SELECT id, string_id, value, status, language \n FROM {$wpdb->prefix}icl_string_translations WHERE string_id in (" . implode(',', array_keys($strings)) . ") \n ORDER BY language ASC");
$base_lang = reset($strings)->language;
$col_order = array($base_lang);
} else {
$base_lang = reset($langs);
}
$fields = $frm_field->getAll(array('fi.form_id' => $id), 'field_order');
$values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
include FRMPRO_VIEWS_PATH . '/frmpro-forms/translate.php';
}
示例8: get_settings_vars
function get_settings_vars($id, $errors = '', $message = '')
{
global $frm_entry, $frm_form, $frm_field, $frmpro_is_installed, $frm_ajax_url;
$record = $frm_form->getOne($id);
$fields = $frm_field->getAll(array('fi.form_id' => $id), 'field_order');
$values = FrmAppHelper::setup_edit_vars($record, 'forms', $fields, true);
$sections = apply_filters('frm_add_form_settings_section', array(), $values);
$pro_feature = $frmpro_is_installed ? '' : ' class="pro_feature"';
if (isset($values['default_template']) && $values['default_template']) {
wp_die(__('That template cannot be edited', 'formidable'));
} else {
require FRM_VIEWS_PATH . '/frm-forms/settings.php';
}
}