CC-1986: Configurable columns for media search
- Added "Year" column - Added "Upload Time" column - Fixed some formatting issue
This commit is contained in:
parent
a1ccb9c42a
commit
7a27be878b
|
@ -488,6 +488,7 @@ class Application_Model_StoredFile {
|
|||
{
|
||||
$file = new CcFiles();
|
||||
$file->setDbGunid(md5(uniqid("", true)));
|
||||
$file->setDbMtime(new DateTime("now"), new DateTimeZone("UTC"));
|
||||
|
||||
$storedFile = new Application_Model_StoredFile();
|
||||
$storedFile->_file = $file;
|
||||
|
@ -628,49 +629,52 @@ class Application_Model_StoredFile {
|
|||
return $res;
|
||||
}
|
||||
|
||||
public static function searchFilesForPlaylistBuilder($datatables) {
|
||||
global $CC_CONFIG;
|
||||
public static function searchFilesForPlaylistBuilder($datatables)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
$displayData = array("track_title", "artist_name", "album_title", "genre", "length", "ftype");
|
||||
$displayData = array("track_title", "artist_name", "album_title", "genre", "length", "year", "upload_time", "ftype");
|
||||
|
||||
$plSelect = "SELECT ";
|
||||
$plSelect = "SELECT ";
|
||||
$fileSelect = "SELECT ";
|
||||
foreach ($displayData as $key){
|
||||
foreach ($displayData as $key) {
|
||||
|
||||
if($key === "track_title"){
|
||||
if ($key === "track_title") {
|
||||
$plSelect .= "name AS ".$key.", ";
|
||||
$fileSelect .= $key.", ";
|
||||
}
|
||||
else if ($key === "ftype"){
|
||||
} else if ($key === "ftype") {
|
||||
$plSelect .= "'playlist' AS ".$key.", ";
|
||||
$fileSelect .= $key.", ";
|
||||
}
|
||||
else if ($key === "artist_name"){
|
||||
} else if ($key === "artist_name") {
|
||||
$plSelect .= "creator AS ".$key.", ";
|
||||
$fileSelect .= $key.", ";
|
||||
}
|
||||
else if ($key === "length"){
|
||||
} else if ($key === "length") {
|
||||
$plSelect .= $key.", ";
|
||||
$fileSelect .= $key.", ";
|
||||
}
|
||||
else {
|
||||
} else if ($key === "year") {
|
||||
$plSelect .= "CAST(mtime AS varchar) AS ".$key.", ";
|
||||
$fileSelect .= $key.", ";
|
||||
} else if ($key === "upload_time") {
|
||||
$plSelect .= "mtime AS ".$key.", ";
|
||||
$fileSelect .= "mtime AS ".$key.", ";
|
||||
} else {
|
||||
$plSelect .= "NULL AS ".$key.", ";
|
||||
$fileSelect .= $key.", ";
|
||||
}
|
||||
}
|
||||
|
||||
$fromTable = " ((".$plSelect."PL.id
|
||||
FROM ".$CC_CONFIG["playListTable"]." AS PL
|
||||
LEFT JOIN ".$CC_CONFIG['playListTimeView']." AS PLT USING(id))
|
||||
$fromTable = " ((".$plSelect."PL.id
|
||||
FROM ".$CC_CONFIG["playListTable"]." AS PL
|
||||
LEFT JOIN ".$CC_CONFIG['playListTimeView']." AS PLT USING(id))
|
||||
|
||||
UNION
|
||||
UNION
|
||||
|
||||
(".$fileSelect."id FROM ".$CC_CONFIG["filesTable"]." AS FILES)) AS RESULTS";
|
||||
|
||||
return Application_Model_StoredFile::searchFiles($fromTable, $datatables);
|
||||
}
|
||||
(".$fileSelect."id FROM ".$CC_CONFIG["filesTable"]." AS FILES)) AS RESULTS";
|
||||
|
||||
return Application_Model_StoredFile::searchFiles($fromTable, $datatables);
|
||||
}
|
||||
|
||||
public static function searchPlaylistsForSchedule($datatables)
|
||||
public static function searchPlaylistsForSchedule($datatables)
|
||||
{
|
||||
$fromTable = "cc_playlist AS pl LEFT JOIN cc_playlisttimes AS plt USING(id) LEFT JOIN cc_subjs AS sub ON pl.editedby = sub.id";
|
||||
//$datatables["optWhere"][] = "INTERVAL '{$time_remaining}' > INTERVAL '00:00:00'";
|
||||
|
@ -750,9 +754,14 @@ class Application_Model_StoredFile {
|
|||
}
|
||||
|
||||
$results = $CC_DBC->getAll($sql);
|
||||
// add checkbox row
|
||||
foreach($results as &$row){
|
||||
// add checkbox row
|
||||
$row['checkbox'] = "<input type='checkbox' name='cb_".$row[id]."'>";
|
||||
|
||||
// a full timestamp is being returned for playlists' year column;
|
||||
// split it and grab only the year info
|
||||
$yearSplit = explode('-', $row['year']);
|
||||
$row['year'] = $yearSplit[0];
|
||||
}
|
||||
//$results['checkbox']
|
||||
//$results = $CC_DBC->getAssoc($sql);
|
||||
|
|
|
@ -493,12 +493,14 @@ function createDataTable(data) {
|
|||
"aoColumns": [
|
||||
/* Checkbox */ { "sTitle": "<input type='checkbox' name='cb_all'>", "bSortable": false, "bSearchable": false, "mDataProp": "checkbox", "sWidth": "25px", "sClass": "library_checkbox"},
|
||||
/* Id */ { "sName": "id", "bSearchable": false, "bVisible": false, "mDataProp": "id", "sClass": "library_id"},
|
||||
/* Title */ { "sTitle": "Title", "sName": "track_title", "mDataProp": "track_title", "sWidth": "30%", "sClass": "library_title"},
|
||||
/* Title */ { "sTitle": "Title", "sName": "track_title", "mDataProp": "track_title", "sClass": "library_title"},
|
||||
/* Creator */ { "sTitle": "Creator", "sName": "artist_name", "mDataProp": "artist_name", "sClass": "library_creator"},
|
||||
/* Album */ { "sTitle": "Album", "sName": "album_title", "mDataProp": "album_title", "sClass": "library_album"},
|
||||
/* Genre */ { "sTitle": "Genre", "sName": "genre", "mDataProp": "genre", "sWidth": "10%", "sClass": "library_genre"},
|
||||
/* Year */ { "sTitle": "Year", "sName": "year", "mDataProp": "year", "sWidth": "8%", "sClass": "library_year"},
|
||||
/* Length */ { "sTitle": "Length", "sName": "length", "mDataProp": "length", "sWidth": "16%", "sClass": "library_length"},
|
||||
/* Type */ { "sTitle": "Type", "sName": "ftype", "bSearchable": false, "mDataProp": "ftype", "sWidth": "9%", "sClass": "library_type"},
|
||||
/* Type */ { "sTitle": "Type", "sName": "ftype", "bSearchable": false, "mDataProp": "ftype", "sWidth": "9%", "sClass": "library_type"},
|
||||
/* Upload Time */ { "sTitle": "Upload Time", "sName": "upload_time", "mDataProp": "upload_time", "sClass": "library_upload_time"},
|
||||
],
|
||||
"aaSorting": [[2,'asc']],
|
||||
"sPaginationType": "full_numbers",
|
||||
|
|
Loading…
Reference in New Issue