Whitespace and deadcode nitpick
This commit is contained in:
parent
6e50af344a
commit
2a53241ba3
15 changed files with 59 additions and 122 deletions
|
@ -1,7 +1,6 @@
|
|||
<?php
|
||||
|
||||
class AutoPlaylistManager {
|
||||
|
||||
/**
|
||||
* @var int how often, in seconds, to check for and ingest new podcast episodes
|
||||
*/
|
||||
|
@ -19,7 +18,6 @@ class AutoPlaylistManager {
|
|||
return empty($lastPolled) || (microtime(true) > $lastPolled + self::$_AUTOPLAYLIST_POLL_INTERVAL_SECONDS);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This function is copied from the TestUser class and is used to instantiate a user so that
|
||||
* the Scheduler model can be utilized by buildAutoPlaylist.
|
||||
|
@ -45,7 +43,6 @@ class AutoPlaylistManager {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Find all shows with autoplaylists who have yet to have their playlists built and added to the schedule
|
||||
*
|
||||
|
@ -70,7 +67,6 @@ class AutoPlaylistManager {
|
|||
Zend_Session::stop();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Find all show instances starting in the next hour with autoplaylists not yet added to the schedule
|
||||
*
|
||||
|
@ -93,5 +89,4 @@ class AutoPlaylistManager {
|
|||
->filterByDbAutoPlaylistBuilt(false)
|
||||
->find();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -223,7 +223,6 @@ class CeleryTask implements AirtimeTask {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Class AutoPlaylistTask
|
||||
*
|
||||
* Checks for shows with an autoplaylist that needs to be filled in
|
||||
|
@ -231,7 +230,6 @@ class CeleryTask implements AirtimeTask {
|
|||
*/
|
||||
class AutoPlaylistTask implements AirtimeTask
|
||||
{
|
||||
|
||||
/**
|
||||
* Checks whether or not the autoplaylist polling interval has passed
|
||||
*
|
||||
|
@ -251,8 +249,6 @@ class AutoPlaylistTask implements AirtimeTask
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Class PodcastTask
|
||||
*
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
// This file generated by Propel 1.7.0 convert-conf target
|
||||
// from XML runtime conf file /home/wcrs/airtime-dev-test/airtime_mvc/build/runtime-conf.xml
|
||||
// from XML runtime conf file /home/sourcefabric/dev/Airtime/airtime_mvc/build/runtime-conf.xml
|
||||
$conf = array (
|
||||
'datasources' =>
|
||||
array (
|
||||
|
@ -22,14 +22,6 @@ $conf = array (
|
|||
),
|
||||
'default' => 'airtime',
|
||||
),
|
||||
'log' =>
|
||||
array (
|
||||
'type' => 'file',
|
||||
'name' => './propel.log',
|
||||
'ident' => 'propel',
|
||||
'level' => '7',
|
||||
'conf' => '',
|
||||
),
|
||||
'generator_version' => '1.7.0',
|
||||
);
|
||||
$conf['classmap'] = include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'classmap-airtime-conf.php');
|
||||
|
|
|
@ -1 +1 @@
|
|||
ALTER TABLE third_party_track_references ALTER COLUMN file_id SET NOT NULL;
|
||||
ALTER TABLE third_party_track_references ALTER COLUMN file_id SET NOT NULL;
|
|
@ -4,14 +4,12 @@ class Application_Form_AddShowAutoPlaylist extends Zend_Form_SubForm
|
|||
{
|
||||
public function init()
|
||||
{
|
||||
$this->setDecorators(array(
|
||||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/add-show-autoplaylist.phtml'))
|
||||
));
|
||||
|
||||
|
||||
|
||||
$notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
|
||||
// retrieves the length limit for each char field
|
||||
// retrieves the length limit for each char field
|
||||
// and store to assoc array
|
||||
$maxLens = Application_Model_Show::getMaxLengths();
|
||||
|
||||
|
@ -25,31 +23,12 @@ class Application_Form_AddShowAutoPlaylist extends Zend_Form_SubForm
|
|||
|
||||
$autoPlaylistSelect = new Zend_Form_Element_Select("add_show_autoplaylist_id");
|
||||
$autoPlaylistSelect->setLabel(_("Select Playlist"));
|
||||
$autoPlaylistSelect->setMultiOptions($this->getPlaylistNames());
|
||||
$autoPlaylistSelect->setMultiOptions(Application_Model_Library::getPlaylistNames());
|
||||
$autoPlaylistSelect->setValue(null);
|
||||
$autoPlaylistSelect->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($autoPlaylistSelect);
|
||||
}
|
||||
|
||||
|
||||
private function getPlaylistNames()
|
||||
{
|
||||
$playlistNames = array(NULL => _("None"));
|
||||
|
||||
|
||||
$playlists = CcPlaylistQuery::create()
|
||||
->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)
|
||||
->find();
|
||||
|
||||
foreach ($playlists as $playlist) {
|
||||
|
||||
$playlistNames[$playlist->getDbId()] = $playlist->getDbName();
|
||||
}
|
||||
|
||||
return $playlistNames;
|
||||
}
|
||||
|
||||
|
||||
public function disable()
|
||||
{
|
||||
$elements = $this->getElements();
|
||||
|
|
|
@ -39,7 +39,7 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
|
|||
'filters' => array('StringTrim'),
|
||||
'validators' => array($notEmptyValidator, array('StringLength', false, array(0, $maxLens['url'])))
|
||||
));
|
||||
|
||||
|
||||
// Add genre element
|
||||
$this->addElement('text', 'add_show_genre', array(
|
||||
'label' => _('Genre:'),
|
||||
|
@ -59,7 +59,6 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
|
|||
|
||||
$descText = $this->getElement('add_show_description');
|
||||
|
||||
|
||||
$descText->setDecorators(array(array('ViewScript', array(
|
||||
'viewScript' => 'form/add-show-block.phtml',
|
||||
'class' => 'block-display'
|
||||
|
@ -67,51 +66,30 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
|
|||
|
||||
// Add the instance description
|
||||
$this->addElement('textarea', 'add_show_instance_description', array(
|
||||
'label' => _('Instance Description:'),
|
||||
'required' => false,
|
||||
'class' => 'input_text_area',
|
||||
'validators' => array(array('StringLength', false, array(0, $maxLens['description'])))
|
||||
'label' => _('Instance Description:'),
|
||||
'required' => false,
|
||||
'class' => 'input_text_area',
|
||||
'validators' => array(array('StringLength', false, array(0, $maxLens['description'])))
|
||||
));
|
||||
|
||||
$instanceDesc = $this->getElement('add_show_instance_description');
|
||||
|
||||
|
||||
$instanceDesc->setDecorators(array(array('ViewScript', array(
|
||||
'viewScript' => 'form/add-show-block.phtml',
|
||||
'class' => 'block-display'
|
||||
'viewScript' => 'form/add-show-block.phtml',
|
||||
'class' => 'block-display'
|
||||
))));
|
||||
$instanceDesc->setAttrib('disabled','disabled');
|
||||
|
||||
}
|
||||
|
||||
|
||||
private function getPlaylistNames()
|
||||
{
|
||||
$playlistNames = array(NULL => _("None"));
|
||||
|
||||
|
||||
$playlists = CcPlaylistQuery::create()
|
||||
->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)
|
||||
->find();
|
||||
|
||||
foreach ($playlists as $playlist) {
|
||||
|
||||
$playlistNames[$playlist->getDbId()] = $playlist->getDbName();
|
||||
}
|
||||
|
||||
return $playlistNames;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Enable the instance description when editing a show instance
|
||||
*/
|
||||
public function enableInstanceDesc()
|
||||
{
|
||||
$el = $this->getElement('add_show_instance_description');
|
||||
Logging::info($el);
|
||||
$el->setAttrib('disabled', null);
|
||||
$el->setAttrib('readonly', null);
|
||||
$el = $this->getElement('add_show_instance_description');
|
||||
Logging::info($el);
|
||||
$el->setAttrib('disabled', null);
|
||||
$el->setAttrib('readonly', null);
|
||||
}
|
||||
|
||||
public function disable()
|
||||
|
|
|
@ -33,4 +33,18 @@ class Application_Model_Library
|
|||
}
|
||||
}
|
||||
|
||||
public static function getPlaylistNames()
|
||||
{
|
||||
$playlistNames = array(NULL => _("None"));
|
||||
|
||||
$playlists = CcPlaylistQuery::create()
|
||||
->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)
|
||||
->find();
|
||||
|
||||
foreach ($playlists as $playlist) {
|
||||
$playlistNames[$playlist->getDbId()] = $playlist->getDbName();
|
||||
}
|
||||
|
||||
return $playlistNames;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -129,7 +129,6 @@ class Application_Model_Show
|
|||
return $this->_showId;
|
||||
}
|
||||
|
||||
|
||||
public function getHasAutoPlaylist()
|
||||
{
|
||||
$show = CcShowQuery::create()->findPK($this->_showId);
|
||||
|
@ -156,7 +155,6 @@ class Application_Model_Show
|
|||
$show->setDbAutoPlaylistId($playlistid);
|
||||
}
|
||||
|
||||
|
||||
public function getHosts()
|
||||
{
|
||||
$sql = <<<SQL
|
||||
|
|
|
@ -169,16 +169,11 @@ SQL;
|
|||
->save();
|
||||
}
|
||||
|
||||
|
||||
public function updateScheduledTime()
|
||||
{
|
||||
$con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME);
|
||||
$this->_showInstance->updateDbTimeFilled($con);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function isDeleted()
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@ class Application_Service_ShowFormService
|
|||
public function createShowForms()
|
||||
{
|
||||
$formWhat = new Application_Form_AddShowWhat();
|
||||
$formAutoPlaylist = new Application_Form_AddShowAutoPlaylist();
|
||||
$formAutoPlaylist = new Application_Form_AddShowAutoPlaylist();
|
||||
$formWho = new Application_Form_AddShowWho();
|
||||
$formWhen = new Application_Form_AddShowWhen();
|
||||
$formRepeats = new Application_Form_AddShowRepeats();
|
||||
|
@ -31,7 +31,7 @@ class Application_Service_ShowFormService
|
|||
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
|
||||
|
||||
$formWhat->removeDecorator('DtDdWrapper');
|
||||
$formAutoPlaylist->removeDecorator('DtDdWrapper');
|
||||
$formAutoPlaylist->removeDecorator('DtDdWrapper');
|
||||
$formWho->removeDecorator('DtDdWrapper');
|
||||
$formWhen->removeDecorator('DtDdWrapper');
|
||||
$formRepeats->removeDecorator('DtDdWrapper');
|
||||
|
@ -43,7 +43,7 @@ class Application_Service_ShowFormService
|
|||
|
||||
$forms = array();
|
||||
$forms["what"] = $formWhat;
|
||||
$forms["autoplaylist"] = $formAutoPlaylist;
|
||||
$forms["autoplaylist"] = $formAutoPlaylist;
|
||||
$forms["who"] = $formWho;
|
||||
$forms["when"] = $formWhen;
|
||||
$forms["repeats"] = $formRepeats;
|
||||
|
@ -61,7 +61,7 @@ class Application_Service_ShowFormService
|
|||
* Popluates the what, autoplaylist, when, and repeat forms
|
||||
* with default values
|
||||
*/
|
||||
public function populateNewShowForms($formWhat, $formWhen, $formRepeats)
|
||||
public function populateNewShowForms($formWhat, $formWhen, $formRepeats)
|
||||
{
|
||||
$formWhat->populate(
|
||||
array('add_show_id' => '-1',
|
||||
|
@ -96,7 +96,7 @@ class Application_Service_ShowFormService
|
|||
*/
|
||||
$forms["what"]->makeReadonly();
|
||||
$forms["what"]->enableInstanceDesc();
|
||||
$forms["autoplaylist"]->disable();
|
||||
$forms["autoplaylist"]->disable();
|
||||
$forms["repeats"]->disable();
|
||||
$forms["who"]->disable();
|
||||
$forms["style"]->disable();
|
||||
|
@ -119,7 +119,7 @@ class Application_Service_ShowFormService
|
|||
{
|
||||
$this->populateFormWhat($forms["what"]);
|
||||
//local show start DT
|
||||
$this->populateFormAutoPlaylist($forms["autoplaylist"]);
|
||||
$this->populateFormAutoPlaylist($forms["autoplaylist"]);
|
||||
$showStart = $this->populateFormWhen($forms["when"]);
|
||||
$this->populateFormRepeats($forms["repeats"], $showStart);
|
||||
$this->populateFormWho($forms["who"]);
|
||||
|
@ -130,12 +130,11 @@ class Application_Service_ShowFormService
|
|||
$this->populateFormRebroadcastAbsolute($forms["abs_rebroadcast"]);
|
||||
}
|
||||
|
||||
private function populateFormWhat($form)
|
||||
private function populateFormWhat($form)
|
||||
{
|
||||
$ccShowInstance = CcShowInstancesQuery::create()->findPk($this->instanceId);
|
||||
|
||||
|
||||
$form->populate(
|
||||
$form->populate(
|
||||
array(
|
||||
'add_show_instance_id' => $this->instanceId,
|
||||
'add_show_id' => $this->ccShow->getDbId(),
|
||||
|
@ -143,18 +142,15 @@ class Application_Service_ShowFormService
|
|||
'add_show_url' => $this->ccShow->getDbUrl(),
|
||||
'add_show_genre' => $this->ccShow->getDbGenre(),
|
||||
'add_show_description' => $this->ccShow->getDbDescription(),
|
||||
'add_show_instance_description' => $ccShowInstance->getDbDescription(),
|
||||
'add_show_instance_description' => $ccShowInstance->getDbDescription(),
|
||||
));
|
||||
}
|
||||
|
||||
private function populateFormAutoPlaylist($form)
|
||||
{
|
||||
$ccShowInstance = CcShowInstancesQuery::create()->findPk($this->instanceId);
|
||||
|
||||
if (!$this->ccShow->getDbAutoPlaylistId()) {
|
||||
// $form->disableAutoPlaylist();
|
||||
}
|
||||
|
||||
$form->populate(
|
||||
$form->populate(
|
||||
array(
|
||||
'add_show_has_autoplaylist' => $this->ccShow->getDbHasAutoPlaylist() ? 1 : 0,
|
||||
'add_show_autoplaylist_id' => $this->ccShow->getDbAutoPlaylistId()
|
||||
|
@ -294,7 +290,7 @@ class Application_Service_ShowFormService
|
|||
//end dates are stored non-inclusively so we need to
|
||||
//subtract one day
|
||||
if (!is_null($repeatEndDate)) {
|
||||
$repeatEndDate->sub(new DateInterval("P1D"));
|
||||
$repeatEndDate->sub(new DateInterval("P1D"));
|
||||
}
|
||||
|
||||
//default monthly repeat type
|
||||
|
@ -348,27 +344,27 @@ class Application_Service_ShowFormService
|
|||
|
||||
private function populateFormStyle($form)
|
||||
{
|
||||
$src = $this->ccShow->getDbImagePath() ?
|
||||
$this->imagePathToDataUri($this->ccShow->getDbImagePath()) : '';
|
||||
|
||||
$src = $this->ccShow->getDbImagePath() ?
|
||||
$this->imagePathToDataUri($this->ccShow->getDbImagePath()) : '';
|
||||
|
||||
$form->populate(
|
||||
array(
|
||||
'add_show_background_color' => $this->ccShow->getDbBackgroundColor(),
|
||||
'add_show_color' => $this->ccShow->getDbColor(),
|
||||
'add_show_logo_current' => $src));
|
||||
'add_show_logo_current' => $src));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a static image from disk to a base64 data URI
|
||||
*
|
||||
* @param unknown $path
|
||||
* - the path to the image on the disk
|
||||
* - the path to the image on the disk
|
||||
* @return string
|
||||
* - the data URI representation of the image
|
||||
* - the data URI representation of the image
|
||||
*/
|
||||
private function imagePathToDataUri($path) {
|
||||
$imageData = null;
|
||||
$bytesRead = 0;
|
||||
$bytesRead = 0;
|
||||
try {
|
||||
ob_start();
|
||||
header("Content-type: image/*");
|
||||
|
@ -382,9 +378,9 @@ class Application_Service_ShowFormService
|
|||
Logging::error("Failed to read image: " . $path);
|
||||
$imageData = null;
|
||||
}
|
||||
// return the data URI - data:{mime};base64,{data}
|
||||
return ($imageData === null || $imageData === '') ?
|
||||
'' : 'data: '.mime_content_type($path).';base64,'.$imageData;
|
||||
// return the data URI - data:{mime};base64,{data}
|
||||
return ($imageData === null || $imageData === '') ?
|
||||
'' : 'data: '.mime_content_type($path).';base64,'.$imageData;
|
||||
}
|
||||
|
||||
private function populateFormLive($form)
|
||||
|
@ -587,8 +583,8 @@ class Application_Service_ShowFormService
|
|||
public function calculateDuration($start, $end, $timezone)
|
||||
{
|
||||
try {
|
||||
|
||||
$tz = new DateTimeZone($timezone);
|
||||
|
||||
$tz = new DateTimeZone($timezone);
|
||||
$startDateTime = new DateTime($start, $tz);
|
||||
$endDateTime = new DateTime($end, $tz);
|
||||
|
||||
|
@ -606,7 +602,7 @@ class Application_Service_ShowFormService
|
|||
return $duration->format('%r%Hh %Im');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
Logging::info($e->getMessage());
|
||||
Logging::info($e->getMessage());
|
||||
return "Invalid Date";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1542,8 +1542,8 @@ SQL;
|
|||
$ccShow->setDbLiveStreamPass($showData['custom_password']);
|
||||
$ccShow->setDbHasAutoPlaylist($showData['add_show_has_autoplaylist'] == 1);
|
||||
// added to prevent errors with insert due to a lack of data
|
||||
if ($showData['add_show_autoplaylist_id'] != '') {
|
||||
$ccShow->setDbAutoPlaylistId($showData['add_show_autoplaylist_id']);
|
||||
if ($showData['add_show_autoplaylist_id'] != '') {
|
||||
$ccShow->setDbAutoPlaylistId($showData['add_show_autoplaylist_id']);
|
||||
}
|
||||
|
||||
//Here a user has edited a show and linked it.
|
||||
|
|
|
@ -20,4 +20,3 @@
|
|||
</div>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
|
|
|
@ -13,5 +13,3 @@
|
|||
}
|
||||
?>
|
||||
</dd>
|
||||
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
<div id="schedule-show-what" class="collapsible-content">
|
||||
<?php echo $this->autoplaylist; ?>
|
||||
</div>
|
||||
|
||||
<h3 class="collapsible-header"><span class="arrow-icon"></span><?php echo _("When") ?></h3>
|
||||
<div id="schedule-show-when" class="collapsible-content">
|
||||
<?php
|
||||
|
|
|
@ -274,7 +274,6 @@ function setAddShowEvents(form) {
|
|||
$("#add_show_playlist_dropdown").show();
|
||||
}
|
||||
|
||||
|
||||
if(!form.find("#add_show_repeats").attr('checked')) {
|
||||
form.find("#schedule-show-when > fieldset:last").hide();
|
||||
$("#add_show_rebroadcast_relative").hide();
|
||||
|
@ -313,7 +312,6 @@ function setAddShowEvents(form) {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
form.find("#add_show_repeats").click(function(){
|
||||
$(this).blur();
|
||||
form.find("#schedule-show-when > fieldset:last").toggle();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue