GravityView
2.17
The best, easiest way to display Gravity Forms entries on your website.
includes
extensions
entry-notes
fields
notes.php
Go to the documentation of this file.
1
<?php
2
/**
3
* Display the name field type
4
*
5
* @package GravityView
6
* @subpackage GravityView/templates/fields
7
*/
8
9
$gravityview_view
=
GravityView_View::getInstance
();
10
11
$visibility_settings
=
$gravityview_view
->getCurrentFieldSetting(
'notes'
);
12
$show_notes_logged_out
= ( ! empty(
$visibility_settings
[
'view'
] ) && ! empty(
$visibility_settings
[
'view_loggedout'
] ) );
13
14
if
( !
GVCommon::has_cap
( array(
'gravityview_view_entry_notes'
,
'gravityview_add_entry_notes'
,
'gravityview_delete_entry_notes'
) ) && !
$show_notes_logged_out
) {
15
return
;
16
}
17
18
require_once( GFCommon::get_base_path() .
'/entry_detail.php'
);
19
20
/**
21
* @action `gravityview/field/notes/scripts` Print scripts and styles required for the Notes field
22
* @see GravityView_Field_Notes::enqueue_scripts
23
* @since 1.17
24
*/
25
do_action(
'gravityview/field/notes/scripts'
);
26
27
$entry
=
$gravityview_view
->getCurrentEntry();
28
$notes
= (array)
GravityView_Entry_Notes::get_notes
(
$entry
[
'id'
] );
29
$strings
=
GravityView_Field_Notes::strings
();
30
$entry_slug
=
GravityView_API::get_entry_slug
(
$entry
[
'id'
],
$entry
);
31
32
$show_add
= ! empty(
$visibility_settings
[
'add'
] );
33
$show_delete
= ( ! empty(
$visibility_settings
[
'delete'
] ) &&
GVCommon::has_cap
(
'gravityview_delete_entry_notes'
) );
34
$show_notes
=
$show_notes_logged_out
|| ( ! empty(
$visibility_settings
[
'view'
] ) &&
GVCommon::has_cap
(
'gravityview_view_entry_notes'
) );
35
36
$container_class
= (
sizeof
(
$notes
) > 0 ?
'gv-has-notes'
:
'gv-no-notes'
);
37
$container_class
.=
$show_notes
?
' gv-show-notes'
:
' gv-hide-notes'
;
38
?>
39
<div
class
=
"gv-notes <?php echo $container_class; ?>"
>
40
<?php
41
if
(
$show_notes
) {
42
?>
43
<form method=
"post"
class
=
"gv-notes-list"
>
44
<?php
if
(
$show_delete
) { wp_nonce_field(
'gv_delete_notes_'
.
$entry_slug
,
'gv_delete_notes'
); } ?>
45
<div>
46
<input type=
"hidden"
name=
"action"
value=
"gv_delete_notes"
/>
47
<input type=
"hidden"
name=
"entry-slug"
value=
"<?php echo esc_attr( $entry_slug ); ?>"
/>
48
<table>
49
<caption><?php echo
$strings
[
'caption'
]; ?></caption>
50
<?php
51
if
(
$show_delete
) {
52
?>
53
<thead>
54
<tr>
55
<th colspan=
"2"
>
56
<label><input type=
"checkbox"
value=
""
class
=
"gv-notes-toggle"
title=
"<?php echo $strings['toggle-notes']; ?>"
><span
class
=
"screen-reader-text"
><?php echo $strings[
'toggle-notes'
]; ?></span></label>
57
<button type=
"submit"
class
=
"button button-small gv-notes-delete"
><?php echo $strings[
'delete'
]; ?></button>
58
</th>
59
</tr>
60
</thead>
61
<?php } ?>
62
<tbody>
63
<tr
class
=
"gv-notes-no-notes"
><td colspan=
"2"
><?php echo $strings[
'no-notes'
]; ?></td></tr>
64
<?php
65
foreach
(
$notes
as $note ) {
66
echo
GravityView_Field_Notes::display_note
( $note,
$show_delete
);
67
}
68
?>
69
</tbody>
70
</table>
71
</div>
72
</form>
73
<?php
74
}
// End if can view notes
75
76
if
(
$show_add
) {
77
echo do_shortcode(
'[gv_note_add]'
);
78
}
79
?>
80
</div>
$show_notes
$show_notes
Definition:
notes.php:34
$show_notes_logged_out
$show_notes_logged_out
Definition:
notes.php:12
GravityView_View\getInstance
static getInstance( $passed_post=NULL)
Definition:
class-template.php:195
$show_add
$show_add
Definition:
notes.php:32
$gravityview_view
$gravityview_view
Definition:
notes.php:9
GravityView_Entry_Notes\get_notes
static get_notes( $entry_id)
Alias for GFFormsModel::get_lead_notes()
Definition:
class-gravityview-entry-notes.php:117
GravityView_Field_Notes\display_note
static display_note( $note, $show_delete=false, $context=null)
Generate HTML output for a single note.
Definition:
class-gravityview-field-notes.php:465
$visibility_settings
$visibility_settings
Definition:
notes.php:11
GravityView_Field_Notes\strings
static strings( $key='')
Get strings used by the Entry Notes field.
Definition:
class-gravityview-field-notes.php:411
GravityView_API\get_entry_slug
static get_entry_slug( $id_or_string, $entry=array())
Get the entry slug for the entry.
Definition:
class-api.php:550
$entry_slug
$entry_slug
Definition:
notes.php:30
GVCommon\has_cap
static has_cap( $caps='', $object_id=null, $user_id=null)
Alias of GravityView_Roles_Capabilities::has_cap()
Definition:
class-common.php:77
$entry
$entry
Definition:
notes.php:27
$container_class
$container_class
Definition:
notes.php:36
$notes
$notes
Definition:
notes.php:28
$strings
$strings
Definition:
notes.php:29
$show_delete
$show_delete
Definition:
notes.php:33