PluginProbe
UpStream: a Project Management Plugin for WordPress / 2.1.0
UpStream: a Project Management Plugin for WordPress v2.1.0
trunk 1.39.0 1.39.1 1.39.2 1.39.3 2.0.7 2.1.0
upstream / templates / single-project.php

single-project.php in UpStream: a Project Management Plugin for WordPress 2.1.0, at templates/single-project.php

292 lines 8.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The Template for displaying a single project
4 *
5 * This template can be overridden by copying it to yourtheme/upstream/single-project.php.
6 *
7 * @package UpStream
8 */
9
10 if ( ! defined( 'ABSPATH' ) ) {
11 exit;
12 }
13
14 @define( 'OP_SCRIPT_DEBUG', '' );
15
16 /* redirect to projects if no permissions for this project */
17 if ( ! upstream_user_can_access_project( get_current_user_id(), upstream_post_id() ) ) {
18 wp_redirect( get_post_type_archive_link( 'project' ) );
19 exit;
20 }
21
22 /* Some hosts disable this function, so let's make sure it is enabled before call it. */
23 if ( function_exists( 'set_time_limit' ) ) {
24 set_time_limit( 120 );
25 }
26
27 $exception = null;
28
29 try {
30 if ( ! session_id() ) {
31 session_start();
32 }
33 } catch ( \Exception $e ) {
34 $exception = $e;
35 }
36
37 add_action(
38 'init',
39 function() {
40 try {
41 if ( ! session_id() ) {
42 session_start();
43 }
44 } catch ( \Exception $e ) {
45 $exception = $e;
46 }
47 },
48 9
49 );
50
51 $up_current_user = (object) upstream_user_data();
52 $projects_list = array();
53
54 if ( isset( $up_current_user->projects ) ) {
55 if ( is_array( $up_current_user->projects ) && count( $up_current_user->projects ) > 0 ) {
56 foreach ( $up_current_user->projects as $project_id => $project ) {
57 $data = (object) array(
58 'id' => $project_id,
59 'author' => (int) $project->post_author,
60 'created_at' => (string) $project->post_date_gmt,
61 'modified_at' => (string) $project->post_modified_gmt,
62 'title' => $project->post_title,
63 'slug' => $project->post_name,
64 'status' => $project->post_status,
65 'permalink' => get_permalink( $project_id ),
66 );
67
68 $projects_list[ $project_id ] = $data;
69 }
70
71 unset( $project, $project_id );
72 }
73
74 unset( $up_current_user->projects );
75 }
76
77 $projects_list_count = count( $projects_list );
78
79 if ( ! apply_filters( 'upstream_theme_override_header', false ) ) {
80 upstream_get_template_part( 'global/header.php' );
81 }
82
83 if ( ! apply_filters( 'upstream_theme_override_sidebar', false ) ) {
84 upstream_get_template_part( 'global/sidebar.php' );
85 }
86
87 if ( ! apply_filters( 'upstream_theme_override_topnav', false ) ) {
88 upstream_get_template_part( 'global/top-nav.php' );
89 }
90
91 /*
92 * upstream_single_project_before hook.
93 */
94 do_action( 'upstream_single_project_before' );
95
96 $user = upstream_user_data();
97
98 $options = (array) get_option( 'upstream_general' );
99 $display_overview_section = ! isset( $options['disable_project_overview'] ) || false === (bool) $options['disable_project_overview'];
100 $display_details_section = ! isset( $options['disable_project_details'] ) || false === (bool) $options['disable_project_details'];
101 $display_progress_section = ! isset( $options['disable_project_progress'] ) || false === (bool) $options['disable_project_progress'];
102
103 /**
104 * Display Overview Section
105 *
106 * @param bool $display_overview_section
107 *
108 * @return bool
109 */
110 $display_overview_section = apply_filters( 'upstream_display_overview_section', $display_overview_section );
111
112 /**
113 * Display Details Section
114 *
115 * @param bool $display_details_section
116 *
117 * @return bool
118 */
119 $display_details_section = apply_filters( 'upstream_display_details_section', $display_details_section );
120
121 unset( $options );
122
123 /*
124 * Sections
125 */
126 $sections = array(
127 'details',
128 'milestones',
129 'tasks',
130 'bugs',
131 'files',
132 'discussion',
133 );
134 $sections = apply_filters( 'upstream_panel_sections', $sections );
135
136 if ( $display_progress_section ) {
137 array_splice( $sections, 1, 0, 'progress' );
138 }
139
140 /* Apply the order to the panels. */
141 $sections_order = (array) \UpStream\Frontend\upstream_get_panel_order();
142 $sections = array_merge( $sections_order, $sections );
143 /* Remove duplicates. */
144 $sections = array_unique( $sections );
145
146 while ( have_posts() ) :
147 the_post(); ?>
148
149 <!-- page content -->
150 <div class="right_col" role="main">
151 <div class="alerts">
152 <?php do_action( 'upstream_frontend_projects_messages' ); ?>
153 <?php do_action( 'upstream_single_project_before_overview' ); ?>
154 </div>
155
156 <?php do_action( 'upstream_single_project_top' ); ?>
157
158 <div id="project-dashboard" class="sortable">
159 <?php foreach ( $sections as $section ) : ?>
160 <?php
161 switch ( $section ) :
162 case 'details':
163 ?>
164 <div class="row" id="project-section-details">
165 <div class="col-xs-12 col-sm-12 col-md-12 col-lg-5">
166 <h3 style="display: inline-block;"><?php echo esc_html( get_the_title( get_the_ID() ) ); ?>
167 <?php $up_status = upstream_project_status_color( $id ); ?>
168 <?php if ( ! empty( $up_status['status'] ) ) : ?>
169 <span class="badge up-o-label"
170 style="background-color: <?php echo esc_attr( $up_status['color'] ); ?>"><?php echo esc_html( $up_status['status'] ); ?></span>
171 <?php endif; ?>
172 </h3>
173 </div>
174
175 <?php if ( $display_overview_section ) : ?>
176 <?php include 'single-project/overview.php'; ?>
177 <?php endif; ?>
178
179 <?php if ( $display_details_section ) : ?>
180 <?php do_action( 'upstream_single_project_before_details' ); ?>
181 <?php upstream_get_template_part( 'single-project/details.php' ); ?>
182 <?php endif; ?>
183 </div>
184 <?php
185 break;
186
187 case 'milestones':
188 if ( ! upstream_are_milestones_disabled() && ! upstream_disable_milestones() ) :
189 ?>
190 <div class="row" id="project-section-milestones">
191 <?php do_action( 'upstream_single_project_before_milestones' ); ?>
192
193 <?php upstream_get_template_part( 'single-project/milestones.php' ); ?>
194
195 <?php do_action( 'upstream_single_project_after_milestones' ); ?>
196 </div>
197 <?php
198 endif;
199 break;
200
201 case 'tasks':
202 if ( ! upstream_are_tasks_disabled() && ! upstream_disable_tasks() ) :
203 ?>
204 <div class="row" id="project-section-tasks">
205 <?php do_action( 'upstream_single_project_before_tasks' ); ?>
206
207 <?php upstream_get_template_part( 'single-project/tasks.php' ); ?>
208
209 <?php do_action( 'upstream_single_project_after_tasks' ); ?>
210 </div>
211 <?php
212 endif;
213 break;
214
215 case 'bugs':
216 if ( ! upstream_disable_bugs() && ! upstream_are_bugs_disabled() ) :
217 ?>
218 <div class="row" id="project-section-bugs">
219 <?php do_action( 'upstream_single_project_before_bugs' ); ?>
220
221 <?php upstream_get_template_part( 'single-project/bugs.php' ); ?>
222
223 <?php do_action( 'upstream_single_project_after_bugs' ); ?>
224 </div>
225 <?php
226 endif;
227 break;
228
229 case 'files':
230 if ( ! upstream_are_files_disabled() && ! upstream_disable_files() ) :
231 ?>
232 <div class="row" id="project-section-files">
233 <?php do_action( 'upstream_single_project_before_files' ); ?>
234
235 <?php upstream_get_template_part( 'single-project/files.php' ); ?>
236
237 <?php do_action( 'upstream_single_project_after_files' ); ?>
238 </div>
239 <?php
240 endif;
241 break;
242
243 case 'discussion':
244 if ( upstream_are_project_comments_enabled() ) :
245 ?>
246 <div class="row" id="project-section-discussion">
247 <?php do_action( 'upstream_single_project_before_discussion' ); ?>
248
249 <?php upstream_get_template_part( 'single-project/discussion.php' ); ?>
250
251 <?php do_action( 'upstream_single_project_after_discussion' ); ?>
252 </div>
253 <?php
254 endif;
255 break;
256
257 case 'progress':
258 ?>
259 <div class="row" id="project-section-progress">
260 <?php do_action( 'upstream_single_project_before_progress' ); ?>
261
262 <?php upstream_get_template_part( 'single-project/progress.php' ); ?>
263
264 <?php do_action( 'upstream_single_project_after_progress' ); ?>
265 </div>
266 <?php
267 break;
268
269 default:
270 do_action( 'upstream_single_project_section_' . $section, upstream_post_id() );
271
272 break;
273
274 endswitch;
275 ?>
276 <?php endforeach; ?>
277
278
279 </div>
280 </div>
281 <input type="hidden" id="project_id" value="<?php echo esc_attr( upstream_post_id() ); ?>">
282 <?php endwhile;
283 /**
284 * Upstream_after_project_content hook.
285 */
286 do_action( 'upstream_after_project_content' );
287
288 if ( ! apply_filters( 'upstream_theme_override_footer', false ) ) {
289 upstream_get_template_part( 'global/footer.php' );
290 }
291 ?>
292