function jomiz_dms_pod_save($pieces, $is_new_item, $id) { $podname = $pieces['params']->pod; if (pods_related::is_dms_pod($podname)) { return; } dms_debug::add_database_message("Anything {$podname} | {$id}", "Action Found", "pods-actions"); execute_actions('auto-after-save', $podname, $pieces, $is_new_item, $id); }
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); } } }
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; }
</form> <div id="filter-submit" class="text-center"> <hr/> <button type="button" class="btn btn-primary" onclick="do_filter()">Filter</button> <button type="button" class="btn btn-default" onclick="reset_filter()">Cancel</button> </div> </div> </div> </div> <?php } ?> <div class="row"> <div class="col-xs-12" id="main-table"> <?php echo pods_related::build_table($pods_info, $offset, $limit, null, false, null, TRUE, TRUE); ?> </div> </div> <div class="row" id="main-table-loading"> <div class="col-xs-12 text-center"> <img src="<?php echo get_template_directory_uri(); ?> /img/loading-getting-data.gif" title="Loading"/> </div> </div> <script type="text/javascript"> var dataLoader; var tableLoader; </script>
<?php /* Template Name: Delete Pods */ $podname = isset($_GET['type']) ? $_GET['type'] : ""; $id = isset($_GET['id']) ? $_GET['id'] : -1; if ($podname == '') { echo core_utilities::get_error_message("No Type Avaliable"); return; } 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?';
?> <div role="tabpanel"> <!-- Nav tabs --> <ul class="nav nav-tabs" role="tablist"> <?php echo $tabs_header; ?> </ul> <!-- Tab panes --> <div class="tab-content"> <?php echo $tabs_body; ?> </div> </div> <?php } else { echo $non_tab_page; } if ($use_dialog) { ?> <div class="row"> <div class="col-xs-12 text-right toolbar-top"> <?php echo pods_related::get_edit_page_toolbar($podname, $return_url, $id, $is_record_sealed, $page_toolbar_params); ?> </div> </div> <?php } get_footer($use_dialog ? "dialog" : "");
public static function gui_filter_pod() { $result = ""; $podname = isset($_GET['podname']) ? $_GET['podname'] : ""; if ($podname == "") { $result = "Op. gui_filter_pod -> Error: No Pod."; return $result; } $PodsAPI = pods_api(); $pods_info = null; try { $pods_info = $PodsAPI->load_pod(array('name' => $podname)); } catch (Exception $e) { $result = "Op. gui_filter_pod -> Error: Pod Not Exists."; return $result; } $offset = 0; $limit = core_utilities::get_default_page_size(); $params = array(); $where = array(); foreach ($_GET as $key => $value) { if ($key == "podname" || $key == "op" || strpos($key, "order-") !== FALSE) { continue; } $field = str_replace("to_control_", "", $key); $field = str_replace("control_", "", $field); $result .= "<br/>Op. gui_filter_pod -> Debug: " . var_export($key, TRUE); $result .= "<br/>Op. gui_filter_pod -> Debug: " . var_export($value, TRUE); $result .= "<br/>Op. gui_filter_pod -> Debug: " . var_export($field, TRUE); $result .= "<br/>Op. gui_filter_pod -> Debug: " . var_export($pods_info['fields'][$field], TRUE); switch ($pods_info['fields'][$field]['type']) { case 'text': case 'website': case 'phone': case 'email': case 'password': case 'paragraph': case 'wysiwyg': case 'code': case 'slug': // Text Field $where[] = "t.{$field} like '%{$value}%'"; break; case 'pick': if ($field == 'author') { $where[] = "{$field}.display_name like '%{$value}%'"; } elseif ($pods_info['fields'][$field]['pick_object'] == "custom-simple") { $where[] = "{$field} = '{$value}'"; } else { $where[] = "{$field}.name like '%{$value}%'"; } break; case 'number': case 'currency': // Numaric Fields $comparison_operation = ">="; if (strpos($key, 'to_control_') !== false) { $comparison_operation = "<="; } $where[] = "t.{$field} {$comparison_operation} {$value}"; break; case 'datetime': case 'date': case 'time': // Date/Time Field $comparison_operation = ">="; if (strpos($key, 'to_control_') !== false) { $comparison_operation = "<="; } $where[] = "t.{$field} {$comparison_operation} '{$value}'"; break; default: $result .= "Op. gui_filter_pod -> Error: Not Supported Field Type."; return $result; } } $params["where"] = implode(" AND ", $where); // Handle Order By if (isset($_GET['order-orderby']) && $_GET['order-orderby'] != "") { $orderby = $_GET['order-orderby']; if (isset($_GET['order-type']) && $_GET['order-type'] != "") { $orderby .= "|" . $_GET['order-type']; } else { $orderby .= "|ASC"; } $params["orderby"] = $orderby; } $result = pods_related::build_table($pods_info, $offset, $limit, $params, FALSE, null, TRUE, TRUE); return $result; }
<link rel="stylesheet/less" type="text/css" href="<?php echo get_template_directory_uri(); ?> /styles/css/styles.less" media="all" /> <script src="<?php echo get_template_directory_uri(); ?> /styles/js/less.min.js" type="text/javascript"></script> <!--[if gte IE 9]> <style type="text/css"> .gradient {filter: none !important;} </style> <![endif]--> <?php wp_head(); $menus = pods_related::build_menu(); ?> </head> <body> <!-- container --> <div class="container-fluid"> <div class="row grey-background hidden-xs"> <div class="col-xs-12 col-sm-8 system-title"> <h1><a href="<?php echo get_home_url(); ?> "><?php echo bloginfo('name'); ?> </a></h1> </div>