Пример #1
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);
                }
            }
        }
    }
Пример #2
0
 public function send_step_email($action_id, $to_user_id = null)
 {
     // sanitize the input
     $action_id = intval($action_id);
     $to_user_id = intval($to_user_id);
     $ow_history_service = new OW_History_Service();
     $action_step = $ow_history_service->get_action_history_by_id($action_id);
     $to_user_id = $to_user_id ? $to_user_id : $action_step->assign_actor_id;
     $mails = $this->get_step_mail_content($action_id, $action_step->step_id, $to_user_id, $action_step->post_id);
     $comment = $this->get_step_comment_content($action_id);
     $data = array('to_user' => $to_user_id, 'history_id' => $action_id, 'create_datetime' => current_time('mysql'));
     // send email if setting is true
     $emails_table = OW_Utility::instance()->get_emails_table_name();
     $email_settings = get_option('oasiswf_email_settings');
     if ($mails->assign_subject && $mails->assign_content && $email_settings['assignment_emails'] == "yes") {
         $mail_content = $mails->assign_content . $comment;
         $this->send_mail($to_user_id, $mails->assign_subject, $mail_content);
         $data["subject"] = $mails->assign_subject;
         $data["message"] = $mail_content;
         $data["send_date"] = current_time('mysql');
         $data["action"] = 0;
         OW_Utility::instance()->insert_to_table($emails_table, $data);
     }
     // set reminder email for future delivery
     if ($mails->reminder_subject && $mails->reminder_content) {
         $mail_content = $mails->reminder_content . $comment;
         $data["subject"] = $mails->reminder_subject;
         $data["message"] = $mail_content;
         $data["action"] = 1;
         // for reminder before date
         if ($action_step->reminder_date) {
             $data["send_date"] = $action_step->reminder_date;
             OW_Utility::instance()->insert_to_table($emails_table, $data);
         }
         // for reminder after date
         if ($action_step->reminder_date_after) {
             $data["send_date"] = $action_step->reminder_date_after;
             OW_Utility::instance()->insert_to_table($emails_table, $data);
         }
     }
 }
Пример #3
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>
Пример #4
0
<?php

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 
Пример #5
0
$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);
}
$reminder_days = get_option('oasiswf_reminder_days');
Пример #6
0
 private function set_loading_post_status()
 {
     $status_info = sanitize_text_field($_POST["hi_process_info"]);
     $post_id = intval(sanitize_text_field($_POST["post_ID"]));
     $temp_array = explode("@#@", $status_info);
     $ow_history_service = new OW_History_Service();
     $action = $ow_history_service->get_action_history_by_id($temp_array[0]);
     $this->copy_step_status_to_post($post_id, $action->step_id, $temp_array[1]);
 }