public static function seal_record($podname, $record_id) { if (dms_data::is_record_sealed($podname, $record_id)) { return; } $data_messages_pods = pods("jomiz_dms_data_pods_messages"); $data = array("name" => "sealed", "pod_name" => $podname, "record_id" => $record_id); $data_messages_pods->add($data); }
echo core_utilities::get_error_message("No Action"); return; } //dms_debug::add_database_message("2", "Action Exectiopn", "ACTION API PAGE"); if ($record_id < 0 || $record_id == "") { echo core_utilities::get_error_message("No Record"); return; } //dms_debug::add_database_message("3", "Action Exectiopn", "ACTION API PAGE"); $action_on_pod = pods("jomiz_dms_actions", array('where' => "t.id = {$action_id}")); //dms_debug::add_database_message(var_export($action_on_pod, TRUE), "Action Exectiopn", "ACTION API PAGE"); if ($action_on_pod->total() == 0) { echo core_utilities::get_error_message("The Action Is Not Registered"); return; } if (dms_data::is_record_sealed($action_on_pod->field("pod_name"), $record_id)) { // Record Is Sealed //wp_redirect($return_url); //return; } $arguments = array(); $arguments["record_id"] = $record_id; $arguments["podname"] = $action_on_pod->field("pod_name"); $arguments["built_in_action"] = ""; $arguments["built_in_parameters"] = ""; $arguments["custom_php"] = $action_on_pod->field("custom_php"); $arguments["stop_on_error_messages"] = $action_on_pod->field("stop_on_error_messages"); $action = new dms_action($arguments); $action->perform(); if ($action->go_to_url != "") { wp_redirect($action->go_to_url);
} if ($id < 0 || !is_numeric($id)) { echo core_utilities::get_error_message("Record Id Type Avaliable"); return; } $return_url = isset($_GET['return-to']) ? urldecode($_GET['return-to']) : pods_related::get_pod_url($podname, "list"); if ($_GET['confirm-delete'] == 1) { $pod_to_delete = pods($podname, $id); $pod_to_delete->delete(); wp_redirect($return_url); return; } settype($id, "integer"); $PodsAPI = pods_api(); $pods_info = $PodsAPI->load_pod(array('name' => $podname)); $record_sealed = dms_data::is_record_sealed($podname, $id); $notification_message = ""; $notification_css_class = ""; if ($record_sealed) { if (dms_security::is_allowed($podname, "delete_sealed")) { $notification_message = '<span class="glyphicon glyphicon-lock"></span> This document is locked. Are you sure you want to delete it?'; $notification_css_class = "text-danger"; } else { $notification_message = '<span class="glyphicon glyphicon-lock"></span> Could not delete this document because it is locked..'; $notification_css_class = "text-warning"; } } else { $notification_message = "<span class='glyphicon glyphicon-remove'></span> Are you sure you want to delete this document?"; $notification_css_class = "text-warning"; } get_header("dialog");
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; }
<?php $notification_count = dms_data::notification_count(); if ($notification_count > 0) { ?> <a href="<?php echo home_url('/'); ?> " title="Notifications" class="btn btn-success btn-sm"><span class="badge" title="Notifications"><?php echo $notification_count; ?> </span></a> <?php } ?> <?php $notification_count = dms_data::workflow_count(); if ($notification_count > 0) { ?> <a href="<?php echo home_url('/'); ?> " title="Things Waiting Your Action" class="btn btn-danger btn-sm"><span class="badge" title="Things Waiting Your Action"><?php echo $notification_count; ?> </span></a> <?php } ?> <button class="btn btn-primary btn-sm dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-expanded="false"> <span class="glyphicon glyphicon-tasks"></span> <span class="caret"></span>