function entry_link_shortcode($atts) { global $user_ID, $frm_entry, $frm_entry_meta, $post; extract(shortcode_atts(array('id' => false, 'field_key' => 'created_at', 'type' => 'list', 'logged_in' => true, 'edit' => true, 'class' => '', 'link_type' => 'page', 'blank_label' => '', 'param_name' => 'entry', 'param_value' => 'key', 'page_id' => false, 'show_delete' => false), $atts)); if (!$id or $logged_in && !$user_ID) { return; } $id = (int) $id; if ($show_delete === 1) { $show_delete = __('Delete', 'formidable'); } $s = FrmAppHelper::get_param('frm_search', false); if ($s) { $entry_ids = FrmProEntriesHelper::get_search_ids($s, $id); } else { $entry_ids = $frm_entry_meta->getEntryIds("fi.form_id='{$id}'"); } if ($entry_ids) { $id_list = implode(',', $entry_ids); $order = $type == 'collapse' ? ' ORDER BY it.created_at DESC' : ''; $where = "it.id in ({$id_list})"; if ($logged_in) { $where .= " and it.form_id='" . $id . "' and it.user_id='" . (int) $user_ID . "'"; } $entries = $frm_entry->getAll($where, $order, '', true); } if (!empty($entries)) { if ($type == 'list') { $content = "<ul class='frm_entry_ul {$class}'>\n"; } else { if ($type == 'collapse') { $content = '<div class="frm_collapse">'; $year = $month = ''; $prev_year = $prev_month = false; } else { $content = "<select id='frm_select_form_{$id}' name='frm_select_form_{$id}' class='{$class}' onchange='location=this.options[this.selectedIndex].value;'>\n <option value='" . get_permalink($post->ID) . "'>{$blank_label}</option>\n"; } } global $frm_field; if ($field_key != 'created_at') { $field = $frm_field->getOne($field_key); } foreach ($entries as $entry) { $action = (isset($_GET) and isset($_GET['frm_action'])) ? 'frm_action' : 'action'; if (isset($_GET) and isset($_GET[$action]) and $_GET[$action] == 'destroy') { if (isset($_GET['entry']) and ($_GET['entry'] == $entry->item_key or $_GET['entry'] == $entry->id)) { continue; } } if ($entry->post_id) { global $wpdb; $post_status = $wpdb->get_var("SELECT post_status FROM {$wpdb->posts} WHERE ID=" . $entry->post_id); if ($post_status != 'publish') { continue; } } $value = ''; $meta = false; if ($field_key && $field_key != 'created_at') { if ($entry->post_id and ($field and $field->field_options['post_field'] or $field->type == 'tag')) { $value = FrmProEntryMetaHelper::get_post_value($entry->post_id, $field->field_options['post_field'], $field->field_options['custom_field'], array('type' => $field->type, 'form_id' => $field->form_id, 'field' => $field)); } else { $meta = isset($entry->metas[$field_key]) ? $entry->metas[$field_key] : ''; } } else { $meta = reset($entry->metas); } $value = ($field_key == 'created_at' or !isset($meta) or !$meta) ? $value : (is_object($meta) ? $meta->meta_value : $meta); if (empty($value)) { $value = date_i18n(get_option('date_format'), strtotime($entry->created_at)); } else { $value = FrmProEntryMetaHelper::display_value($value, $field, array('type' => $field->type, 'show_filename' => false)); } if ($param_value == 'key') { $args = array($param_name => $entry->item_key); } else { $args = array($param_name => $entry->id); } if ($edit) { $args['frm_action'] = 'edit'; } if ($link_type == 'scroll') { $link = '#' . $entry->item_key; } else { if ($link_type == 'admin') { $link = add_query_arg($args, $_SERVER['REQUEST_URI']); } else { if ($page_id) { $permalink = get_permalink($page_id); } else { $permalink = get_permalink($post->ID); } $link = add_query_arg($args, $permalink); } } unset($args); $current = isset($_GET['entry']) && $_GET['entry'] == $entry->item_key ? true : false; if ($type == 'list') { $content .= "<li><a href='{$link}'>" . stripslashes($value) . "</a>"; if ($show_delete and isset($permalink) and FrmProEntriesHelper::allow_delete($entry)) { $content .= " <a href='" . add_query_arg(array('frm_action' => 'destroy', 'entry' => $entry->id), $permalink) . "' class='frm_delete_list'>{$show_delete}</a>\n"; } $content .= "</li>\n"; } else { if ($type == 'collapse') { $new_year = strftime('%G', strtotime($entry->created_at)); $new_month = strftime('%B', strtotime($entry->created_at)); if ($new_year != $year) { if ($prev_year) { if ($prev_month) { $content .= '</ul></div>'; } $content .= '</div>'; $prev_month = false; } $style = $prev_year ? " style='display:none'" : ''; $triangle = $prev_year ? "e" : "s"; $content .= "\n<div class='frm_year_heading frm_year_heading_{$id}'>\n <span class='ui-icon ui-icon-triangle-1-{$triangle}'></span>\n\n <a>{$new_year}</a></div>\n\n <div class='frm_toggle_container' {$style}>\n"; $prev_year = true; } if ($new_month != $month) { if ($prev_month) { $content .= '</ul></div>'; } $style = $prev_month ? " style='display:none'" : ''; $triangle = $prev_month ? "e" : "s"; $content .= "<div class='frm_month_heading frm_month_heading_{$id}'>\n <span class='ui-icon ui-icon-triangle-1-{$triangle}'></span>\n\n <a>{$new_month}</a>\n</div>\n\n <div class='frm_toggle_container frm_month_listing' {$style}><ul>\n"; $prev_month = true; } $content .= "<li><a href='{$link}'>" . stripslashes($value) . "</a></li>"; $year = $new_year; $month = $new_month; } else { $selected = $current ? ' selected="selected"' : ''; $content .= "<option value='{$link}'{$selected}>" . stripslashes($value) . "</option>\n"; } } } if ($type == 'list') { $content .= "</ul>\n"; } else { if ($type == 'collapse') { if ($prev_year) { $content .= '</div>'; } if ($prev_month) { $content .= '</ul></div>'; } $content .= '</div>'; $content .= "<script type='text/javascript'>jQuery(document).ready(function(\$){ \$('.frm_month_heading_" . $id . ", .frm_year_heading_" . $id . "').toggle(function(){ \$(this).children('.ui-icon-triangle-1-e').addClass('ui-icon-triangle-1-s'); \$(this).children('.ui-icon-triangle-1-s').removeClass('ui-icon-triangle-1-e'); \$(this).next('.frm_toggle_container').fadeIn('slow');},function(){ \$(this).children('.ui-icon-triangle-1-s').addClass('ui-icon-triangle-1-e'); \$(this).children('.ui-icon-triangle-1-e').removeClass('ui-icon-triangle-1-s'); \$(this).next('.frm_toggle_container').hide();});})</script>\n"; } else { $content .= "</select>\n"; if ($show_delete and isset($_GET) and isset($_GET['entry']) and $_GET['entry']) { $content .= " <a href='" . add_query_arg(array('frm_action' => 'destroy', 'entry' => $_GET['entry']), $permalink) . "' class='frm_delete_list'>{$show_delete}</a>\n"; } } } } else { $content = ''; } return $content; }
$col->options = maybe_unserialize($col->options); $count = count($col->options); if ($col->type == 'select' and reset($col->options) == '') { $col->field_options = maybe_unserialize($col->field_options); if ($col->field_options['post_field'] == 'post_status') { $count = 3; } else { $count--; } } if ($count == 1) { $type = 'boolean'; } unset($count); } $val = FrmProEntryMetaHelper::display_value(isset($entry->metas[$col->id]) ? $entry->metas[$col->id] : false, $col, array('type' => $col->type, 'post_id' => $entry->post_id, 'entry_id' => $entry->id, 'show_filename' => false)); if ($type == 'number') { ?> data.setCell(<?php echo $i; ?> ,<?php echo $c; ?> ,<?php echo empty($val) ? '0' : $val; ?> ); <?php } else { if ($type == 'boolean') {
function get_linked_options($values, $field, $entry_id = false) { global $frm_entry_meta, $user_ID, $frm_field, $frmdb; $metas = array(); $selected_field = $frm_field->getOne($values['form_select']); if (!$selected_field) { return array(); } $selected_field->field_options = maybe_unserialize($selected_field->field_options); $linked_posts = (isset($selected_field->field_options['post_field']) and $selected_field->field_options['post_field'] and $selected_field->field_options['post_field'] != '') ? true : false; $post_ids = array(); if (is_numeric($values['hide_field']) and empty($values['hide_opt'])) { global $frmpro_entry_meta; if (isset($_POST) and isset($_POST['item_meta'])) { $observed_field_val = isset($_POST['item_meta'][$values['hide_field']]) ? $_POST['item_meta'][$values['hide_field']] : ''; } else { if ($entry_id) { $observed_field_val = $frm_entry_meta->get_entry_meta_by_field($entry_id, $values['hide_field']); } else { $observed_field_val = ''; } } $observed_field_val = maybe_unserialize($observed_field_val); $metas = $frmpro_entry_meta->meta_through_join($values['hide_field'], $selected_field, $observed_field_val); } else { if ($values['restrict'] and $user_ID) { $entry_user = $user_ID; if ($entry_id and is_admin()) { $entry_user = $frmdb->get_var($frmdb->entries, array('id' => $entry_id), 'user_id'); if (!$entry_user or empty($entry_user)) { $entry_user = $user_ID; } } if (isset($selected_field->form_id)) { $linked_where = array('form_id' => $selected_field->form_id, 'user_id' => $entry_user); if ($linked_posts) { $post_ids = $frmdb->get_records($frmdb->entries, $linked_where, '', '', 'id, post_id'); } else { $entry_ids = $frmdb->get_col($frmdb->entries, $linked_where, 'id'); } unset($linked_where); } if (isset($entry_ids) and !empty($entry_ids)) { $metas = $frm_entry_meta->getAll("it.item_id in (" . implode(',', $entry_ids) . ") and field_id=" . (int) $values['form_select'], ' ORDER BY meta_value'); } } else { $metas = $frmdb->get_records($frmdb->entry_metas, array('field_id' => $values['form_select']), 'meta_value', '', 'item_id, meta_value'); $post_ids = $frmdb->get_records($frmdb->entries, array('form_id' => $selected_field->form_id), '', '', 'id, post_id'); } } if ($linked_posts and !empty($post_ids)) { foreach ($post_ids as $entry) { $meta_value = FrmProEntryMetaHelper::get_post_value($entry->post_id, $selected_field->field_options['post_field'], $selected_field->field_options['custom_field'], array('type' => $selected_field->type, 'form_id' => $selected_field->form_id, 'field' => $selected_field)); $metas[] = array('meta_value' => $meta_value, 'item_id' => $entry->id); } } $options = array(); foreach ($metas as $meta) { $meta = (array) $meta; if (empty($meta['meta_value'])) { continue; } if ($selected_field->type == 'image') { $options[$meta['item_id']] = $meta['meta_value']; } else { $options[$meta['item_id']] = FrmProEntryMetaHelper::display_value($meta['meta_value'], $selected_field, array('type' => $selected_field->type, 'show_icon' => false, 'show_filename' => false)); } unset($meta); } unset($metas); natcasesort($options); //TODO: add sorting options return $options; }
function single_row($item, $style = '') { global $frmpro_settings; $checkbox = ''; // Set up the hover actions for this user $actions = array(); $edit_link = "?page=formidable-{$this->page_name}&frm_action=edit&id={$item->id}"; $actions['edit'] = "<a href='" . wp_nonce_url($edit_link) . "'>" . __('Edit', 'formidable') . "</a>"; $duplicate_link = "?page=formidable-{$this->page_name}&frm_action=duplicate&id={$item->id}"; $delete_link = "?page=formidable-{$this->page_name}&frm_action=destroy&id={$item->id}"; if ($this->plural == 'entries') { $duplicate_link .= "&form=" . $this->params['form']; $delete_link .= "&form=" . $this->params['form']; $view_link = "?page=formidable-{$this->page_name}&frm_action=show&id={$item->id}"; $actions['view'] = "<a href='" . wp_nonce_url($view_link) . "'>" . __('View', 'formidable') . "</a>"; } $actions['duplicate'] = "<a href='" . wp_nonce_url($duplicate_link) . "'>" . __('Duplicate', 'formidable') . "</a>"; $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url($delete_link) . "' onclick='return confirm(\"" . __('Are you sure you want to delete that?', 'formidable') . "\")'>" . __('Delete', 'formidable') . "</a>"; if ($this->plural == 'displays' and !current_user_can('frm_edit_displays')) { $actions = array(); } else { if ($this->plural == 'entries') { if (!current_user_can('frm_edit_entries')) { unset($actions['edit']); } if (!current_user_can('frm_create_entries')) { unset($actions['duplicate']); } if (!current_user_can('frm_delete_entries')) { unset($actions['delete']); } } } $action_links = $this->row_actions($actions); // Set up the checkbox ( because the user is editable, otherwise its empty ) $checkbox = "<input type='checkbox' name='item-action[]' id='cb-item-action-{$item->id}' value='{$item->id}' />"; $r = "<tr id='item-action-{$item->id}'{$style}>"; list($columns, $hidden) = $this->get_column_info(); $action_col = false; foreach ($columns as $column_name => $column_display_name) { $class = "class=\"{$column_name} column-{$column_name}\""; $style = ''; if (in_array($column_name, $hidden)) { $style = ' style="display:none;"'; } else { if (!$action_col and !in_array($column_name, array('cb', 'id', 'form_id', 'post_id'))) { $action_col = $column_name; } } $attributes = "{$class}{$style}"; $col_name = preg_replace('/^(' . $this->params['form'] . '_)/', '', $column_name); switch ($col_name) { case 'cb': $r .= "<th scope='row' class='check-column'>{$checkbox}</th>"; break; case 'ip': case 'id': case 'item_key': case 'display_key': case 'show_count': $val = stripslashes($item->{$col_name}); break; case 'name': case 'description': case 'content': case 'dyncontent': $val = FrmAppHelper::truncate(strip_tags(stripslashes($item->{$col_name})), 100); break; case 'created_at': case 'updated_at': $date = date($frmpro_settings->date_format, strtotime($item->{$col_name})); $val = "<abbr title='" . date($frmpro_settings->date_format . ' g:i:s A', strtotime($item->{$col_name})) . "'>" . $date . "</abbr>"; break; case 'form_id': global $frm_form; $form = $frm_form->getName($item->form_id); if ($form) { $val = '<a href="' . admin_url('admin.php') . '?page=formidable&frm_action=edit&id=' . $item->form_id . '">' . FrmAppHelper::truncate(stripslashes($form), 40) . '</a>'; } else { $val = ''; } break; case 'post_id': if ($this->plural == 'displays' and $item->insert_loc == 'none') { $val = ''; break; } $post = get_post($item->{$col_name}); if ($post) { $val = '<a href="' . admin_url('post.php') . '?post=' . $item->{$col_name} . '&action=edit">' . FrmAppHelper::truncate($post->post_title, 50) . '</a>'; } else { $val = ''; } break; case 'user_id': $user = get_userdata($item->user_id); $val = $user->user_login; break; case 'shortcode': if ($this->plural == 'displays') { $code = "[display-frm-data id={$item->id} filter=1]"; } else { $code = ''; } $val = "<input type='text' style='font-size:10px;width:100%;' readonly='true' onclick='this.select();' onfocus='this.select();' value='{$code}' />"; break; default: if ($this->plural == 'entries') { global $frm_field; $col = $frm_field->getOne($col_name); $field_value = isset($item->metas[$col->id]) ? $item->metas[$col->id] : false; $col->field_options = maybe_unserialize($col->field_options); if (!$field_value and $col->type == 'data' and $col->field_options['data_type'] == 'data' and isset($col->field_options['hide_field'])) { $field_value = array(); foreach ((array) $col->field_options['hide_field'] as $hfield) { if (isset($item->metas[$hfield])) { $field_value[] = maybe_unserialize($item->metas[$hfield]); } } } $val = FrmProEntryMetaHelper::display_value($field_value, $col, array('type' => $col->type, 'truncate' => true, 'post_id' => $item->post_id, 'entry_id' => $item->id)); } else { $val = $col_name; } break; } if (isset($val)) { $r .= "<td {$attributes}>"; if ($column_name == $action_col) { $r .= '<a class="row-title" href="' . (isset($actions['edit']) ? $edit_link : $view_link) . '">' . $val . '</a> '; $r .= $action_links; } else { $r .= $val; } $r .= '</td>'; } unset($val); } $r .= '</tr>'; return $r; }
public static function get_field_value_shortcode($atts) { extract(shortcode_atts(array('entry_id' => false, 'field_id' => false, 'user_id' => false, 'ip' => false, 'show' => '', 'format' => ''), $atts)); if (!$field_id) { return __('You are missing options in your shortcode. field_id is required.', 'formidable'); } global $frm_field, $wpdb, $frmdb; $field = $frm_field->getOne($field_id); if (!$field) { return ''; } $query = $wpdb->prepare("SELECT post_id, id FROM {$frmdb->entries} WHERE form_id=%d", $field->form_id); if ($user_id) { // make sure we are not getting entries for logged-out users $query .= $wpdb->prepare(' AND user_id=%d AND user_id > 0', (int) FrmProAppHelper::get_user_id_param($user_id)); } if ($entry_id) { if (!is_numeric($entry_id)) { $entry_id = isset($_GET[$entry_id]) ? $_GET[$entry_id] : $entry_id; } if ((int) $entry_id < 1) { // don't run the sql query if we know there will be no results return; } $query .= $wpdb->prepare(' AND id=%d', (int) $entry_id); } if ($ip) { $query .= $wpdb->prepare(' AND ip=%s', $ip == true ? $_SERVER['REMOTE_ADDR'] : $ip); } $query .= " ORDER BY created_at DESC LIMIT 1"; $entry = $wpdb->get_row($query); if (!$entry) { return; } $value = FrmProEntryMetaHelper::get_post_or_meta_value($entry, $field, $atts); $atts['type'] = $field->type; $atts['post_id'] = $entry->post_id; $atts['entry_id'] = $entry->id; if (!isset($atts['show_filename'])) { $atts['show_filename'] = false; } if (isset($show) and !empty($show)) { $atts['show'] = $show; $value = FrmProFieldsHelper::get_display_value($value, $field, $atts); } else { $value = FrmProEntryMetaHelper::display_value($value, $field, $atts); } return $value; }
public static function get_linked_options($values, $field, $entry_id = false) { global $frm_entry_meta, $user_ID, $frm_field, $frmdb; $metas = array(); $selected_field = $frm_field->getOne($values['form_select']); if (!$selected_field) { return array(); } $linked_posts = (isset($selected_field->field_options['post_field']) and $selected_field->field_options['post_field'] and $selected_field->field_options['post_field'] != '') ? true : false; $post_ids = array(); if (is_numeric($values['hide_field']) and empty($values['hide_opt'])) { if (isset($_POST) and isset($_POST['item_meta'])) { $observed_field_val = isset($_POST['item_meta'][$values['hide_field']]) ? $_POST['item_meta'][$values['hide_field']] : ''; } else { if ($entry_id) { $observed_field_val = $frm_entry_meta->get_entry_meta_by_field($entry_id, $values['hide_field']); } else { $observed_field_val = ''; } } $observed_field_val = maybe_unserialize($observed_field_val); $metas = FrmProEntryMetaHelper::meta_through_join($values['hide_field'], $selected_field, $observed_field_val); } else { if ($values['restrict'] and $user_ID) { $entry_user = $user_ID; if ($entry_id and is_admin() and !defined('DOING_AJAX')) { $entry_user = $frmdb->get_var($frmdb->entries, array('id' => $entry_id), 'user_id'); if (!$entry_user or empty($entry_user)) { $entry_user = $user_ID; } } if (isset($selected_field->form_id)) { $linked_where = array('form_id' => $selected_field->form_id, 'user_id' => $entry_user); if ($linked_posts) { $post_ids = $frmdb->get_records($frmdb->entries, $linked_where, '', '', 'id, post_id'); } else { $entry_ids = $frmdb->get_col($frmdb->entries, $linked_where, 'id'); } unset($linked_where); } if (isset($entry_ids) and !empty($entry_ids)) { $metas = $frm_entry_meta->getAll("it.item_id in (" . implode(',', $entry_ids) . ") and field_id=" . (int) $values['form_select'], ' ORDER BY meta_value', ''); } } else { $limit = ''; if (is_admin() and isset($_GET) and isset($_GET['page']) and $_GET['page'] == 'formidable') { $limit = 500; } $metas = $frmdb->get_records($frmdb->entry_metas, array('field_id' => $values['form_select']), 'meta_value', $limit, 'item_id, meta_value'); $post_ids = $frmdb->get_records($frmdb->entries, array('form_id' => $selected_field->form_id), '', $limit, 'id, post_id'); } } if ($linked_posts and !empty($post_ids)) { foreach ($post_ids as $entry) { $meta_value = FrmProEntryMetaHelper::get_post_value($entry->post_id, $selected_field->field_options['post_field'], $selected_field->field_options['custom_field'], array('type' => $selected_field->type, 'form_id' => $selected_field->form_id, 'field' => $selected_field)); $metas[] = array('meta_value' => $meta_value, 'item_id' => $entry->id); } } $options = array(); foreach ($metas as $meta) { $meta = (array) $meta; if ($meta['meta_value'] == '') { continue; } if ($selected_field->type == 'image') { $options[$meta['item_id']] = $meta['meta_value']; } else { $options[$meta['item_id']] = FrmProEntryMetaHelper::display_value($meta['meta_value'], $selected_field, array('type' => $selected_field->type, 'show_icon' => true, 'show_filename' => false)); } unset($meta); } $options = apply_filters('frm_data_sort', $options, array('metas' => $metas, 'field' => $selected_field)); unset($metas); if (!empty($options) and $field->field_options['data_type'] == 'select' and (!isset($field->field_options['multiple']) or empty($field->field_options['multiple']) or isset($field->field_options['autocom']) and $field->field_options['autocom'])) { $options = array('' => '') + (array) $options; } return stripslashes_deep($options); }
echo $field->name; ?> :</th> <td> <?php $field_value = isset($entry->metas[$field->id]) ? $entry->metas[$field->id] : false; $field->field_options = maybe_unserialize($field->field_options); if (!$field_value and $field->type == 'data' and $field->field_options['data_type'] == 'data' and isset($field->field_options['hide_field'])) { $field_value = array(); foreach ((array) $field->field_options['hide_field'] as $hfield) { if (isset($entry->metas[$hfield])) { $field_value[] = maybe_unserialize($entry->metas[$hfield]); } } } echo $display_value = FrmProEntryMetaHelper::display_value($field_value, $field, array('type' => $field->type, 'post_id' => $entry->post_id, 'show_filename' => true, 'show_icon' => true, 'entry_id' => $entry->id)); if (is_email($display_value) and !in_array($display_value, $to_emails)) { $to_emails[] = $display_value; } ?> </td> </tr> <?php } } ?> <?php if ($entry->post_id) { ?> <tr><th><?php _e('Post', 'formidable');
public static function ajax_data_options() { $hide_field = FrmAppHelper::get_param('hide_field'); $entry_id = FrmAppHelper::get_param('entry_id'); $selected_field_id = FrmAppHelper::get_param('selected_field_id'); $field_id = FrmAppHelper::get_param('field_id'); global $frm_field; $data_field = $frm_field->getOne($selected_field_id); if ($entry_id == '') { die; } $entry_id = explode(',', $entry_id); $field_data = $frm_field->getOne($field_id); $field_name = "item_meta[{$field_id}]"; if (isset($field_data->field_options['multiple']) and $field_data->field_options['multiple'] and ($field_data->type == 'select' or $field_data->type == 'data' and isset($field_data->field_options['data_type']) and $field_data->field_options['data_type'] == 'select')) { $field_name .= '[]'; } $field = array('id' => $field_id, 'value' => '', 'default_value' => '', 'form_id' => $field_data->form_id, 'type' => apply_filters('frm_field_type', $field_data->type, $field_data, ''), 'options' => $field_data->options, 'size' => isset($field_data->field_options['size']) && $field_data->field_options['size'] != '' ? $field_data->field_options['size'] : '', 'field_key' => $field_data->field_key); if ($field['size'] == '') { global $frm_vars; $field['size'] = isset($frm_vars['sidebar_width']) ? $frm_vars['sidebar_width'] : ''; } if (is_numeric($selected_field_id)) { $field['options'] = array(); $metas = FrmProEntryMetaHelper::meta_through_join($hide_field, $data_field, $entry_id); $metas = stripslashes_deep($metas); if ($metas and (!isset($field_data->field_options['data_type']) or !in_array($field_data->field_options['data_type'], array('radio', 'checkbox'))) and (!isset($field_data->field_options['multiple']) or !$field_data->field_options['multiple'] or isset($field_data->field_options['autocom']) and $field_data->field_options['autocom'])) { $field['options'][''] = ''; } foreach ($metas as $meta) { $field['options'][$meta->item_id] = FrmProEntryMetaHelper::display_value($meta->meta_value, $data_field, array('type' => $data_field->type, 'show_icon' => true, 'show_filename' => false)); unset($meta); } $field = apply_filters('frm_setup_new_fields_vars', $field, $field_data); } else { if ($selected_field_id == 'taxonomy') { if ($entry_id == 0) { die; } if (is_array($entry_id)) { $zero = array_search(0, $entry_id); if ($zero !== false) { unset($entry_id[$zero]); } if (empty($entry_id)) { die; } } $field = apply_filters('frm_setup_new_fields_vars', $field, $field_data); $cat_ids = array_keys($field['options']); $args = array('include' => implode(',', $cat_ids), 'hide_empty' => false); $post_type = FrmProFormsHelper::post_type($field_data->form_id); $args['taxonomy'] = FrmProAppHelper::get_custom_taxonomy($post_type, $field_data); if (!$args['taxonomy']) { die; } $cats = get_categories($args); foreach ($cats as $cat) { if (!in_array($cat->parent, (array) $entry_id)) { unset($field['options'][$cat->term_id]); } } if (count($field['options']) == 1 and reset($field['options']) == '') { die; } } else { $field = apply_filters('frm_setup_new_fields_vars', $field, $field_data); } } $auto_width = isset($field['size']) && $field['size'] > 0 ? 'class="auto_width"' : ''; require FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-fields/data-options.php'; die; }
echo esc_attr($entry_action . ' ' . stripslashes($item->name)); ?> "> <?php } $field_value = isset($item->metas[$col->id]) ? $item->metas[$col->id] : false; $col->field_options = maybe_unserialize($col->field_options); if (!$field_value and $col->type == 'data' and $col->field_options['data_type'] == 'data' and isset($col->field_options['hide_field'])) { $field_value = array(); foreach ((array) $col->field_options['hide_field'] as $hfield) { if (isset($item->metas[$hfield])) { $field_value[] = maybe_unserialize($item->metas[$hfield]); } } } echo FrmProEntryMetaHelper::display_value($field_value, $col, array('type' => $col->type, 'truncate' => true, 'post_id' => $item->post_id, 'entry_id' => $item->id)); if ($col == $form_cols[0]) { ?> </a><br/> <div class="row-actions"> <span><a href="?page=formidable-entries&frm_action=show&id=<?php echo $item->id; ?> " title="<?php _e('View', 'formidable'); ?> <?php echo $item->item_key; ?> "><?php _e('View', 'formidable');
function ajax_data_options($hide_field, $entry_id, $selected_field_id, $field_id) { global $frmpro_entry_meta, $frm_field; $data_field = $frm_field->getOne($selected_field_id); $entry_id = explode(',', $entry_id); $field_name = "item_meta[{$field_id}]"; $field_data = $frm_field->getOne($field_id); $field_data->field_options = maybe_unserialize($field_data->field_options); $field = array('id' => $field_id, 'value' => '', 'default_value' => '', 'form_id' => $field_data->form_id, 'type' => apply_filters('frm_field_type', $field_data->type, $field_data, ''), 'options' => stripslashes_deep(maybe_unserialize($field_data->options)), 'size' => isset($field_data->field_options['size']) && $field_data->field_options['size'] != '' ? $field_data->field_options['size'] : ''); if ($field['size'] == '') { global $frm_sidebar_width; $field['size'] = $frm_sidebar_width; } $field = apply_filters('frm_setup_new_fields_vars', stripslashes_deep($field), $field_data); if (is_numeric($selected_field_id)) { $field['options'] = array(); $metas = $frmpro_entry_meta->meta_through_join($hide_field, $data_field, $entry_id); foreach ($metas as $meta) { $field['options'][$meta->item_id] = FrmProEntryMetaHelper::display_value($meta->meta_value, $data_field, array('type' => $data_field->type, 'show_icon' => true, 'show_filename' => false)); } } else { if ($selected_field_id == 'taxonomy') { $cat_ids = array_keys($field['options']); $args = array('include' => implode(',', $cat_ids), 'hide_empty' => false); if (function_exists('get_object_taxonomies')) { $post_type = FrmProForm::post_type($field_data->form_id); $args['taxonomy'] = FrmProAppHelper::get_custom_taxonomy($post_type, $field_data); if (!$args['taxonomy']) { return; } } $cats = get_categories($args); foreach ($cats as $cat) { if (!in_array($cat->parent, (array) $entry_id)) { unset($field['options'][$cat->term_id]); } } } } $auto_width = isset($field['size']) && $field['size'] > 0 ? 'class="auto_width"' : ''; require FRMPRO_VIEWS_PATH . '/frmpro-fields/data-options.php'; die; }
$where = 'id IN (' . join(',', $next_set) . ')'; $entries = $frm_entry->getAll($where, '', '', true, false); foreach ($entries as $entry) { foreach ($form_cols as $col) { $field_value = isset($entry->metas[$col->id]) ? $entry->metas[$col->id] : false; if (!$field_value and $entry->post_id) { $col->field_options = maybe_unserialize($col->field_options); if ($col->type == 'tag' || isset($col->field_options['post_field']) && $col->field_options['post_field']) { $field_value = FrmProEntryMetaHelper::get_post_value($entry->post_id, $col->field_options['post_field'], $col->field_options['custom_field'], array('truncate' => $col->field_options['post_field'] == 'post_category' ? true : false, 'form_id' => $entry->form_id, 'field' => $col, 'type' => $col->type, 'exclude_cat' => isset($col->field_options['exclude_cat']) ? $col->field_options['exclude_cat'] : 0, 'sep' => $sep)); } } if (in_array($col->type, array('user_id', 'file', 'date', 'data'))) { $field_value = FrmProFieldsHelper::get_export_val($field_value, $col); } else { if (isset($col->field_options['separate_value']) and $col->field_options['separate_value']) { $sep_value = FrmProEntryMetaHelper::display_value($field_value, $col, array('type' => $col->type, 'post_id' => $entry->post_id, 'show_icon' => false, 'entry_id' => $entry->id, 'sep' => $sep)); if (is_array($sep_value)) { $sep_value = implode($sep, $sep_value); } $sep_value = FrmProEntriesHelper::encode_value($sep_value, $charset, $to_encoding); $sep_value = str_replace('"', '""', $sep_value); //escape for CSV files. if ($line_break != 'return') { $sep_value = str_replace(array("\r\n", "\r", "\n"), $line_break, $sep_value); } echo '"' . $sep_value . '"' . $col_sep; unset($sep_value); } $checked_values = maybe_unserialize($field_value); $checked_values = apply_filters('frm_csv_value', $checked_values, array('field' => $col)); if (is_array($checked_values)) {