PluginProbe
UpStream: a Project Management Plugin for WordPress / trunk
UpStream: a Project Management Plugin for WordPress vtrunk
trunk 1.39.0 1.39.1 1.39.2 1.39.3 2.0.7 2.1.0
upstream / templates / global / sidebar.php

sidebar.php in UpStream: a Project Management Plugin for WordPress trunk, at templates/global/sidebar.php

318 lines 11.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Sidebar template
4 *
5 * @package UpStream
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit;
10 }
11
12 $plugin_options = get_option( 'upstream_general' );
13 $site_url = get_bloginfo( 'url' );
14 $page_title = get_bloginfo( 'name' );
15 $up_current_user = (object) upstream_user_data();
16 $projects_list_url = get_post_type_archive_link( 'project' );
17 $is_single = is_single();
18 $support_url = upstream_admin_support( $plugin_options );
19 $log_out_url = upstream_logout_url();
20 $are_clients_enabled = ! upstream_is_clients_disabled();
21
22 $i18n = array(
23 'LB_PROJECT' => upstream_project_label(),
24 'LB_PROJECTS' => upstream_project_label_plural(),
25 'LB_TASKS' => upstream_task_label_plural(),
26 'LB_BUGS' => upstream_bug_label_plural(),
27 'LB_LOGOUT' => __( 'Log Out', 'upstream' ),
28 'LB_ENDS_AT' => __( 'Ends at', 'upstream' ),
29 'MSG_SUPPORT' => upstream_admin_support_label( $plugin_options ),
30 'LB_TITLE' => __( 'Title', 'upstream' ),
31 'LB_TOGGLE_FILTERS' => __( 'Toggle Filters', 'upstream' ),
32 'LB_EXPORT' => __( 'Export', 'upstream' ),
33 'LB_PLAIN_TEXT' => __( 'Plain Text', 'upstream' ),
34 'LB_CSV' => __( 'CSV', 'upstream' ),
35 'LB_CLIENT' => upstream_client_label(),
36 'LB_CLIENTS' => upstream_client_label_plural(),
37 'LB_STATUS' => __( 'Status', 'upstream' ),
38 'LB_STATUSES' => __( 'Statuses', 'upstream' ),
39 'LB_CATEGORIES' => __( 'Categories' ),
40 'LB_PROGRESS' => __( 'Progress', 'upstream' ),
41 'LB_NONE_UCF' => __( 'None', 'upstream' ),
42 'LB_NONE' => __( 'none', 'upstream' ),
43 // translators: %s: completed item label.
44 'LB_COMPLETE' => __( '%s Complete', 'upstream' ),
45 );
46
47 if ( $is_single ) {
48 $are_milestones_disabled_at_all = upstream_disable_milestones();
49 $are_milestones_disabled_for_this_project = upstream_are_milestones_disabled();
50 $are_tasks_disabled_at_all = upstream_disable_tasks();
51 $are_tasks_disabled_for_this_project = upstream_are_tasks_disabled();
52 $are_bugs_disabled_at_all = upstream_disable_bugs();
53 $are_bugs_disabled_for_this_project = upstream_are_bugs_disabled();
54 $are_files_disabled_for_this_project = upstream_are_files_disabled();
55 $are_comments_disabled = upstream_are_comments_disabled();
56 }
57
58 $projects = upstream_user_projects();
59 $reports = UpStream_Report_Generator::get_instance()->get_all_reports();
60 usort(
61 $reports,
62 function ( $a, $b ) {
63 return strcmp( $a->title, $b->title );
64 }
65 );
66 ?>
67
68 <?php do_action( 'upstream_before_sidebar' ); ?>
69
70 <div class="col-md-3 left_col">
71 <div class="left_col scroll-view">
72 <div class="navbar nav_title">
73 <a href="<?php echo esc_url( $site_url ); ?>" class="site_title">
74 <span><?php echo esc_html( $page_title ); ?></span>
75 </a>
76 </div>
77 <div class="clearfix"></div>
78
79 <?php if ( is_user_logged_in() ) : ?>
80 <!-- menu profile quick info -->
81 <div class="profile">
82 <div class="profile_pic">
83 <img src="<?php echo esc_url( $up_current_user->avatar ); ?>" alt="" class="img-circle rounded-circle profile_img">
84 </div>
85 <div class="profile_info">
86 <h2><?php echo esc_html( $up_current_user->display_name ); ?></h2>
87 <p><?php echo esc_html( $up_current_user->role ); ?></p>
88 </div>
89 </div>
90 <?php endif; ?>
91
92 <!-- /menu profile quick info -->
93 <br/>
94 <!-- sidebar menu -->
95 <div id="sidebar-menu" class="main_menu_side hidden-print main_menu">
96 <div class="menu_section">
97 <h3>&nbsp;</h3>
98 <ul class="nav side-menu">
99 <li>
100 <a href="javascript:void(0);">
101 <i class="fa fa-home"></i>
102 <?php echo esc_html( $i18n['LB_PROJECTS'] ); ?>
103 </a>
104 <ul class="nav child_menu">
105 <li id="nav-projects">
106 <a href="<?php echo esc_attr( $projects_list_url ); ?>">
107 <i class="fa fa-columns"></i>
108 <?php
109 printf(
110 // translators: %s: project label.
111 esc_html__( 'All %s', 'upstream' ),
112 esc_html( $i18n['LB_PROJECTS'] )
113 );
114 ?>
115 </a>
116
117 <?php do_action( 'upstream_sidebar_after_all_projects_link' ); ?>
118 </li>
119
120 <?php do_action( 'upstream_sidebar_projects_submenu' ); ?>
121 </ul>
122 </li>
123 </ul>
124 </div>
125 <?php if ( $is_single && get_post_type() === 'project' ) : ?>
126 <?php $project_id = get_the_ID(); ?>
127 <div class="menu_section active">
128 <ul class="nav side-menu">
129 <li class="current-page active">
130 <a href="#">
131 <i class="fa fa-folder"></i>
132 <?php echo esc_html( get_the_title( $project_id ) ); ?>
133 </a>
134
135 <ul class="nav child_menu" style="display: block;">
136 <?php do_action( 'upstream_sidebar_before_single_menu' ); ?>
137
138 <?php if ( ! $are_milestones_disabled_for_this_project && ! $are_milestones_disabled_at_all ) : ?>
139 <li id="nav-milestones">
140 <a href="#milestones">
141 <i class="fa fa-flag"></i> <?php echo esc_html( upstream_milestone_label_plural() ); ?>
142 <?php
143 if ( function_exists( 'count_items_for_user_on_project' ) ) {
144 $items_count = count_items_for_user_on_project(
145 'milestones',
146 get_current_user_id(),
147 upstream_post_id()
148 );
149 } else {
150 $items_count = (int) upstream_count_assigned_to( 'milestones' );
151 }
152
153 if ( $items_count > 0 ) :
154 ?>
155 <span class="badge bg-info pull-right" data-toggle="tooltip"
156 title="<?php esc_html_e( 'Assigned to me', 'upstream' ); ?>"
157 ><?php echo esc_html( $items_count ); ?></span>
158 <?php endif; ?>
159 </a>
160 </li>
161 <?php endif; ?>
162
163 <?php if ( ! $are_tasks_disabled_for_this_project && ! $are_tasks_disabled_at_all ) : ?>
164 <li id="nav-tasks">
165 <a href="#tasks">
166 <i class="fa fa-wrench"></i> <?php echo esc_html( $i18n['LB_TASKS'] ); ?>
167 <?php
168 if ( function_exists( 'count_items_for_user_on_project' ) ) {
169 $items_count = count_items_for_user_on_project(
170 'tasks',
171 get_current_user_id(),
172 upstream_post_id()
173 );
174 } else {
175 $items_count = (int) upstream_count_assigned_to( 'tasks' );
176 }
177
178 if ( $items_count > 0 ) :
179 ?>
180 <span class="badge bg-info pull-right" data-toggle="tooltip"
181 title="<?php esc_html_e( 'Assigned to me', 'upstream' ); ?>"
182 ><?php echo esc_html( $items_count ); ?></span>
183 <?php endif; ?>
184 <?php do_action( 'upstream_sidebar_after_tasks_menu' ); ?>
185 </a>
186 </li>
187 <?php endif; ?>
188
189 <?php if ( ! $are_bugs_disabled_at_all && ! $are_bugs_disabled_for_this_project ) : ?>
190 <li id="nav-bugs">
191 <a href="#bugs">
192 <i class="fa fa-bug"></i> <?php echo esc_html( $i18n['LB_BUGS'] ); ?>
193 <?php
194 if ( function_exists( 'count_items_for_user_on_project' ) ) {
195 $items_count = count_items_for_user_on_project(
196 'bugs',
197 get_current_user_id(),
198 upstream_post_id()
199 );
200 } else {
201 $items_count = (int) upstream_count_assigned_to( 'bugs' );
202 }
203
204 if ( $items_count > 0 ) :
205 ?>
206 <span class="badge bg-info pull-right" data-toggle="tooltip"
207 title="<?php esc_html_e( 'Assigned to me', 'upstream' ); ?>"
208 ><?php echo esc_html( $items_count ); ?></span>
209 <?php endif; ?>
210 <?php do_action( 'upstream_sidebar_after_bugs_menu' ); ?>
211 </a>
212 </li>
213 <?php endif; ?>
214
215 <?php if ( ! $are_files_disabled_for_this_project && ! upstream_disable_files() ) : ?>
216 <li id="nav-files">
217 <a href="#files">
218 <i class="fa fa-file"></i> <?php echo esc_html( upstream_file_label_plural() ); ?>
219 </a>
220 </li>
221 <?php endif; ?>
222
223 <?php if ( ! $are_comments_disabled ) : ?>
224 <li id="nav-discussion">
225 <a href="#discussion">
226 <i class="fa fa-comments"></i>
227 <?php echo esc_html( upstream_discussion_label() ); ?>
228 </a>
229 </li>
230 <?php endif; ?>
231
232 <?php do_action( 'upstream_sidebar_after_single_menu' ); ?>
233 </ul>
234 </li>
235
236 <?php do_action( 'upstream_sidebar_menu' ); ?>
237 </ul>
238 </div>
239 <?php endif; ?>
240
241 <?php
242
243 if ( ! isset( $plugin_options['disable_reports'] ) || 0 == $plugin_options['disable_reports'] ) :
244 ?>
245 <div class="menu_section">
246 <ul class="nav side-menu">
247 <li>
248 <a href="#">
249 <i class="fa fa-bar-chart"></i>
250
251 <?php esc_html_e( 'Reports', 'upstream' ); ?>
252 </a>
253
254 <ul class="nav child_menu">
255 <?php
256 foreach ( $reports as $report ) :
257 $rurl = add_query_arg( 'report', $report->id, esc_attr( $projects_list_url ) );
258 ?>
259 <li id="nav-reports">
260 <a target="_blank" href="<?php echo esc_url( $rurl ); ?>">
261 <i class="fa fa-file-text"></i> <?php echo esc_html( $report->title ); ?>
262 </a>
263 </li>
264 <?php endforeach; ?>
265 </ul>
266 </li>
267 </ul>
268 </div>
269 <?php
270 endif;
271
272 ?>
273
274 <?php
275 $min_projects_count = $is_single ? 1 : 0;
276 if ( ! $is_single ) {
277 $project_id = 0;
278 }
279 ?>
280 <?php if ( count( $projects ) > $min_projects_count && upstream_show_all_projects_in_sidebar() ) : ?>
281 <div class="menu_section">
282 <ul class="nav side-menu">
283 <?php foreach ( $projects as $project ) : ?>
284 <?php if ( $project_id != $project->id ) : ?>
285 <li class="current-page active">
286 <a href="<?php echo esc_url( $project->permalink ); ?>">
287 <i class="fa fa-folder"></i>
288 <?php echo esc_html( $project->title ); ?>
289 </a>
290 </li>
291 <?php endif; ?>
292 <?php endforeach; ?>
293 </ul>
294 </div>
295 <?php endif; ?>
296 </div>
297 <!-- /sidebar menu -->
298 <!-- /menu footer buttons -->
299 <div class="sidebar-footer hidden-small">
300 <a href="<?php echo esc_attr( $projects_list_url ); ?>" data-toggle="tooltip" data-placement="top"
301 title="<?php printf( esc_attr( 'My %s', 'upstream' ), esc_attr( $i18n['LB_PROJECTS'] ) ); ?>">
302 <i class="fa fa-home"></i>
303 </a>
304 <a href="<?php echo esc_url( $support_url ); ?>" data-toggle="tooltip" data-placement="top"
305 title="<?php echo esc_attr( $i18n['MSG_SUPPORT'] ); ?>" target="_blank" rel="noreferrer noopener">
306 <i class="fa fa-question-circle"></i>
307 </a>
308 <a href="<?php echo esc_url( $log_out_url ); ?>" data-toggle="tooltip" data-placement="top"
309 title="<?php echo esc_attr( $i18n['LB_LOGOUT'] ); ?>">
310 <i class="fa fa-sign-out"></i>
311 </a>
312 </div>
313 <!-- /menu footer buttons -->
314 </div>
315 </div>
316
317 <?php do_action( 'upstream_after_sidebar' ); ?>
318