コード例 #1
0
ファイル: dms_action.php プロジェクト: hasanhalabi/jDMS
 public function perform()
 {
     $this->go_to_url = "";
     if ($this->stop_on_error_messages == 1 && dms_messages::does_pod_record_has_error_messages($this->podname, $this->record_id)) {
         return;
     }
     $data = array();
     // Custom PHP
     if ($this->custom_php != "") {
         dms_debug::add_database_message($this->custom_php, "Code To Execute", "DMS ACTION");
         $eval_result = eval($this->custom_php);
         dms_debug::add_database_message($eval_result, "Evaluate Result | {$this->podname} | {$this->record_id} |", "DMS ACTION");
     }
     $author = $this->current_pod->field("author");
     if (!isset($author) || $author <= 0 || $author == "") {
         global $current_user;
         $data["author"] = $current_user->ID;
     }
     dms_debug::add_database_message(var_export($data, TRUE), "Array Size", "DMS ACTION Data To Save");
     if (sizeof($data) > 0) {
         $this->current_pod->save($data);
     }
     if ($this->go_to_url != "") {
         wp_redirect($this->go_to_url);
     }
 }
コード例 #2
0
ファイル: dms_data.php プロジェクト: hasanhalabi/jDMS
 public static function is_record_sealed($podname, $record_id)
 {
     $messages_pods_params = array();
     $messages_pods_params['where'] = "t.name = 'sealed' AND t.pod_name = '{$podname}' AND t.record_id = {$record_id}";
     $messages_on_record = pods("jomiz_dms_data_pods_messages", $messages_pods_params);
     if ($messages_on_record->total() > 0) {
         return TRUE;
     }
     $messages_pods = dms_messages::get_pod_record_messages($podname, $record_id);
     foreach ($messages_pods as $pod_message) {
         if ($pod_message["type"] == "sealed") {
             return TRUE;
         }
     }
     return FALSE;
 }
コード例 #3
0
ファイル: dms_messages.php プロジェクト: hasanhalabi/jDMS
 public static function add_message($message_code, $podname, $record_id, $allow_message_duplication = FALSE)
 {
     if (!$allow_message_duplication) {
         dms_messages::delete_message($message_code, $podname, $record_id);
     }
     $data_messages_pods = pods("jomiz_dms_data_pods_messages");
     $data = array("name" => $message_code, "pod_name" => $podname, "record_id" => $record_id);
     $data_messages_pods->add($data);
     $message_pod = pods("jomiz_dms_available_messages", array("where" => "message_code = '{$message_code}'"));
     while ($message_pod->fetch()) {
         $message_type = $message_pod->field("message_type");
         if ($message_type == 'status' || $message_type == "sealed") {
             $link = pods_related::get_pod_url($podname, "edit", $record_id);
             $text = "New status added to document: " . $message_pod->field("name");
             $record_pod = pods($podname, $record_id);
             $record_owner = $record_pod->field("author.ID");
             dms_messages::add_notification($record_owner, $link, $text);
         }
     }
 }
コード例 #4
0
ファイル: pods_related.php プロジェクト: hasanhalabi/jDMS
 public static function get_edit_page_toolbar($podname, $return_url, $record_id, $record_sealed = null, $params = array())
 {
     // Basic Toolbar (Save | Save & Close | Cancel)
     if ($record_sealed == null) {
         $record_sealed = dms_data::is_record_sealed($podname, $record_id);
     }
     if ($params['overwrite_seal'] || !$record_sealed && !isset($_GET['lock-screen'])) {
         $basic_toolbar = "<a disabled='disabled' id='toolbar-button-waiting' class='btn btn-info' href='#' title='Please wait while saving.'><span class='glyphicon glyphicon-time'></span></a>";
         $basic_toolbar .= "<a class='btn btn-primary' href='#' title='Save' onclick='save_jomizdms_form()'><span class='glyphicon glyphicon-floppy-disk'></span></a>";
     }
     $basic_toolbar .= "<a class='btn btn-default' href='{$return_url}' title='Cancel'><span class='glyphicon glyphicon-floppy-remove'></span></a>";
     $basic_toolbar = "<div class='btn-group' role='group' aria-label='Save'>{$basic_toolbar}</div>";
     // Default Operations (Delete | Print)
     // Print
     if ($record_id > 0) {
         // Get Print Operations
         $print_params = array();
         $print_params['where'] = "pod_name = '{$podname}'";
         $print_params['orderby'] = "display_order";
         $print_params['limit'] = -1;
         $print_pods = pods("jomiz_dms_prints", $print_params);
         $default_operations = "";
         while ($print_pods->fetch()) {
             $print_url = pods_related::get_print_url($print_pods, $podname, $record_id);
             $button_type = $print_pods->field("button_type");
             $capability = $print_pods->field("capability");
             $print_title = $print_pods->field("name");
             $message_code_to_disallow = $print_pods->field("message_code_to_disallow");
             if ($capability != "" && !dms_security::is_allowed_cap($capability)) {
                 continue;
             }
             if ($message_code_to_disallow != "" && dms_messages::has_message_code($podname, $record_id, $message_code_to_disallow)) {
                 continue;
             }
             if ($button_type == "") {
                 $button_type = "btn-default";
             }
             $default_operations .= "<a target='_blank' class='btn {$button_type}' href='{$print_url}' title='{$print_title}'><span class='glyphicon glyphicon-print'></span></a>";
         }
     }
     if (dms_security::is_allowed($podname, "delete") && !$record_sealed && $record_id > 0 && !isset($_GET['lock-screen'])) {
         $default_operations .= "<a class='btn btn-danger' href='" . pods_related::get_pod_url($podname, "delete", $record_id, TRUE, $return_url) . "' title='Delete'><span class='glyphicon glyphicon-trash'></span></a>";
     }
     if ($default_operations != "") {
         $default_operations = "<div class='btn-group' role='group' aria-label='Basic Operations'>{$default_operations}</div>";
     }
     // Custom Operations (From Setup Pods)
     $custom_operations = "";
     if ($record_id > 0) {
         $has_errors = dms_messages::does_pod_record_has_error_messages($podname, $record_id);
         $actions_on_pod = pods("jomiz_dms_actions", array("where" => "t.pod_name = '{$podname}' AND t.status = 'active' AND t.action_type = 'toolbar'"));
         if ($actions_on_pod->total() > 0) {
             while ($actions_on_pod->fetch()) {
                 $arguments = array("record_id" => $record_id);
                 $arguments["podname"] = $podname;
                 $arguments["message_code_to_allow_toolbar"] = $actions_on_pod->field("message_code_to_allow_toolbar");
                 $arguments["message_code_to_disallow_toolbar"] = $actions_on_pod->field("message_code_to_disallow_toolbar");
                 $arguments["custom_php"] = $actions_on_pod->field("custom_php");
                 $arguments["stop_on_error_messages"] = $actions_on_pod->field("stop_on_error_messages");
                 $arguments["capability"] = $actions_on_pod->field("capability");
                 if ($arguments["capability"] != "") {
                     if (!dms_security::is_allowed_cap($arguments["capability"])) {
                         continue;
                     }
                 }
                 if ($actions_on_pod->field("stop_on_error_messages") == 1 && $has_errors) {
                     continue;
                 }
                 if ($arguments["message_code_to_allow_toolbar"] != "") {
                     if (!dms_messages::has_message_code($podname, $record_id, $arguments["message_code_to_allow_toolbar"])) {
                         continue;
                     }
                 }
                 if ($arguments["message_code_to_disallow_toolbar"] != "") {
                     if (dms_messages::has_message_code($podname, $record_id, $arguments["message_code_to_disallow_toolbar"])) {
                         continue;
                     }
                 }
                 $action_text = $actions_on_pod->field("name");
                 $action_url = dms_action::get_action_url($actions_on_pod->field("id"), $record_id);
                 $action_icon = $actions_on_pod->field("toolbar_icon");
                 $action_url = urlencode($action_url);
                 $onclick = "redirect_to_page(\"{$action_url}\")";
                 $custom_operations .= "<a onclick='{$onclick}' class='btn btn-info'  title='{$action_text}'><span class='glyphicon glyphicon-{$action_icon}'></span></a>";
             }
         }
     }
     if ($custom_operations != "") {
         $custom_operations = "<div class='btn-group' role='group' aria-label='...'>{$custom_operations}</div>";
     }
     // The Complete Toolbar
     $toolbar = "<div class='btn-toolbar pull-right' role='toolbar' aria-label='...'>\n\t\t\t\t\t  {$basic_toolbar}\n\t\t\t\t\t  {$default_operations}\n\t\t\t\t\t  {$custom_operations}\n\t\t\t\t\t</div>";
     return $toolbar;
 }
コード例 #5
0
ファイル: page-edit-pod.php プロジェクト: hasanhalabi/jDMS
								</div>';
        }
    }
}
// Workflow Display
if (sizeof($workflow_data) > 0) {
    $tabs_header .= "<li role='presentation'><a href='#workflow-tab' aria-controls='workflow-tab' role='tab' data-toggle='tab'>Actions</a></li>";
    $tabs_body .= "<div role='tabpanel' class='tab-pane fade' id='workflow-tab'>" . $workflow_data['form-to-display'] . "</div>";
}
if (isset($operation_settings->{"use_attachments"}) && $operation_settings->{"use_attachments"} == 1) {
    $tabs_header .= "<li role='presentation'><a href='#attachments-tab' aria-controls='workflow-tab' role='tab' data-toggle='tab'>Attachments</a></li>";
    $attachments = new dms_attachments();
    $tabs_body .= "<div role='tabpanel' class='tab-pane fade' id='attachments-tab'>" . $attachments->get_attachments_tab($is_record_sealed) . "</div>";
}
// Messages
$messages_pods = dms_messages::get_pod_record_messages($podname, $id);
$messages_to_show = "";
$message_alert_type = "alert-info";
if (is_array($messages_pods) && sizeof($messages_pods) > 0) {
    foreach ($messages_pods as $pod_message) {
        $messages_to_show .= "<li class='" . joimz_dms_utilities::get_message_css_class($pod_message["type"]) . "'>" . $pod_message["text"] . "</li>";
        if ($pod_message["type"] == "error") {
            $message_alert_type = "alert-danger";
        } elseif ($pod_message["type"] == "warning" && ($message_alert_type == "alert-info" || $message_alert_type == "alert-success")) {
            $message_alert_type = "alert-warning";
        } elseif ($pod_message["type"] == "pass" && $message_alert_type == "alert-info") {
            $message_alert_type = "alert-success";
        }
    }
} elseif (!is_array($messages_pods)) {
    $messages_to_show = $messages_pods;
コード例 #6
0
ファイル: dms_api.php プロジェクト: hasanhalabi/jDMS
 public static function workflow_save()
 {
     $podname = isset($_GET['podname']) ? $_GET['podname'] : "";
     $workflow_id = isset($_GET['workflow-id']) ? $_GET['workflow-id'] : "";
     $code = isset($_GET['code']) ? $_GET['code'] : "";
     $record_id = isset($_GET['record-id']) ? $_GET['record-id'] : "";
     $user_id = isset($_GET['user-id']) ? $_GET['user-id'] : "";
     $last_sender_id = isset($_GET['last-sender-id']) ? $_GET['last-sender-id'] : "";
     $chosen_option = isset($_GET['chosen-option']) ? $_GET['chosen-option'] : "";
     $remarks = isset($_GET['remarks']) ? $_GET['remarks'] : "";
     $e_signature = isset($_GET['e-signature']) ? $_GET['e-signature'] : "";
     $message = "";
     if ($podname == "") {
         $message .= "<div>No Podname</div>";
     }
     if ($workflow_id == "") {
         $message .= "<div>No Workflow ID</div>";
     }
     if ($code == "") {
         $message .= "<div>No Workflow Code</div>";
     }
     if ($record_id == "") {
         $message .= "<div>No Record ID</div>";
     }
     if ($user_id == "") {
         $message .= "<div>No User ID</div>";
     }
     if ($chosen_option == "") {
         $message .= "<div>Procedure Not Exist</div>";
     }
     if ($remarks == "") {
         $message .= "<div>Please Fill The Notes.</div>";
     }
     if ($e_signature == "") {
         $message .= "<div>Please Fill The e-Signature</div>";
     }
     // Check Signature
     $user_pod = pods("user", $user_id);
     if ($user_pod->field("e_signature") == "") {
         $message .= "<div>You are not authorized because you don't have any e-signature in the system.</div>";
     }
     if ($user_pod->field("e_signature") != $e_signature) {
         $message .= "<div>Your e-Signature is not correct.</div>";
     }
     if ($message != "") {
         return $message;
     }
     // Add The Message
     $choosen_option_tokens = explode('|', $chosen_option);
     $choosen_option_direction = $choosen_option_tokens[0];
     $choosen_option_message_code = $choosen_option_tokens[1];
     $choosen_option_text = $choosen_option_tokens[2];
     dms_messages::add_message($choosen_option_message_code, $podname, $record_id, TRUE);
     $workflow_data = array();
     // Find recipient_user_id
     if ($choosen_option_direction == "next") {
         $current_workflow_pod = pods("jomiz_dms_workflow", array("where" => "workflow_code = '{$code}'"));
         $groups = $current_workflow_pod->field("groups");
         foreach ($groups as $group) {
             $group_pod = pods("jomiz_dms_groups", array("where" => "t.id = " . $group['id'] . " AND members.id = {$user_id}"));
             while ($group_pod->fetch()) {
                 $managers = $group_pod->field("managers");
                 foreach ($managers as $manager) {
                     $single_workflow_data = array();
                     $single_workflow_data["workflow_code"] = $workflow_id;
                     $single_workflow_data["pod_name"] = $podname;
                     $single_workflow_data["record_id"] = $record_id;
                     $single_workflow_data["option_chosed"] = "{$choosen_option_direction}|{$choosen_option_message_code}";
                     $single_workflow_data["chosen_option_direction"] = $choosen_option_direction;
                     $single_workflow_data["chosen_option_message_code"] = $choosen_option_message_code;
                     $single_workflow_data["chosen_option_text"] = $choosen_option_text;
                     $single_workflow_data["remarks"] = $remarks;
                     $single_workflow_data["sender_user"] = $user_id;
                     $single_workflow_data["recipient_user"] = $manager['ID'];
                     $single_workflow_data["is_last_step_performed"] = 1;
                     $workflow_data[] = $single_workflow_data;
                 }
             }
         }
     } elseif ($choosen_option_direction == "back") {
         $single_workflow_data = array();
         $single_workflow_data["workflow_code"] = $workflow_id;
         $single_workflow_data["pod_name"] = $podname;
         $single_workflow_data["record_id"] = $record_id;
         $single_workflow_data["option_chosed"] = "{$choosen_option_direction}|{$choosen_option_message_code}";
         $single_workflow_data["chosen_option_direction"] = $choosen_option_direction;
         $single_workflow_data["chosen_option_message_code"] = $choosen_option_message_code;
         $single_workflow_data["chosen_option_text"] = $choosen_option_text;
         $single_workflow_data["remarks"] = $remarks;
         $single_workflow_data["sender_user"] = $user_id;
         $single_workflow_data["recipient_user"] = $last_sender_id;
         $single_workflow_data["is_last_step_performed"] = 1;
         $workflow_data[] = $single_workflow_data;
     } else {
         // Stop
         $single_workflow_data = array();
         $single_workflow_data["workflow_code"] = $workflow_id;
         $single_workflow_data["pod_name"] = $podname;
         $single_workflow_data["record_id"] = $record_id;
         $single_workflow_data["option_chosed"] = "{$choosen_option_direction}|{$choosen_option_message_code}";
         $single_workflow_data["chosen_option_direction"] = $choosen_option_direction;
         $single_workflow_data["chosen_option_message_code"] = $choosen_option_message_code;
         $single_workflow_data["chosen_option_text"] = $choosen_option_text;
         $single_workflow_data["remarks"] = $remarks;
         $single_workflow_data["sender_user"] = $user_id;
         $single_workflow_data["is_last_step_performed"] = 1;
         $workflow_data[] = $single_workflow_data;
     }
     dms_messages::add_message($choosen_option_message_code, $podname, $record_id, TRUE);
     //Update Other Steps To Indicate The Last Performed Step
     global $wpdb;
     settype($record_id, "integer");
     $where = array("pod_name" => $podname, "record_id" => $record_id);
     $update_result = $wpdb->update("jomiz_pods_jomiz_dms_data_workflow", array("is_last_step_performed" => 0), $where);
     $new_workflow_pod = pods("jomiz_dms_data_workflow");
     foreach ($workflow_data as $single_workflow_data) {
         $new_workflow_pod->add($single_workflow_data);
     }
     return $message;
 }