Whitespace and deadcode nitpick

This commit is contained in:
Lucas Bickel 2017-03-10 16:20:44 +01:00
parent 6e50af344a
commit 2a53241ba3
15 changed files with 59 additions and 122 deletions

View file

@ -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();

View file

@ -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()