/**
  * Add Edit Entry links when on a single entry
  *
  * @since 1.13
  * @return void
  */
 function add_edit_entry_link()
 {
     /** @var WP_Admin_Bar $wp_admin_bar */
     global $wp_admin_bar;
     $entry_id = $this->gravityview_view->getSingleEntry();
     if ($entry_id && GVCommon::has_cap(array('gravityforms_edit_entries', 'gravityview_edit_entries'), $entry_id)) {
         $entry = $this->gravityview_view->getEntry();
         $wp_admin_bar->add_menu(array('id' => 'edit-entry', 'parent' => 'gravityview', 'title' => __('Edit Entry', 'gravityview'), 'meta' => array('title' => sprintf(__('Edit Entry %s', 'gravityview'), GravityView_API::get_entry_slug($entry['id'], $entry))), 'href' => esc_url_raw(admin_url(sprintf('admin.php?page=gf_entries&screen_mode=edit&view=entry&id=%d&lid=%d', $entry['form_id'], $entry['id'])))));
     }
 }
 /**
  * Generate a nonce link with the base URL of the current View embed
  *
  * We don't want to link to the single entry, because when deleted, there would be nothing to return to.
  *
  * @since 1.5.1
  * @param  array      $entry Gravity Forms entry array
  * @return string|null             If directory link is valid, the URL to process the delete request. Otherwise, `NULL`.
  */
 public static function get_delete_link($entry, $view_id = 0, $post_id = null)
 {
     self::getInstance()->set_entry($entry);
     $base = GravityView_API::directory_link($post_id, true);
     if (empty($base)) {
         do_action('gravityview_log_error', __METHOD__ . ' - Post ID does not exist: ' . $post_id);
         return NULL;
     }
     // Use the slug instead of the ID for consistent security
     $entry_slug = GravityView_API::get_entry_slug($entry['id'], $entry);
     $view_id = empty($view_id) ? gravityview_get_view_id() : $view_id;
     $actionurl = add_query_arg(array('action' => 'delete', 'entry_id' => $entry_slug, 'gvid' => $view_id, 'view_id' => $view_id), $base);
     $url = wp_nonce_url($actionurl, 'delete_' . $entry_slug, 'delete');
     return $url;
 }
 /**
  * Get the Add Note form HTML
  *
  * @todo Allow passing entry_id as a shortcode parameter to set entry from shortcode
  *
  * @since 1.17
  *
  * @return string HTML of the Add Note form, or empty string if the user doesn't have the `gravityview_add_entry_notes` cap
  */
 public static function get_add_note_part()
 {
     if (!GVCommon::has_cap('gravityview_add_entry_notes')) {
         do_action('gravityview_log_error', __METHOD__ . ': User does not have permission to add entry notes ("gravityview_add_entry_notes").');
         return '';
     }
     $gravityview_view = GravityView_View::getInstance();
     ob_start();
     $gravityview_view->get_template_part('note', 'add-note');
     $add_note_html = ob_get_clean();
     $visibility_settings = $gravityview_view->getCurrentFieldSetting('notes');
     $entry = $gravityview_view->getCurrentEntry();
     $entry_slug = GravityView_API::get_entry_slug($entry['id'], $entry);
     $nonce_field = wp_nonce_field('gv_note_add_' . $entry_slug, 'gv_note_add', false, false);
     // Only generate the dropdown if the field settings allow it
     $email_fields = '';
     if (!empty($visibility_settings['email'])) {
         $email_fields = self::get_note_email_fields($entry_slug);
     }
     $add_note_html = str_replace('{entry_slug}', $entry_slug, $add_note_html);
     $add_note_html = str_replace('{nonce_field}', $nonce_field, $add_note_html);
     $add_note_html = str_replace('{show_delete}', intval($visibility_settings['delete']), $add_note_html);
     $add_note_html = str_replace('{email_fields}', $email_fields, $add_note_html);
     return $add_note_html;
 }
Example #4
0
 * @subpackage GravityView/templates
 *
 * @global GravityView_View $this
 */
gravityview_before();
?>

<div class="gv-container gv-list-single-container gv-list-container">
	<p class="gv-back-link"><?php 
echo gravityview_back_link();
?>
</p>
	<?php 
foreach ($this->getEntries() as $entry) {
    $this->setCurrentEntry($entry);
    $entry_slug = GravityView_API::get_entry_slug($entry['id'], $entry);
    ?>

		<div id="gv_list_<?php 
    echo esc_attr($entry_slug);
    ?>
" class="gv-list-view">
	<?php 
    if ($this->getFields('single_list-title') || $this->getFields('single_list-subtitle')) {
        ?>
		<div class="gv-list-view-title">
		<?php 
        if ($fields = $this->getFields('single_list-title')) {
            $i = 0;
            $title_args = array('entry' => $entry, 'form' => $this->form, 'hide_empty' => $this->atts['hide_empty']);
            foreach ($fields as $field) {