| 1 |
<?php |
| 2 |
/** |
| 3 |
* Single project: details |
| 4 |
* |
| 5 |
* @package UpStream |
| 6 |
*/ |
| 7 |
|
| 8 |
// Prevent direct access. |
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; |
| 11 |
} |
| 12 |
|
| 13 |
$project_id = (int) upstream_post_id(); |
| 14 |
$project = get_up_stream_project_details_by_id( $project_id ); |
| 15 |
|
| 16 |
$project_timeframe = ''; |
| 17 |
$project_date_start_is_not_empty = $project->date_start > 0; |
| 18 |
$project_date_end_is_not_empty = $project->date_end > 0; |
| 19 |
if ( $project_date_start_is_not_empty || $project_date_end_is_not_empty ) { |
| 20 |
if ( $project->date_start_ymd ) { |
| 21 |
$project->date_start = esc_html( \UpStream_Model_Object::ymdToTimestamp( $project->date_start_ymd ) ); |
| 22 |
} |
| 23 |
if ( $project->date_end_ymd ) { |
| 24 |
$project->date_end = esc_html( \UpStream_Model_Object::ymdToTimestamp( $project->date_end_ymd ) ); |
| 25 |
} |
| 26 |
|
| 27 |
if ( ! $project_date_end_is_not_empty ) { |
| 28 |
$project_timeframe = '<i class="text-muted">' . __( |
| 29 |
'Start Date', |
| 30 |
'upstream' |
| 31 |
) . ': </i>' . esc_html( upstream_format_date( $project->date_start ) ); |
| 32 |
} elseif ( ! $project_date_start_is_not_empty ) { |
| 33 |
$project_timeframe = '<i class="text-muted">' . __( |
| 34 |
'End Date', |
| 35 |
'upstream' |
| 36 |
) . ': </i>' . esc_html( upstream_format_date( $project->date_end ) ); |
| 37 |
} else { |
| 38 |
$project_timeframe = esc_html( upstream_format_date( $project->date_start ) . ' - ' . upstream_format_date( $project->date_end ) ); |
| 39 |
|
| 40 |
} |
| 41 |
} |
| 42 |
|
| 43 |
$plugin_options = get_option( 'upstream_general' ); |
| 44 |
$collapse_details = isset( $plugin_options['collapse_project_details'] ) && true === (bool) $plugin_options['collapse_project_details']; |
| 45 |
$collapse_details_state = \UpStream\Frontend\upstream_get_section_collapse_state( 'details' ); |
| 46 |
|
| 47 |
if ( ! is_null( $collapse_details_state ) ) { |
| 48 |
$collapse_details = 'closed' === $collapse_details_state; |
| 49 |
} |
| 50 |
|
| 51 |
$is_clients_disabled = upstream_is_clients_disabled(); |
| 52 |
?> |
| 53 |
|
| 54 |
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"> |
| 55 |
<div class="x_panel details-panel" data-section="details"> |
| 56 |
<div class="x_title"> |
| 57 |
<h2> |
| 58 |
<i class="fa fa-bars sortable_handler"></i> |
| 59 |
<?php |
| 60 |
printf( |
| 61 |
'<i class="fa fa-info-circle"></i> ' . |
| 62 |
// translators: %s: Title. |
| 63 |
esc_html__( '%s Details', 'upstream' ), |
| 64 |
esc_html( upstream_project_label() ) |
| 65 |
); |
| 66 |
?> |
| 67 |
<?php do_action( 'upstream:frontend.project.details.after_title', $project ); ?> |
| 68 |
</h2> |
| 69 |
<ul class="nav navbar-right panel_toolbox"> |
| 70 |
<li> |
| 71 |
<a class="collapse-link"> |
| 72 |
<i class="fa fa-chevron-<?php echo $collapse_details ? 'down' : 'up'; ?>"></i> |
| 73 |
</a> |
| 74 |
</li> |
| 75 |
</ul> |
| 76 |
<div class="clearfix"></div> |
| 77 |
</div> |
| 78 |
<div class="x_content" style="display: <?php echo $collapse_details ? 'none' : 'block'; ?>;"> |
| 79 |
<div class="row"> |
| 80 |
<div class="col-xs-12 col-sm-6 col-md-2 col-lg-2 upstream-pd-id"> |
| 81 |
<p class="title"><?php esc_html_e( 'ID', 'upstream' ); ?></p> |
| 82 |
<span><?php echo esc_html( $project_id ); ?></span> |
| 83 |
</div> |
| 84 |
|
| 85 |
<?php if ( ! empty( $project_timeframe ) ) : ?> |
| 86 |
<div class="col-xs-12 col-sm-6 col-md-2 col-lg-2 upstream-pd-timeframe"> |
| 87 |
<p class="title"><?php esc_html_e( 'Timeframe', 'upstream' ); ?></p> |
| 88 |
<?php |
| 89 |
if ( upstream_override_access_field( true, UPSTREAM_ITEM_TYPE_PROJECT, $project_id, null, 0, 'start', UPSTREAM_PERMISSIONS_ACTION_VIEW ) && |
| 90 |
upstream_override_access_field( true, UPSTREAM_ITEM_TYPE_PROJECT, $project_id, null, 0, 'end', UPSTREAM_PERMISSIONS_ACTION_VIEW ) ) : |
| 91 |
?> |
| 92 |
<span><?php echo wp_kses_post( $project_timeframe ); /* already sanitized */ ?></span> |
| 93 |
<?php else : ?> |
| 94 |
<span class="label up-o-label" style="background-color:#666;color:#fff">(hidden)</span> |
| 95 |
<?php endif; ?> |
| 96 |
</div> |
| 97 |
<?php endif; ?> |
| 98 |
|
| 99 |
<?php if ( ! $is_clients_disabled && $project->client_id > 0 ) : ?> |
| 100 |
<div class="col-xs-12 col-sm-6 col-md-2 col-lg-2 upstream-pd-client"> |
| 101 |
<p class="title"><?php echo esc_html( upstream_client_label() ); ?></p> |
| 102 |
<span> |
| 103 |
<?php |
| 104 |
echo $project->client_id > 0 && ! empty( $project->client_name ) ? esc_html( $project->client_name ) : '<i class="text-muted">(' . esc_html__( |
| 105 |
'none', |
| 106 |
'upstream' |
| 107 |
) . ')</i>'; |
| 108 |
?> |
| 109 |
</span> |
| 110 |
</div> |
| 111 |
<?php endif; ?> |
| 112 |
|
| 113 |
<div class="col-xs-12 col-sm-6 col-md-2 col-lg-2 upstream-pd-progress"> |
| 114 |
<p class="title"><?php esc_html_e( 'Progress', 'upstream' ); ?></p> |
| 115 |
<span> |
| 116 |
<?php if ( upstream_override_access_field( true, UPSTREAM_ITEM_TYPE_PROJECT, $project_id, null, 0, 'progress', UPSTREAM_PERMISSIONS_ACTION_VIEW ) ) : ?> |
| 117 |
<?php echo esc_html( $project->progress ); ?>% <?php esc_html_e( 'complete', 'upstream' ); ?> |
| 118 |
<?php else : ?> |
| 119 |
<span class="label up-o-label" style="background-color:#666;color:#fff">(hidden)</span> |
| 120 |
<?php endif; ?> |
| 121 |
</span> |
| 122 |
</div> |
| 123 |
<?php if ( $project->owner_id > 0 ) : ?> |
| 124 |
<div class="col-xs-12 col-sm-6 col-md-2 col-lg-2 upstream-pd-owner"> |
| 125 |
<p class="title"><?php esc_html_e( 'Owner', 'upstream' ); ?></p> |
| 126 |
<?php if ( upstream_override_access_field( true, UPSTREAM_ITEM_TYPE_PROJECT, $project_id, null, 0, 'progress', UPSTREAM_PERMISSIONS_ACTION_VIEW ) ) : ?> |
| 127 |
<span> |
| 128 |
<?php |
| 129 |
echo $project->owner_id > 0 ? wp_kses_post( upstream_user_avatar( $project->owner_id ) ) : '<i class="text-muted">(' . esc_html__( |
| 130 |
'none', |
| 131 |
'upstream' |
| 132 |
) . ')</i>'; |
| 133 |
?> |
| 134 |
</span> |
| 135 |
<?php else : ?> |
| 136 |
<span class="label up-o-label" style="background-color:#666;color:#fff">(hidden)</span> |
| 137 |
<?php endif; ?> |
| 138 |
</div> |
| 139 |
<?php endif; ?> |
| 140 |
|
| 141 |
<?php if ( ! $is_clients_disabled && $project->client_id > 0 ) : ?> |
| 142 |
<div class="col-xs-12 col-sm-6 col-md-2 col-lg-2 upstream-pd-clientusers"> |
| 143 |
<p class="title"> |
| 144 |
<?php |
| 145 |
printf( |
| 146 |
// translators: %s: Users counter. |
| 147 |
esc_html__( '%s Users', 'upstream' ), |
| 148 |
esc_html( upstream_client_label() ) |
| 149 |
); |
| 150 |
?> |
| 151 |
</p> |
| 152 |
<?php if ( is_array( $project->client_users ) && count( $project->client_users ) > 0 ) : ?> |
| 153 |
<?php upstream_output_client_users(); ?> |
| 154 |
<?php else : ?> |
| 155 |
<span><i class="text-muted">(<?php esc_html_e( 'none', 'upstream' ); ?>)</i></span> |
| 156 |
<?php endif; ?> |
| 157 |
</div> |
| 158 |
<?php endif; ?> |
| 159 |
|
| 160 |
<div class="col-xs-12 col-sm-6 col-md-2 col-lg-2 upstream-pd-members"> |
| 161 |
<p class="title"><?php esc_html_e( 'Members', 'upstream' ); ?></p> |
| 162 |
<?php upstream_output_project_members(); ?> |
| 163 |
</div> |
| 164 |
|
| 165 |
<?php do_action( 'upstream:frontend.project.render_details', $project->id ); ?> |
| 166 |
</div> |
| 167 |
<?php if ( ! empty( $project->description ) ) : ?> |
| 168 |
<div class="upstream-pd-description"> |
| 169 |
<p class="title"><?php esc_html_e( 'Description', 'upstream' ); ?></p> |
| 170 |
<?php if ( upstream_override_access_field( true, UPSTREAM_ITEM_TYPE_PROJECT, $project_id, null, 0, 'description', UPSTREAM_PERMISSIONS_ACTION_VIEW ) ) : ?> |
| 171 |
<blockquote |
| 172 |
style="font-size: 1em;"><?php echo wp_kses_post( upstream_esc_w( nl2br( htmlspecialchars_decode( $project->description ) ) ) ); ?></blockquote> |
| 173 |
<?php else : ?> |
| 174 |
<span class="label up-o-label" style="background-color:#666;color:#fff">(hidden)</span> |
| 175 |
<?php endif; ?> |
| 176 |
</div> |
| 177 |
<?php endif; ?> |
| 178 |
</div> |
| 179 |
</div> |
| 180 |
</div> |
| 181 |
|