2011-08-15 22:10:46 +02:00
|
|
|
<?php
|
|
|
|
|
2011-08-18 19:53:12 +02:00
|
|
|
class Application_Form_StreamSetting extends Zend_Form
|
2011-08-15 22:10:46 +02:00
|
|
|
{
|
2011-08-18 19:53:12 +02:00
|
|
|
private $setting;
|
2011-09-30 00:11:22 +02:00
|
|
|
|
2011-08-15 22:10:46 +02:00
|
|
|
public function init()
|
|
|
|
{
|
2011-09-30 00:11:22 +02:00
|
|
|
|
2011-08-18 19:53:12 +02:00
|
|
|
}
|
2011-09-30 00:11:22 +02:00
|
|
|
|
2011-08-18 19:53:12 +02:00
|
|
|
public function setSetting($setting){
|
|
|
|
$this->setting = $setting;
|
|
|
|
}
|
2011-09-30 00:11:22 +02:00
|
|
|
|
|
|
|
public function startFrom() {
|
2011-08-18 19:53:12 +02:00
|
|
|
$setting = $this->setting;
|
2011-11-23 23:03:30 +01:00
|
|
|
if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
|
|
|
|
$output_sound_device = new Zend_Form_Element_Checkbox('output_sound_device');
|
2011-11-29 19:09:23 +01:00
|
|
|
$output_sound_device->setLabel('Hardware Audio Output')
|
2011-11-23 23:03:30 +01:00
|
|
|
->setRequired(false)
|
|
|
|
->setValue(($setting['output_sound_device'] == "true")?1:0)
|
|
|
|
->setDecorators(array('ViewHelper'));
|
|
|
|
if (Application_Model_Preference::GetEnableStreamConf() == "false"){
|
|
|
|
$output_sound_device->setAttrib("readonly", true);
|
|
|
|
}
|
|
|
|
$this->addElement($output_sound_device);
|
2011-12-13 12:10:25 +01:00
|
|
|
|
2011-12-01 01:01:40 +01:00
|
|
|
$output_types = array("ALSA"=>"ALSA", "AO"=>"AO", "OSS"=>"OSS", "Portaudio"=>"Portaudio", "Pulseaudio"=>"Pulseaudio");
|
|
|
|
$output_type = new Zend_Form_Element_Select('output_sound_device_type');
|
|
|
|
$output_type->setLabel("Output Type")
|
|
|
|
->setMultiOptions($output_types)
|
|
|
|
->setValue($setting['output_sound_device_type'])
|
|
|
|
->setDecorators(array('ViewHelper'));
|
|
|
|
if($setting['output_sound_device'] != "true"){
|
|
|
|
$output_type->setAttrib("disabled", "disabled");
|
|
|
|
}
|
|
|
|
$this->addElement($output_type);
|
2011-11-23 23:03:30 +01:00
|
|
|
}
|
2011-12-13 12:10:25 +01:00
|
|
|
|
2011-12-09 19:42:03 +01:00
|
|
|
# tooltip
|
2011-12-13 12:10:25 +01:00
|
|
|
$description = 'VLC and mplayer have a serious bug when playing an OGG/VORBIS
|
|
|
|
stream that has metadata information enabled (stream metadata is the
|
|
|
|
track title, show name, etc displayed in the audio player): they will
|
|
|
|
disconnect from the stream after every song if this option is enabled.
|
|
|
|
If your listeners do not require support for these audio players,
|
2011-12-09 19:42:03 +01:00
|
|
|
then you should enable this option.';
|
2011-12-13 12:10:25 +01:00
|
|
|
|
2011-11-23 23:03:30 +01:00
|
|
|
$icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata');
|
2011-11-25 21:38:29 +01:00
|
|
|
$icecast_vorbis_metadata->setLabel('Icecast Vorbis Metadata')
|
2011-12-09 19:42:03 +01:00
|
|
|
->setDescription($description)
|
2011-11-23 23:03:30 +01:00
|
|
|
->setRequired(false)
|
|
|
|
->setValue(($setting['icecast_vorbis_metadata'] == "true")?1:0)
|
|
|
|
->setDecorators(array('ViewHelper'));
|
2011-09-30 00:11:22 +02:00
|
|
|
if (Application_Model_Preference::GetEnableStreamConf() == "false"){
|
2011-11-23 23:03:30 +01:00
|
|
|
$icecast_vorbis_metadata->setAttrib("readonly", true);
|
2011-09-02 22:13:30 +02:00
|
|
|
}
|
2011-11-23 23:03:30 +01:00
|
|
|
$this->addElement($icecast_vorbis_metadata);
|
2011-12-13 12:10:25 +01:00
|
|
|
|
|
|
|
$stream_format = new Zend_Form_Element_Radio('streamFormat');
|
|
|
|
$stream_format->setLabel('Stream Label:');
|
|
|
|
$stream_format->setMultiOptions(array("Artist - Title",
|
|
|
|
"Show - Artist - Title",
|
|
|
|
"Station name - Show name"));
|
|
|
|
$stream_format->setValue(Application_Model_Preference::GetStreamLabelFormat());
|
|
|
|
$stream_format->setDecorators(array('ViewHelper'));
|
|
|
|
$this->addElement($stream_format);
|
2011-08-18 19:53:12 +02:00
|
|
|
}
|
2011-09-30 00:11:22 +02:00
|
|
|
|
2011-08-18 19:53:12 +02:00
|
|
|
public function isValid($data){
|
2011-12-01 01:01:40 +01:00
|
|
|
$this->populate(array("output_sound_device"=>$data['output_sound_device'], "icecast_vorbis_metadata"=>$data['icecast_vorbis_metadata'],
|
2011-12-13 12:10:25 +01:00
|
|
|
"output_sound_device_type"=>$data['output_sound_device_type'], "streamFormat"=>$data['streamFormat']));
|
2011-08-18 19:53:12 +02:00
|
|
|
return true;
|
2011-08-15 22:10:46 +02:00
|
|
|
}
|
|
|
|
}
|