sintonia/legacy/application/forms/StreamSetting.php

74 lines
2.7 KiB
PHP
Raw Permalink Normal View History

<?php
class Application_Form_StreamSetting extends Zend_Form
{
private $setting;
public function init() {}
public function setSetting($setting)
{
$this->setting = $setting;
}
public function startFrom()
{
2021-10-11 16:10:47 +02:00
$this->setDecorators([
['ViewScript', ['viewScript' => 'preference/stream-setting.phtml']],
]);
2015-07-03 19:32:41 +02:00
$setting = $this->setting;
$stream_format = new Zend_Form_Element_Radio('streamFormat');
$stream_format
->setLabel(_('Stream Label:'))
2021-10-11 16:10:47 +02:00
->setMultiOptions([
_('Artist - Title'),
_('Show - Artist - Title'),
_('Station name - Show name'),
])
->setValue(Application_Model_Preference::GetStreamLabelFormat())
->setDecorators(['ViewHelper']);
$this->addElement($stream_format);
2021-10-11 16:10:47 +02:00
$offAirMeta = new Zend_Form_Element_Text('offAirMeta');
$offAirMeta
->setLabel(_('Off Air Metadata'))
->setValue(Application_Model_Preference::getOffAirMeta())
->setDecorators(['ViewHelper']);
$this->addElement($offAirMeta);
2021-10-11 16:10:47 +02:00
$enable_replay_gain = new Zend_Form_Element_Checkbox('enableReplayGain');
$enable_replay_gain
->setLabel(_('Enable Replay Gain'))
2021-10-11 16:10:47 +02:00
->setValue(Application_Model_Preference::GetEnableReplayGain())
->setDecorators(['ViewHelper']);
$this->addElement($enable_replay_gain);
2021-10-11 16:10:47 +02:00
$replay_gain = new Zend_Form_Element_Hidden('replayGainModifier');
$replay_gain
->setLabel(_('Replay Gain Modifier'))
2021-10-11 16:10:47 +02:00
->setValue(Application_Model_Preference::getReplayGainModifier())
->setAttribs(['style' => 'border: 0; color: #f6931f; font-weight: bold;'])
->setDecorators(['ViewHelper']);
2012-12-28 04:58:41 +01:00
$this->addElement($replay_gain);
2015-07-03 19:32:41 +02:00
$output_sound_device = new Zend_Form_Element_Checkbox('output_sound_device');
$output_sound_device
->setLabel(_('Hardware Audio Output:'))
->setAttrib('readonly', true)
->setRequired(false)
->setValue(($setting['output_sound_device'] == 'true') ? 1 : 0)
->setDecorators(['ViewHelper']);
$this->addElement($output_sound_device);
$output_sound_device_type = new Zend_Form_Element_Select('output_sound_device_type');
$output_sound_device_type
->setLabel(_('Output Type'))
->setAttrib('readonly', true)
->setValue(isset($setting['output_sound_device_type']) ? $setting['output_sound_device_type'] : 0)
->setDecorators(['ViewHelper']);
$this->addElement($output_sound_device_type);
}
}