Merge pull request #55 from radiorabe/feature/autodj

Robbs AutoDJ
This commit is contained in:
Robb 2017-03-11 18:41:08 -05:00 committed by GitHub
commit 2be8ef0f2b
65 changed files with 1611 additions and 126 deletions

View file

@ -0,0 +1,51 @@
<?php
class Application_Form_AddShowAutoPlaylist extends Zend_Form_SubForm
{
public function init()
{
$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
// and store to assoc array
$maxLens = Application_Model_Show::getMaxLengths();
// Add autoplaylist checkbox element
$this->addElement('checkbox', 'add_show_has_autoplaylist', array(
'label' => _('Auto Schedule Playlist ?'),
'required' => false,
'class' => 'input_text',
'decorators' => array('ViewHelper')
));
$autoPlaylistSelect = new Zend_Form_Element_Select("add_show_autoplaylist_id");
$autoPlaylistSelect->setLabel(_("Select Playlist"));
$autoPlaylistSelect->setMultiOptions(Application_Model_Library::getPlaylistNames());
$autoPlaylistSelect->setValue(null);
$autoPlaylistSelect->setDecorators(array('ViewHelper'));
$this->addElement($autoPlaylistSelect);
}
public function disable()
{
$elements = $this->getElements();
foreach ($elements as $element) {
if ($element->getType() != 'Zend_Form_Element_Hidden') {
$element->setAttrib('disabled','disabled');
}
}
}
public function makeReadonly()
{
$elements = $this->getElements();
foreach ($elements as $element) {
if ($element->getType() != 'Zend_Form_Element_Hidden') {
$element->setAttrib('readonly','readonly');
}
}
}
}

View file

@ -27,7 +27,7 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
'class' => 'input_text',
'required' => true,
'filters' => array('StringTrim'),
'value' => _('Untitled Show'),
'value' => _('New Show'),
'validators' => array($notEmptyValidator, array('StringLength', false, array(0, $maxLens['name'])))
));
@ -66,30 +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');
}
/**
* 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()