Merge branch 'devel' into mediamonitor2
Conflicts: python_apps/api_clients/api_client.py
This commit is contained in:
commit
20e32b98ba
31 changed files with 253 additions and 143 deletions
|
@ -453,13 +453,14 @@ class Application_Model_Playlist
|
|||
->filterByDbPlaylistId($this->id)
|
||||
->filterByDbPosition($pos)
|
||||
->findOne();
|
||||
|
||||
|
||||
|
||||
#Propel returns values in form 00.000000 format which is for only seconds.
|
||||
$fadeIn = $row->getDbFadein();
|
||||
$fadeOut = $row->getDbFadeout();
|
||||
|
||||
return array($fadeIn, $fadeOut);
|
||||
}
|
||||
#Propel returns values in form 00.000000 format which is for only seconds.
|
||||
$fadeIn = $row->getDbFadein();
|
||||
$fadeOut = $row->getDbFadeout();
|
||||
return array($fadeIn, $fadeOut);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change fadeIn and fadeOut values for playlist Element
|
||||
|
@ -800,12 +801,33 @@ class Application_Model_Playlist
|
|||
* Delete playlists that match the ids..
|
||||
* @param array $p_ids
|
||||
*/
|
||||
public static function DeletePlaylists($p_ids)
|
||||
public static function deletePlaylists($p_ids, $p_userId)
|
||||
{
|
||||
CcPlaylistQuery::create()->findPKs($p_ids)->delete();
|
||||
$leftOver = self::playlistsNotOwnedByUser($p_ids, $p_userId);
|
||||
if (count($leftOver) == 0) {
|
||||
CcPlaylistQuery::create()->findPKs($p_ids)->delete();
|
||||
} else {
|
||||
throw new PlaylistNoPermissionException;
|
||||
}
|
||||
}
|
||||
|
||||
// This function returns that are not owen by $p_user_id among $p_ids
|
||||
private static function playlistsNotOwnedByUser($p_ids, $p_userId){
|
||||
$ownedByUser = CcPlaylistQuery::create()->filterByDbCreatorId($p_userId)->find()->getData();
|
||||
$selectedPls = $p_ids;
|
||||
$ownedPls = array();
|
||||
foreach ($ownedByUser as $pl) {
|
||||
if (in_array($pl->getDbId(), $selectedPls)) {
|
||||
$ownedPls[] = $pl->getDbId();
|
||||
}
|
||||
}
|
||||
|
||||
$leftOvers = array_diff($selectedPls, $ownedPls);
|
||||
return $leftOvers;
|
||||
}
|
||||
|
||||
} // class Playlist
|
||||
|
||||
class PlaylistNotFoundException extends Exception {}
|
||||
class PlaylistNoPermissionException extends Exception {}
|
||||
class PlaylistOutDatedException extends Exception {}
|
||||
|
|
|
@ -32,6 +32,7 @@ class Application_Model_Schedule
|
|||
{
|
||||
if (!is_int($p_prev) || !is_int($p_next)) {
|
||||
//must enter integers to specify ranges
|
||||
Logging::log("Invalid range parameters: $p_prev or $p_next");
|
||||
return array();
|
||||
}
|
||||
|
||||
|
@ -49,7 +50,6 @@ class Application_Model_Schedule
|
|||
"schedulerTime"=>$timeNow,
|
||||
"previous"=>$results['previous'] !=null?$results['previous']:(count($shows['previousShow'])>0?$shows['previousShow'][0]:null),
|
||||
"current"=>$results['current'] !=null?$results['current']:((count($shows['currentShow'])>0 && $shows['currentShow'][0]['record'] == 1)?$shows['currentShow'][0]:null),
|
||||
//"current"=>$results['current'] !=null?$results['current']:(count($shows['currentShow'])>0?$shows['currentShow'][0]:null),
|
||||
"next"=> $results['next'] !=null?$results['next']:(count($shows['nextShow'])>0?$shows['nextShow'][0]:null),
|
||||
"currentShow"=>$shows['currentShow'],
|
||||
"nextShow"=>$shows['nextShow'],
|
||||
|
|
|
@ -1876,9 +1876,9 @@ class Application_Model_Show
|
|||
|
||||
/**
|
||||
* Given a start time $timeStart and end time $timeEnd, returns the next $limit
|
||||
* number of shows within the time interval;
|
||||
* If $timeEnd not given, shows within next 48 hours from $timeStart are returned;
|
||||
* If $limit not given, all shows within the intervals are returns;
|
||||
* number of shows within the time interval
|
||||
* If $timeEnd not given, shows within next 48 hours from $timeStart are returned
|
||||
* If $limit not given, all shows within the intervals are returned
|
||||
* Times are all in UTC time.
|
||||
*
|
||||
* @param String $timeStart - interval start time (in UTC)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue