Exemplo n.º 1
0
function lend_requests($option, $bid)
{
    global $database, $mainframe, $mosConfig_list_limit;
    $limit = $mainframe->getUserStateFromRequest("viewlistlimit", 'limit', $mosConfig_list_limit);
    $limitstart = $mainframe->getUserStateFromRequest("view{$option}limitstart", 'limitstart', 0);
    $database->setQuery("SELECT count(*) FROM #__booklibrary AS a" . "\nLEFT JOIN #__booklibrary_lend_request AS l" . "\nON l.fk_bookid = a.id" . "\nWHERE l.status = 0");
    $total = $database->loadResult();
    echo $database->getErrorMsg();
    if ($database->getErrorNum()) {
        echo $database->stderr();
    }
    $pageNav = new JPagination($total, $limitstart, $limit);
    // for J 1.6
    $database->setQuery("SELECT * FROM #__booklibrary AS a" . "\nLEFT JOIN #__booklibrary_lend_request AS l" . "\nON l.fk_bookid = a.id" . "\nWHERE l.status = 0" . "\nORDER BY l.lend_from, l.lend_until, l.user_name" . "\nLIMIT {$pageNav->limitstart},{$pageNav->limit};");
    $lend_requests = $database->loadObjectList();
    echo $database->getErrorMsg();
    if ($database->getErrorNum()) {
        echo $database->stderr();
    }
    HTML_booklibrary::showRequestLendBooks($option, $lend_requests, $pageNav);
}