-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsingle.php
More file actions
160 lines (121 loc) · 4.96 KB
/
single.php
File metadata and controls
160 lines (121 loc) · 4.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?php
/**
* Redirect back to dashboard if user can't view this
*/
if ( ! eman_can_view($post) ) {
wp_redirect( home_url('/') );
}
/**
* Confirm the draft, this will send it on
*/
get_template_part('partials/single/function', 'confirm');
/**
* If a gatekeeper has requested pullback, pullback the NOC from Submitted to Ready to Submit
*/
get_template_part('partials/single/function', 'pullback');
/**
* Get status
*/
$status = emanager_post::status($post, 'slug');
$cpt = eman_post_types(get_post_type());
/**
* ACF needs this, form processing
*/
if ( function_exists('acf_form_head') ) { acf_form_head(); }
get_header(); ?>
<div id="content">
<div class="wrap">
<?php do_action( 'before_content' ); ?>
<div id="main" role="main">
<?php if ( $obj = get_post_type_object(get_post_type()) ) : ?>
<div class="archive-nav" class="cf">
<?php /** / ?><a class="back-list btn btn-default" href="/<?php echo $obj->has_archive; ?>/" title="Back to list"><i class="fa fa-arrow-left"></i> Back to List</a>
<?php /** / ?><a class="add-new btn btn-success" href="/<?php echo ( 'em_issue' == get_post_type() ) ? $obj->rewrite['slug'] : $obj->has_archive; ?>/add/" title="Add"><i class="fa fa-plus-circle"></i> <?php echo $obj->labels->add_new_item; ?></a><?php /**/ ?>
<?php
$url = site_url( '/' . $obj->has_archive . '/' . ('noc' == get_post_type() && ! in_array($status, array('submitted','executed','recommend')) ? 'pco/' : '' ) );
echo do_shortcode('[button class="back-list" link="' . $url . '" color="default" title="Back to list" icon_before="arrow-left"]Back to list[/button]');
if (
( (eman_check_role('turner') || eman_check_role('sub')) )
|| ( 'em_issue' == get_post_type() )
) :
$label = str_replace('NOC', 'PCO', $obj->labels->add_new_item);
echo do_shortcode('[button class="add-new" link="' . home_url( ('em_issue' == get_post_type() ? $obj->rewrite['slug'] : $obj->has_archive) . '/add/') . '" color="success" icon_before="plus-circle" title="' . $label . '"]' . $label. '[/button]');
endif; ?>
</div>
<?php endif; ?>
<div id="content" class="content clearfix" role="main">
<div class="entry-content inner">
<?php
while ( have_posts() ) : the_post();
/**
* Show a form
*/
if ( eman_can_edit($post) && ! empty($_REQUEST['edit']) ) :
get_template_part('partials/single/form');
/**
* Specific for NOCs (not PCO)
*/
elseif ( 'em_noc' == get_post_type() ) :
if ( in_array($status, array('submitted','executed','recommend')) ) :
eman_template_part('single');
else :
get_template_part('partials/single/summary');
get_template_part('partials/single/summary-action');
endif;
/**
* Specific for Invoices
*/
elseif ( 'em_invoice' == get_post_type() ) :
get_template_part('partials/single/summary');
get_template_part('partials/single/summary-action');
/**
* If not a draft, load a single view from post_type if it exists or default to standard summary
*/
elseif ( ('settings' != $cpt['type'] && 'draft' == $status) || ! eman_template_part('single') ) ://'settings' != $cpt['type'] &&
get_template_part('partials/single/summary');
get_template_part('partials/single/summary-action');
/**
* Specific for NOCs (not PCO)
* /
elseif ( in_array($status, array('submitted','executed','recommend')) ) :
get_template_part('partials/single/noc');
get_template_part('partials/single/summary-action');
/**
* if it is a particular post type view
* /
elseif ( 'em_locations' == get_post_type() ) :
get_template_part('partials/single/location');
elseif ( 'em_letter' == get_post_type() ) :
get_template_part('partials/single/letter');
elseif ( 'em_rfi' == get_post_type() ) :
get_template_part('partials/single/rfi');
/**
* Get the regular summary
* /
else :
get_template_part('partials/single/summary');
get_template_part('partials/single/summary-action');
/**/
endif;
endwhile; ?>
</div><!-- .inner (end) -->
</div><!-- #content (end) -->
<?php if ( in_array(get_post_type(), array('em_tickets','em_noc','em_dcr','em_issue', 'em_letter', 'em_rfi', 'em_invoice')) && 'draft' != $status ) : ?>
<div id="comments-area" class="clearfix">
<div class="sixcol first reviews clearfix">
<?php get_template_part('partials/single/reviews'); ?>
</div>
<?php if ( ! in_array(get_post_type(), array('em_letter')) ) : ?>
<div class="sixcol last comments clearfix">
<?php comments_template( '', true ); ?>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
<?php echo do_shortcode('[qrcode size="100" link="' . get_permalink() . '"][/qrcode]'); ?>
</div>
<?php #get_sidebar(); ?>
<?php do_action( 'after_content' ); ?>
</div>
</div>
<?php get_footer();