CC-3329: Library: Add "track number" to the list of available columns to show (was in 1.9, disappeared in 2.0)

- updated the view columns to include track_number from db as track
- updated sql query to include track_number from db
This commit is contained in:
Daniel 2012-02-15 11:21:21 -05:00
parent 14a9225b97
commit 190490d6f4
2 changed files with 11 additions and 5 deletions

View file

@ -583,7 +583,7 @@ class Application_Model_StoredFile {
{
global $CC_CONFIG;
$displayData = array("track_title", "artist_name", "album_title", "genre", "length", "year", "utime", "mtime", "ftype");
$displayData = array("track_title", "artist_name", "album_title", "genre", "length", "year", "utime", "mtime", "ftype", "track_number");
$plSelect = "SELECT ";
$fileSelect = "SELECT ";
@ -610,6 +610,9 @@ class Application_Model_StoredFile {
} else if ($key === "mtime") {
$plSelect .= $key.", ";
$fileSelect .= $key.", ";
} else if ($key === "track_number") {
$plSelect .= "NULL AS ".$key.", ";
$fileSelect .= $key.", ";
} else {
$plSelect .= "NULL AS ".$key.", ";
$fileSelect .= $key.", ";
@ -621,10 +624,11 @@ class Application_Model_StoredFile {
UNION
(".$fileSelect."id FROM ".$CC_CONFIG["filesTable"]." AS FILES WHERE file_exists = 'TRUE')) AS RESULTS";
$results = Application_Model_StoredFile::searchFiles($fromTable, $datatables);
$results = Application_Model_StoredFile::searchFiles($fromTable, $datatables);
foreach($results['aaData'] as &$row){
$row['id'] = intval($row['id']);
//$length = new DateTime($row['length']);
@ -733,6 +737,7 @@ class Application_Model_StoredFile {
$sql = $selectorRows." FROM ".$fromTable." ORDER BY ".$orderby." OFFSET ".$data["iDisplayStart"]." LIMIT ".$data["iDisplayLength"];
}
//display sql executed in airtime log for testing
//Logging::log($sql);
$results = $CC_DBC->getAll($sql);