function getListingFiltersBlock() { global $PHP_SELF; global $HTTP_VARS; $buffer = ''; if ($HTTP_VARS['listings.filters'] != 'N' && get_opendb_config_var('listings.filters', 'enable') !== FALSE) { $excluded_vars_list = NULL; $buffer .= "<div id=\"listing-filters\" class=\"menuContainer toggleContainer\">"; $buffer .= "<span id=\"listing-filters-toggle\" class=\"menuToggle toggleHidden\" onclick=\"return toggleVisible('listing-filters');\">" . get_opendb_lang_var('listing_filters') . "</span>"; $buffer .= "<div id=\"listing-filters-content\" class=\"menuContent elementHidden\"\">"; $buffer .= "<h2 class=\"menu\">" . get_opendb_lang_var('listing_filters') . "</h2>"; $buffer .= "<form name=\"listing-filters\" action=\"{$PHP_SELF}\" method=\"GET\">"; $buffer .= "<ul>"; if (get_opendb_config_var('listings.filters', 'show_owner_lov') !== FALSE) { $excluded_vars_list[] = 'owner_id'; $buffer .= "<li><label for=\"select-owner_id\">" . get_opendb_lang_var('owner_id') . "</label>\n\t\t\t\t<select id=\"select-owner_id\" name=\"owner_id\">\n\t\t\t\t<option value=\"\"></option>" . custom_select('owner_id', fetch_user_rs(PERM_ITEM_OWNER), '%fullname% (%user_id%)', 'NA', $HTTP_VARS['owner_id'], 'user_id') . "\n</select></li>"; } if (get_opendb_config_var('listings.filters', 'show_s_status_type_lov') !== FALSE) { if (!is_array($HTTP_VARS['s_status_type']) || $HTTP_VARS['search_list'] != 'y' && $HTTP_VARS['attribute_list'] != 'y') { $results = fetch_status_type_rs(); if ($results && db_num_rows($results) > 1) { $excluded_vars_list[] = 's_status_type'; $buffer .= "<li><label for=\"select-s_status_type\">" . get_opendb_lang_var('s_status_type') . "</label>\n\t\t\t\t\t\t<select id=\"select-s_status_type\" name=\"s_status_type\">\n\t\t\t\t\t\t<option value=\"\"></option>" . custom_select('owner_id', $results, '%s_status_type% - %description%', 'NA', $HTTP_VARS['s_status_type'], 's_status_type') . "\n</select></li>"; } } } if (get_opendb_config_var('listings.filters', 'show_item_type_group_lov') !== FALSE) { $v_item_type_groups = get_list_item_type_groups(); if (is_not_empty_array($v_item_type_groups)) { $excluded_vars_list[] = 's_item_type_group'; $buffer .= "<li><label for=\"select-s_item_type_group\">" . get_opendb_lang_var('s_item_type_group') . "</label>\n\t\t\t\t\t<select id=\"select-s_item_type_group\" name=\"s_item_type_group\">\n\t\t\t\t\t<option value=\"\"></option>" . custom_select('s_item_type_group', $v_item_type_groups, '%value% - %display%', 'NA', $HTTP_VARS['s_item_type_group'], 'value') . "\n</select></li>"; } } if (get_opendb_config_var('listings.filters', 'show_item_type_lov') !== FALSE) { $v_item_types = get_list_item_types(NULL); if (is_not_empty_array($v_item_type_groups)) { $excluded_vars_list[] = 's_item_type'; $buffer .= "<li><label for=\"select-s_item_type\">" . get_opendb_lang_var('s_item_type') . "</label>\n\t\t\t\t\t<select id=\"select-s_item_type\" name=\"s_item_type\">\n\t\t\t\t\t<option value=\"\"></option>" . custom_select('s_item_type', $v_item_types, '%value% - %display%', 'NA', $HTTP_VARS['s_item_type'], 'value') . "\n</select></li>"; } } if (get_opendb_config_var('listings.filters', 'show_interest') !== FALSE) { $buffer .= "<li><label for=\"select-interest\">" . get_opendb_lang_var('interest_only_marked') . "</label>" . "<input type=\"checkbox\" class=\"checkbox\" id=\"select-interest\" name=\"interest_level\" value=\"1\"" . ($HTTP_VARS['interest_level'] >= 1 ? ' CHECKED' : '') . "></li>"; $excluded_vars_list[] = 'interest_level'; } if ($HTTP_VARS['owner_id'] != get_opendb_session_var('user_id')) { $buffer .= "<li><label for=\"exclude-current-user\">" . get_opendb_lang_var('exclude_current_user') . "</label>" . "<input type=\"checkbox\" class=\"checkbox\" id=\"exclude-current-user\" name=\"not_owner_id\" value=\"" . get_opendb_session_var('user_id') . "\"" . ($HTTP_VARS['not_owner_id'] == get_opendb_session_var('user_id') ? ' CHECKED' : '') . "></li>"; $excluded_vars_list[] = 'not_owner_id'; } $buffer .= "</ul>"; $buffer .= get_url_fields($HTTP_VARS, NULL, $excluded_vars_list); $buffer .= "<input type=\"submit\" class=\"submit\" value=\"" . get_opendb_lang_var('submit') . "\">"; $buffer .= "</form>"; $buffer .= "</div>"; $buffer .= "</div>"; } return $buffer; }
function display_s_file_type_row($file_type_r, $row) { global $PHP_SELF; global $ADMIN_TYPE; echo "\n<tr>"; if (is_not_empty_array($file_type_r)) { echo "\n<td class=\"data\">" . get_input_field("content_type[{$row}]", NULL, NULL, "readonly", "N", $file_type_r['content_type'], FALSE) . "<input type=\"hidden\" name=\"exists_ind[{$row}]\" value=\"Y\">" . "</td>"; } else { echo "\n<td class=\"data\">" . get_input_field("content_type[{$row}]", NULL, NULL, "text(20,100)", "Y", $file_type_r['content_type'], FALSE) . "<input type=\"hidden\" name=\"exists_ind[{$row}]\" value=\"N\">" . "</td>"; } $groups = array(); $results = fetch_s_file_type_content_group_rs(); if ($results) { while ($content_group_r = db_fetch_assoc($results)) { $groups[] = $content_group_r['content_group']; } } echo "<td class=\"data\">" . custom_select("content_group[{$row}]", $groups, "%value%", 1, $file_type_r['content_group'], "value") . "</td>"; //description echo "\n<td class=\"data\">" . get_input_field("description[{$row}]", NULL, NULL, "text(20,255)", "N", $file_type_r['description'], FALSE) . "</td>"; echo "\n<td class=\"data\">" . get_input_field("extension[{$row}]", NULL, "Extension", "text(10,10)", "Y", $file_type_r['extension'], FALSE) . "</td>"; $alt_extensions = ''; if (is_not_empty_array($file_type_r)) { $alt_extensions_r = fetch_s_file_type_alt_extension_r($file_type_r['content_type']); if (is_array($alt_extensions_r)) { $alt_extensions = implode(', ', $alt_extensions_r); } } // convert array of extensiosn to a string echo "\n<td class=\"data\">" . get_input_field("alt_extensions[{$row}]", NULL, "Alternate Extensions", "text(20,255)", "N", $alt_extensions, FALSE) . "</td>"; echo "<td class=\"data\">"; // Get the theme specific source of the image. if (strlen($file_type_r['image']) > 0) { $src = theme_image_src($file_type_r['image']); } if ($src !== FALSE && strlen($src) > 0) { echo "<img src=\"{$src}\">"; } else { echo " "; } echo "</td>"; echo "\n<td class=\"data\">" . get_input_field("image[{$row}]", NULL, NULL, "url(15,*,\"gif,jpg,png\",N)", "N", $file_type_r['image'], FALSE) . "</td>"; echo "\n<td class=\"data\">" . get_input_field("thumbnail_support_ind[{$row}]", NULL, NULL, "simple_checkbox(" . (strtoupper($file_type_r['thumbnail_support_ind']) == "Y" ? "CHECKED" : "") . ")", "N", "Y", FALSE) . "</td>"; echo "\n<td class=\"data\">"; if (is_not_empty_array($file_type_r)) { echo "<a href=\"{$PHP_SELF}?type={$ADMIN_TYPE}&op=delete&content_type=" . $file_type_r['content_type'] . "\">Delete</a>"; } else { echo " "; } echo "\n</td>"; echo "</tr>"; }
function getItemsPerPageControl($PHP_SELF, $HTTP_VARS) { $buffer = ''; $items_per_page_options_r = get_opendb_config_var('listings', 'items_per_page_options'); if (is_not_empty_array($items_per_page_options_r)) { $items_per_page_rs = array(); while (list(, $items_per_page) = each($items_per_page_options_r)) { if ($items_per_page == '0') { $display = get_opendb_lang_var('all'); } else { $display = $items_per_page; } $items_per_page_rs[] = array('value' => $items_per_page, 'display' => $display); } $buffer .= "<form class=\"itemsPerPageControl\" id=\"form-items_per_page\" action=\"" . $PHP_SELF . "\" method=\"GET\">" . get_url_fields($HTTP_VARS) . "<label for=\"select-items_per_page\">" . get_opendb_lang_var('items_per_page') . '</label>' . "<select id=\"select-items_per_page\" name=\"items_per_page\" class=\"footer\" onChange=\"this.form.submit()\">" . custom_select('items_per_page', $items_per_page_rs, '%display%', 'NA', ifempty($HTTP_VARS['items_per_page'], get_opendb_config_var('listings', 'items_per_page')), 'value') . "\n</select></form>"; } return $buffer; }
function display_borrower_form($HTTP_VARS) { echo "\n<form action=\"{$PHP_SELF}\" method=\"GET\">"; echo "\n<input type=\"hidden\" name=\"op\" value=\"checkout\">"; echo "\n<table class=\"borrowerForm\">"; if (get_opendb_config_var('borrow', 'admin_quick_checkout_borrower_lov') !== TRUE) { echo get_input_field('borrower_id', NULL, get_opendb_lang_var('borrower'), "filtered(20,20,a-zA-Z0-9_.)", "Y", NULL, TRUE); } else { $results = fetch_user_rs(PERM_USER_BORROWER, INCLUDE_ROLE_PERMISSIONS, EXCLUDE_CURRENT_USER, EXCLUDE_DEACTIVATED_USER, 'fullname', 'ASC'); if ($results) { echo format_field(get_opendb_lang_var('borrower'), custom_select('borrower_id', $results, '%fullname% (%user_id%)', 1, NULL, 'user_id')); } else { echo format_field(get_opendb_lang_var('borrower'), get_opendb_lang_var('no_records_found')); } } echo "</table>"; echo "<input type=\"submit\" class=\"submit\" value=\"" . get_opendb_lang_var('submit') . "\">"; echo "</form>"; }
/** * @param $op is 'edit' or 'new' */ function get_user_input_form($user_r, $HTTP_VARS) { global $PHP_SELF; $buffer .= "<form action=\"{$PHP_SELF}\" method=\"POST\">"; $buffer .= "<table class=\"userInputForm\">"; if (is_not_empty_array($user_r)) { $buffer .= get_input_field("user_id", NULL, get_opendb_lang_var('userid'), "readonly", "", $user_r['user_id'], TRUE); } else { $buffer .= get_input_field("user_id", NULL, get_opendb_lang_var('userid'), "filtered(20,20,a-zA-Z0-9_.)", "Y", $HTTP_VARS['user_id'], TRUE); } if (is_not_empty_array($user_r) && !is_user_granted_permission(PERM_ADMIN_USER_PROFILE)) { $role_r = fetch_role_r($user_r['user_role']); $buffer .= get_input_field("user_role", NULL, get_opendb_lang_var('user_role'), "readonly", "", $role_r['description'], TRUE); } else { $buffer .= format_field(get_opendb_lang_var('user_role'), custom_select('user_role', fetch_user_role_rs($HTTP_VARS['op'] == 'signup' ? EXCLUDE_SIGNUP_UNAVAILABLE_USER : INCLUDE_SIGNUP_UNAVAILABLE_USER), "%description%", '1', ifempty($user_r['user_role'], $HTTP_VARS['user_role']), 'role_name')); } $buffer .= get_input_field("fullname", NULL, get_opendb_lang_var('fullname'), "text(30,100)", "Y", ifempty($HTTP_VARS['fullname'], $user_r['fullname']), TRUE); $buffer .= get_input_field("email_addr", NULL, get_opendb_lang_var('email'), "email(30,100)", "Y", ifempty($HTTP_VARS['email_addr'], $user_r['email_addr']), TRUE); if (get_opendb_config_var('user_admin', 'user_themes_support') !== FALSE) { $uid_theme = ifempty($HTTP_VARS['uid_theme'], $user_r['theme']); $buffer .= format_field(get_opendb_lang_var('user_theme'), custom_select("uid_theme", get_user_theme_r(), "%value%", 1, is_exists_theme($uid_theme) ? $uid_theme : get_opendb_config_var('site', 'theme'))); // If theme no longer exists, then set to default! } if (get_opendb_config_var('user_admin', 'user_language_support') !== FALSE) { // Do not bother with language input field if only one language pack available. if (fetch_language_cnt() > 1) { $uid_language = ifempty($HTTP_VARS['uid_language'], $user_r['language']); $buffer .= format_field(get_opendb_lang_var('user_language'), custom_select('uid_language', fetch_language_rs(), "%language%", 1, is_exists_language($uid_language) ? $uid_language : get_opendb_config_var('site', 'language'), 'language', NULL, 'default_ind')); // If language no longer exists, then set to default! } } $buffer .= "</table>"; // Now do the addresses if (is_not_empty_array($user_r)) { $addr_results = fetch_user_address_type_rs($user_r['user_id'], TRUE); } else { $addr_results = fetch_address_type_rs(TRUE); } if ($addr_results) { while ($address_type_r = db_fetch_assoc($addr_results)) { $v_address_type = strtolower($address_type_r['s_address_type']); if (is_not_empty_array($user_r)) { $attr_results = fetch_address_type_attribute_type_rs($address_type_r['s_address_type'], 'update', TRUE); } else { $attr_results = fetch_address_type_attribute_type_rs($address_type_r['s_address_type'], 'update', TRUE); } if ($attr_results) { $buffer .= '<h3>' . $address_type_r['description'] . '</h3>'; $buffer .= "<ul class=\"addressIndicators\">"; $buffer .= '<li><input type="checkbox" class="checkbox" name="' . $v_address_type . '[public_address_ind]" value="Y"' . (ifempty($address_type_r['public_address_ind'], $HTTP_VARS[$v_address_type]['public_address_ind']) == 'Y' ? ' CHECKED' : '') . '">' . get_opendb_lang_var('public_address_indicator') . '</li>'; $buffer .= '<li><input type="checkbox" class="checkbox" name="' . $v_address_type . '[borrow_address_ind]" value="Y"' . (ifempty($address_type_r['borrow_address_ind'], $HTTP_VARS[$v_address_type]['borrow_address_ind']) == 'Y' ? ' CHECKED' : '') . '">' . get_opendb_lang_var('borrow_address_indicator') . '</li>'; $buffer .= "</ul>"; $buffer .= "<table class=\"addressInputForm\">"; while ($addr_attribute_type_r = db_fetch_assoc($attr_results)) { $fieldname = get_field_name($addr_attribute_type_r['s_attribute_type'], $addr_attribute_type_r['order_no']); $value = NULL; if ($address_type_r['sequence_number'] !== NULL) { if (is_lookup_attribute_type($addr_attribute_type_r['s_attribute_type'])) { $value = fetch_user_address_lookup_attribute_val($address_type_r['sequence_number'], $addr_attribute_type_r['s_attribute_type'], $addr_attribute_type_r['order_no']); } else { $value = fetch_user_address_attribute_val($address_type_r['sequence_number'], $addr_attribute_type_r['s_attribute_type'], $addr_attribute_type_r['order_no']); } $value = ifempty(filter_item_input_field($addr_attribute_type_r, $HTTP_VARS[$v_address_type][$fieldname]), $value); } else { $value = filter_item_input_field($addr_attribute_type_r, $HTTP_VARS[$v_address_type][$fieldname]); } // If this is an edit operation - the value must be NOT NULL // for some widgets to work properly. if ($address_type_r['sequence_number'] !== NULL && $value === NULL) { $value = ''; } $buffer .= get_item_input_field($v_address_type . '[' . $fieldname . ']', $addr_attribute_type_r, NULL, $value); } //while db_free_result($attr_results); $buffer .= "</table>"; } //if($attr_results) } //while db_free_result($addr_results); } //if($addr_results) $buffer .= format_help_block(array('img' => 'compulsory.gif', 'text' => get_opendb_lang_var('compulsory_field'), id => 'compulsory')); if ($HTTP_VARS['op'] == 'new_user') { $buffer .= "<h3>" . get_opendb_lang_var('password') . "</h3>"; if (get_opendb_config_var('user_admin', 'user_passwd_change_allowed') !== FALSE || is_user_granted_permission(PERM_ADMIN_CHANGE_PASSWORD)) { $buffer .= "<table class=\"changePasswordForm\">"; if (is_valid_opendb_mailer()) { $compulsory_ind = 'N'; } else { $compulsory_ind = 'Y'; } $buffer .= get_input_field("pwd", NULL, get_opendb_lang_var('new_passwd'), "password(30,40)", $compulsory_ind, "", TRUE); $buffer .= get_input_field("confirmpwd", NULL, get_opendb_lang_var('confirm_passwd'), "password(30,40)", $compulsory_ind, "", TRUE, NULL, get_opendb_config_var('widgets', 'enable_javascript_validation') !== FALSE ? "if( (this.form.pwd.value.length!=0 || this.form.confirmpwd.value.length!=0) && this.form.pwd.value!=this.form.confirmpwd.value){alert('" . get_opendb_lang_var('passwds_do_not_match') . "'); this.focus(); return false;}" : ""); $buffer .= "\n</table>"; if ($compulsory_ind == 'N') { $buffer .= format_help_block(get_opendb_lang_var('new_passwd_will_be_autogenerated_if_not_specified')); } } } if ($HTTP_VARS['op'] == 'signup' && get_opendb_config_var('login.signup', 'disable_captcha') !== TRUE) { $buffer .= render_secret_image_form_field(); } if (get_opendb_config_var('widgets', 'enable_javascript_validation') !== FALSE) { $onclick_event = "if(!checkForm(this.form)){return false;}else{this.form.submit();}"; } else { $onclick_event = "this.form.submit();"; } if (is_not_empty_array($user_r)) { $buffer .= "\n<input type=\"hidden\" name=\"op\" value=\"update\">"; if ($HTTP_VARS['user_id'] != get_opendb_session_var('user_id')) { $buffer .= "\n<input type=\"button\" class=\"button\" onclick=\"this.form.op.value='update'; {$onclick_event}\" value=\"" . get_opendb_lang_var('update_user') . "\">"; if (is_user_not_activated($HTTP_VARS['user_id'])) { $buffer .= "\n<input type=\"button\" class=\"button\" onclick=\"this.form.op.value='delete'; this.form.submit();\" value=\"" . get_opendb_lang_var('delete_user') . "\">"; } else { if (is_user_active($HTTP_VARS['user_id'])) { $buffer .= "\n<input type=\"button\" class=\"button\" onclick=\"this.form.op.value='deactivate'; this.form.submit();\" value=\"" . get_opendb_lang_var('deactivate_user') . "\">"; } } if (!is_user_active($HTTP_VARS['user_id'])) { $buffer .= "\n<input type=\"button\" class=\"button\" onclick=\"this.form.op.value='activate'; this.form.submit();\" value=\"" . get_opendb_lang_var('activate_user') . "\">"; } } else { $buffer .= "\n<input type=\"button\" class=\"button\" onclick=\"{$onclick_event}\" value=\"" . get_opendb_lang_var('update_details') . "\">"; } } else { if ($HTTP_VARS['op'] != 'signup') { if (is_valid_opendb_mailer()) { if ($HTTP_VARS['op'] == 'new_user') { if ($HTTP_VARS['email_user'] == 'Y') { $checked = "CHECKED"; } else { $checked = ""; } } else { $checked = "CHECKED"; } $buffer .= "<p><input type=\"checkbox\" class=\"checkbox\" id=\"email_user\" name=\"email_user\" value=\"Y\" {$checked}>" . get_opendb_lang_var('send_welcome_email') . "</p>"; } $buffer .= "\n<input type=\"hidden\" name=\"op\" value=\"insert\">" . "\n<input type=\"button\" class=\"button\" onclick=\"{$onclick_event}\" value=\"" . get_opendb_lang_var('add_user') . "\">"; } else { $buffer .= "\n<input type=\"hidden\" name=\"op\" value=\"signup\">" . "<input type=\"hidden\" name=\"op2\" value=\"send_info\">" . "<input type=\"button\" class=\"button\" onclick=\"{$onclick_event}\" value=\"" . get_opendb_lang_var('submit') . "\">"; } } $buffer .= "\n</form>"; return $buffer; }
$HTTP_VARS['op'] = 'my_reserve_basket'; if (is_exists_item_instance($HTTP_VARS['item_id'], $HTTP_VARS['instance_no'])) { $footer_links_r[] = array(url => "item_display.php?item_id=" . $HTTP_VARS['item_id'] . "&instance_no=" . $HTTP_VARS['instance_no'], text => get_opendb_lang_var('back_to_item')); } if (is_opendb_session_var('listing_url_vars')) { $footer_links_r[] = array(url => "listings.php?" . get_url_string(get_opendb_session_var('listing_url_vars')), text => get_opendb_lang_var('back_to_listing')); } } else { if ($HTTP_VARS['op'] == 'admin_history') { echo _theme_header(get_opendb_lang_var('borrower_history')); echo "<h2>" . get_opendb_lang_var('borrower_history') . "</h2>"; echo "\n<form action=\"{$PHP_SELF}\" method=\"GET\">"; echo "\n<input type=\"hidden\" name=\"op\" value=\"my_history\">"; echo "\n<table>"; $results = fetch_user_rs(PERM_USER_BORROWER, ROLE_PERMISSIONS_INCLUDE, INCLUDE_CURRENT_USER, EXCLUDE_DEACTIVATED_USER, "fullname", "ASC"); echo format_field(get_opendb_lang_var('borrower'), custom_select('uid', $results, '%fullname% (%user_id%)', 1, get_opendb_session_var('user_id'), 'user_id')); echo "</table>"; echo "<input type=\"submit\" class=\"submit\" value=\"" . get_opendb_lang_var('submit') . "\">"; echo "</form>"; echo _theme_footer(); $show_listings = FALSE; } else { opendb_operation_not_available(); $show_listings = FALSE; } } } } } } }
function build_roles_select($attribute_type_r) { $user_roles = array(); $result = fetch_user_role_rs(); $public = fetch_role_r(get_public_access_rolename()); $user_roles[] = array('role_name' => $public['role_name'], 'description' => $public['description']); while ($role = db_fetch_assoc($result)) { $user_roles[] = $role; } $select = format_field("View Permission", custom_select('view_perm', $user_roles, '%description%', 1, $attribute_type_r['view_perm'], 'role_name')); db_free_result($result); return $select; }
function display_site_plugin_s_attribute_type_lookup_map_row($record_r, $row) { global $PHP_SELF; global $ADMIN_TYPE; if (is_not_empty_array($record_r)) { echo "<input type=\"hidden\" name=\"exists_ind[{$row}]\" value=\"Y\">"; echo "<input type=\"hidden\" name=\"sequence_number[{$row}]\" value=\"" . $record_r['sequence_number'] . "\">"; echo "<td class=\"data\">" . get_input_field("s_attribute_type[{$row}]", NULL, "Attribute Type", "readonly", "Y", $record_r['s_attribute_type'], FALSE) . "</td>"; echo "<td class=\"data\">" . get_input_field("value[{$row}]", NULL, "Site Value", "readonly", "Y", $record_r['value'], FALSE) . "</td>"; $results = fetch_attribute_type_lookup_rs($record_r['s_attribute_type'], 'order_no, value ASC'); echo "\n<td class=\"data\">" . custom_select("lookup_attribute_val[{$row}]", $results, "%value% - %display%", 1, $record_r['lookup_attribute_val']) . "</td>"; } else { echo "<input type=\"hidden\" name=\"exists_ind[{$row}]\" value=\"N\">"; $attribute_types[] = ''; $results = fetch_lookup_s_attribute_type_rs(); if ($results) { while ($attribute_type_r = db_fetch_assoc($results)) { $attribute_types[] = $attribute_type_r['s_attribute_type']; } db_free_result($results); } echo "\n<td class=\"data\">" . custom_select("s_attribute_type[{$row}]", $attribute_types, "%value%", 1, NULL, 'value', NULL, NULL, "populateList(this.options[this.options.selectedIndex].value, this.form['lookup_attribute_val[{$row}]'], arrayOfLookupValues, false, null, false);") . "</td>"; echo "<td class=\"data\">" . get_input_field("value[{$row}]", NULL, "Site Value", "text(20,100)", "Y", NULL, FALSE) . "</td>"; echo "\n<td class=\"data\">" . custom_select("lookup_attribute_val[{$row}]", array(array('value' => '', 'display' => '')), "%value% - %display%", 1, NULL) . "</td>"; } echo "\n<td class=\"data\">"; if (is_not_empty_array($record_r)) { echo "<a href=\"{$PHP_SELF}?type={$ADMIN_TYPE}&op=delete_site_plugin_s_attribute_type_lookup_map&site_type=" . $record_r['site_type'] . "&sequence_number=" . $record_r['sequence_number'] . "\">Delete</a>"; } else { echo " "; } echo "\n</td>"; }
function get_column_details($record_r, $row) { if (is_not_empty_array($record_r)) { $new_record = FALSE; } else { $new_record = TRUE; } $columns_r = NULL; $columns_r[] = array('column' => 'button', 'field' => '<a style="{cursor: pointer;}" onClick="moveRowUp(document.forms[\'s_item_listing_conf\'], document.forms[\'s_item_listing_conf\'][\'column_no[' . $row . ']\']); return false;"><img src="./images/admin/up.gif" border=0></a><br />' . '<a style="{cursor: pointer;}" onClick="moveRowDown(document.forms[\'s_item_listing_conf\'], document.forms[\'s_item_listing_conf\'][\'column_no[' . $row . ']\']); return false;"><img src="./images/admin/down.gif" border=0></a>'); $column_types_r = array(array('value' => '', 'display' => ''), array('value' => 's_field_type', 'display' => 'Field Type'), array('value' => 's_attribute_type', 'display' => 'Attribute Type'), array('value' => 'action_links', 'display' => 'Action Links'), array('value' => 'borrow_status', 'display' => 'Borrow Status')); $columns_r[] = array('column' => 'column_type', 'field' => custom_select("column_type[{$row}]", $column_types_r, '%display%', 1, $record_r['column_type'], 'value', NULL, '', 'doOnChange(this.form, this)', FALSE)); // disabled $field_type_r = array(); if ($new_record || $record_r['column_type'] != 's_field_type') { $field_type_r = array(array('value' => '', 'display' => '')); } //ITEM_ID, TITLE, STATUSTYPE, STATUSCMNT, CATEGORY, RATING, ITEMTYPE, OWNER, INTEREST $field_type_r = array_merge($field_type_r, array(array('value' => 'ITEM_ID', 'display' => 'Item ID'), array('value' => 'ITEMTYPE', 'display' => 'Item Type'), array('value' => 'TITLE', 'display' => 'Title'), array('value' => 'CATEGORY', 'display' => 'Category'), array('value' => 'STATUSTYPE', 'display' => 'Status Type'), array('value' => 'STATUSCMNT', 'display' => 'Status Comment'), array('value' => 'OWNER', 'display' => 'Owner'), array('value' => 'INTEREST', 'display' => 'Interest'), array('value' => 'RATING', 'display' => 'Rating'))); $columns_r[] = array('column' => 's_field_type', 'field' => custom_select("s_field_type[{$row}]", $field_type_r, '%display%', 1, $record_r['s_field_type'], 'value', NULL, '', 'doOnChange(this.form, this)', $new_record || is_field_disabled('s_field_type', $record_r))); $attribute_type_rs = array(); if ($new_record || $record_r['column_type'] != 's_attribute_type') { $attribute_type_rs = array(array('value' => '', 'display' => '')); } $attribute_type_rs = get_attribute_type_rs($attribute_type_rs); // this is to avoid confusion if system data is defined for non-existent s_attribute_types if (!$new_record && !in_array($record_r['s_attribute_type'], $attribute_type_rs)) { $attribute_type_rs[] = array('value' => $record_r['s_attribute_type'], 'display' => $record_r['s_attribute_type']); } $columns_r[] = array('column' => 's_attribute_type', 'field' => custom_select("s_attribute_type[{$row}]", $attribute_type_rs, '%value%', 1, $record_r['s_attribute_type'], 'value', NULL, '', 'doOnChange(this.form, this)', $new_record || is_field_disabled('s_attribute_type', $record_r))); $columns_r[] = array('column' => 'override_prompt', 'field' => get_input_field("override_prompt[{$row}]", NULL, 'Override Prompt', 'text(20,30)', 'N', $record_r['override_prompt'], FALSE, '', '', $new_record || is_field_disabled('override_prompt', $record_r))); $disabled = $new_record || is_field_disabled('printable_support_ind', $record_r); if ($disabled) { $record_r['printable_support_ind'] = 'N'; } $columns_r[] = array('column' => 'printable_support_ind', 'field' => get_input_field("printable_support_ind[{$row}]", NULL, 'Printable Support', "simple_checkbox(" . ($record_r['printable_support_ind'] == 'Y' ? 'CHECKED' : '') . ")", 'N', 'Y', FALSE, '', '', $disabled)); $disabled = $new_record || is_field_disabled('orderby_support_ind', $record_r); if ($disabled) { $record_r['orderby_support_ind'] = 'N'; } $columns_r[] = array('column' => 'orderby_support_ind', 'field' => get_input_field('orderby_support_ind[' . $row . ']', NULL, 'Order By Support', "simple_checkbox(" . ($record_r['orderby_support_ind'] == 'Y' ? 'CHECKED' : '') . ")", 'N', 'Y', FALSE, NULL, 'doOnChange(this.form, this);', $new_record || is_field_disabled('orderby_support_ind', $record_r))); $orderby_datatypes_r = array(); if (is_field_disabled('orderby_datatype', $record_r)) { $orderby_datatypes_r = array(array('value' => '', 'display' => '')); } $orderby_datatypes_r = array_merge($orderby_datatypes_r, array(array('value' => 'alpha'), array('value' => 'numeric'))); $columns_r[] = array('column' => 'orderby_datatype', 'field' => custom_select("orderby_datatype[{$row}]", $orderby_datatypes_r, '%value%', 1, $record_r['orderby_datatype'], 'value', NULL, '', '', $new_record || is_field_disabled('orderby_datatype', $record_r))); $disabled = $new_record || is_field_disabled('orderby_default_ind', $record_r); if ($disabled) { $record_r['orderby_default_ind'] = 'N'; } $columns_r[] = array('column' => 'orderby_default_ind', 'field' => get_input_field("orderby_default_ind[{$row}]", NULL, 'Default Orderby', "simple_checkbox(" . ($record_r['orderby_default_ind'] == 'Y' ? 'CHECKED' : '') . ")", 'N', 'Y', FALSE, '', 'doOnChange(this.form, this);', $disabled)); $sortorder_r = array(); if (is_field_disabled('orderby_sort_order', $record_r)) { $sortorder_r = array(array('value' => '', 'display' => '')); } $sortorder_r = array_merge($sortorder_r, array(array('value' => 'asc'), array('value' => 'desc'))); $columns_r[] = array('column' => 'orderby_sort_order', 'field' => custom_select("orderby_sort_order[{$row}]", $sortorder_r, '%value%', 1, $record_r['orderby_sort_order'], 'value', NULL, '', '', $new_record || is_field_disabled('orderby_sort_order', $record_r))); $buffer = "<tr>"; $buffer .= '<input type="hidden" name="is_new_row[' . $row . ']" value="' . ($new_record ? 'true' : 'false') . '">'; $class = 'data'; if (strlen($columns_r['error']) > 0) { $class = 'error'; } // column_no hidden must be null for us to determine if a row has been populated $buffer .= get_input_field("column_no[{$row}]", NULL, 'Column No', 'hidden', 'N', $record_r['column_no'], FALSE); while (list(, $column_r) = each($columns_r)) { $buffer .= '<td class="' . $class . '" id="' . $column_r['column'] . '[' . $row . ']" nowrap>' . $column_r['field'] . '</td>'; } $buffer .= '</tr>'; return $buffer; }
while (list(, $plugin_r) = @each($plugin_list_r)) { $field .= '<option value="' . $plugin_r['name'] . '"'; if ($plugin_r['name'] == 'OpenDbExportPlugin') { $field .= ' SELECTED'; } $field .= '>' . $plugin_r['description'] . "\n"; } } $field .= "</select>"; echo format_field(get_opendb_lang_var('type'), $field); if (is_user_granted_permission(PERM_ADMIN_EXPORT)) { echo format_field(get_opendb_lang_var('owner'), "\n<select name=\"owner_id\">" . "\n<option value=\"\">-------------- " . get_opendb_lang_var('all') . " --------------" . custom_select('owner_id', fetch_user_rs(PERM_USER_EXPORT), '%fullname% (%user_id%)', 'NA', ifempty($HTTP_VARS['owner_id'], get_opendb_session_var('user_id')), 'user_id') . "\n</select>"); } else { echo "<input type=\"hidden\" name=\"owner_id\" value=\"" . $HTTP_VARS['owner_id'] . "\">"; } echo format_field(get_opendb_lang_var('item_type'), "<select name=\"s_item_type\">" . "\n<option value=\"\">-------------- " . get_opendb_lang_var('all') . " --------------" . custom_select('s_item_type', fetch_item_type_rs(), '%s_item_type% - %description%', 'NA', $HTTP_VARS['s_item_type'], 's_item_type') . "\n</select>"); $lookup_results = fetch_status_type_rs(TRUE); if ($lookup_results && db_num_rows($lookup_results) > 1) { echo format_field(get_opendb_lang_var('s_status_type'), checkbox_grid('s_status_type', $lookup_results, '%img%', 'VERTICAL', NULL)); // value } echo "</table>"; echo "<input type=\"submit\" class=\"submit\" value=\"" . get_opendb_lang_var('submit') . "\">"; echo "</form>"; echo _theme_footer(); } } else { //no guests or borrowers allowed! opendb_not_authorised_page(array(PERM_USER_EXPORT, PERM_ADMIN_EXPORT)); } } else {
function get_upload_form($HTTP_VARS) { global $PHP_SELF; $buffer .= "\n<form name=\"main\" action=\"{$PHP_SELF}\" method=\"POST\" enctype=\"multipart/form-data\">"; $buffer .= "\n<input type=\"hidden\" name=\"op\" value=\"upload\">"; $buffer .= "\n<table>"; if (is_user_granted_permission(PERM_ADMIN_IMPORT)) { $buffer .= format_field(get_opendb_lang_var('owner'), custom_select('owner_id', fetch_user_rs(PERM_USER_IMPORT), '%fullname% (%user_id%)', 1, ifempty($HTTP_VARS['owner_id'], get_opendb_session_var('user_id')), 'user_id')); } else { $buffer .= "\n<input type=\"hidden\" name=\"owner_id\" value=\"" . $HTTP_VARS['owner_id'] . "\">"; } $buffer .= format_field(get_opendb_lang_var('item_type'), single_select('s_item_type', fetch_item_type_rs(TRUE), "%value% - %display%", NULL, $HTTP_VARS['s_item_type'])); $buffer .= format_field(get_opendb_lang_var('file'), "<input type=\"file\" class=\"file\" size=\"25\" name=\"uploadfile\">"); $buffer .= "\n</table>"; $buffer .= "\n<input type=\"submit\" class=\"submit\" value=\"" . get_opendb_lang_var('submit') . "\">"; $buffer .= "\n</form>"; return $buffer; }
/** boolean - TRUE or FALSE only text - arbritrary text textarea - arbritrary text email - email address number - enforce a numeric value datemask - enforce a date mask. usertype - Restrict to a single user type only. usertype_array - Restrict to set of user types only. value_select(option1,option2) array - keys will be numeric and in sequence only. */ function get_group_block_input_field($config_group_item_r, $value) { // replace period with '$', so we can avoid PHP auto-replacing '.' with '_' and the // confusion that will bring. $config_group_item_r['group_id'] = str_replace('.', '$', $config_group_item_r['group_id']); $fieldname = $config_group_item_r['group_id'] . '[' . $config_group_item_r['id'] . ']'; if ($config_group_item_r['keyid'] != '0') { $fieldname .= '[' . $config_group_item_r['keyid'] . ']'; } switch ($config_group_item_r['type']) { case 'boolean': return checkbox_field($fieldname, $config_group_item_r['prompt'], $value !== NULL && $value === TRUE, 'TRUE'); break; case 'readonly': return readonly_field($fieldname, htmlspecialchars($value)); break; case 'text': return text_field($fieldname, $config_group_item_r['prompt'], 50, 255, 'N', htmlspecialchars($value)); break; case 'password': return password_field($fieldname, $config_group_item_r['prompt'], 50, 255, 'N', htmlspecialchars($value)); break; case 'textarea': return textarea_field($fieldname, $config_group_item_r['prompt'], 50, 5, 255, 'N', htmlspecialchars($value)); break; case 'email': return email_field($fieldname, $config_group_item_r['prompt'], 50, 255, 'N', htmlspecialchars($value)); break; case 'number': return number_field($fieldname, $config_group_item_r['prompt'], 10, 50, 'N', htmlspecialchars($value)); break; case 'datemask': return text_field($fieldname, $config_group_item_r['prompt'], 50, 255, 'N', htmlspecialchars($value)); break; case 'instance_attribute_type': return custom_select($fieldname, fetch_instance_attribute_type_rs(), '%s_attribute_type% - %description%', 1, $value, 's_attribute_type'); break; case 'language': return custom_select($fieldname, fetch_language_rs(), '%language%', 1, $value, 'language', NULL, 'default_ind'); break; case 'theme': return custom_select($fieldname, get_user_theme_r(), '%value%', 1, $value); break; case 'export': return custom_select($fieldname, array_merge(array(''), get_export_r()), '%value%', 1, $value); break; case 'value_select': $value_options_r = explode(',', $config_group_item_r['subtype']); return value_select($fieldname, $value_options_r, 1, $value); break; case 'array': $buffer = ''; switch ($config_group_item_r['subtype']) { case 'text': case 'number': $element_name = $config_group_item_r['group_id'] . "[" . $config_group_item_r['id'] . "][]"; $buffer .= "<select name=\"" . $element_name . "\" size=\"5\" MULTIPLE>\n"; if (is_array($value)) { reset($value); while (list($key, $val) = each($value)) { $buffer .= "<option value=\"" . $val . "\" SELECTED>" . $val . "\n"; } } $buffer .= "</select>"; $buffer .= "<ul class=\"actionButtons\">"; $buffer .= "<li><input type=\"button\" class=\"button\" value=\"Edit\" onClick=\"updateSelectedOption(this.form['" . $element_name . "'], '" . $config_group_item_r['prompt'] . "', '" . $config_group_item_r['subtype'] . "');\"></li>"; $buffer .= "<li><input type=\"button\" class=\"button\" value=\"Add\" onClick=\"addSelectOption(this.form['" . $element_name . "'], '" . $config_group_item_r['prompt'] . "', '" . $config_group_item_r['subtype'] . "');\"></li>"; $buffer .= "<li><input type=\"button\" class=\"button\" value=\"Delete\" onClick=\"removeSelectedOption(this.form['" . $element_name . "']);\"></li>"; $buffer .= "</ul>"; break; } return $buffer; } //else return '>>> ERROR <<<'; }
} $attrTypeSelect = "<select name=\"attribute_type\" id=\"search-attributetype\" onChange=\"populateList(this.options[this.options.selectedIndex].value, this.form['lookup_attribute_val'], arrayOfLookupValues, false, '" . get_opendb_lang_var('use_the_value_field') . " ---->', true);\">" . "\n<option value=\"\">-------------- " . get_opendb_lang_var('all') . " --------------"; @reset($item_attribute_type_rs); while (list(, $item_attribute_type_r) = @each($item_attribute_type_rs)) { if (has_role_permission($item_attribute_type_r['view_perm'])) { $attrTypeSelect .= "\n<option value=\"" . $item_attribute_type_r['s_attribute_type'] . "\">" . $item_attribute_type_r['s_attribute_type'] . " - " . $item_attribute_type_r['description']; } } $itemTypeBlock .= "</select>"; echo format_field(get_opendb_lang_var('s_attribute_type'), $attrTypeSelect); echo format_field(get_opendb_lang_var('s_attribute_type_lookup'), "\n<select name=\"lookup_attribute_val\" id=\"search-lookupattributeval\" onChange=\"if(this.options[this.options.selectedIndex].value.length>0){this.form['attribute_val'].disabled=true;}else{this.form['attribute_val'].disabled=false;}\">" . "\n<option value=\"\">" . get_opendb_lang_var('use_the_value_field') . " ---->" . "\n</select>"); echo format_field(get_opendb_lang_var('attribute_val'), "<input type=\"text\" class=\"text\" name=\"attribute_val\" id=\"search-attributeval\" size=\"50\" value=\"\">" . "\n<ul class=\"searchInputOptions\">" . "\n<li><input type=\"radio\" class=\"radio\" name=\"attr_match\" value=\"word\">" . get_opendb_lang_var('word_match') . "</li>" . "\n<li><input type=\"radio\" class=\"radio\" name=\"attr_match\" value=\"partial\" CHECKED>" . get_opendb_lang_var('partial_match') . "</li>" . "\n<li><input type=\"radio\" class=\"radio\" name=\"attr_match\" value=\"exact\">" . get_opendb_lang_var('exact_match') . "</li>" . "\n<li><input type=\"checkbox\" class=\"checkbox\" name=\"attr_case\" value=\"case_sensitive\">" . get_opendb_lang_var('case_sensitive') . "</li>" . "\n</ul>"); if (strlen($HTTP_VARS['not_owner_id']) > 0) { echo "\n<input type=\"hidden\" name=\"not_owner_id\" value=\"" . $HTTP_VARS['not_owner_id'] . "\">"; } echo format_field(get_opendb_lang_var('owner'), "\n<select name=\"owner_id\" id=\"search-owner\">" . "\n<option value=\"\">-------------- " . get_opendb_lang_var('all') . " --------------" . custom_select('owner_id', fetch_user_rs(PERM_ITEM_OWNER), '%fullname% (%user_id%)', 'NA', NULL, 'user_id') . "\n</select>"); $lookup_results = fetch_status_type_rs(TRUE); if ($lookup_results && db_num_rows($lookup_results) > 1) { echo format_field(get_opendb_lang_var('s_status_type'), checkbox_grid('s_status_type', $lookup_results, '%img%', 'VERTICAL', array())); // value } echo format_field(get_opendb_lang_var('status_comment'), "\n<input type=\"text\" class=\"text\" name=\"status_comment\" id=\"search-statuscomment\" size=\"50\">" . "\n<ul class=\"searchInputOptions\">" . "\n<li><input type=\"radio\" class=\"radio\" name=\"status_comment_match\" value=\"word\">" . get_opendb_lang_var('word_match') . "</li>" . "\n<li><input type=\"radio\" class=\"radio\" name=\"status_comment_match\" value=\"partial\" CHECKED>" . get_opendb_lang_var('partial_match') . "</li>" . "\n<li><input type=\"radio\" class=\"radio\" name=\"status_comment_match\" value=\"exact\">" . get_opendb_lang_var('exact_match') . "</li>" . "\n<li><input type=\"checkbox\" class=\"checkbox\" name=\"status_comment_case\" value=\"case_sensitive\">" . get_opendb_lang_var('case_sensitive') . "</li>" . "\n</ul>"); echo format_field(get_opendb_lang_var('updated'), "\n<select name=\"update_on_days\" id=\"search-updateondays\" onChange=\"if(this.options[this.options.selectedIndex].value.length>0){this.form['update_on'].disabled=true;}else{this.form['update_on'].disabled=false;}\">" . "\n<option value=\"\">" . get_opendb_lang_var('specify_datetime') . " ---->" . "\n<option value=\"1\">" . get_opendb_lang_var('one_day_ago') . "\n<option value=\"7\">" . get_opendb_lang_var('one_week_ago') . "\n<option value=\"28\">" . get_opendb_lang_var('one_month_ago') . "\n<option value=\"365\">" . get_opendb_lang_var('one_year_ago') . "\n</select>" . get_input_field("update_on", NULL, NULL, "datetime(" . get_opendb_config_var('search', 'datetime_mask') . ")", "N", NULL, FALSE)); echo format_field(get_opendb_lang_var('order_by'), "\n<select name=\"order_by\" id=\"search-orderby\">" . "\n<option value=\"title\" SELECTED>" . get_opendb_lang_var('title') . "\n<option value=\"owner_id\">" . get_opendb_lang_var('owner') . "\n<option value=\"category\">" . get_opendb_lang_var('category') . "\n<option value=\"s_item_type\">" . get_opendb_lang_var('item_type') . "\n<option value=\"s_status_type\">" . get_opendb_lang_var('s_status_type') . "\n<option value=\"update_on\">" . get_opendb_lang_var('update_date') . "\n</select>" . "\n<input type=\"radio\" class=\"radio\" name=\"sortorder\" value=\"ASC\" CHECKED>" . get_opendb_lang_var('asc') . "\n<input type=\"radio\" class=\"radio\" name=\"sortorder\" value=\"DESC\">" . get_opendb_lang_var('desc')); echo "</table>"; echo "\n<input type=\"submit\" class=\"submit\" value=\"" . get_opendb_lang_var('search') . "\">"; echo "</form>"; echo _theme_footer(); } else { opendb_not_authorised_page(PERM_VIEW_ADVANCED_SEARCH, $HTTP_VARS); }
function perform_cloneitem_process(&$item_r, &$status_type_r, &$HTTP_VARS, &$footer_links_r) { global $PHP_SELF; if (!is_exists_item_type($HTTP_VARS['s_item_type'])) { do_op_title($item_r, $status_type_r, 'clone_item'); echo '<form action="' . $PHP_SELF . '">'; echo '<input type="hidden" name="op" value="clone_item">'; echo '<input type="hidden" name="item_id" value="' . $item_r['item_id'] . '">'; echo '<input type="hidden" name="instance_no" value="' . $item_r['instance_no'] . '">'; echo '<table class="cloneItemForm">'; echo '<tr><th class="prompt">' . get_opendb_lang_var('item_type') . '</th>' . '<td class="data">' . custom_select('s_item_type', fetch_item_type_rs(), '%s_item_type% - %description%', '1', $item_r['s_item_type'], 's_item_type', NULL, NULL, NULL, FALSE, 'clone-s_item_type') . '</td></tr>'; echo '</table>'; echo '<input type="submit" class="submit" value="' . get_opendb_lang_var('submit') . '">'; echo '</form>'; echo format_help_block(get_opendb_lang_var('clone_item_help')); $footer_links_r[] = array(url => "item_display.php?item_id=" . $item_r['item_id'] . "&instance_no=" . $item_r['instance_no'], text => get_opendb_lang_var('back_to_item')); } else { // at this point we need to populate $HTTP_VARS with all data corresponding to a mapping between the old and possible new item type $HTTP_VARS = array_merge($HTTP_VARS, copy_item_to_http_vars($item_r, $HTTP_VARS['s_item_type'])); // insert item for item type as specified in previous dialog $item_r['s_item_type'] = $HTTP_VARS['s_item_type']; do_op_title($item_r, $status_type_r, 'clone_item'); $item_r['title'] = NULL; // fix for clone reverting to source item on insert. $item_r['item_id'] = NULL; $item_r['instance_no'] = NULL; $errors = NULL; $formContents = handle_new_or_site($HTTP_VARS['op'], $item_r, $status_type_r, $HTTP_VARS, $errors); if ($formContents !== FALSE) { echo $formContents; } else { echo format_error_block($errors); } } }
function display_item_type_insert_field($title, $fieldType) { $lookup_results = fetch_sfieldtype_attribute_type_rs($fieldType); echo "<tr><td class=\"prompt\">" . "{$title} <a href=\"#\" onmouseover=\"return show_sat_select_tooltip(document.forms['s_item_type']['s_field_type[{$fieldType}]'], arrayOfSystemAttributeTypeTooptips);\" onmouseout=\"return hide_tooltip();\">(?)</a>: " . "</td><td class=\"data\">" . custom_select("s_field_type[{$fieldType}]", $lookup_results, "%s_attribute_type% - %description%", 1, is_array($HTTP_VARS['s_field_type']) ? $HTTP_VARS['s_field_type'][$fieldType] : NULL, "s_attribute_type") . "</td></tr>"; }
/** * @param $borrowed_item_rs Items that this action will be performed against. It may actually * be an array of 'sequence_number' values, in which case the borrow * record for the sequence_number will be fetched. * @param $HTTP_VARS * */ function more_information_form($op, $borrowed_item_rs, $HTTP_VARS, $email_notification = TRUE) { global $PHP_SELF; $duration_attr_type = NULL; $default_borrow_duration = NULL; echo "\n<form action=\"{$PHP_SELF}\" method=\"POST\">"; // In case no detail is required. echo "\n<input type=\"hidden\" name=\"more_info_requested\" value=\"true\">"; // Pass all http variables onto next instance... // Includes empty fields... echo get_url_fields($HTTP_VARS, NULL, NULL); // Display the items to be operated on. if (is_not_empty_array($borrowed_item_rs)) { echo "<div id=\"moreInfoListing\">"; // no pagination. $HTTP_VARS['items_per_page'] = ''; $listingObject = new HTML_Listing($PHP_SELF, $HTTP_VARS); $listingObject->setIncludeHrefLinks(TRUE); $listingObject->setIncludeFooter(FALSE); $listingObject->startListing(); $listingObject->addHeaderColumn(get_opendb_lang_var('type')); $listingObject->addHeaderColumn(get_opendb_lang_var('title')); if ($op == 'reserve' || $op == 'cancel_reserve' || $op == 'quick_check_out') { $listingObject->addHeaderColumn(get_opendb_lang_var('owner')); } else { if ($op == 'check_in') { $listingObject->addHeaderColumn(get_opendb_lang_var('borrower')); } } if (get_opendb_config_var('borrow', 'duration_support')) { if ($op == 'check_out' || $op == 'quick_check_out') { $listingObject->addHeaderColumn(get_opendb_lang_var('borrow_duration')); } } //initialise $max_overdue_duration = NULL; $default_borrow_duration = NULL; reset($borrowed_item_rs); while (list(, $borrowed_item_r) = each($borrowed_item_rs)) { $listingObject->startRow(); // If only a sequence_number, we need to fetch the borrow record. if (!is_array($borrowed_item_r) && is_numeric($borrowed_item_r)) { $borrowed_item_r = fetch_borrowed_item_r($borrowed_item_r); } // TODO - add borrowed item history this to be displayed as readonly. //$results = fetch_borrowed_item_hist_rs($borrowed_item_r['sequence_number']); $item_r = fetch_item_instance_r($borrowed_item_r['item_id'], $borrowed_item_r['instance_no']); $listingObject->addItemTypeImageColumn($item_r['s_item_type']); $listingObject->addTitleColumn($item_r); if ($op == 'reserve' || $op == 'cancel_reserve' || $op == 'quick_check_out') { $listingObject->addUserNameColumn($item_r['owner_id'], array('bi_sequence_number' => $borrowed_item_r['sequence_number'])); } else { if ($op == 'check_in') { $listingObject->addUserNameColumn($borrowed_item_r['borrower_id'], array('bi_sequence_number' => $borrowed_item_r['sequence_number'])); } } if (get_opendb_config_var('borrow', 'duration_support')) { if ($op == 'check_out' || $op == 'quick_check_out') { if (is_numeric($item_r['borrow_duration'])) { // todo - change $duration_attr_type_r = fetch_sfieldtype_item_attribute_type_r($item_r['s_item_type'], 'DURATION'); $listingObject->addDisplayColumn($duration_attr_type_r['s_attribute_type'], NULL, $duration_attr_type_r['display_type'], $item_r['borrow_duration']); } else { $listingObject->addColumn(get_opendb_lang_var('undefined')); } } } // While we are here, we are going to calculate the default duration value. // We want to choose the least duration value. If any of the items use a // different s_attribute_type for duration, then we should not try to get // a default value. This is indicated by the $duration_attr_type===FALSE // if we have encountered a difference. if (get_opendb_config_var('borrow', 'duration_support') && $duration_attr_type !== FALSE) { $new_duration_attr_type = fetch_sfieldtype_item_attribute_type($item_r['s_item_type'], 'DURATION'); if ($duration_attr_type == NULL) { $duration_attr_type = $new_duration_attr_type; } else { if ($duration_attr_type !== $new_duration_attr_type) { // Different s_attribute_type's for DURATION, so cannot display Duration chooser. $duration_attr_type = FALSE; } } if ($duration_attr_type !== FALSE) { if ($op == 'check_out' || $op == 'quick_check_out') { // The default borrow duration should be the least amount of days or undefined // if no records have a borrow duration. if ($default_borrow_duration === NULL) { $default_borrow_duration = $item_r['borrow_duration']; } else { if ($default_borrow_duration !== '') { // Undefined empty value. if (is_numeric($default_borrow_duration) && is_numeric($item_r['borrow_duration']) && $item_r['borrow_duration'] < $default_borrow_duration) { $default_borrow_duration = $item_r['borrow_duration']; } } } } else { if ($op == 'extension') { if ($borrowed_item_r['total_duration'] > $borrowed_item_r['borrow_duration']) { $tmp_overdue_duration = $borrowed_item_r['total_duration'] - $borrowed_item_r['borrow_duration']; } // We want to get the max overdue duration, so we can give the User granting the extension a // default, that will bring all selected items back into non-overdue status. if (!is_numeric($max_overdue_duration) || $max_overdue_duration < $tmp_overdue_duration) { $max_overdue_duration = $tmp_overdue_duration; } } } } } //if(get_opendb_config_var('borrow', 'duration_support') && $duration_attr_type!==FALSE) $listingObject->endRow(); } //while(list(,$borrowed_item_r) = each($borrowed_item_rs)) $listingObject->endListing(); echo "</div>"; } echo "<table class=\"moreInfo\">"; // Do not display this more information section unless email is enabled. if (is_valid_opendb_mailer() && $email_notification !== FALSE) { echo get_input_field("more_information", NULL, get_opendb_lang_var('more_information'), "textarea(50,10)", "N", NULL, TRUE); } // Include a Borrower ID select, minus the current user. if ($op == 'quick_check_out') { if (strlen($HTTP_VARS['borrower_id']) == 0 || !is_user_granted_permission(PERM_USER_BORROWER, $HTTP_VARS['borrower_id'])) { $current_user_mode = EXCLUDE_CURRENT_USER; if (get_opendb_config_var('borrow', 'owner_self_checkout') !== FALSE) { $current_user_mode = INCLUDE_CURRENT_USER; } $results = fetch_user_rs(PERM_USER_BORROWER, INCLUDE_ROLE_PERMISSIONS, $current_user_mode, EXCLUDE_DEACTIVATED_USER, 'fullname', 'ASC'); if ($results) { echo format_field(get_opendb_lang_var('borrower'), custom_select('borrower_id', $results, '%fullname% (%user_id%)', 1, NULL, 'user_id')); } else { echo format_field(get_opendb_lang_var('borrower'), get_opendb_lang_var('no_records_found')); } } } //Only for check_out/quick_check_out operations - makes no sense otherwise! if (get_opendb_config_var('borrow', 'duration_support') !== FALSE && ($op == 'check_out' || $op == 'quick_check_out' || $op == 'extension')) { // Display default borrow duration. if (strlen($duration_attr_type) > 0) { $duration_attr_type_r = fetch_attribute_type_r($duration_attr_type); // We have to find the matching DURATION lookup value, which is at least // as many days as the max_overdue value, or the highest possible // duration value, if none found as large as the $max_overdue_duration if ($op == 'extension') { $default_borrow_duration = NULL; $result = fetch_attribute_type_lookup_rs($duration_attr_type_r['s_attribute_type'], 'order_no, value ASC'); if ($result) { while ($lookup_r = db_fetch_assoc($result)) { if (is_numeric($lookup_r['value']) && (!is_numeric($max_overdue_duration) || is_numeric($max_overdue_duration) && $max_overdue_duration <= $lookup_r['value'])) { $default_borrow_duration = $lookup_r['value']; break; } // backup, in case we need to use outside while loop $lookup_r2 = $lookup_r; } db_free_result($result); // If still null, then set to the largest option if ($default_borrow_duration == NULL) { $default_borrow_duration = $lookup_r2['value']; } } } if ($op != 'extension' && strlen(get_opendb_lang_var('default_borrow_duration')) > 0 && is_array($borrowed_item_rs)) { $duration_attr_type_r['prompt'] = get_opendb_lang_var('default_borrow_duration'); } $duration_attr_type_r['compulsory_ind'] = 'N'; echo get_item_input_field("default_borrow_duration", $duration_attr_type_r, NULL, $op != 'quick_check_out' ? $default_borrow_duration : NULL); // Not appropriate for extension operation if ($op == 'check_out' || $op == 'quick_check_out') { echo get_input_field("override_item_duration", NULL, get_opendb_lang_var('override_item_duration'), "simple_checkbox(" . ($default_borrow_duration === NULL ? "CHECKED" : "") . ")", "N", "Y", TRUE); } } else { //otherwise tell checkout to use item_instance borrow duration instead. if ($op == 'check_out' || $op == 'quick_check_out') { echo "\n<input type=\"hidden\" name=\"override_item_duration\" value=\"N\">"; } } } echo "</table>"; echo "<input type=\"submit\" class=\"submit\" value=\"" . get_opendb_lang_var('submit') . "\">"; echo "</form>"; echo format_help_block(get_opendb_lang_var('more_information_help')); }