} } // sort the comments via timestamp usort($comments, function ($a, $b) { $a = $a[0]; $b = $b[0]; if (isset($a->comment_timestamp) && isset($b->comment_timestamp)) { return $a->comment_timestamp < $b->comment_timestamp ? 1 : -1; // need to switch 1 and -1 } else { return 1; } }); } if (isset($_POST["page_action"]) && $_POST["page_action"] == "history") { $action = $ow_history_service->get_action_history_by_from_id($_POST["actionid"]); $post_id = $action->post_id; if ($action) { $comments[] = json_decode($action->comment); } } if (isset($_POST["page_action"]) && $_POST["page_action"] == "review") { $action = $ow_history_service->get_review_action_by_id($_POST["actionid"]); $action_history = $ow_history_service->get_action_history_by_id($action->action_history_id); $post_id = $action_history->post_id; if ($action) { $comments[] = json_decode($action->comments); } } ?> <div id="ow-editorial-readonly-comment-popup">
public function get_sign_off_comments($action_id, $page_action = "") { $action_id = intval($action_id); $ow_history_service = new OW_History_Service(); $action = $ow_history_service->get_action_history_by_id($action_id); $comments = array(); $content = ""; if ($action && $action->comment != "") { if ($action->action_status != "claimed" && $action->action_status != "claim_cancel") { // no comments needed for claimed and claim cancel actions $comments = json_decode($action->comment); } } if ($action && $action->create_datetime != "") { $sign_off_date = $action->create_datetime; } else { $sign_off_date = ""; } $review_rows = $ow_history_service->get_review_action_by_history_id($action_id, "update_datetime"); if ($review_rows) { foreach ($review_rows as $review_row) { if ($review_row->review_status == 'reassigned') { if (!empty($review_row->comments)) { $comments = json_decode($review_row->comments); // get the latest comment break; } } } } if ($page_action != "" && $page_action == "history") { $action = $ow_history_service->get_action_history_by_from_id($action_id); if ($action) { if ($action->comment != "") { if ($action->action_status != "claimed" && $action->action_status != "claim_cancel") { // no comments needed for claimed and claim cancel actions $comments = json_decode($action->comment); } } } } if ($page_action != "" && $page_action == "review") { $sign_off_date = ""; $action = $ow_history_service->get_review_action_by_id($action_id); if ($action) { $comments = json_decode($action->comments); $sign_off_date = $action->update_datetime; } } foreach ($comments as $key => $comment) { if ($comment->send_id == "System") { $lbl = "System"; } else { $lbl = OW_Utility::instance()->get_user_name($comment->send_id); } //return only comments exclude user and date if ($key >= 0) { $content .= nl2br($comment->comment); } else { $content .= nl2br($comment->comment) . "\t"; } } return $content; }