Пример #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");
?>
Пример #2
0
 public function step_signoff_popup_setup()
 {
     global $wpdb, $chkResult;
     $selected_user = isset($_GET['user']) ? intval($_GET['user']) : get_current_user_id();
     $chkResult = $this->workflow_submit_check($selected_user);
     $inbox_service = new OW_Inbox_Service();
     if (get_option("oasiswf_activate_workflow") == "active" && is_admin() && preg_match_all('/page=oasiswf(.*)|post-new\\.(.*)|post\\.(.*)/', $_SERVER['REQUEST_URI'], $matches)) {
         if ($chkResult == "inbox") {
             $this->enqueue_and_localize_submit_step_script();
             $inbox_service->enqueue_and_localize_script();
         } else {
             if (current_user_can('ow_submit_to_workflow') && $chkResult == "submit" && is_admin() && preg_match_all('/page=oasiswf(.*)|post-new\\.(.*)|post\\.(.*)/', $_SERVER['REQUEST_URI'], $matches)) {
                 // if the post is published or scheduled, we do not want to show the "submit to workflow" button.
                 // submit to workflow is only available for new posts
                 if (isset($_GET['post']) && sanitize_text_field($_GET["post"]) && isset($_GET['action']) && sanitize_text_field($_GET["action"]) == "edit") {
                     $post_status = get_post_status($_GET["post"]);
                     if ($post_status == "publish" || $post_status == "future") {
                         return;
                     }
                 }
                 include OASISWF_PATH . "includes/pages/subpages/submit-workflow.php";
                 $this->enqueue_and_localize_submit_workflow_script();
             } else {
                 if (current_user_can('ow_sign_off_step') && is_numeric($chkResult) && is_admin() && preg_match_all('/page=oasiswf(.*)|post-new\\.(.*)|post\\.(.*)/', $_SERVER['REQUEST_URI'], $matches)) {
                     include OASISWF_PATH . "includes/pages/subpages/submit-step.php";
                     $this->enqueue_and_localize_submit_step_script();
                     $inbox_service->enqueue_and_localize_script();
                 }
             }
         }
         $role = OW_Utility::instance()->get_current_user_role();
         $post_type = get_post_type();
         $post_status = "";
         // do not hide the ootb publish section for skip_workflow_roles option, but hide it if the post is in the workflow
         $show_workflow_for_post_types = get_option('oasiswf_show_wfsettings_on_post_types');
         $row = null;
         if (isset($_GET['post']) && sanitize_text_field($_GET["post"]) && isset($_GET['action']) && sanitize_text_field($_GET["action"]) == "edit") {
             $post_id = intval(sanitize_text_field($_GET["post"]));
             $post_status = get_post_status($post_id);
             $row = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . OW_Utility::instance()->get_action_history_table_name() . " WHERE post_id = %d AND action_status = 'assignment'", $post_id));
         }
         $hide_ootb_publish_section = array("skip_workflow_roles" => true, "show_workflow_for_post_types" => true);
         if (current_user_can('ow_skip_workflow')) {
             // do not hide the ootb publish section for skip_workflow_roles option
             $hide_ootb_publish_section["skip_workflow_roles"] = false;
         } else {
             $hide_ootb_publish_section["skip_workflow_roles"] = true;
         }
         if (is_array($show_workflow_for_post_types) && in_array($post_type, $show_workflow_for_post_types)) {
             // do not show ootb publish section for oasiswf_show_wfsettings_on_post_types
             $hide_ootb_publish_section['show_workflow_for_post_types'] = true;
         } else {
             $hide_ootb_publish_section['show_workflow_for_post_types'] = false;
         }
         // we are dealing with unpublished post
         if ($hide_ootb_publish_section["skip_workflow_roles"] == 1 && $hide_ootb_publish_section['show_workflow_for_post_types'] == 1) {
             $this->ootb_publish_section_hide();
         }
         // if the item is in the workflow, hide the OOTB publish section
         if ($row) {
             $this->ootb_publish_section_hide();
         }
         // Add nonce to the post page
         echo "<input type='hidden' name='owf_claim_process_ajax_nonce' id='owf_claim_process_ajax_nonce' value='" . wp_create_nonce('owf_claim_process_ajax_nonce') . "'/>";
         wp_nonce_field('owf_exit_post_from_workflow_ajax_nonce', 'owf_exit_post_from_workflow');
         //--------generate abort workflow link---------
         if (current_user_can('ow_abort_workflow')) {
             if ($row) {
                 echo "<script type='text/javascript'>var exit_wfid = {$row->ID} ;</script>";
                 $this->enqueue_and_localize_abort_script();
             }
         }
     }
 }