2011-04-03 23:34:44 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
|
|
|
{
|
2012-05-18 18:58:09 +02:00
|
|
|
private $isSaas;
|
|
|
|
|
2011-04-03 23:34:44 +02:00
|
|
|
public function init()
|
|
|
|
{
|
2012-05-18 18:58:09 +02:00
|
|
|
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
2012-05-19 01:08:50 +02:00
|
|
|
$this->isSaas = $isSaas;
|
2012-05-18 18:58:09 +02:00
|
|
|
|
2011-04-03 23:34:44 +02:00
|
|
|
$this->setDecorators(array(
|
2012-05-18 18:58:09 +02:00
|
|
|
array('ViewScript', array('viewScript' => 'form/preferences_general.phtml', "isSaas" => $isSaas))
|
2011-04-03 23:34:44 +02:00
|
|
|
));
|
|
|
|
|
|
|
|
$defaultFade = Application_Model_Preference::GetDefaultFade();
|
|
|
|
if($defaultFade == ""){
|
2012-04-09 21:49:39 +02:00
|
|
|
$defaultFade = '0.500000';
|
2011-04-03 23:34:44 +02:00
|
|
|
}
|
2011-12-13 12:10:25 +01:00
|
|
|
|
2011-08-19 22:42:46 +02:00
|
|
|
//Station name
|
|
|
|
$this->addElement('text', 'stationName', array(
|
|
|
|
'class' => 'input_text',
|
|
|
|
'label' => 'Station Name',
|
|
|
|
'required' => false,
|
|
|
|
'filters' => array('StringTrim'),
|
2012-07-10 05:32:21 +02:00
|
|
|
'value' => Application_Model_Preference::getValue("station_name"),
|
2011-08-19 22:42:46 +02:00
|
|
|
'decorators' => array(
|
|
|
|
'ViewHelper'
|
|
|
|
)
|
|
|
|
));
|
2011-12-13 12:10:25 +01:00
|
|
|
|
2011-04-03 23:34:44 +02:00
|
|
|
//Default station fade
|
|
|
|
$this->addElement('text', 'stationDefaultFade', array(
|
|
|
|
'class' => 'input_text',
|
2012-02-27 21:29:02 +01:00
|
|
|
'label' => 'Default Fade (s):',
|
2011-04-03 23:34:44 +02:00
|
|
|
'required' => false,
|
|
|
|
'filters' => array('StringTrim'),
|
2011-06-17 17:54:36 +02:00
|
|
|
'validators' => array(array('regex', false,
|
2012-04-12 16:01:22 +02:00
|
|
|
array('/^[0-9]{1,2}(\.\d{1,6})?$/',
|
|
|
|
'messages' => 'enter a time in seconds 0{.000000}'))),
|
2011-04-03 23:34:44 +02:00
|
|
|
'value' => $defaultFade,
|
|
|
|
'decorators' => array(
|
|
|
|
'ViewHelper'
|
|
|
|
)
|
|
|
|
));
|
2011-06-17 17:54:36 +02:00
|
|
|
|
2011-04-03 23:34:44 +02:00
|
|
|
$third_party_api = new Zend_Form_Element_Radio('thirdPartyApi');
|
2011-04-04 21:15:54 +02:00
|
|
|
$third_party_api->setLabel('Allow Remote Websites To Access "Schedule" Info?<br> (Enable this to make front-end widgets work.)');
|
2011-04-03 23:34:44 +02:00
|
|
|
$third_party_api->setMultiOptions(array("Disabled",
|
|
|
|
"Enabled"));
|
|
|
|
$third_party_api->setValue(Application_Model_Preference::GetAllow3rdPartyApi());
|
|
|
|
$third_party_api->setDecorators(array('ViewHelper'));
|
|
|
|
$this->addElement($third_party_api);
|
2011-12-13 12:10:25 +01:00
|
|
|
|
2011-08-12 20:14:07 +02:00
|
|
|
/* Form Element for setting the Timezone */
|
|
|
|
$timezone = new Zend_Form_Element_Select("timezone");
|
|
|
|
$timezone->setLabel("Timezone");
|
|
|
|
$timezone->setMultiOptions($this->getTimezones());
|
|
|
|
$timezone->setValue(Application_Model_Preference::GetTimezone());
|
|
|
|
$timezone->setDecorators(array('ViewHelper'));
|
|
|
|
$this->addElement($timezone);
|
2011-12-13 12:10:25 +01:00
|
|
|
|
2011-10-19 18:42:22 +02:00
|
|
|
/* Form Element for setting which day is the start of the week */
|
|
|
|
$week_start_day = new Zend_Form_Element_Select("weekStartDay");
|
|
|
|
$week_start_day->setLabel("Week Starts On");
|
|
|
|
$week_start_day->setMultiOptions($this->getWeekStartDays());
|
|
|
|
$week_start_day->setValue(Application_Model_Preference::GetWeekStartDay());
|
|
|
|
$week_start_day->setDecorators(array('ViewHelper'));
|
|
|
|
$this->addElement($week_start_day);
|
2011-08-12 20:14:07 +02:00
|
|
|
}
|
2011-12-13 12:10:25 +01:00
|
|
|
|
2011-08-12 20:14:07 +02:00
|
|
|
private function getTimezones(){
|
|
|
|
$regions = array(
|
|
|
|
'Africa' => DateTimeZone::AFRICA,
|
|
|
|
'America' => DateTimeZone::AMERICA,
|
|
|
|
'Antarctica' => DateTimeZone::ANTARCTICA,
|
2012-02-01 03:24:01 +01:00
|
|
|
'Arctic' => DateTimeZone::ARCTIC,
|
2011-08-22 17:37:48 +02:00
|
|
|
'Asia' => DateTimeZone::ASIA,
|
2011-08-12 20:14:07 +02:00
|
|
|
'Atlantic' => DateTimeZone::ATLANTIC,
|
2012-02-01 03:24:01 +01:00
|
|
|
'Australia' => DateTimeZone::AUSTRALIA,
|
2011-08-12 20:14:07 +02:00
|
|
|
'Europe' => DateTimeZone::EUROPE,
|
|
|
|
'Indian' => DateTimeZone::INDIAN,
|
|
|
|
'Pacific' => DateTimeZone::PACIFIC
|
|
|
|
);
|
2011-12-13 12:10:25 +01:00
|
|
|
|
2011-08-12 20:14:07 +02:00
|
|
|
$tzlist = array();
|
2011-12-13 12:10:25 +01:00
|
|
|
|
2011-08-12 20:14:07 +02:00
|
|
|
foreach ($regions as $name => $mask){
|
|
|
|
$ids = DateTimeZone::listIdentifiers($mask);
|
|
|
|
foreach ($ids as $id){
|
|
|
|
$tzlist[$id] = str_replace("_", " ", $id);
|
|
|
|
}
|
|
|
|
}
|
2011-06-17 17:54:36 +02:00
|
|
|
|
2011-08-12 20:14:07 +02:00
|
|
|
return $tzlist;
|
2011-04-03 23:34:44 +02:00
|
|
|
}
|
2011-12-13 12:10:25 +01:00
|
|
|
|
2011-04-03 23:34:44 +02:00
|
|
|
|
2011-10-19 18:42:22 +02:00
|
|
|
private function getWeekStartDays() {
|
|
|
|
$days = array(
|
|
|
|
'Sunday',
|
|
|
|
'Monday',
|
|
|
|
'Tuesday',
|
|
|
|
'Wednesday',
|
|
|
|
'Thursday',
|
|
|
|
'Friday',
|
|
|
|
'Saturday'
|
|
|
|
);
|
2011-12-13 12:10:25 +01:00
|
|
|
return $days;
|
2011-10-19 18:42:22 +02:00
|
|
|
}
|
2011-04-03 23:34:44 +02:00
|
|
|
}
|
|
|
|
|