if ($addr_results) { while ($address_type_r = db_fetch_assoc($addr_results)) { if (is_user_address_visible($HTTP_VARS, $address_type_r)) { $attr_results = fetch_address_type_attribute_type_rs($address_type_r['s_address_type'], 'query', TRUE); if ($attr_results) { echo '<h3>' . $address_type_r['description'] . '</h3>'; echo "<table>"; while ($addr_attribute_type_r = db_fetch_assoc($attr_results)) { $value = 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']); } if (strlen($value) > 0) { echo get_item_display_field(NULL, $addr_attribute_type_r, $value); } } db_free_result($attr_results); echo "\n</table>"; } } } db_free_result($addr_results); } if (is_valid_opendb_mailer() && strlen($user_r['email_addr']) > 0 && is_user_granted_permission(PERM_SEND_EMAIL) && is_user_permitted_to_receive_email($user_r['user_id'])) { $url = 'email.php?' . get_url_string(array('op' => 'send_to_uid', 'uid' => $user_r['user_id'], 'inc_menu' => 'N', 'subject' => ifempty($HTTP_VARS['subject'], get_opendb_lang_var('no_subject')))); $footer_links_r[] = array(url => $url, target => 'popup(640,480)', text => get_opendb_lang_var('send_email')); } if (is_user_granted_permission(PERM_VIEW_LISTINGS) && $user_r['active_ind'] == 'Y') { $footer_links_r[] = array(url => "listings.php?owner_id=" . $user_r['user_id'], text => get_opendb_lang_var('list_user_items'));
/** return a database value for $item_id based on whether $mask_variable points to title or to an item_attribute. for item_attribute references there are some further options. a legal mask item can include the following: {s_attribute_type} {s_attribute_type.img} {s_attribute_type.value} // the .value will result in the same as if no .option was specified. {s_attribute_type.display} {title} {s_item_type} {item_id} {instance_no} {s_status_type} */ function _get_mask_variable_value($mask_variable, $item_instance_r) { $value = ''; if (is_array($mask_variable) && isset($mask_variable['s_attribute_type']) && isset($mask_variable['option'])) { $value = NULL; // the options that require a item_id context if (is_numeric($item_instance_r['item_id'])) { if ($mask_variable['option'] == 'img') { $lookup_attr_r = fetch_attribute_type_lookup_r($mask_variable['s_attribute_type'], fetch_attribute_val($item_instance_r['item_id'], $item_instance_r['instance_no'], $mask_variable['s_attribute_type'])); if ($lookup_attr_r !== false) { if (strlen($lookup_attr_r['img']) > 0 && $lookup_attr_r['img'] != 'none') { $value = theme_image($lookup_attr_r['img'], $lookup_attr_r['display']); } else { // if no image, then use (value). $value = '(' . $lookup_attr_r['value'] . ')'; } } } else { if ($mask_variable['option'] == 'display' && is_numeric($item_instance_r['item_id'])) { $value = fetch_attribute_type_lookup_r($mask_variable['s_attribute_type'], fetch_attribute_val($item_instance_r['item_id'], $item_instance_r['instance_no'], $mask_variable['s_attribute_type']), 'display'); } else { if ($mask_variable['option'] == 'display_type' && is_numeric($item_instance_r['item_id'])) { //$value = get_display_field($mask_variable['s_attribute_type'], $mask_variable['prompt'], $mask_variable['display_type'], fetch_attribute_val($item_instance_r['item_id'], $item_instance_r['instance_no'], $mask_variable['s_attribute_type']), FALSE); $value = get_item_display_field($item_instance_r, $mask_variable, fetch_attribute_val($item_instance_r['item_id'], $item_instance_r['instance_no'], $mask_variable['s_attribute_type']), FALSE); } } } // as a last resort. if (strlen($value) == 0) { $value = fetch_attribute_val($item_instance_r['item_id'], $item_instance_r['instance_no'], $mask_variable['s_attribute_type']); } } else { if (strlen($item_instance_r['s_item_type']) > 0) { if ($mask_variable['option'] == 'prompt') { $value = fetch_s_item_type_attr_prompt($item_instance_r['s_item_type'], $mask_variable['s_attribute_type']); } } } return $value; } else { if (!is_array($mask_variable) && $mask_variable == 'title') { return $item_instance_r['title']; } else { if (!is_array($mask_variable) && $mask_variable == 's_item_type') { return $item_instance_r['s_item_type']; } else { if (!is_array($mask_variable) && $mask_variable == 'item_id') { return $item_instance_r['item_id']; } else { if (!is_array($mask_variable) && $mask_variable == 'instance_no') { return $item_instance_r['instance_no']; } else { if (!is_array($mask_variable) && $mask_variable == 's_status_type') { return $item_instance_r['s_status_type']; } else { return $mask_variable; } } } } } } }
function __listing_item_import_result_row($item_r, $status_type_r, $attribute_rs, $errorMsg = NULL) { $this->_listingsObject->startRow(); if (is_not_empty_array($errorMsg) || !is_array($errorMsg) && strlen($errorMsg) > 0) { $this->_listingsObject->addThemeImageColumn("cross.gif"); $this_failure_row_count++; } else { $this->_listingsObject->addThemeImageColumn("tick.gif"); $this->_success_row_count++; } $this->_listingsObject->addItemTypeImageColumn($item_r['s_item_type']); if (is_numeric($item_r['instance_no'])) { $instance_no = $item_r['instance_no']; } // We have to include the title, instance, etc. $title = $item_r['title'] . (is_numeric($instance_no) && $instance_no > 1 ? ' #' . $instance_no : ''); $this->_listingsObject->addColumn($title); if (is_not_empty_array($errorMsg) || !is_array($errorMsg) && strlen($errorMsg) > 0) { $this->_listingsObject->addColumn(format_error_block($errorMsg, 'smerror')); $this->_listingsObject->addColumn(); } else { // if override status type, then we are not showing this column if ($this->_cfg_override_status_type !== TRUE) { if (is_array($status_type_r)) { $this->_listingsObject->addThemeImageColumn($status_type_r['img'], $status_type_r['description'], $status_type_r['description'], 's_status_type'); } else { $this->_listingsObject->addColumn('', 1); } } $column = ''; if (is_array($attribute_rs)) { $column .= '<dl class="importAttribs">'; reset($attribute_rs); while (list($key, $attribute_val) = each($attribute_rs)) { $attribute_type_r = NULL; $attribute_type_rs = $this->__getItemTypeAttribs($item_r['s_item_type']); if (is_array($attribute_type_rs)) { reset($attribute_type_rs); while (list(, $attribute_type_r) = each($attribute_type_rs)) { if ($key == get_field_name($attribute_type_r['s_attribute_type'], $attribute_type_r['order_no'])) { if ($attribute_type_r['display_type'] == 'hidden' || $attribute_type_r['display_type'] == 0 && $attribute_type_r['input_type'] == 'hidden') { $attribute_type_r['display_type'] = 'display'; $attribute_type_r['display_type_arg1'] = '%value%'; } $attribute_type_r['listing_link_ind'] = 'N'; $column .= '<dt>' . $attribute_type_r['prompt'] . '</dt>'; $column .= '<dd>' . get_item_display_field(NULL, $attribute_type_r, $attribute_val, FALSE) . '</dd>'; break; } } } } $column .= '</dl>'; } $this->_listingsObject->addColumn($column); } $this->_listingsObject->endRow(); }
function get_search_query_matrix($HTTP_VARS) { function get_match_type($match) { if ($match == 'word') { return get_opendb_lang_var('word_match'); } else { if ($match == 'partial') { return get_opendb_lang_var('partial_match'); } else { if ($match == 'exact') { return get_opendb_lang_var('exact_match'); } else { return NULL; } } } } $searches = array(); if (strlen($HTTP_VARS['title']) > 0) { // Default title match is exact match. $HTTP_VARS['title_match'] = ifempty($HTTP_VARS['title_match'], 'exact'); if ($HTTP_VARS['title_match'] == 'word' || $HTTP_VARS['title_match'] == 'partial') { if (is_null($HTTP_VARS['title_case'])) { $searches[] = array(prompt => get_opendb_lang_var('title') . ' (<em>' . get_match_type($HTTP_VARS['title_match']) . '</em>)', field => $HTTP_VARS['title']); } else { $searches[] = array(prompt => get_opendb_lang_var('title') . ' (<em>' . get_match_type($HTTP_VARS['title_match']) . ', ' . get_opendb_lang_var('case_sensitive') . '</em>)', field => $HTTP_VARS['title']); } } else { $searches[] = array(prompt => get_opendb_lang_var('title'), field => $HTTP_VARS['title']); } } if (strlen($HTTP_VARS['category']) > 0) { // If s_item_type defined, we can get at the s_attribute_type of the category value. if (strlen($HTTP_VARS['s_item_type']) > 0) { $attribute_type_r = fetch_sfieldtype_item_attribute_type_r($HTTP_VARS['s_item_type'], 'CATEGORY'); $searches[] = array(prompt => get_opendb_lang_var('category'), field => get_item_display_field(NULL, $attribute_type_r, $HTTP_VARS['category'], FALSE)); } else { $searches[] = array(prompt => get_opendb_lang_var('category'), field => $HTTP_VARS['category']); } } if (strlen($HTTP_VARS['owner_id']) > 0) { $username = fetch_user_name($HTTP_VARS['owner_id']); if (strlen($username) > 0) { $searches[] = array(prompt => get_opendb_lang_var('owner'), field => $username . ' (' . $HTTP_VARS['owner_id'] . ')'); } } if (strlen($HTTP_VARS['s_item_type_group']) > 0) { $searches[] = array(prompt => get_opendb_lang_var('s_item_type_group'), field => $HTTP_VARS['s_item_type_group']); } if (is_array($HTTP_VARS['s_item_type'])) { $field = ''; for ($i = 0; $i < count($HTTP_VARS['s_item_type']); $i++) { $item_type_r = fetch_item_type_r($HTTP_VARS['s_item_type'][$i]); $field .= theme_image($item_type_r['image'], $item_type_r['description'], 's_item_type'); } $searches[] = array(prompt => get_opendb_lang_var('s_item_type'), field => $field); } else { if (strlen($HTTP_VARS['s_item_type']) > 0) { $item_type_r = fetch_item_type_r($HTTP_VARS['s_item_type']); $searches[] = array(prompt => get_opendb_lang_var('s_item_type'), field => theme_image($item_type_r['image'], $item_type_r['description'], 's_item_type')); } } if (is_numeric($HTTP_VARS['rating'])) { $attribute_type_r = fetch_cached_attribute_type_r('S_RATING'); $searches[] = array(prompt => $attribute_type_r['prompt'], field => get_display_field($attribute_type_r['s_attribute_type'], NULL, 'review()', $HTTP_VARS['rating'], FALSE)); } $attribute_type_r = NULL; if (strlen($HTTP_VARS['attribute_type']) > 0) { $attribute_type_r = fetch_cached_attribute_type_r($HTTP_VARS['attribute_type']); if (is_not_empty_array($attribute_type_r)) { $attribute_type_r['listing_link_ind'] = 'N'; // Default title match is exact match. $HTTP_VARS['attr_match'] = ifempty($HTTP_VARS['attr_match'], 'exact'); // Special category search, but ignore if category variable actually specified. if (strlen($HTTP_VARS['category']) == 0 && strlen($HTTP_VARS['attribute_val']) > 0 && $HTTP_VARS['attr_match'] == 'category') { // We do not want the Listing Link to be added to this display field $searches[] = array(prompt => $attribute_type_r['prompt'], field => get_item_display_field(NULL, $attribute_type_r, stripslashes($HTTP_VARS['attribute_val']), FALSE)); } else { if (strlen($HTTP_VARS['attribute_val']) > 0) { $HTTP_VARS['attribute_val'] = stripslashes($HTTP_VARS['attribute_val']); if (starts_with($HTTP_VARS['attribute_val'], '"') && ends_with($HTTP_VARS['attribute_val'], '"')) { $HTTP_VARS['attribute_val'] = substr($HTTP_VARS['attribute_val'], 1, -1); } $search = ifempty(get_item_display_field(NULL, $attribute_type_r, $HTTP_VARS['attribute_val'], FALSE), $HTTP_VARS['attribute_val']); } else { if (strlen($HTTP_VARS['lookup_attribute_val']) > 0) { $search = get_item_display_field(NULL, $attribute_type_r, stripslashes($HTTP_VARS['lookup_attribute_val']), FALSE); } } if (!is_lookup_attribute_type($HTTP_VARS['attribute_type']) && $HTTP_VARS['attr_match'] != 'exact') { $searches[] = array(prompt => $attribute_type_r['prompt'] . ' (<em>' . get_match_type($HTTP_VARS['attr_match']) . '</em>)', field => $search); } else { $searches[] = array(prompt => $attribute_type_r['prompt'], field => $search); } } } //if(is_not_empty_array($attribute_type_r)) } else { if (strlen($HTTP_VARS['attribute_val']) > 0) { // specified a search term without attribute type, this is a global search. if (is_null($HTTP_VARS['attr_case'])) { $searches[] = array(prompt => get_opendb_lang_var('attribute_val') . ' (<em>' . get_match_type(ifempty($HTTP_VARS['attr_match'], 'exact')) . '</em>)', field => stripslashes($HTTP_VARS['attribute_val'])); } else { $searches[] = array(prompt => get_opendb_lang_var('attribute_val') . ' (<em>' . get_match_type(ifempty($HTTP_VARS['attr_match'], 'exact')) . ', ' . get_opendb_lang_var('case_sensitive') . '</em>)', field => stripslashes($HTTP_VARS['attribute_val'])); } } } // add another search field if update_on value also specified. if (strlen($HTTP_VARS['attr_update_on']) > 0) { if (is_not_empty_array($attribute_type_r)) { $prompt = get_opendb_lang_var('attribute_prompt_updated', array('s_attribute_type' => $attribute_type_r['s_attribute_type'], 'prompt' => $attribute_type_r['prompt'])); } else { $prompt = get_opendb_lang_var('attributes_updated'); } if (strlen($HTTP_VARS['datetimemask']) > 0) { $searches[] = array(prompt => $prompt, field => $HTTP_VARS['attr_update_on'] . ' (' . $HTTP_VARS['datetimemask'] . ')'); } else { $searches[] = array(prompt => $prompt, field => $HTTP_VARS['attr_update_on']); } } else { if (is_numeric($HTTP_VARS['attr_update_on_days'])) { if (is_not_empty_array($attribute_type_r)) { $prompt = get_opendb_lang_var('attribute_prompt_updated', array('s_attribute_type' => $attribute_type_r['s_attribute_type'], 'prompt' => $attribute_type_r['prompt'])); } else { $prompt = get_opendb_lang_var('attributes_updated'); } if ($HTTP_VARS['attr_update_on_days'] == '1') { $field = get_opendb_lang_var('one_day_ago'); } else { if ($HTTP_VARS['attr_update_on_days'] == '7') { $field = get_opendb_lang_var('one_week_ago'); } else { if ($HTTP_VARS['attr_update_on_days'] == '28') { $field = get_opendb_lang_var('one_month_ago'); } else { if ($HTTP_VARS['attr_update_on_days'] == '365') { $field = get_opendb_lang_var('one_year_ago'); } } } } $searches[] = array(prompt => $prompt, field => $field); } } if (strlen($HTTP_VARS['update_on']) > 0) { if (strlen($HTTP_VARS['datetimemask']) > 0) { $searches[] = array(prompt => get_opendb_lang_var('updated'), field => $HTTP_VARS['update_on'] . ' (' . $HTTP_VARS['datetimemask'] . ')'); } else { $searches[] = array(prompt => get_opendb_lang_var('updated'), field => $HTTP_VARS['update_on']); } } else { if (is_numeric($HTTP_VARS['update_on_days'])) { if ($HTTP_VARS['update_on_days'] == '1') { $field = get_opendb_lang_var('one_day_ago'); } else { if ($HTTP_VARS['update_on_days'] == '7') { $field = get_opendb_lang_var('one_week_ago'); } else { if ($HTTP_VARS['update_on_days'] == '28') { $field = get_opendb_lang_var('one_month_ago'); } else { if ($HTTP_VARS['update_on_days'] == '365') { $field = get_opendb_lang_var('one_year_ago'); } } } } $searches[] = array(prompt => get_opendb_lang_var('updated'), field => $field); } } if (is_not_empty_array($HTTP_VARS['s_status_type']) > 0) { $search = ''; for ($i = 0; $i < count($HTTP_VARS['s_status_type']); $i++) { if (strlen($search) > 0) { $search .= ' '; } $status_type_r = fetch_status_type_r($HTTP_VARS['s_status_type'][$i]); if (is_not_empty_array($status_type_r)) { $search .= format_display_value('%img%', $status_type_r['img'], 'Y', $status_type_r['description'], 's_status_type'); } } if (strlen($search) > 0) { $searches[] = array(prompt => get_opendb_lang_var('s_status_type'), field => $search); } } if (strlen($HTTP_VARS['status_comment']) > 0) { // Default status_comment match is exact match. $HTTP_VARS['status_comment_match'] = ifempty($HTTP_VARS['status_comment_match'], 'exact'); if ($HTTP_VARS['status_comment_match'] == 'word' || $HTTP_VARS['status_comment_match'] == 'partial' || $HTTP_VARS['status_comment_match'] == 'exact') { if (is_null($HTTP_VARS['status_comment_case'])) { $searches[] = array(prompt => get_opendb_lang_var('status_comment') . ' (<em>' . get_match_type($HTTP_VARS['status_comment_match']) . '</em>)', field => $HTTP_VARS['status_comment']); } else { $searches[] = array(prompt => get_opendb_lang_var('status_comment') . ' (<em>' . get_match_type($HTTP_VARS['status_comment_match']) . ', ' . get_opendb_lang_var('case_sensitive') . '</em>)', field => $HTTP_VARS['status_comment']); } } else { $searches[] = array(prompt => get_opendb_lang_var('status_comment'), field => $HTTP_VARS['status_comment']); } } if (is_numeric($HTTP_VARS['interest_level']) && $HTTP_VARS['interest_level'] > 0) { $searches[] = array(prompt => get_opendb_lang_var('interest'), field => theme_image("interest_1.gif", get_opendb_lang_var('interest'), 's_item_type')); } return $searches; }
/** @selected will be currently selected record. $borrow_duration is the item_instance.borrow_duration value in all cases, the rest of the values to do with borrow duration will be calculated. */ function get_item_status_row($class, $item_r, $selected) { global $HTTP_VARS; global $PHP_SELF; global $titleMaskCfg; $rowcontents = "\n<tr class=\"{$class}\"><td"; if ($selected) { $rowcontents .= " class=\"currentItemInstance\">" . $item_r['instance_no'] . "</span>"; } else { $rowcontents .= "><a href=\"{$PHP_SELF}?item_id={$item_r['item_id']}&instance_no={$item_r['instance_no']}\">" . $item_r['instance_no'] . "</a>"; } $rowcontents .= "\n</td>"; $page_title = $titleMaskCfg->expand_item_title($item_r); $page_title = remove_enclosing_quotes($page_title); $rowcontents .= "<td>" . get_list_username($item_r['owner_id'], $HTTP_VARS['mode'], $page_title, get_opendb_lang_var('back_to_item'), 'item_display.php?item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no']) . "</td>"; $status_type_r = fetch_status_type_r($item_r['s_status_type']); // ---------------------- Borrow,Reserve,Cancel,Edit,Delete,etc operations here. $action_links_rs = NULL; if (is_user_granted_permission(PERM_ITEM_OWNER) && get_opendb_session_var('user_id') === $item_r['owner_id'] || is_user_granted_permission(PERM_ITEM_ADMIN)) { $action_links_rs[] = array(url => 'item_input.php?op=edit&item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no'], img => 'edit.gif', text => get_opendb_lang_var('edit')); // Checks if any legal site plugins defined for $item_r['s_item_type'] if (is_item_legal_site_type($item_r['s_item_type'])) { $action_links_rs[] = array(url => 'item_input.php?op=site-refresh&item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no'], img => 'refresh.gif', text => get_opendb_lang_var('refresh')); } if ($status_type_r['delete_ind'] == 'Y' && !is_item_reserved_or_borrowed($item_r['item_id'], $item_r['instance_no'])) { $action_links_rs[] = array(url => 'item_input.php?op=delete&item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no'], img => 'delete.gif', text => get_opendb_lang_var('delete')); } } if (is_user_granted_permission(array(PERM_USER_BORROWER, PERM_ADMIN_BORROWER))) { if (get_opendb_config_var('borrow', 'enable') !== FALSE) { if (get_opendb_config_var('borrow', 'quick_checkout') !== FALSE && $status_type_r['borrow_ind'] == 'Y' && is_user_allowed_to_checkout_item($item_r['item_id'], $item_r['instance_no'])) { if (!is_item_borrowed($item_r['item_id'], $item_r['instance_no'])) { $action_links_rs[] = array(url => 'item_borrow.php?op=quick_check_out&item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no'], img => 'quick_check_out.gif', text => get_opendb_lang_var('quick_check_out')); } } // Check if already in reservation session variable. if (get_opendb_config_var('borrow', 'reserve_basket') !== FALSE && is_item_in_reserve_basket($item_r['item_id'], $item_r['instance_no'])) { $action_links_rs[] = array(url => 'borrow.php?op=delete_from_my_reserve_basket&item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no'], img => 'delete_reserve_basket.gif', text => get_opendb_lang_var('delete_from_reserve_list')); } else { if (is_item_reserved_or_borrowed($item_r['item_id'], $item_r['instance_no'])) { if (is_item_reserved_by_user($item_r['item_id'], $item_r['instance_no'])) { $action_links_rs[] = array(url => 'item_borrow.php?op=cancel_reserve&item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no'], img => 'cancel_reserve.gif', text => get_opendb_lang_var('cancel_reservation')); } else { if (!is_item_borrowed_by_user($item_r['item_id'], $item_r['instance_no'])) { if ($status_type_r['borrow_ind'] == 'Y' && (get_opendb_config_var('borrow', 'allow_reserve_if_borrowed') !== FALSE || !is_item_borrowed($item_r['item_id'], $item_r['instance_no'])) && (get_opendb_config_var('borrow', 'allow_multi_reserve') !== FALSE || !is_item_reserved($item_r['item_id'], $item_r['instance_no']))) { if (get_opendb_config_var('borrow', 'reserve_basket') !== FALSE) { $action_links_rs[] = array(url => 'borrow.php?op=update_my_reserve_basket&item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no'], img => 'add_reserve_basket.gif', text => get_opendb_lang_var('add_to_reserve_list')); } else { $action_links_rs[] = array(url => 'item_borrow.php?op=reserve&item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no'], img => 'reserve_item.gif', text => get_opendb_lang_var('reserve_item')); } } } } } else { if ($status_type_r['borrow_ind'] == 'Y') { if (get_opendb_config_var('borrow', 'reserve_basket') !== FALSE) { $action_links_rs[] = array(url => 'borrow.php?op=update_my_reserve_basket&item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no'], img => 'add_reserve_basket.gif', text => get_opendb_lang_var('add_to_reserve_list')); } else { $action_links_rs[] = array(url => 'item_borrow.php?op=reserve&item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no'], img => 'reserve_item.gif', text => get_opendb_lang_var('reserve_item')); } } } } } } if (is_item_borrowed($item_r['item_id'], $item_r['instance_no']) && is_user_allowed_to_checkin_item($item_r['item_id'], $item_r['instance_no'])) { $action_links_rs[] = array(url => 'item_borrow.php?op=check_in&item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no'], img => 'check_in_item.gif', text => get_opendb_lang_var('check_in_item')); } if ($item_r['owner_id'] == get_opendb_session_var('user_id') || is_user_granted_permission(PERM_ADMIN_BORROWER)) { if (is_exists_item_instance_history_borrowed_item($item_r['item_id'], $item_r['instance_no'])) { $action_links_rs[] = array(url => 'borrow.php?op=my_item_history&item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no'], img => 'item_history.gif', text => get_opendb_lang_var('item_history')); } } $rowcontents .= "\n<td>"; $rowcontents .= ifempty(format_action_links($action_links_rs), get_opendb_lang_var('not_applicable')); $rowcontents .= "</td>"; // Item Status Image. $rowcontents .= "\n<td>"; $rowcontents .= theme_image($status_type_r['img'], $status_type_r['description'], "s_status_type"); $rowcontents .= "</td>"; // If a comment is allowed and defined, add it in. $rowcontents .= "\n<td>"; if ($status_type_r['status_comment_ind'] == 'Y' || get_opendb_session_var('user_id') === $item_r['owner_id'] || is_user_granted_permission(PERM_ITEM_ADMIN)) { $rowcontents .= ifempty(nl2br($item_r['status_comment']), " "); // support newlines in this field } else { $rowcontents .= get_opendb_lang_var('not_applicable'); } $rowcontents .= "</td>"; if (get_opendb_config_var('borrow', 'enable') !== FALSE) { if (get_opendb_config_var('borrow', 'include_borrower_column') !== FALSE) { $rowcontents .= "\n<td>"; if (is_item_borrowed($item_r['item_id'], $item_r['instance_no'])) { $rowcontents .= get_list_username(fetch_item_borrower($item_r['item_id'], $item_r['instance_no']), NULL, $page_title, get_opendb_lang_var('back_to_item'), 'item_display.php?item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no']); } else { $rowcontents .= get_opendb_lang_var('not_applicable'); } $rowcontents .= "</td>"; } // Borrow Status Image. $rowcontents .= "\n<td>"; if (is_item_borrowed($item_r['item_id'], $item_r['instance_no'])) { $rowcontents .= theme_image("borrowed.gif", get_opendb_lang_var('borrowed'), "borrowed_item"); } else { if (is_item_reserved($item_r['item_id'], $item_r['instance_no'])) { $rowcontents .= theme_image("reserved.gif", get_opendb_lang_var('reserved'), "borrowed_item"); } else { $rowcontents .= get_opendb_lang_var('not_applicable'); } } $rowcontents .= "</td>"; if (get_opendb_config_var('borrow', 'duration_support') !== FALSE) { // 'Due Back' functionality. $rowcontents .= "\n<td>"; if (is_item_borrowed($item_r['item_id'], $item_r['instance_no'])) { $due_date = fetch_item_duedate_timestamp($item_r['item_id'], $item_r['instance_no']); if (strlen($due_date) > 0) { $rowcontents .= get_localised_timestamp(get_opendb_config_var('borrow', 'date_mask'), $due_date); } else { $rowcontents .= get_opendb_lang_var('undefined'); } } else { if (is_numeric($item_r['borrow_duration'])) { $duration_attr_type_r = fetch_sfieldtype_item_attribute_type_r($item_r['s_item_type'], 'DURATION'); $rowcontents .= get_item_display_field($item_r, $duration_attr_type_r, $item_r['borrow_duration'], FALSE); } else { $rowcontents .= get_opendb_lang_var('undefined'); } } $rowcontents .= "</td>"; } } $rowcontents .= "\n</tr>"; return $rowcontents; }
$value = $item_r['item_id']; } else { if ($item_attribute_type_r['s_field_type'] == 'UPDATE_ON') { $value = $item_r['update_on']; } else { if (is_multivalue_attribute_type($item_attribute_type_r['s_attribute_type'])) { $value = fetch_attribute_val_r($item_r['item_id'], $item_r['instance_no'], $item_attribute_type_r['s_attribute_type'], $item_attribute_type_r['order_no']); } else { $value = fetch_attribute_val($item_r['item_id'], $item_r['instance_no'], $item_attribute_type_r['s_attribute_type'], $item_attribute_type_r['order_no']); } } } if (is_not_empty_array($value) || !is_array($value) && strlen($value) > 0) { $item_attribute_type_r['display_type'] = $display_type; $item_attribute_type_r['compulsory_ind'] = 'N'; $field = get_item_display_field($item_r, $item_attribute_type_r, $value, FALSE); if (strlen($field) > 0) { echo format_item_data_field($item_attribute_type_r, $field, $prompt_mask, NULL); // field mask } } } } db_free_result($results); echo "\n</table>"; } echo get_site_plugin_links($page_title, $item_r); echo "</div>"; $instance_info_links_r = array(); echo "<div class=\"{$otherTabsClass}\" id=\"instance_info\">"; echo get_instance_info_block($item_r, $HTTP_VARS, $instance_info_links_r);
/** * stub */ function get_display_field($s_attribute_type, $prompt, $display_type, $value, $dowrap = TRUE, $prompt_mask = NULL) { $display_type_def = prc_function_spec($display_type); return get_item_display_field(NULL, array('s_attribute_type' => $s_attribute_type, 'prompt' => $prompt, 'display_type' => $display_type_def['type'], 'display_type_arg1' => $display_type_def['args'][0], 'display_type_arg2' => $display_type_def['args'][1], 'display_type_arg3' => $display_type_def['args'][2], 'display_type_arg4' => $display_type_def['args'][3], 'display_type_arg5' => $display_type_def['args'][4]), $value, $dowrap, $prompt_mask); }
function writeRowImpl($row_column_rs) { if ($this->_toggle) { $this->rowclass = "oddRow"; } else { $this->rowclass = "evenRow"; } $this->_write("\n<tr class=\"" . $this->rowclass . "\">"); for ($i = 0; $i < count($row_column_rs); $i++) { $header_column_r = $this->_header_column_rs[$i]; $columnClass = NULL; if (strlen($header_column_r['fieldname']) > 0) { $columnClass = $header_column_r['fieldname']; } switch ($row_column_rs[$i]['column_type']) { case 'action_links': $this->_write('<td class="action_links ' . $columnClass . '">'); $this->_write(ifempty(format_action_links($row_column_rs[$i]['action_links']), get_opendb_lang_var('not_applicable'))); $this->_write('</td>'); break; case 'username': $this->_write('<td class="username ' . $columnClass . '">'); $user_id = $row_column_rs[$i]['user_id']; $fullname = $row_column_rs[$i]['fullname']; if ($user_id == get_opendb_session_var('user_id')) { $this->_write(get_opendb_lang_var('current_user', array('fullname' => $fullname, 'user_id' => $user_id))); } else { $user_name = get_opendb_lang_var('user_name', array('fullname' => $fullname, 'user_id' => $user_id)); if ($this->_include_href_links && is_user_granted_permission(PERM_VIEW_USER_PROFILE)) { $item_title = ''; // lets find the title column. for ($j = 0; $j < count($row_column_rs); $j++) { if ($row_column_rs[$j]['column_type'] == 'title') { $item_title = trim(strip_tags($row_column_rs[$j]['item_title'])); break; } } $url = "user_profile.php?uid=" . $user_id; if (is_array($row_column_rs[$i]['extra_http_vars'])) { $url .= "&" . get_url_string($row_column_rs[$i]['extra_http_vars']); } $url .= "&subject=" . urlencode(ifempty($item_title, get_opendb_lang_var('no_subject'))); $this->_write("<a href=\"{$url}\" title=\"" . htmlspecialchars(get_opendb_lang_var('user_profile')) . "\">{$user_name}</a>"); } else { $this->_write($user_name); } } $this->_write('</td>'); break; case 'interest': // opendb_logger(OPENDB_LOG_INFO, __FILE__, __FUNCTION__, "_xajax=" . $_xajax===NULL?"nulles":"nonnul"); $item_id = $row_column_rs[$i]['item_id']; $instance_no = $row_column_rs[$i]['instance_no']; $level = $row_column_rs[$i]['level']; if ($level > 0) { $this->addHelpEntry(get_opendb_lang_var('interest_help'), 'interest_1.gif', 'interest'); $new_level_value = 0; $level_display .= "<img" . " id=\"interest_level_{$item_id}" . "_{$instance_no}\"" . " src=\"" . theme_image_src('interest_1.gif') . "\"" . " alt=\"" . get_opendb_lang_var('interest_remove') . "\"" . " title=\"" . get_opendb_lang_var('interest_remove') . "\"" . " onclick=\"xajax_ajax_update_interest_level('{$item_id}', '{$instance_no}', document.getElementById('new_level_value_{$item_id}\\_{$instance_no}').value);\"" . " style=\"cursor:pointer;\"" . " >"; } else { $new_level_value = 1; $level_display .= "<img" . " id=\"interest_level_{$item_id}" . "_{$instance_no}\"" . " src=\"" . theme_image_src('interest_0.gif') . "\"" . " alt=\"" . get_opendb_lang_var('interest_mark') . "\"" . " title=\"" . get_opendb_lang_var('interest_mark') . "\"" . " onclick=\"xajax_ajax_update_interest_level('{$item_id}','{$instance_no}', document.getElementById('new_level_value_{$item_id}\\_{$instance_no}').value);\"" . " style=\"cursor:pointer;\"" . " >"; } $this->_write('<td class="interest ' . $columnClass . '">'); $this->_write("<input id=\"new_level_value_{$item_id}" . "_{$instance_no}\" type=\"hidden\" value=\"{$new_level_value}\" />"); $this->_write($level_display); $this->_write('</td>'); break; case 'item_type_image': $this->_write('<td class="item_type_image ' . $columnClass . '">'); $s_item_type = $row_column_rs[$i]['s_item_type']; if (!is_array($this->_item_type_rs[$s_item_type]) || strlen($this->_item_type_rs[$s_item_type]['image']) == 0) { $this->_item_type_rs[$s_item_type] = fetch_item_type_r($s_item_type); // expand to the actual location once only. if (strlen($this->_item_type_rs[$s_item_type]['image']) > 0) { $this->_item_type_rs[$s_item_type]['image'] = theme_image_src($this->_item_type_rs[$s_item_type]['image']); } else { $this->_item_type_rs[$s_item_type]['image'] = 'none'; } if (strlen($this->_item_type_rs[$s_item_type]['description']) > 0) { $this->_item_type_rs[$s_item_type]['description'] = htmlspecialchars($this->_item_type_rs[$s_item_type]['description']); } else { $this->_item_type_rs[$s_item_type]['description'] = NULL; } } if (strlen($this->_item_type_rs[$s_item_type]['image']) > 0 && $this->_item_type_rs[$s_item_type]['image'] != 'none') { $this->_write(theme_image($this->_item_type_rs[$s_item_type]['image'], $this->_item_type_rs[$s_item_type]['description'], 's_item_type')); } else { // otherwise write the item type itself in place of the image. $this->_write($s_item_type); } $this->_write('</td>'); break; case 'theme_image': $this->_write('<td class="' . $columnClass . '">'); $this->_write(theme_image($row_column_rs[$i]['src'], htmlspecialchars($row_column_rs[$i]['title']), $row_column_rs[$i]['type'])); $this->_write('</td>'); break; case 'title': $title_href_link = $row_column_rs[$i]['title_href_link']; $is_item_reviewed = $row_column_rs[$i]['is_item_reviewed']; $is_borrowed_or_returned = $row_column_rs[$i]['is_borrowed_or_returned']; $item_title = ''; if ($this->_include_href_links && is_user_granted_permission(PERM_VIEW_ITEM_DISPLAY)) { $item_title = '<a href="' . $title_href_link . '">' . $row_column_rs[$i]['item_title'] . '</a>'; } else { $item_title = $row_column_rs[$i]['item_title']; } if ($is_item_reviewed) { // show star if rated - Add it to the actual title, so we can do a bit more with title masks $this->addHelpEntry(get_opendb_lang_var('item_reviewed'), 'rs.gif', 'item_reviewed'); $item_title .= theme_image('rs.gif', get_opendb_lang_var('item_reviewed'), 'item_reviewed'); } if ($is_borrowed_or_returned) { $this->addHelpEntry(get_opendb_lang_var('youve_borrow_or_return'), 'tick.gif', 'borrow_or_return'); $item_title .= theme_image("tick.gif", get_opendb_lang_var('youve_borrow_or_return'), 'borrow_or_return'); // show tick if previously borrowed or returned. } $this->_write('<td class="title ' . $columnClass . '">'); $this->_write($item_title); $this->_write('</td>'); break; case 'coverimage': $item_cover_image = $row_column_rs[$i]['item_cover_image']; $title_href_link = $row_column_rs[$i]['title_href_link']; $this->_write('<td class="coverimage ' . $columnId . 'Column">'); $file_r = file_cache_get_image_r($item_cover_image, 'listing'); if (is_array($file_r)) { $cover_image_tag = '<img src="' . $file_r['thumbnail']['url'] . '"'; if (is_numeric($file_r['thumbnail']['width'])) { $cover_image_tag .= ' width="' . $file_r['thumbnail']['width'] . '"'; } if (is_numeric($file_r['thumbnail']['height'])) { $cover_image_tag .= ' height="' . $file_r['thumbnail']['height'] . '"'; } $cover_image_tag .= '>'; if ($this->_mode != 'printable' && $this->_include_href_links) { $cover_image_tag = '<a href="' . $title_href_link . '">' . $cover_image_tag . '</a>'; } $this->_write($cover_image_tag); } $this->_write('</td>'); break; case 'display': $this->_write('<td class="' . $columnClass . '">'); $this->_write(get_display_field($row_column_rs[$i]['attribute_type'], $row_column_rs[$i]['prompt'], $row_column_rs[$i]['display_type'], $row_column_rs[$i]['value'], FALSE)); $this->_write('</td>'); break; case 'attribute_display': $this->_write('<td class="' . $columnClass . '">'); $this->_write(get_item_display_field($row_column_rs[$i]['item_r'], $row_column_rs[$i]['attribute_type_r'], $row_column_rs[$i]['value'], FALSE)); $this->_write('</td>'); break; case 'checkbox': $this->_write('<td class="checkbox">'); $value = $row_column_rs[$i]['value']; $this->_write('<input type="checkbox" class="checkbox" name="' . $this->_header_column_rs[$i]['fieldname'] . '[]" value="' . $value . '">'); $this->_write('</td>'); break; default: $this->_write('<td class="' . $columnClass . '">'); $this->_write($row_column_rs[$i]['value']); $this->_write('</td>'); break; } } $this->_write("\n</tr>"); }