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; }
$edit_type = "edit_only_mine"; } else { $edit_type = "no_edit_allowed"; } if ($edit_type == "no_edit_allowed" || !($edit_type == "edit_all" || ($edit_type == "edit_only_mine" && $record_author == $current_user->ID || is_array($record_author) && $record_author["ID"] == $current_user->ID) || $edit_type == "edit_bygroup" && in_array($current_user->ID, $jomiz_dms_workflow->records_should_owned_to))) { $is_record_sealed = TRUE; } } if (isset($_GET['lock-screen']) && $_GET['lock-screen'] == 1) { $is_record_sealed = TRUE; } if ($id < 0) { $is_record_sealed = FALSE; } $page_toolbar_params = array(); if (dms_security::is_allowed($podname, "edit_sealed")) { $is_record_sealed = FALSE; $page_toolbar_params['overwrite_seal'] = TRUE; } // Related Pods if ($related_pods->total() > 0) { while ($related_pods->fetch()) { $related_pod_info = $PodsAPI->load_pod(array('name' => $related_pods->field("related_pod"))); $params = array("join" => "INNER JOIN jomiz_podsrel on (`t`.`id` = jomiz_podsrel.item_id AND jomiz_podsrel.field_id = " . $related_pods->field('field_id') . " AND jomiz_podsrel.related_item_id = {$id})"); if ($use_tabs) { $tab_header_text = $related_pods->field("title"); $tab_header_id = $related_pods->field("related_pod"); $toolbar_row = $id == -1 || $is_record_sealed ? "" : '<div class="row"><div class="col-xs-12 text-right toolbar-top">' . pods_related::build_toolbar($related_pods->field("related_pod"), $related_pods->field("title"), TRUE, $url_params) . '</div></div>'; $table_row = '<div class="row"><div class="col-xs-12">' . pods_related::build_table($related_pod_info, 0, -1, $params, TRUE, $url_params, TRUE, FALSE, array("owner_document_is_sealed" => $is_record_sealed)) . '</div></div>'; $tabs_header .= "<li role='presentation'><a href='#{$tab_header_id}' aria-controls='{$tab_header_id}' role='tab' data-toggle='tab'>{$tab_header_text}</a></li>"; $tabs_body .= "<div role='tabpanel' class='tab-pane fade' id='{$tab_header_id}'>{$toolbar_row} {$table_row}</div>";
</h1> </div> </div> </div> </div> </div> <div class="row"> <div class="col-xs-12 delete-message <?php echo $notification_css_class; ?> "> <?php echo $notification_message; ?> </div> </div> <div class="row"> <div class="col-xs-12 delete-options text-center"> <?php if ($record_sealed && dms_security::is_allowed($podname, "delete_sealed") || !$record_sealed) { echo "<a title='Delete' href='" . core_utilities::get_current_page_url() . "&confirm-delete=1' class='btn btn-danger'>Delete</a>"; } ?> <a title="Cancel" href="<?php echo $return_url; ?> " class="btn btn-default">Cancel</a> </div> </div> <?php get_footer("dialog");
</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> </button> <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1"> <?php echo $menus["navbar-menu"]; ?> </ul> </div> <?php if (dms_security::is_allowed_cap("jomiz_dms_front_settings")) { ?> <a href="<?php echo home_url('/settings/'); ?> " title="Settings" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-cog"></span></a> <?php } ?> <button type="button" class="btn btn-default btn-sm" title="My Profile"><?php echo $current_user->display_name; ?> <span class="glyphicon glyphicon-user"></span></button> <a href="<?php echo wp_logout_url(); ?>