Exemplo n.º 1
0
function setList()
{
    global $database, $mainframe, $option;
    $limit = $mainframe->getUserStateFromRequest("viewlistlimit", 'limit', 10);
    $limitstart = $mainframe->getUserStateFromRequest("view{$option}limitstart", 'limitstart', 0);
    $search = $mainframe->getUserStateFromRequest("search{$option}", 'search', '');
    $search = $database->getEscaped(trim(strtolower($search)));
    $chordBase = new ChordBase($database, "#__cb_");
    $chordBase->setCriteria($criteria);
    $categories = $chordBase->getCategories();
    $database->setQuery("SELECT COUNT(*)" . "\nFROM `#__cb_sets` AS a" . (count($where) ? "\nWHERE " . implode(' AND ', $where) : ""));
    $total = $database->loadResult();
    echo $database->getErrorMsg();
    include_once "includes/pageNavigation.php";
    $pageNav = new mosPageNav($total, $limitstart, $limit);
    $query = "select #__cb_sets.* from #__cb_sets" . (count($where) ? "\nWHERE " . implode(' AND ', $where) : "") . "\nORDER BY `name` ASC" . "\nLIMIT {$pageNav->limitstart}, {$pageNav->limit}";
    $database->setQuery($query);
    $rows = $database->loadObjectList();
    if ($database->getErrorNum()) {
        echo $database->stderr();
        return false;
    }
    HTML_chordbase::setList($option, $rows, $categories, users_array(), $search, $pageNav);
}
Exemplo n.º 2
0
function editSong($song_id = "")
{
    global $database, $Itemid, $my;
    HTML_chordbase::cb_header("Song Editor");
    $chordBase = new ChordBase($database, "#__cb_");
    $chordBase->setCriteria($criteria);
    $categories = $chordBase->getCategories();
    $writers = $chordBase->getWriters();
    $song = new cbSong($database, "#__cb_");
    if ($song_id) {
        $song->load($song_id);
        $song->add_time = $song->add_time == 0 ? time() : $song->add_time;
    } else {
        $song->add_time = time();
    }
    $song->form("index.php?option=com_chordbase&Itemid=" . $Itemid . "&task=saveSong", $categories, $writers, $my->id, TRUE);
    HTML_chordbase::footer();
}