Merge branch 'cc-5709-airtime-analyzer-cloud-storage' into cc-5709-airtime-analyzer-cloud-storage-saas
Conflicts: airtime_mvc/application/Bootstrap.php airtime_mvc/application/configs/ACL.php airtime_mvc/application/controllers/ApiController.php airtime_mvc/application/controllers/plugins/Acl_plugin.php airtime_mvc/application/forms/GeneralPreferences.php airtime_mvc/application/modules/rest/controllers/MediaController.php airtime_mvc/application/views/scripts/form/preferences_general.phtml airtime_mvc/application/views/scripts/form/support-setting.phtml airtime_mvc/build/sql/schema.sql
This commit is contained in:
commit
ca9750f415
46 changed files with 771 additions and 595 deletions
|
@ -1156,7 +1156,7 @@ SQL;
|
|||
*/
|
||||
public function saveSmartBlockCriteria($p_criteria)
|
||||
{
|
||||
$data = $this->organizeSmartPlyalistCriteria($p_criteria);
|
||||
$data = $this->organizeSmartPlaylistCriteria($p_criteria);
|
||||
// saving dynamic/static flag
|
||||
$blockType = $data['etc']['sp_type'] == 0 ? 'static':'dynamic';
|
||||
$this->saveType($blockType);
|
||||
|
@ -1224,6 +1224,16 @@ SQL;
|
|||
}
|
||||
}
|
||||
|
||||
// insert sort info
|
||||
$qry = new CcBlockcriteria();
|
||||
$qry->setDbCriteria("sort")
|
||||
->setDbModifier("N/A")
|
||||
->setDbValue($p_criteriaData['etc']['sp_sort_options'])
|
||||
->setDbBlockId($this->id)
|
||||
->save();
|
||||
|
||||
|
||||
|
||||
// insert limit info
|
||||
$qry = new CcBlockcriteria();
|
||||
$qry->setDbCriteria("limit")
|
||||
|
@ -1231,7 +1241,8 @@ SQL;
|
|||
->setDbValue($p_criteriaData['etc']['sp_limit_value'])
|
||||
->setDbBlockId($this->id)
|
||||
->save();
|
||||
|
||||
|
||||
|
||||
// insert repeate track option
|
||||
$qry = new CcBlockcriteria();
|
||||
$qry->setDbCriteria("repeat_tracks")
|
||||
|
@ -1352,6 +1363,7 @@ SQL;
|
|||
"isrc_number" => _("ISRC"),
|
||||
"label" => _("Label"),
|
||||
"language" => _("Language"),
|
||||
"utime" => _("Upload Time"),
|
||||
"mtime" => _("Last Modified"),
|
||||
"lptime" => _("Last Played"),
|
||||
"length" => _("Length"),
|
||||
|
@ -1399,6 +1411,8 @@ SQL;
|
|||
"display_modifier"=>_($modifier));
|
||||
} else if($criteria == "repeat_tracks") {
|
||||
$storedCrit["repeat_tracks"] = array("value"=>$value);
|
||||
} else if($criteria == "sort") {
|
||||
$storedCrit["sort"] = array("value"=>$value);
|
||||
} else {
|
||||
$storedCrit["crit"][$criteria][] = array(
|
||||
"criteria"=>$criteria,
|
||||
|
@ -1507,8 +1521,20 @@ SQL;
|
|||
// check if file exists
|
||||
$qry->add("file_exists", "true", Criteria::EQUAL);
|
||||
$qry->add("hidden", "false", Criteria::EQUAL);
|
||||
if (isset($storedCrit['sort'])) {
|
||||
$sortTracks = $storedCrit['sort']['value'];
|
||||
}
|
||||
if ($sortTracks == 'newest') {
|
||||
$qry->addDescendingOrderByColumn('utime');
|
||||
}
|
||||
else if ($sortTracks == 'oldest') {
|
||||
$qry->addAscendingOrderByColumn('utime');
|
||||
}
|
||||
else {
|
||||
$qry->addAscendingOrderByColumn('random()');
|
||||
}
|
||||
|
||||
}
|
||||
// construct limit restriction
|
||||
$limits = array();
|
||||
|
||||
|
@ -1537,9 +1563,8 @@ SQL;
|
|||
Logging::info($e);
|
||||
}
|
||||
}
|
||||
|
||||
public static function organizeSmartPlyalistCriteria($p_criteria)
|
||||
{
|
||||
public static function organizeSmartPlaylistCriteria($p_criteria)
|
||||
{
|
||||
$fieldNames = array('sp_criteria_field', 'sp_criteria_modifier', 'sp_criteria_value', 'sp_criteria_extra');
|
||||
$output = array();
|
||||
foreach ($p_criteria as $ele) {
|
||||
|
|
|
@ -263,7 +263,7 @@ class Application_Model_Preference
|
|||
|
||||
if ($fade === "") {
|
||||
// the default value of the fade is 00.5
|
||||
return "00.5";
|
||||
return "0.5";
|
||||
}
|
||||
|
||||
return $fade;
|
||||
|
@ -279,8 +279,8 @@ class Application_Model_Preference
|
|||
$fade = self::getValue("default_fade_out");
|
||||
|
||||
if ($fade === "") {
|
||||
// the default value of the fade is 00.5
|
||||
return "00.5";
|
||||
// the default value of the fade is 0.5
|
||||
return "0.5";
|
||||
}
|
||||
|
||||
return $fade;
|
||||
|
@ -291,33 +291,6 @@ class Application_Model_Preference
|
|||
self::setValue("default_fade", $fade);
|
||||
}
|
||||
|
||||
public static function GetDefaultFade()
|
||||
{
|
||||
$fade = self::getValue("default_fade");
|
||||
|
||||
if ($fade === "") {
|
||||
// the default value of the fade is 00.5
|
||||
return "00.5";
|
||||
}
|
||||
|
||||
// we need this function to work with 2.0 version on default_fade value in cc_pref
|
||||
// it has 00:00:00.000000 format where in 2.1 we have 00.000000 format
|
||||
if (preg_match("/([0-9]{2}):([0-9]{2}):([0-9]{2}).([0-9]{6})/", $fade, $matches) == 1 && count($matches) == 5) {
|
||||
$out = 0;
|
||||
$out += intval($matches[1] * 3600);
|
||||
$out += intval($matches[2] * 60);
|
||||
$out += intval($matches[3]);
|
||||
$out .= ".$matches[4]";
|
||||
$fade = $out;
|
||||
}
|
||||
|
||||
$fade = number_format($fade, 1, '.', '');
|
||||
//fades need 2 leading zeros for DateTime conversion
|
||||
$fade = str_pad($fade, 4, "0", STR_PAD_LEFT);
|
||||
|
||||
return $fade;
|
||||
}
|
||||
|
||||
public static function SetDefaultTransitionFade($fade)
|
||||
{
|
||||
self::setValue("default_transition_fade", $fade);
|
||||
|
@ -330,7 +303,7 @@ class Application_Model_Preference
|
|||
public static function GetDefaultTransitionFade()
|
||||
{
|
||||
$transition_fade = self::getValue("default_transition_fade");
|
||||
return ($transition_fade == "") ? "00.000000" : $transition_fade;
|
||||
return ($transition_fade == "") ? "0.000" : $transition_fade;
|
||||
}
|
||||
|
||||
public static function SetStreamLabelFormat($type)
|
||||
|
|
|
@ -862,9 +862,11 @@ SQL;
|
|||
* In UTC time.
|
||||
* @param unknown_type $excludeInstance
|
||||
* @param boolean $onlyRecord
|
||||
* @param int $showId
|
||||
* limits the results to instances of a given showId only
|
||||
* @return array
|
||||
*/
|
||||
public static function getShows($start_timestamp, $end_timestamp, $onlyRecord=FALSE)
|
||||
public static function getShows($start_timestamp, $end_timestamp, $onlyRecord=FALSE, $showId=null)
|
||||
{
|
||||
self::createAndFillShowInstancesPastPopulatedUntilDate($end_timestamp);
|
||||
|
||||
|
@ -898,13 +900,21 @@ SQL;
|
|||
//only want shows that are starting at the time or later.
|
||||
$start_string = $start_timestamp->format("Y-m-d H:i:s");
|
||||
$end_string = $end_timestamp->format("Y-m-d H:i:s");
|
||||
|
||||
$params = array();
|
||||
|
||||
if ($showId) {
|
||||
$sql .= " AND (si1.show_id = :show_id)";
|
||||
$params[':show_id'] = $showId;
|
||||
}
|
||||
|
||||
if ($onlyRecord) {
|
||||
$sql .= " AND (si1.starts >= :start::TIMESTAMP AND si1.starts < :end::TIMESTAMP)";
|
||||
$sql .= " AND (si1.record = 1)";
|
||||
|
||||
return Application_Common_Database::prepareAndExecute( $sql,
|
||||
array( ':start' => $start_string,
|
||||
':end' => $end_string ), 'all');
|
||||
$params[':start'] = $start_string;
|
||||
$params[':end'] = $end_string;
|
||||
return Application_Common_Database::prepareAndExecute( $sql, $params, 'all');
|
||||
|
||||
} else {
|
||||
$sql .= " ". <<<SQL
|
||||
|
@ -913,15 +923,16 @@ AND ((si1.starts >= :start1::TIMESTAMP AND si1.starts < :end1::TIMESTAMP)
|
|||
OR (si1.starts <= :start3::TIMESTAMP AND si1.ends >= :end3::TIMESTAMP))
|
||||
ORDER BY si1.starts
|
||||
SQL;
|
||||
return Application_Common_Database::prepareAndExecute( $sql,
|
||||
array(
|
||||
$params = array_merge($params, array(
|
||||
'start1' => $start_string,
|
||||
'start2' => $start_string,
|
||||
'start3' => $start_string,
|
||||
'end1' => $end_string,
|
||||
'end2' => $end_string,
|
||||
'end3' => $end_string
|
||||
), 'all');
|
||||
)
|
||||
);
|
||||
return Application_Common_Database::prepareAndExecute( $sql, $params, 'all');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1016,10 +1027,10 @@ SQL;
|
|||
|
||||
//for putting the now playing icon on the show.
|
||||
if ($now > $startsDT && $now < $endsDT) {
|
||||
$event["nowPlaying"] = true;
|
||||
$event["nowPlaying"] = true;
|
||||
}
|
||||
else {
|
||||
$event["nowPlaying"] = false;
|
||||
$event["nowPlaying"] = false;
|
||||
}
|
||||
|
||||
//event colouring
|
||||
|
@ -1048,9 +1059,9 @@ SQL;
|
|||
**/
|
||||
private static function getPercentScheduled($p_starts, $p_ends, $p_time_filled)
|
||||
{
|
||||
$utcTimezone = new DatetimeZone("UTC");
|
||||
$startDt = new DateTime($p_starts, $utcTimezone);
|
||||
$endDt = new DateTime($p_ends, $utcTimezone);
|
||||
$utcTimezone = new DatetimeZone("UTC");
|
||||
$startDt = new DateTime($p_starts, $utcTimezone);
|
||||
$endDt = new DateTime($p_ends, $utcTimezone);
|
||||
$durationSeconds = intval($endDt->format("U")) - intval($startDt->format("U"));
|
||||
$time_filled = Application_Common_DateHelper::playlistTimeToSeconds($p_time_filled);
|
||||
if ($durationSeconds != 0) { //Prevent division by zero if the show duration somehow becomes zero.
|
||||
|
@ -1457,4 +1468,5 @@ SQL;
|
|||
|
||||
return array($start, $end);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -555,7 +555,7 @@ SQL;
|
|||
|
||||
}
|
||||
|
||||
public function getShowListContent()
|
||||
public function getShowListContent($timezone = null)
|
||||
{
|
||||
$con = Propel::getConnection();
|
||||
|
||||
|
@ -606,9 +606,14 @@ SQL;
|
|||
':instance_id2' => $this->_instanceId
|
||||
));
|
||||
$results = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
$userTimezone = Application_Model_Preference::GetUserTimezone();
|
||||
$displayTimezone = new DateTimeZone($userTimezone);
|
||||
|
||||
if (isset($timezone)) {
|
||||
$displayTimezone = new DateTimeZone($timezone);
|
||||
} else {
|
||||
$userTimezone = Application_Model_Preference::GetUserTimezone();
|
||||
$displayTimezone = new DateTimeZone($userTimezone);
|
||||
}
|
||||
|
||||
$utcTimezone = new DateTimeZone("UTC");
|
||||
|
||||
foreach ($results as &$row) {
|
||||
|
|
|
@ -88,11 +88,19 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
|
|||
|
||||
public static function deleteStreams($p_ids, $p_userId)
|
||||
{
|
||||
$leftOver = self::streamsNotOwnedByUser($p_ids, $p_userId);
|
||||
if (count($leftOver) == 0) {
|
||||
CcWebstreamQuery::create()->findPKs($p_ids)->delete();
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
||||
|
||||
if (!$isAdminOrPM) {
|
||||
$leftOver = self::streamsNotOwnedByUser($p_ids, $p_userId);
|
||||
if (count($leftOver) == 0) {
|
||||
CcWebstreamQuery::create()->findPKs($p_ids)->delete();
|
||||
} else {
|
||||
throw new WebstreamNoPermissionException;
|
||||
}
|
||||
} else {
|
||||
throw new WebstreamNoPermissionException;
|
||||
CcWebstreamQuery::create()->findPKs($p_ids)->delete();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -304,4 +304,23 @@ class CcShow extends BaseCcShow {
|
|||
->filterByDbId($instanceId, Criteria::NOT_EQUAL)
|
||||
->find();
|
||||
}
|
||||
|
||||
public function getShowInfo()
|
||||
{
|
||||
$info = array();
|
||||
if ($this->getDbId() == null) {
|
||||
return $info;
|
||||
} else {
|
||||
$info['name'] = $this->getDbName();
|
||||
$info['id'] = $this->getDbId();
|
||||
$info['url'] = $this->getDbUrl();
|
||||
$info['genre'] = $this->getDbGenre();
|
||||
$info['description'] = $this->getDbDescription();
|
||||
$info['color'] = $this->getDbColor();
|
||||
$info['background_color'] = $this->getDbBackgroundColor();
|
||||
$info['linked'] = $this->getDbLinked();
|
||||
return $info;
|
||||
}
|
||||
|
||||
}
|
||||
} // CcShow
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue