function get_related_items_listing($item_r, $HTTP_VARS, $related_mode) { global $PHP_SELF; $buffer = ''; $results = fetch_item_instance_relationship_rs($item_r['item_id'], $item_r['instance_no'], $related_mode); if ($results) { $listingObject = new HTML_Listing($PHP_SELF, $HTTP_VARS); $listingObject->setBufferOutput(TRUE); $listingObject->setNoRowsMessage(get_opendb_lang_var('no_items_found')); $listingObject->setShowItemImages(TRUE); $listingObject->setIncludeFooter(FALSE); $listingObject->addHeaderColumn(get_opendb_lang_var('type'), 'type', FALSE); $listingObject->addHeaderColumn(get_opendb_lang_var('title'), 'title', FALSE); $listingObject->addHeaderColumn(get_opendb_lang_var('action'), 'action', FALSE); $listingObject->addHeaderColumn(get_opendb_lang_var('status'), 'status', FALSE); $listingObject->addHeaderColumn(get_opendb_lang_var('status_comment'), 'status_comment', FALSE); $listingObject->addHeaderColumn(get_opendb_lang_var('category'), 'category', FALSE); $listingObject->startListing(NULL); while ($related_item_r = db_fetch_assoc($results)) { $listingObject->startRow(); $listingObject->addItemTypeImageColumn($related_item_r['s_item_type']); $listingObject->addTitleColumn($related_item_r); $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=' . $related_item_r['item_id'] . '&instance_no=' . $related_item_r['instance_no'], img => 'edit.gif', text => get_opendb_lang_var('edit')); if (get_opendb_config_var('listings', 'show_refresh_actions') && is_item_legal_site_type($related_item_r['s_item_type'])) { $action_links_rs[] = array(url => 'item_input.php?op=site-refresh&item_id=' . $related_item_r['item_id'] . '&instance_no=' . $related_item_r['instance_no'], img => 'refresh.gif', text => get_opendb_lang_var('refresh')); } $action_links_rs[] = array(url => 'item_input.php?op=delete&item_id=' . $related_item_r['item_id'] . '&instance_no=' . $related_item_r['instance_no'] . '&parent_item_id=' . $item_r['item_id'] . '&parent_instance_no=' . $item_r['instance_no'], img => 'delete.gif', text => get_opendb_lang_var('delete')); $action_links_rs[] = array(url => 'item_input.php?op=delete-relation&item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no'] . '&parent_item_id=' . $related_item_r['item_id'] . '&parent_instance_no=' . $related_item_r['instance_no'], img => 'delete.gif', text => get_opendb_lang_var('delete_relationship')); } $listingObject->addActionColumn($action_links_rs); $status_type_r = fetch_status_type_r($related_item_r['s_status_type']); $listingObject->addThemeImageColumn($status_type_r['img'], $status_type_r['description'], $status_type_r['description'], 's_status_type'); //type // If a comment is allowed and defined, add it in. if ($status_type_r['status_comment_ind'] == 'Y' || get_opendb_session_var('user_id') === $related_item_r['owner_id'] || is_user_granted_permission(PERM_ITEM_ADMIN)) { // support newlines in this field $listingObject->addColumn(nl2br($related_item_r['status_comment'])); } else { $listingObject->addColumn(get_opendb_lang_var('not_applicable')); } $attribute_type_r = fetch_sfieldtype_item_attribute_type_r($related_item_r['s_item_type'], 'CATEGORY'); if (is_array($attribute_type_r)) { if ($attribute_type_r['lookup_attribute_ind'] === 'Y') { $attribute_val = fetch_attribute_val_r($related_item_r['item_id'], $related_item_r['instance_no'], $attribute_type_r['s_attribute_type'], $attribute_type_r['order_no']); } else { $attribute_val = fetch_attribute_val($related_item_r['item_id'], $related_item_r['instance_no'], $attribute_type_r['s_attribute_type'], $attribute_type_r['order_no']); } $listingObject->addAttrDisplayColumn($related_item_r, $attribute_type_r, $attribute_val); } $listingObject->endRow(); } $listingObject->endListing(); $buffer =& $listingObject->getContents(); unset($listingObject); return $buffer; } else { return NULL; } }
include_once "./lib/widgets.php"; include_once "./lib/http.php"; include_once "./lib/borrowed_item.php"; include_once "./lib/item.php"; include_once "./lib/email.php"; include_once "./lib/review.php"; include_once "./lib/listutils.php"; include_once "./lib/sortutils.php"; include_once "./lib/HTML_Listing.class.php"; include_once "./lib/TitleMask.class.php"; if (is_site_enabled()) { if (is_opendb_valid_session()) { if (get_opendb_config_var('borrow', 'enable') !== FALSE) { if (is_user_granted_permission(PERM_USER_BORROWER)) { $listingObject = new HTML_Listing($PHP_SELF, $HTTP_VARS); $listingObject->setNoRowsMessage(get_opendb_lang_var('no_records_found')); $show_listings = TRUE; $checkbox_column = FALSE; if ($HTTP_VARS['op'] == 'my_borrowed') { //all titles that the person has actually borrowed from others. $page_title = get_opendb_lang_var('my_borrowed_items'); if (is_numeric($listingObject->getItemsPerPage())) { $listingObject->setTotalItems(fetch_my_borrowed_item_cnt(get_opendb_session_var('user_id'))); if ($listingObject->getTotalItemCount() > 0) { $result = fetch_my_borrowed_item_rs(get_opendb_session_var('user_id'), $listingObject->getCurrentOrderBy(), $listingObject->getCurrentSortOrder(), $listingObject->getStartIndex(), $listingObject->getItemsPerPage()); } } else { $result = fetch_my_borrowed_item_rs(get_opendb_session_var('user_id'), $listingObject->getCurrentOrderBy(), $listingObject->getCurrentSortOrder()); } } else { if ($HTTP_VARS['op'] == 'all_borrowed' && is_user_granted_permission(PERM_ADMIN_BORROWER)) {
echo "<p class=\"error\">" . get_opendb_lang_var('import_cache_file_not_found') . "</p>"; echo _theme_footer(); } } else { if ($HTTP_VARS['op'] == 'import') { $import_cache_r = fetch_import_cache_r($HTTP_VARS['ic_sequence_number'], $HTTP_VARS['owner_id']); if (is_not_empty_array($import_cache_r)) { $importPlugin =& get_import_plugin($import_cache_r['plugin_name']); if ($importPlugin !== NULL) { $inFile = import_cache_fetch_file($HTTP_VARS['ic_sequence_number']); if ($inFile) { $fileHandler = new WrapperFileHandler($inFile); // we want to display all items - no pagination. $HTTP_VARS['items_per_page'] = ''; $listingObject = new HTML_Listing($PHP_SELF, $HTTP_VARS); $listingObject->setNoRowsMessage(get_opendb_lang_var('no_items_found')); $cfg_include_header_row = strcmp($HTTP_VARS['include_header_row'], 'Y') === 0 ? TRUE : FALSE; $cfg_ignore_duplicate_title = strcmp($HTTP_VARS['ignore_duplicate_title'], 'Y') === 0 ? TRUE : FALSE; $cfg_is_trial_run = strcmp($HTTP_VARS['trial_run'], 'Y') === 0 ? TRUE : FALSE; $cfg_override_status_type = strcmp($HTTP_VARS['override_status_type'], 'Y') === 0 ? TRUE : FALSE; // force disable of duplicate titles. set_opendb_config_ovrd_var('item_input', 'duplicate_title_support', $cfg_ignore_duplicate_title); set_opendb_config_ovrd_var('listings', 'show_item_image', FALSE); //set_opendb_config_ovrd_var('item_input', 'confirm_duplicate_insert', TRUE); if (is_valid_s_status_type($HTTP_VARS['s_status_type'])) { $cfg_default_status_type_r = fetch_status_type_r($HTTP_VARS['s_status_type']); } else { $cfg_default_status_type_r = fetch_status_type_r(fetch_default_status_type()); } $itemImportHandler = new ItemImportHandler($HTTP_VARS['owner_id'], $cfg_is_trial_run, $cfg_ignore_duplicate_title, $cfg_override_status_type, $cfg_default_status_type_r, $listingObject); if (strcmp($HTTP_VARS['owner_id'], get_opendb_session_var('user_id')) === 0) {