Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
Conflicts: airtime_mvc/application/models/StoredFile.php airtime_mvc/application/models/airtime/om/BaseCcFiles.php airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php
This commit is contained in:
commit
d5d4d50a9e
24 changed files with 4604 additions and 373 deletions
|
@ -90,6 +90,9 @@ class Application_Model_StoredFile {
|
|||
}
|
||||
$this->setDbColMetadata($dbMd);
|
||||
}
|
||||
|
||||
$this->_file->setDbMtime(new DateTime("now"), new DateTimeZone("UTC"));
|
||||
$this->_file->save();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -120,6 +123,7 @@ class Application_Model_StoredFile {
|
|||
}
|
||||
}
|
||||
|
||||
$this->_file->setDbMtime(new DateTime("now"), new DateTimeZone("UTC"));
|
||||
$this->_file->save();
|
||||
}
|
||||
|
||||
|
@ -494,6 +498,8 @@ class Application_Model_StoredFile {
|
|||
{
|
||||
$file = new CcFiles();
|
||||
$file->setDbGunid(md5(uniqid("", true)));
|
||||
$file->setDbUtime(new DateTime("now"), new DateTimeZone("UTC"));
|
||||
$file->setDbMtime(new DateTime("now"), new DateTimeZone("UTC"));
|
||||
|
||||
$storedFile = new Application_Model_StoredFile();
|
||||
$storedFile->_file = $file;
|
||||
|
@ -636,50 +642,53 @@ 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", "utime", "mtime", "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(utime AS varchar) AS ".$key.", ";
|
||||
$fileSelect .= $key.", ";
|
||||
} else if ($key === "utime") {
|
||||
$plSelect .= $key.", ";
|
||||
$fileSelect .= $key.", ";
|
||||
} else if ($key === "mtime") {
|
||||
$plSelect .= $key.", ";
|
||||
$fileSelect .= $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
|
||||
(".$fileSelect."id FROM ".$CC_CONFIG["filesTable"]." AS FILES WHERE file_exist = 'TRUE')) AS RESULTS";
|
||||
|
||||
return Application_Model_StoredFile::searchFiles($fromTable, $datatables);
|
||||
}
|
||||
|
||||
UNION
|
||||
|
||||
(".$fileSelect."id FROM ".$CC_CONFIG["filesTable"]." AS FILES WHERE file_exist = 'TRUE')) 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'";
|
||||
|
@ -698,7 +707,12 @@ class Application_Model_StoredFile {
|
|||
$searchTerms = explode(" ", $data["sSearch"]);
|
||||
|
||||
$selectorCount = "SELECT COUNT(*)";
|
||||
$selectorRows = "SELECT ". join("," , $columnsDisplayed);
|
||||
foreach( $columnsDisplayed as $key=>$col){
|
||||
if($col == ''){
|
||||
unset($columnsDisplayed[$key]);
|
||||
}
|
||||
}
|
||||
$selectorRows = "SELECT " . join(',', $columnsDisplayed );
|
||||
|
||||
$sql = $selectorCount." FROM ".$fromTable;
|
||||
$totalRows = $CC_DBC->getOne($sql);
|
||||
|
@ -741,7 +755,7 @@ class Application_Model_StoredFile {
|
|||
// End Order By clause
|
||||
|
||||
//ordered by integer as expected by datatables.
|
||||
$CC_DBC->setFetchMode(DB_FETCHMODE_ORDERED);
|
||||
//$CC_DBC->setFetchMode(DB_FETCHMODE_ORDERED);
|
||||
|
||||
if(isset($where)) {
|
||||
$where = join(" AND ", $where);
|
||||
|
@ -754,6 +768,18 @@ class Application_Model_StoredFile {
|
|||
}
|
||||
|
||||
$results = $CC_DBC->getAll($sql);
|
||||
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);
|
||||
Logging::log(print_r($results, true));
|
||||
//echo $results;
|
||||
//echo $sql;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue