global $wpdb, $chkResult;
$ow_workflow_service = new OW_Workflow_Service();
if (is_admin() && preg_match_all('/page=oasiswf(.*)|post-new\\.(.*)|post\\.(.*)/', $_SERVER['REQUEST_URI'], $matches)) {
    wp_enqueue_script('owf-workflow-history', OASISWF_URL . 'js/pages/subpages/history-graphic.js', '', OASISWF_VERSION, true);
}
$workflow = null;
$post_id = intval(sanitize_text_field($_GET['post']));
if (is_numeric($chkResult)) {
    $sql = "SELECT C.ID, C.wf_info\n   \t\t\tFROM (\n   \t\t\t\t(SELECT * FROM " . OW_Utility::instance()->get_action_history_table_name() . " WHERE ID = {$chkResult}) AS A\n   \t\t\t\tLEFT JOIN " . OW_Utility::instance()->get_workflow_steps_table_name() . " AS B\n   \t\t\t\tON A.step_id = B.ID\n   \t\t\t\tLEFT JOIN " . OW_Utility::instance()->get_workflows_table_name() . " AS C\n   \t\t\t\tON B.workflow_id = C.ID\n   \t\t\t)";
    $workflow = $wpdb->get_row($sql);
}
if ($workflow) {
    $sql = "SELECT * FROM " . OW_Utility::instance()->get_action_history_table_name() . " WHERE ID <= {$chkResult} AND (action_status = 'processed' OR action_status = 'assignment') AND post_id = %d ORDER BY ID";
    $processes = $wpdb->get_results($wpdb->prepare($sql, $post_id));
    if ($processes) {
        $startid = "";
        foreach ($processes as $process) {
            if ($startid) {
                $newconns[] = $ow_workflow_service->get_connection($workflow, $startid, $process->step_id);
            }
            $startid = $process->step_id;
        }
        $current_step_id = $ow_workflow_service->get_gpid_dbid($workflow->wf_info, $startid);
        $wf_info = $workflow->wf_info;
    }
    echo "<script type='text/javascript'>\n\t\t\tvar wfPluginUrl  = '" . OASISWF_URL . "' ;\n\t\t\tvar stepinfo='{$wf_info}' ;\n\t\t\tvar currentStepGpId='{$current_step_id}' ;\n\t\t</script>";
}
?>
<div id="workflow-area" style="position:relative;width:100%;"></div>
<br class="clear">
            }
            $step = $workflow_service->get_step_by_id($step_id);
            $workflow = $workflow_service->get_workflow_by_id($step->workflow_id);
            echo "<tr id='post-{$assigned_task->post_id}' class='post-{$assigned_task->post_id} post type-post status-pending format-standard hentry category-uncategorized alternate iedit author-other'> ";
            $assigned_actor_id = null;
            if ($assigned_task->assign_actor_id != -1) {
                // not in review process
                $assigned_actor = OW_Utility::instance()->get_user_name($assigned_task->assign_actor_id);
            } else {
                //in review process
                $assigned_actor = OW_Utility::instance()->get_user_name($assigned_task->actor_id);
            }
            echo "<td>" . $assigned_actor . "</td>";
            echo "<td><a href='post.php?post=" . $post->ID . "&action=edit'>{$post->post_title}</a></td>";
            echo "<td>{$workflow->name}</td>";
            echo "<td>" . $wf_status[$workflow_service->get_gpid_dbid($workflow->ID, $step_id, 'process')] . "</td>";
            echo "<td>" . OW_Utility::instance()->format_date_for_display($assigned_task->due_date) . "</td>";
            echo "</tr>";
        }
        $count++;
    }
} else {
    echo "<tr>";
    echo "<td class='hurry-td' colspan='5'>\n   \t\t\t\t\t\t<label class='hurray-lbl'>";
    echo __("No current assignments.", "oasisworkflow");
    echo "</label></td>";
    echo "</tr>";
}
?>
   	</tbody>
   </table>
Exemple #3
0
                }
                if (current_user_can('ow_view_workflow_history')) {
                    $nonce_url = wp_nonce_url("admin.php?page=oasiswf-history&post={$inbox_item->post_id}", 'owf_view_history_nonce');
                    echo "<span><a href='{$nonce_url}'> " . __("View History", "oasisworkflow") . "</a></span>";
                }
                echo "</div>";
                get_inline_data($post);
            }
            echo "</td>";
            echo "<td>{$post->post_type}</td>";
            echo "<td>" . OW_Utility::instance()->get_user_name($user->ID) . "</td>";
            $workflow_name = $workflow->name;
            if (!empty($workflow->version)) {
                $workflow_name .= " (" . $workflow->version . ")";
            }
            echo "<td>{$workflow_name} [{$ow_workflow_service->get_gpid_dbid($workflow->ID, $stepId, 'lbl')}]</td>";
            $arg = add_query_arg(array('category' => $cat_name, 'nonce' => wp_create_nonce('category_filter')));
            echo "<td><a href={$arg}>{$cat_name}</a></td>";
            $post_status = $ow_custom_statuses->get_single_term_by('slug', get_post_status($post->ID));
            $post_status = is_object($post_status) && isset($post_status->name) ? $post_status->name : $wf_process_status[$ow_workflow_service->get_gpid_dbid($workflow->ID, $stepId, 'process')];
            // if the due date is passed the current date show the field in a different color
            echo "<td><span class=' . {$past_due_date_field_class} . '>" . OW_Utility::instance()->format_date_for_display($inbox_item->due_date) . "</span></td>";
            echo "<td class='comments column-comments'>\n\t\t\t\t\t\t\t\t\t\t<div class='post-com-count-wrapper'>\n\t\t\t\t\t\t\t\t\t\t\t<strong>\n\t\t\t\t\t\t\t\t\t\t\t\t<a href='#' actionid={$inbox_item->ID} class='post-com-count post-com-count-approved' data-comment='inbox_comment' post_id={$inbox_item->post_id}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span class='comment-count-approved'>{$ow_process_flow->get_comment_count($inbox_item->ID, TRUE, $inbox_item->post_id)}</span>\n\t\t\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t\t\t\t<span class='loading'>{$space}</span>\n\t\t\t\t\t\t\t\t\t\t\t</strong>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t  </td>";
            echo "</tr>";
        }
        $count++;
    }
} else {
    echo "<tr>";
    echo "<td class='hurry-td' colspan='9'>\n\t\t\t\t\t\t\t\t<label class='hurray-lbl'>";
    echo __("Hurray! No assignments", "oasisworkflow");
Exemple #4
0
} else {
    if (isset($_GET["user"]) && sanitize_text_field($_GET["user"])) {
        $task_user = intval(sanitize_text_field($_GET["user"]));
    } else {
        $task_user = "";
    }
}
$editable = current_user_can('edit_posts');
$post_id = null;
$ow_process_flow = new OW_Process_Flow();
$ow_history_service = new OW_History_Service();
$ow_workflow_service = new OW_Workflow_Service();
if ($action_history_id) {
    $current_action = $ow_history_service->get_action_history_by_id($action_history_id);
    $current_step = $ow_workflow_service->get_step_by_id($current_action->step_id);
    $process = $ow_workflow_service->get_gpid_dbid($current_step->workflow_id, $current_action->step_id, "process");
    $success_status = json_decode($current_step->step_info);
    $success_status = $success_status->status;
    $post_id = $current_action->post_id;
}
$default_due_days = get_option('oasiswf_default_due_days');
$default_date = '';
if (!empty($default_due_days)) {
    $default_date = date(OASISWF_EDIT_DATE_FORMAT, current_time('timestamp') + DAY_IN_SECONDS * $default_due_days);
}
$reminder_days = get_option('oasiswf_reminder_days');
$reminder_days_after = get_option('oasiswf_reminder_days_after');
$workflow_terminology_options = get_option('oasiswf_custom_workflow_terminology');
$sign_off_label = !empty($workflow_terminology_options['signOffText']) ? $workflow_terminology_options['signOffText'] : __('Sign Off', 'oasisworkflow');
$assign_actors_label = !empty($workflow_terminology_options['assignActorsText']) ? $workflow_terminology_options['assignActorsText'] : __('Assign Actor(s)', 'oasisworkflow');
$due_date_label = !empty($workflow_terminology_options['dueDateText']) ? $workflow_terminology_options['dueDateText'] : __('Due Date', 'oasisworkflow');