Exemplo n.º 1
0
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)) {
                        $page_title = get_opendb_lang_var('items_borrowed');
                        if (is_numeric($listingObject->getItemsPerPage())) {
                            $listingObject->setTotalItems(fetch_all_borrowed_item_cnt());
                            if ($listingObject->getTotalItemCount() > 0) {
                                $result = fetch_all_borrowed_item_rs($listingObject->getCurrentOrderBy(), $listingObject->getCurrentSortOrder(), $listingObject->getStartIndex(), $listingObject->getItemsPerPage());
                            }
                        } else {
                            $result = fetch_all_borrowed_item_rs($listingObject->getCurrentOrderBy(), $listingObject->getCurrentSortOrder());