<?php

$wf_id = "";
$workflow = "";
$wf_editable = true;
if (isset($_GET['wf_id']) && sanitize_text_field($_GET["wf_id"])) {
    $wf_id = intval(sanitize_text_field($_GET["wf_id"]));
    $workflow_service = new OW_Workflow_Service();
    $workflow = $workflow_service->get_workflow_by_id($wf_id);
    $wf_editable = $workflow_service->is_workflow_editable($wf_id);
    // check if editable.
}
$workflow_info = "";
if (is_object($workflow)) {
    $workflow_info = addslashes($workflow->wf_info);
}
$title = "";
$workflow_description = "";
$start_date = "";
$end_date = "";
if ($workflow) {
    $title = $workflow->name;
    $workflow_description = $workflow->description;
    $start_date = OW_Utility::instance()->format_date_for_display_and_edit($workflow->start_date);
    $end_date = OW_Utility::instance()->format_date_for_display_and_edit($workflow->end_date);
}
echo "<script type='text/javascript'>\n\t\t   wf_structure_data = '{$workflow_info}';\n\t\t   wfeditable = '{$wf_editable}' ;\n\t   </script>";
?>
<div class="wrap">
   <div id="workflow-edit-icon" class="icon32"><br></div>
   <?php 
Exemple #2
0
 //$selected_term
 $post_categories = get_the_category($inbox_item->post_id);
 if (!empty($post_categories)) {
     $cat_name = $post_categories[0]->name;
 }
 if ($selected_term && $cat_name != $selected_term) {
     continue;
 }
 $post = get_post($inbox_item->post_id);
 $user = get_userdata($post->post_author);
 $stepId = $inbox_item->step_id;
 if ($stepId <= 0 || $stepId == "") {
     $stepId = $inbox_item->review_step_id;
 }
 $step = $ow_workflow_service->get_step_by_id($stepId);
 $workflow = $ow_workflow_service->get_workflow_by_id($step->workflow_id);
 $needs_to_be_claimed = $ow_process_flow->check_for_claim($inbox_item->ID);
 $original_post_id = get_post_meta($inbox_item->post_id, 'oasis_original', true);
 /*Check due date and make post item background color in red to notify the admin*/
 $ow_email = new OW_Email();
 $current_date = Date(" F j, Y ");
 $due_date = OW_Utility::instance()->format_date_for_display($inbox_item->due_date);
 $past_due_date_row_class = '';
 $past_due_date_field_class = '';
 if ($due_date != "" && strtotime($due_date) < strtotime($current_date)) {
     $past_due_date_row_class = 'past-due-date-row';
     $past_due_date_field_class = 'past-due-date-field';
 }
 echo "<tr id='post-{$inbox_item->post_id}'\n                        \tclass='post-{$inbox_item->post_id} post type-post {$past_due_date_row_class}\n                        \tstatus-pending format-standard hentry category-uncategorized alternate iedit author-other'> ";
 $workflow_action_id = esc_attr($inbox_item->post_id);
 echo "<th scope='row' class='check-column'>\n\t\t\t\t\t\t\t\t\t<input type='checkbox' name='post[]' value={$workflow_action_id} wfid='{$inbox_item->ID}'></th>";
 public function change_workflow_status_to_complete()
 {
     check_ajax_referer('owf_signoff_ajax_nonce', 'security');
     $post_id = intval($_POST['post_id']);
     $history_id = intval($_POST['oasiswf_id']);
     $publish_datetime = null;
     if (isset($_POST["immediately"])) {
         $publish_datetime = sanitize_text_field($_POST["immediately"]);
     } else {
         $pdata = get_post($post_id);
         $publish_datetime = get_the_date('Y-m-d H:i:s', $post_id);
     }
     $task_user = get_current_user_id();
     // find out who is signing off the task; sometimes the admin can signoff on behalf of the actual user
     if (isset($_POST["hi_task_user"]) && $_POST["hi_task_user"] != "") {
         $task_user = intval(sanitize_text_field($_POST["hi_task_user"]));
     }
     $post_complete_action = $this->change_workflow_status_to_complete_internal($post_id, $publish_datetime, $history_id, $task_user);
     echo $post_complete_action;
     $ow_history_service = new OW_History_Service();
     $ow_workflow_service = new OW_Workflow_Service();
     $history = $ow_history_service->get_action_history_by_id($history_id);
     $step = $ow_workflow_service->get_step_by_id($history->step_id);
     $workflow = $ow_workflow_service->get_workflow_by_id($step->workflow_id);
     do_action('owf_workflow_complete', $post_id, $workflow->ID);
     die;
 }