Add timeline

This commit is contained in:
Almira Krdzic
2018-12-03 13:13:03 +01:00
parent c5f590c3fe
commit 8476529bb4
2 changed files with 107 additions and 1 deletions

View File

@@ -128,12 +128,74 @@ if ( ! empty($delivery_process)) {
</div>
<?php
foreach ($steps as $step) {
foreach ($steps as $step) {
$step = $workflow_api->get_step($step->get_id(), $delivery_process);
require 'html-delivery-process-step.php';
}
?>
<div id="postbox-container-2" class="postbox-container">
<div id="wiaas-delivery-process-timeline" class="postbox">
<h3>
<label for="name"><?php esc_html_e( 'Timeline', 'gravityflow' ); ?></label>
</h3>
<div class="inside">
<?php
$notes = Gravity_Flow_Common::get_timeline_notes( $delivery_process );
foreach ( $notes as $note ) {
$user_id = $note->user_id;
$step = Gravity_Flow_Common::get_timeline_note_step( $note );
$display_name = Gravity_Flow_Common::get_timeline_note_display_name( $note, $step );
$step_type = $step ? $step->get_type() : $display_name;
if ( $user_id ) {
$avatar = get_avatar( $user_id, 65 );
} else {
$step_icon = $step ? $step->get_icon_url() : gravity_flow()->get_base_url() . '/images/gravityflow-icon-blue.svg';
if ( strpos( $step_icon, 'http' ) !== false ) {
$avatar = sprintf( '<img class="avatar avatar-65 photo" src="%s" style="width:65px;height:65px;" />', $step_icon );
} else {
$avatar = sprintf( '<span class="avatar avatar-65 photo">%s</span>', $step_icon );
}
}
?>
<div class="wiaas-delivery-process-timeline-note">
<div class="wiaas-delivery-process-timeline-note-avatar">
<?php echo $avatar ?>
</div>
<div class="wiaas-delivery-process-timeline-note-body-wrap">
<div class="wiaas-delivery-process-timeline-note-body">
<div>
<div class="wiaas-delivery-process-timeline-note-title">
<?php esc_html_e( $display_name, 'wiaas' ) ?>
</div>
<div class="wiaas-delivery-process-timeline-note-date">
<?php esc_html_e( Gravity_Flow_Common::format_date( $note->date_created ), 'wiaas' ) ?>
</div>
</div>
<div class="wiaas-delivery-process-timeline-note-body">
<?php echo nl2br( esc_html( $note->value ) ) ?>
</div>
</div>
</div>
</div>
<?php
}
?>
</div>
</div>
</div>
<?php
}
?>