Ejemplo n.º 1
0
<?php

global $ow_custom_statuses;
$selected_term = FALSE;
if (isset($_GET['category']) && !empty($_GET['category']) && isset($_GET['nonce']) && wp_verify_nonce($_GET['nonce'], 'category_filter')) {
    $selected_term = trim($_GET['category']);
}
// sanitize the data
$selected_user = isset($_GET['user']) && sanitize_text_field($_GET["user"]) ? intval(sanitize_text_field($_GET["user"])) : get_current_user_id();
$page_number = isset($_GET['paged']) && sanitize_text_field($_GET["paged"]) ? intval(sanitize_text_field($_GET["paged"])) : 1;
$ow_inbox_service = new OW_Inbox_Service();
$ow_process_flow = new OW_Process_Flow();
$ow_workflow_service = new OW_Workflow_Service();
// get assigned posts for selected user
$inbox_items = $ow_process_flow->get_assigned_post(null, $selected_user);
$count_posts = count($inbox_items);
$per_page = OASIS_PER_PAGE;
// TODO: see how to better look into the capabilities of current user
$is_post_editable = current_user_can('edit_others_posts');
$current_user_role = OW_Utility::instance()->get_current_user_role();
$current_user_id = get_current_user_id();
// get custom terminology
$workflow_terminology_options = get_option('oasiswf_custom_workflow_terminology');
$sign_off_label = !empty($workflow_terminology_options['signOffText']) ? $workflow_terminology_options['signOffText'] : __('Sign Off', 'oasisworkflow');
$abort_workflow_label = !empty($workflow_terminology_options['abortWorkflowText']) ? $workflow_terminology_options['abortWorkflowText'] : __('Abort Workflow', 'oasisworkflow');
?>
<div class="wrap">
	<div id="icon-edit" class="icon32 icon32-posts-post"><br></div>
	<h2><?php 
echo __("Inbox", "oasisworkflow");
?>
Ejemplo n.º 2
0
<?php

$comments = array();
$ow_process_flow = new OW_Process_Flow();
$ow_history_service = new OW_History_Service();
// in the inbox, we want to show all the comments and not just the latest comments
if (isset($_POST['comment']) && sanitize_text_field($_POST['comment']) == 'inbox_comment') {
    global $wpdb;
    $post_id = intval(sanitize_text_field($_POST['post_id']));
    $action_history_id = intval(sanitize_text_field($_POST['actionid']));
    // get previous assignment and publish comments from post id
    $action_history_ids = array();
    $results = $ow_process_flow->get_assignment_comment_for_post($post_id);
    if ($results) {
        foreach ($results as $result) {
            $action_history_ids[] = $result->ID;
            if (!empty($result->comment)) {
                $comments[] = json_decode($result->comment);
            }
        }
    }
    if (!empty($action_history_ids)) {
        $results = $ow_process_flow->get_reassigned_comments_for_review_steps($action_history_ids);
        if ($results) {
            foreach ($results as $result) {
                if (!empty($result->comments)) {
                    $comments[] = json_decode($result->comments);
                }
            }
        }
    }
Ejemplo n.º 3
0
 /**
  * Create/Register menu items for the plugin.
  *
  * @since 2.0
  */
 public function register_menu_pages()
 {
     $current_role = OW_Utility::instance()->get_current_user_role();
     $position = $this->get_menu_position(".8");
     $ow_process_flow = new OW_Process_Flow();
     $inbox_count = $ow_process_flow->get_assigned_post_count();
     $count = $inbox_count ? '<span class="update-plugins count"><span class="plugin-count">' . $inbox_count . '</span></span>' : '';
     // top level menu for Workflows
     add_menu_page(__('Workflows', 'oasisworkflow'), __('Workflows', 'oasisworkflow') . $count, $current_role, 'oasiswf-inbox', array($this, 'workflow_inbox_page_content'), '', $position);
     // Inbox menu
     add_submenu_page('oasiswf-inbox', __('Inbox', 'oasisworkflow'), __('Inbox', 'oasisworkflow') . $count, $current_role, 'oasiswf-inbox', array($this, 'workflow_inbox_page_content'));
     $workflow_terminology_options = get_option('oasiswf_custom_workflow_terminology');
     $workflow_history_label = !empty($workflow_terminology_options['workflowHistoryText']) ? $workflow_terminology_options['workflowHistoryText'] : __('Історія завдань');
     // Workflow history menu - it can have a custom label, as defined in Settings -> Terminology
     if (current_user_can('ow_view_workflow_history')) {
         add_submenu_page('oasiswf-inbox', $workflow_history_label, $workflow_history_label, $current_role, 'oasiswf-history', array($this, 'workflow_history_page_content'));
     }
     // Reports
     if (current_user_can('ow_view_reports')) {
         add_submenu_page('oasiswf-inbox', __('Reports', 'oasisworkflow'), __('Reports', 'oasisworkflow'), $current_role, 'oasiswf-reports', array($this, 'workflow_reports_page_content'));
     }
     // All Workflows - will display the workflow list
     if (current_user_can('ow_edit_workflow')) {
         add_submenu_page('oasiswf-inbox', __('Edit Workflows', 'oasisworkflow'), __('Edit Workflows', 'oasisworkflow'), 'edit_theme_options', 'oasiswf-admin', array($this, 'list_workflows_page_content'));
     }
     if (current_user_can('ow_edit_workflow')) {
         add_submenu_page('oasiswf-inbox', __('Custom Statuses', 'oasisworkflow'), __('Custom Statuses', 'oasisworkflow'), $current_role, 'oasiswf-custom-statuses', array($this, 'custom_statuses_page_content'));
     }
     // to add sub menus for add ons
     do_action('owf_add_submenu');
 }
<?php

$selected_user = isset($_REQUEST['user']) && sanitize_text_field($_REQUEST["user"]) ? intval(sanitize_text_field($_REQUEST["user"])) : null;
$page_number = isset($_GET['paged']) && sanitize_text_field($_GET["paged"]) ? intval(sanitize_text_field($_GET["paged"])) : 1;
$ow_process_flow = new OW_Process_Flow();
$assigned_tasks = $ow_process_flow->get_assigned_post(null, $selected_user);
$count_posts = count($assigned_tasks);
$workflow_service = new OW_Workflow_Service();
$per_page = OASIS_PER_PAGE;
$option = get_option('oasiswf_custom_workflow_terminology');
$due_date_title = !empty($option['dueDateText']) ? $option['dueDateText'] : __('Due Date', 'oasisworkflow');
?>
<div class="wrap">
	<form id="assignment_report_form" method="post" action="<?php 
echo admin_url('admin.php?page=oasiswf-reports&tab=userAssignments');
?>
">
      <div class="tablenav">
      	<ul class="subsubsub"></ul>
      	<div class="tablenav-pages">
      		<?php 
OW_Utility::instance()->get_page_link($count_posts, $page_number, $per_page);
?>
      	</div>
      </div>
   </form>
   <table class="wp-list-table widefat fixed posts" cellspacing="0" border=0>
   	<thead>
   		<?php 
echo "<tr>";
echo "<th class='column-role'>" . __("User", "oasisworkflow") . "</th>";
Ejemplo n.º 5
0
<?php

$history_id = trim($_POST["oasiswf"]);
// sanitize data
$history_id = intval(sanitize_text_field($history_id));
$task_user = isset($_POST["task_user"]) && $_POST["task_user"] ? trim($_POST["task_user"]) : get_current_user_id();
// sanitize data
$task_user = intval(sanitize_text_field($task_user));
$ow_process_flow = new OW_Process_Flow();
$ow_history_service = new OW_History_Service();
$workflow_service = new OW_Workflow_Service();
$history_details = $ow_history_service->get_action_history_by_id($history_id);
$user_info = $ow_process_flow->get_users_in_step_internal($history_details->step_id);
$users = $user_info["users"];
?>
<div id="reassgn-setting" class="info-setting">
	<div class="dialog-title"><strong><?php 
echo __("Reassign", "oasisworkflow");
?>
</strong></div>
	<br class="clear">
	<div class="owf-text-info left full-width">
		<div class="left">
			<label><?php 
echo __("Select a User: "******"oasisworkflow");
?>
</label>
		</div>
		<div class="left">	
			<select id="reassign_actors" style="width:200px;">
				<option value=""></option>
Ejemplo n.º 6
0
if (isset($_GET['post']) && sanitize_text_field($_GET["post"]) && isset($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'owf_view_history_nonce')) {
    $selected_post = intval(sanitize_text_field($_GET["post"]));
} else {
    $selected_post = NULL;
}
$pagenum = isset($_GET['paged']) && sanitize_text_field($_GET["paged"]) ? intval(sanitize_text_field($_GET["paged"])) : 1;
$trashed = isset($_GET['trashed']) && sanitize_text_field($_GET["trashed"]) ? sanitize_text_field($_GET["trashed"]) : "";
if ($selected_post && isset($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'owf_view_history_nonce')) {
    $selected_post = $selected_post;
} else {
    $selected_post = NULL;
}
$ow_history_service = new OW_History_Service();
$workflow_service = new OW_Workflow_Service();
$ow_process_flow = new OW_Process_Flow();
$histories = $ow_history_service->get_workflow_history_all($selected_post);
$count_posts = $ow_history_service->get_workflow_history_count($selected_post);
$per_page = OASIS_PER_PAGE;
$current_user_role = OW_Utility::instance()->get_current_user_role();
$option = get_option('oasiswf_custom_workflow_terminology');
$workflow_history = !empty($option['workflowHistoryText']) ? $option['workflowHistoryText'] : __('Workflow History', 'oasisworkflow');
?>
<div class="wrap">
   <div id="icon-edit" class="icon32 icon32-posts-post"><br></div>
   <h2><?php 
echo $workflow_history;
?>
</h2>
   <?php 
if (!empty($trashed) && $trashed === "success") {
<?php

//----------------
$action = isset($_REQUEST["action"]) && sanitize_text_field($_REQUEST["action"]) ? sanitize_text_field($_REQUEST["action"]) : "not-workflow";
$post_type = isset($_REQUEST["type"]) && sanitize_text_field($_REQUEST["type"]) ? sanitize_text_field($_REQUEST["type"]) : "all";
$page_number = isset($_GET['paged']) && sanitize_text_field($_GET["paged"]) ? intval(sanitize_text_field($_GET["paged"])) : 1;
$ow_process_flow = new OW_Process_Flow();
$submitted_posts = $ow_process_flow->get_submitted_articles($post_type);
$un_submitted_posts = $ow_process_flow->get_unsubmitted_articles($post_type);
if ($action == "in-workflow") {
    $posts = $submitted_posts;
} else {
    $posts = $un_submitted_posts;
}
$count_posts = count($posts);
$per_page = OASIS_PER_PAGE;
?>
<div class="wrap">
    <div id="view-workflow">
        <form id="submission_report_form" method="post" action="<?php 
echo admin_url('admin.php?page=oasiswf-reports&tab=workflowSubmissions');
?>
">
            <div class="tablenav top">
                <input type="hidden" name="page" value="oasiswf-submission" />
                <input type="hidden" id="action" name="action" value="<?php 
echo esc_attr($action);
?>
" />
                <div class="alignleft actions">
                    <select name="type">
Ejemplo n.º 8
0
global $chkResult;
$action_history_id = isset($_GET["oasiswf"]) && sanitize_text_field($_GET["oasiswf"]) ? sanitize_text_field($_GET["oasiswf"]) : $chkResult;
$parent_page = isset($_GET["parent_page"]) && $_GET["parent_page"] ? sanitize_text_field($_GET["parent_page"]) : "post_edit";
//check to be called from which page
if (isset($_GET["task_user"]) && sanitize_text_field($_GET["task_user"])) {
    $task_user = intval(sanitize_text_field($_GET["task_user"]));
} 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);
}