CC-4090: Make code style PSR compliant
-removed all trailing whitespace in forms directory -replace all tabs with 4 spaces
This commit is contained in:
parent
d9cde230cd
commit
7ce4934cdc
25 changed files with 297 additions and 297 deletions
|
@ -29,7 +29,7 @@ class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm
|
|||
$this->addElement($text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function disable(){
|
||||
$elements = $this->getElements();
|
||||
foreach ($elements as $element)
|
||||
|
|
|
@ -11,13 +11,13 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
|
|||
->setRequired(false)
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($cb_airtime_auth);
|
||||
|
||||
|
||||
$cb_custom_auth = new Zend_Form_Element_Checkbox("cb_custom_auth");
|
||||
$cb_custom_auth ->setLabel("Use Custom Authentication:")
|
||||
->setRequired(false)
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($cb_custom_auth);
|
||||
|
||||
|
||||
//custom username
|
||||
$custom_username = new Zend_Form_Element_Text('custom_username');
|
||||
$custom_username->setAttrib('class', 'input_text')
|
||||
|
@ -29,7 +29,7 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
|
|||
new ConditionalNotEmpty(array("cb_custom_auth"=>"1"))))
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($custom_username);
|
||||
|
||||
|
||||
//custom password
|
||||
$custom_password = new Zend_Form_Element_Password('custom_password');
|
||||
$custom_password->setAttrib('class', 'input_text')
|
||||
|
@ -42,20 +42,20 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
|
|||
new ConditionalNotEmpty(array("cb_custom_auth"=>"1"))))
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($custom_password);
|
||||
|
||||
|
||||
$connection_url = Application_Model_Preference::GetLiveDJSourceConnectionURL();
|
||||
if(trim($connection_url) == ""){
|
||||
$connection_url = "N/A";
|
||||
}
|
||||
|
||||
|
||||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/add-show-live-stream.phtml', "connection_url"=>$connection_url))
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
public function isValid($data){
|
||||
$isValid = parent::isValid($data);
|
||||
|
||||
|
||||
if($data['cb_custom_auth'] == 1){
|
||||
if(trim($data['custom_username']) == ''){
|
||||
$element = $this->getElement("custom_username");
|
||||
|
|
|
@ -6,16 +6,16 @@ class Application_Form_AddShowRR extends Zend_Form_SubForm
|
|||
public function init()
|
||||
{
|
||||
// Add record element
|
||||
$this->addElement('checkbox', 'add_show_record', array(
|
||||
$this->addElement('checkbox', 'add_show_record', array(
|
||||
'label' => 'Record from Line In?',
|
||||
'required' => false,
|
||||
));
|
||||
));
|
||||
|
||||
// Add record element
|
||||
$this->addElement('checkbox', 'add_show_rebroadcast', array(
|
||||
$this->addElement('checkbox', 'add_show_rebroadcast', array(
|
||||
'label' => 'Rebroadcast?',
|
||||
'required' => false,
|
||||
));
|
||||
));
|
||||
}
|
||||
|
||||
public function disable(){
|
||||
|
|
|
@ -34,7 +34,7 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm
|
|||
$this->addElement($text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function disable(){
|
||||
$elements = $this->getElements();
|
||||
foreach ($elements as $element)
|
||||
|
|
|
@ -6,56 +6,56 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm
|
|||
public function init()
|
||||
{
|
||||
//Add type select
|
||||
$this->addElement('select', 'add_show_repeat_type', array(
|
||||
$this->addElement('select', 'add_show_repeat_type', array(
|
||||
'required' => true,
|
||||
'label' => 'Repeat Type:',
|
||||
'class' => ' input_select',
|
||||
'multiOptions' => array(
|
||||
"0" => "weekly",
|
||||
"0" => "weekly",
|
||||
"1" => "bi-weekly",
|
||||
"2" => "monthly"
|
||||
),
|
||||
));
|
||||
|
||||
// Add days checkboxes
|
||||
$this->addElement(
|
||||
$this->addElement(
|
||||
'multiCheckbox',
|
||||
'add_show_day_check',
|
||||
array(
|
||||
'label' => 'Select Days:',
|
||||
'label' => 'Select Days:',
|
||||
'required' => false,
|
||||
'multiOptions' => array(
|
||||
"0" => "Sun",
|
||||
"1" => "Mon",
|
||||
"2" => "Tue",
|
||||
"3" => "Wed",
|
||||
"4" => "Thu",
|
||||
"5" => "Fri",
|
||||
"6" => "Sat",
|
||||
"0" => "Sun",
|
||||
"1" => "Mon",
|
||||
"2" => "Tue",
|
||||
"3" => "Wed",
|
||||
"4" => "Thu",
|
||||
"5" => "Fri",
|
||||
"6" => "Sat",
|
||||
),
|
||||
));
|
||||
|
||||
// Add end date element
|
||||
// Add end date element
|
||||
$this->addElement('text', 'add_show_end_date', array(
|
||||
'label' => 'Date End:',
|
||||
'class' => 'input_text',
|
||||
'value' => date("Y-m-d"),
|
||||
'required' => false,
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array(
|
||||
'NotEmpty',
|
||||
array('date', false, array('YYYY-MM-DD'))
|
||||
)
|
||||
'validators' => array(
|
||||
'NotEmpty',
|
||||
array('date', false, array('YYYY-MM-DD'))
|
||||
)
|
||||
));
|
||||
|
||||
// Add no end element
|
||||
$this->addElement('checkbox', 'add_show_no_end', array(
|
||||
// Add no end element
|
||||
$this->addElement('checkbox', 'add_show_no_end', array(
|
||||
'label' => 'No End?',
|
||||
'required' => false,
|
||||
'checked' => true,
|
||||
));
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
public function disable(){
|
||||
$elements = $this->getElements();
|
||||
foreach ($elements as $element)
|
||||
|
@ -69,10 +69,10 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm
|
|||
|
||||
public function checkReliantFields($formData) {
|
||||
|
||||
if (!$formData['add_show_no_end']){
|
||||
if (!$formData['add_show_no_end']){
|
||||
$start_timestamp = $formData['add_show_start_date'];
|
||||
$end_timestamp = $formData['add_show_end_date'];
|
||||
|
||||
|
||||
$start_epoch = strtotime($start_timestamp);
|
||||
$end_epoch = strtotime($end_timestamp);
|
||||
|
||||
|
|
|
@ -18,14 +18,14 @@ class Application_Form_AddShowStyle extends Zend_Form_SubForm
|
|||
'viewScript' => 'form/add-show-style.phtml',
|
||||
'class' => 'big'
|
||||
))));
|
||||
|
||||
|
||||
$bg->setValidators(array(
|
||||
'Hex',
|
||||
array('stringLength', false, array(6, 6))
|
||||
));
|
||||
|
||||
|
||||
// Add show color input
|
||||
|
||||
// Add show color input
|
||||
$this->addElement('text', 'add_show_color', array(
|
||||
'label' => 'Text Colour:',
|
||||
'class' => 'input_text',
|
||||
|
@ -38,7 +38,7 @@ class Application_Form_AddShowStyle extends Zend_Form_SubForm
|
|||
'viewScript' => 'form/add-show-style.phtml',
|
||||
'class' => 'big'
|
||||
))));
|
||||
|
||||
|
||||
$c->setValidators(array(
|
||||
'Hex',
|
||||
array('stringLength', false, array(6, 6))
|
||||
|
|
|
@ -4,22 +4,22 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
|
|||
{
|
||||
public function init()
|
||||
{
|
||||
// retrieves the length limit for each char field
|
||||
// and store to assoc array
|
||||
$maxLens = Application_Model_Show::getMaxLengths();
|
||||
|
||||
// retrieves the length limit for each char field
|
||||
// and store to assoc array
|
||||
$maxLens = Application_Model_Show::getMaxLengths();
|
||||
|
||||
// Hidden element to indicate whether the show is new or
|
||||
// whether we are updating an existing show.
|
||||
$this->addElement('hidden', 'add_show_id', array(
|
||||
'decorators' => array('ViewHelper')
|
||||
));
|
||||
|
||||
|
||||
// Hidden element to indicate the instance id of the show
|
||||
// being edited.
|
||||
$this->addElement('hidden', 'add_show_instance_id', array(
|
||||
'decorators' => array('ViewHelper')
|
||||
));
|
||||
|
||||
|
||||
// Add name element
|
||||
$this->addElement('text', 'add_show_name', array(
|
||||
'label' => 'Name:',
|
||||
|
@ -27,8 +27,8 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
|
|||
'required' => true,
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array('NotEmpty'),
|
||||
'value' => 'Untitled Show',
|
||||
'validators' => array(array('StringLength', false, array(0, $maxLens['name'])))
|
||||
'value' => 'Untitled Show',
|
||||
'validators' => array(array('StringLength', false, array(0, $maxLens['name'])))
|
||||
));
|
||||
|
||||
// Add URL element
|
||||
|
@ -46,16 +46,16 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
|
|||
'class' => 'input_text',
|
||||
'required' => false,
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array(array('StringLength', false, array(0, $maxLens['genre'])))
|
||||
'validators' => array(array('StringLength', false, array(0, $maxLens['genre'])))
|
||||
));
|
||||
|
||||
// Add the description element
|
||||
// Add the description element
|
||||
$this->addElement('textarea', 'add_show_description', array(
|
||||
'label' => 'Description:',
|
||||
'required' => false,
|
||||
'class' => 'input_text_area',
|
||||
'validators' => array(array('StringLength', false, array(0, $maxLens['description'])))
|
||||
));
|
||||
'validators' => array(array('StringLength', false, array(0, $maxLens['description'])))
|
||||
));
|
||||
|
||||
$descText = $this->getElement('add_show_description');
|
||||
|
||||
|
@ -65,7 +65,7 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
|
|||
))));
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function disable(){
|
||||
$elements = $this->getElements();
|
||||
foreach ($elements as $element)
|
||||
|
|
|
@ -8,7 +8,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/add-show-when.phtml'))
|
||||
));
|
||||
|
||||
|
||||
// Add start date element
|
||||
$startDate = new Zend_Form_Element_Text('add_show_start_date');
|
||||
$startDate->class = 'input_text';
|
||||
|
@ -22,7 +22,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
->setDecorators(array('ViewHelper'));
|
||||
$startDate->setAttrib('alt', 'date');
|
||||
$this->addElement($startDate);
|
||||
|
||||
|
||||
// Add start time element
|
||||
$startTime = new Zend_Form_Element_Text('add_show_start_time');
|
||||
$startTime->class = 'input_text';
|
||||
|
@ -50,7 +50,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
->setDecorators(array('ViewHelper'));
|
||||
$endDate->setAttrib('alt', 'date');
|
||||
$this->addElement($endDate);
|
||||
|
||||
|
||||
// Add end time element
|
||||
$endTime = new Zend_Form_Element_Text('add_show_end_time');
|
||||
$endTime->class = 'input_text';
|
||||
|
@ -64,7 +64,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
->setDecorators(array('ViewHelper'));
|
||||
$endTime->setAttrib('alt', 'time');
|
||||
$this->addElement($endTime);
|
||||
|
||||
|
||||
// Add duration element
|
||||
$this->addElement('text', 'add_show_duration', array(
|
||||
'label' => 'Duration:',
|
||||
|
@ -85,13 +85,13 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
|
||||
public function checkReliantFields($formData, $validateStartDate, $originalStartDate=null, $update=false, $instanceId=null) {
|
||||
$valid = true;
|
||||
|
||||
|
||||
$hours;
|
||||
$minutes;
|
||||
|
||||
|
||||
$start_time = $formData['add_show_start_date']." ".$formData['add_show_start_time'];
|
||||
$end_time = $formData['add_show_end_date_no_repeat']." ".$formData['add_show_end_time'];
|
||||
|
||||
|
||||
//DateTime stores $start_time in the current timezone
|
||||
$nowDateTime = new DateTime();
|
||||
$showStartDateTime = new DateTime($start_time);
|
||||
|
@ -112,15 +112,15 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if end time is in the past, return error
|
||||
if($showEndDateTime->getTimestamp() < $nowDateTime->getTimestamp()) {
|
||||
$this->getElement('add_show_end_time')->setErrors(array('End date/time cannot be in the past'));
|
||||
$valid = false;
|
||||
}
|
||||
|
||||
|
||||
$pattern = '/([0-9][0-9])h ([0-9][0-9])m/';
|
||||
|
||||
|
||||
if (preg_match($pattern, $formData['add_show_duration'], $matches) && count($matches) == 3) {
|
||||
$hours = $matches[1];
|
||||
$minutes = $matches[2];
|
||||
|
@ -152,7 +152,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
$show_end->setTimezone(new DateTimeZone('UTC'));
|
||||
|
||||
if ($formData["add_show_repeats"]) {
|
||||
|
||||
|
||||
//get repeating show end date
|
||||
if ($formData["add_show_no_end"]) {
|
||||
$date = Application_Model_Preference::GetShowsPopulatedUntil();
|
||||
|
@ -163,12 +163,12 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
} else {
|
||||
$populateUntilDateTime = clone $date;
|
||||
}
|
||||
|
||||
|
||||
} elseif (!$formData["add_show_no_end"]) {
|
||||
$popUntil = $formData["add_show_end_date"]." ".$formData["add_show_end_time"];
|
||||
$populateUntilDateTime = new DateTime($popUntil, new DateTimeZone('UTC'));
|
||||
}
|
||||
|
||||
|
||||
//get repeat interval
|
||||
if ($formData["add_show_repeat_type"] == 0) {
|
||||
$interval = 'P7D';
|
||||
|
@ -177,12 +177,12 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
} elseif ($formData["add_show_repeat_type"] == 2) {
|
||||
$interval = 'P1M';
|
||||
}
|
||||
|
||||
|
||||
/* Check first show
|
||||
* Continue if the first show does not overlap
|
||||
*/
|
||||
$overlapping = Application_Model_Schedule::checkOverlappingShows($show_start, $show_end, $update, $instanceId);
|
||||
|
||||
|
||||
/* Check if repeats overlap with previously scheduled shows
|
||||
* Do this for each show day
|
||||
*/
|
||||
|
@ -222,7 +222,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
* Continue if the first show does not overlap
|
||||
*/
|
||||
$overlapping = Application_Model_Schedule::checkOverlappingShows($show_start, $show_end, $update, $instanceId);
|
||||
|
||||
|
||||
if (!$overlapping) {
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
$hours = ltrim($hours, '0');
|
||||
|
@ -233,7 +233,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
$minutes = "0";
|
||||
$durationToAdd = "PT".$hours."H";
|
||||
}
|
||||
|
||||
|
||||
$abs_rebroadcast_start = $formData["add_show_rebroadcast_date_absolute_".$i]." ".
|
||||
$formData["add_show_rebroadcast_time_absolute_".$i];
|
||||
$rebroadcastShowStart = new DateTime($abs_rebroadcast_start);
|
||||
|
@ -259,10 +259,10 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $valid;
|
||||
}
|
||||
|
||||
|
||||
public function disable(){
|
||||
$elements = $this->getElements();
|
||||
foreach ($elements as $element)
|
||||
|
@ -273,7 +273,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function disableRepeatCheckbox(){
|
||||
$element = $this->getElement('add_show_repeats');
|
||||
if ($element->getType() != 'Zend_Form_Element_Hidden')
|
||||
|
@ -281,7 +281,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
$element->setAttrib('disabled','disabled');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function disableStartDateAndTime(){
|
||||
$elements = array($this->getElement('add_show_start_date'), $this->getElement('add_show_start_time'));
|
||||
foreach ($elements as $element)
|
||||
|
|
|
@ -10,21 +10,21 @@ class Application_Form_AddShowWho extends Zend_Form_SubForm
|
|||
'label' => 'Search Users:',
|
||||
'class' => 'input_text ui-autocomplete-input',
|
||||
'required' => false
|
||||
));
|
||||
));
|
||||
|
||||
$options = array();
|
||||
$hosts = Application_Model_User::getHosts();
|
||||
$options = array();
|
||||
$hosts = Application_Model_User::getHosts();
|
||||
|
||||
foreach ($hosts as $host) {
|
||||
$options[$host['index']] = $host['label'];
|
||||
}
|
||||
foreach ($hosts as $host) {
|
||||
$options[$host['index']] = $host['label'];
|
||||
}
|
||||
|
||||
//Add hosts selection
|
||||
$hosts = new Zend_Form_Element_MultiCheckbox('add_show_hosts');
|
||||
$hosts->setLabel('DJs:')
|
||||
->setMultiOptions($options);
|
||||
//Add hosts selection
|
||||
$hosts = new Zend_Form_Element_MultiCheckbox('add_show_hosts');
|
||||
$hosts->setLabel('DJs:')
|
||||
->setMultiOptions($options);
|
||||
|
||||
$this->addElement($hosts);
|
||||
$this->addElement($hosts);
|
||||
}
|
||||
|
||||
public function disable(){
|
||||
|
|
|
@ -10,11 +10,11 @@ class Application_Form_AddUser extends Zend_Form
|
|||
'../application/validate',
|
||||
'validate');
|
||||
* */
|
||||
|
||||
|
||||
$hidden = new Zend_Form_Element_Hidden('user_id');
|
||||
$hidden->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($hidden);
|
||||
|
||||
|
||||
$login = new Zend_Form_Element_Text('login');
|
||||
$login->setLabel('Username:');
|
||||
$login->setAttrib('class', 'input_text');
|
||||
|
@ -22,7 +22,7 @@ class Application_Form_AddUser extends Zend_Form
|
|||
$login->addFilter('StringTrim');
|
||||
//$login->addValidator('UserNameValidate');
|
||||
$this->addElement($login);
|
||||
|
||||
|
||||
$password = new Zend_Form_Element_Password('password');
|
||||
$password->setLabel('Password:');
|
||||
$password->setAttrib('class', 'input_text');
|
||||
|
@ -30,21 +30,21 @@ class Application_Form_AddUser extends Zend_Form
|
|||
$password->addFilter('StringTrim');
|
||||
$password->addValidator('NotEmpty');
|
||||
$this->addElement($password);
|
||||
|
||||
|
||||
$firstName = new Zend_Form_Element_Text('first_name');
|
||||
$firstName->setLabel('Firstname:');
|
||||
$firstName->setAttrib('class', 'input_text');
|
||||
$firstName->addFilter('StringTrim');
|
||||
$firstName->addValidator('NotEmpty');
|
||||
$this->addElement($firstName);
|
||||
|
||||
|
||||
$lastName = new Zend_Form_Element_Text('last_name');
|
||||
$lastName->setLabel('Lastname:');
|
||||
$lastName->setAttrib('class', 'input_text');
|
||||
$lastName->addFilter('StringTrim');
|
||||
$lastName->addValidator('NotEmpty');
|
||||
$this->addElement($lastName);
|
||||
|
||||
|
||||
$email = new Zend_Form_Element_Text('email');
|
||||
$email->setLabel('Email:');
|
||||
$email->setAttrib('class', 'input_text');
|
||||
|
@ -52,7 +52,7 @@ class Application_Form_AddUser extends Zend_Form
|
|||
$email->setRequired(true);
|
||||
$email->addValidator('EmailAddress');
|
||||
$this->addElement($email);
|
||||
|
||||
|
||||
$cellPhone = new Zend_Form_Element_Text('cell_phone');
|
||||
$cellPhone->setLabel('Mobile Phone:');
|
||||
$cellPhone->setAttrib('class', 'input_text');
|
||||
|
@ -79,30 +79,30 @@ class Application_Form_AddUser extends Zend_Form
|
|||
$select->setMultiOptions(array(
|
||||
"G" => "Guest",
|
||||
"H" => "DJ",
|
||||
"P" => "Program Manager",
|
||||
"P" => "Program Manager",
|
||||
"A" => "Admin"
|
||||
));
|
||||
$select->setRequired(true);
|
||||
$this->addElement($select);
|
||||
|
||||
|
||||
$submit = new Zend_Form_Element_Submit('submit');
|
||||
$submit->setAttrib('class', 'ui-button ui-state-default right-floated');
|
||||
$submit->setIgnore(true);
|
||||
$submit->setLabel('Save');
|
||||
$this->addElement($submit);
|
||||
}
|
||||
|
||||
|
||||
public function validateLogin($data){
|
||||
|
||||
|
||||
if (strlen($data['user_id']) == 0){
|
||||
$count = CcSubjsQuery::create()->filterByDbLogin($data['login'])->count();
|
||||
|
||||
|
||||
if ($count != 0){
|
||||
$this->getElement('login')->setErrors(array("Login name is not unique."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,21 +7,21 @@ class Application_Form_EditAudioMD extends Zend_Form
|
|||
// Set the method for the display form to POST
|
||||
$this->setMethod('post');
|
||||
|
||||
// Add title field
|
||||
// Add title field
|
||||
$this->addElement('text', 'track_title', array(
|
||||
'label' => 'Title:',
|
||||
'class' => 'input_text',
|
||||
'filters' => array('StringTrim'),
|
||||
));
|
||||
|
||||
// Add artist field
|
||||
// Add artist field
|
||||
$this->addElement('text', 'artist_name', array(
|
||||
'label' => 'Creator:',
|
||||
'class' => 'input_text',
|
||||
'filters' => array('StringTrim'),
|
||||
));
|
||||
|
||||
// Add album field
|
||||
// Add album field
|
||||
$this->addElement('text', 'album_title', array(
|
||||
'label' => 'Album:',
|
||||
'class' => 'input_text',
|
||||
|
@ -37,39 +37,39 @@ class Application_Form_EditAudioMD extends Zend_Form
|
|||
'required' => true
|
||||
));
|
||||
|
||||
// Add genre field
|
||||
// Add genre field
|
||||
$this->addElement('text', 'genre', array(
|
||||
'label' => 'Genre:',
|
||||
'class' => 'input_text',
|
||||
'filters' => array('StringTrim')
|
||||
));
|
||||
|
||||
// Add year field
|
||||
// Add year field
|
||||
$this->addElement('text', 'year', array(
|
||||
'label' => 'Year:',
|
||||
'class' => 'input_text',
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array(
|
||||
array('date', false, array('YYYY-MM-DD')),
|
||||
array('date', false, array('YYYY-MM-DD')),
|
||||
array('date', false, array('YYYY-MM')),
|
||||
array('date', false, array('YYYY'))
|
||||
)
|
||||
array('date', false, array('YYYY'))
|
||||
)
|
||||
));
|
||||
|
||||
// Add label field
|
||||
// Add label field
|
||||
$this->addElement('text', 'label', array(
|
||||
'label' => 'Label:',
|
||||
'class' => 'input_text',
|
||||
'filters' => array('StringTrim')
|
||||
));
|
||||
|
||||
// Add composer field
|
||||
// Add composer field
|
||||
$this->addElement('text', 'composer', array(
|
||||
'label' => 'Composer:',
|
||||
'class' => 'input_text',
|
||||
'filters' => array('StringTrim')
|
||||
));
|
||||
|
||||
|
||||
// Add conductor field
|
||||
$this->addElement('text', 'conductor', array(
|
||||
'label' => 'Conductor:',
|
||||
|
@ -77,7 +77,7 @@ class Application_Form_EditAudioMD extends Zend_Form
|
|||
'filters' => array('StringTrim')
|
||||
));
|
||||
|
||||
// Add mood field
|
||||
// Add mood field
|
||||
$this->addElement('text', 'mood', array(
|
||||
'label' => 'Mood:',
|
||||
'class' => 'input_text',
|
||||
|
@ -122,7 +122,7 @@ class Application_Form_EditAudioMD extends Zend_Form
|
|||
'filters' => array('StringTrim')
|
||||
));
|
||||
|
||||
// Add the submit button
|
||||
// Add the submit button
|
||||
$this->addElement('submit', 'submit', array(
|
||||
'ignore' => true,
|
||||
'class' => 'ui-button ui-state-default',
|
||||
|
@ -132,7 +132,7 @@ class Application_Form_EditAudioMD extends Zend_Form
|
|||
)
|
||||
));
|
||||
|
||||
// Add the submit button
|
||||
// Add the submit button
|
||||
$this->addElement('button', 'cancel', array(
|
||||
'ignore' => true,
|
||||
'class' => 'ui-button ui-state-default ui-button-text-only md-cancel',
|
||||
|
|
|
@ -9,8 +9,8 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
|
|||
public function init()
|
||||
{
|
||||
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||
$this->isSaas = $isSaas;
|
||||
|
||||
$this->isSaas = $isSaas;
|
||||
|
||||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/preferences_email_server.phtml', "isSaas" => $isSaas))
|
||||
));
|
||||
|
@ -24,7 +24,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
|
|||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
|
||||
$this->addElement('text', 'systemEmail', array(
|
||||
'class' => 'input_text',
|
||||
'label' => 'Reset Password \'From\' Email',
|
||||
|
@ -32,7 +32,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
|
|||
'readonly' => true,
|
||||
'decorators' => array('viewHelper')
|
||||
));
|
||||
|
||||
|
||||
$this->addElement('checkbox', 'configureMailServer', array(
|
||||
'label' => 'Configure Mail Server',
|
||||
'required' => false,
|
||||
|
@ -41,7 +41,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
|
|||
'viewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
|
||||
$this->addElement('text', 'mailServer', array(
|
||||
'class' => 'input_text',
|
||||
'label' => 'Mail Server',
|
||||
|
@ -53,7 +53,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
|
|||
new ConditionalNotEmpty(array('configureMailServer'=>'1'))
|
||||
)
|
||||
));
|
||||
|
||||
|
||||
$this->addElement('text', 'email', array(
|
||||
'class' => 'input_text',
|
||||
'label' => 'Email Address',
|
||||
|
@ -65,7 +65,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
|
|||
new ConditionalNotEmpty(array('configureMailServer'=>'1'))
|
||||
)
|
||||
));
|
||||
|
||||
|
||||
$this->addElement('password', 'ms_password', array(
|
||||
'class' => 'input_text',
|
||||
'label' => 'Password',
|
||||
|
@ -78,7 +78,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
|
|||
),
|
||||
'renderPassword' => true
|
||||
));
|
||||
|
||||
|
||||
$port = new Zend_Form_Element_Text('port');
|
||||
$port->class = 'input_text';
|
||||
$port->setRequired(false)
|
||||
|
@ -86,7 +86,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
|
|||
->setLabel('Port')
|
||||
->setAttrib('readonly', true)
|
||||
->setDecorators(array('viewHelper'));
|
||||
|
||||
|
||||
$this->addElement($port);
|
||||
|
||||
}
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
||||
{
|
||||
private $isSaas;
|
||||
|
||||
private $isSaas;
|
||||
|
||||
public function init()
|
||||
{
|
||||
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||
$this->isSaas = $isSaas;
|
||||
|
||||
$this->isSaas = $isSaas;
|
||||
|
||||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/preferences_general.phtml', "isSaas" => $isSaas))
|
||||
));
|
||||
|
@ -98,16 +98,16 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
|||
|
||||
|
||||
private function getWeekStartDays() {
|
||||
$days = array(
|
||||
'Sunday',
|
||||
'Monday',
|
||||
'Tuesday',
|
||||
'Wednesday',
|
||||
'Thursday',
|
||||
'Friday',
|
||||
'Saturday'
|
||||
);
|
||||
return $days;
|
||||
$days = array(
|
||||
'Sunday',
|
||||
'Monday',
|
||||
'Tuesday',
|
||||
'Wednesday',
|
||||
'Thursday',
|
||||
'Friday',
|
||||
'Saturday'
|
||||
);
|
||||
return $days;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,33 +2,33 @@
|
|||
|
||||
class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
||||
{
|
||||
|
||||
|
||||
public function init()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$isDemo = isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1;
|
||||
$isStreamConfigable = Application_Model_Preference::GetEnableStreamConf() == "true";
|
||||
|
||||
|
||||
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||
$defaultFade = Application_Model_Preference::GetDefaultTransitionFade();
|
||||
if($defaultFade == ""){
|
||||
$defaultFade = '00.000000';
|
||||
}
|
||||
|
||||
|
||||
// automatic trasition on source disconnection
|
||||
$auto_transition = new Zend_Form_Element_Checkbox("auto_transition");
|
||||
$auto_transition->setLabel("Auto Switch Off")
|
||||
->setValue(Application_Model_Preference::GetAutoTransition())
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($auto_transition);
|
||||
|
||||
|
||||
// automatic switch on upon source connection
|
||||
$auto_switch = new Zend_Form_Element_Checkbox("auto_switch");
|
||||
$auto_switch->setLabel("Auto Switch On")
|
||||
->setValue(Application_Model_Preference::GetAutoSwitch())
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($auto_switch);
|
||||
|
||||
|
||||
// Default transition fade
|
||||
$transition_fade = new Zend_Form_Element_Text("transition_fade");
|
||||
$transition_fade->setLabel("Switch Transition Fade (s)")
|
||||
|
@ -38,7 +38,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
|||
->setValue($defaultFade)
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($transition_fade);
|
||||
|
||||
|
||||
//Master username
|
||||
$master_username = new Zend_Form_Element_Text('master_username');
|
||||
$master_username->setAttrib('autocomplete', 'off')
|
||||
|
@ -48,7 +48,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
|||
->setValue(Application_Model_Preference::GetLiveSteamMasterUsername())
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($master_username);
|
||||
|
||||
|
||||
//Master password
|
||||
if($isDemo){
|
||||
$master_password = new Zend_Form_Element_Text('master_password');
|
||||
|
@ -64,7 +64,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
|||
->setFilters(array('StringTrim'))
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($master_password);
|
||||
|
||||
|
||||
//Master source connection url
|
||||
$master_dj_connection_url = new Zend_Form_Element_Text('master_dj_connection_url');
|
||||
$master_dj_connection_url->setAttrib('readonly', true)
|
||||
|
@ -72,7 +72,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
|||
->setValue(Application_Model_Preference::GetMasterDJSourceConnectionURL())
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($master_dj_connection_url);
|
||||
|
||||
|
||||
//Show source connection url
|
||||
$live_dj_connection_url = new Zend_Form_Element_Text('live_dj_connection_url');
|
||||
$live_dj_connection_url->setAttrib('readonly', true)
|
||||
|
@ -80,7 +80,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
|||
->setValue(Application_Model_Preference::GetLiveDJSourceConnectionURL())
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($live_dj_connection_url);
|
||||
|
||||
|
||||
//liquidsoap harbor.input port
|
||||
if (!$isSaas) {
|
||||
$m_port = Application_Model_StreamSetting::getMasterLiveStreamPort();
|
||||
|
@ -91,7 +91,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
|||
->addValidator('regex', false, array('pattern'=>'/^[0-9]+$/', 'messages'=>array('regexNotMatch'=>'Only numbers are allowed.')))
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($master_dj_port);
|
||||
|
||||
|
||||
$m_mount = Application_Model_StreamSetting::getMasterLiveStreamMountPoint();
|
||||
$master_dj_mount = new Zend_Form_Element_Text('master_harbor_input_mount_point');
|
||||
$master_dj_mount->setLabel("Master Source Mount Point")
|
||||
|
@ -100,7 +100,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
|||
array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered'))))
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($master_dj_mount);
|
||||
|
||||
|
||||
//liquidsoap harbor.input port
|
||||
$l_port = Application_Model_StreamSetting::getDjLiveStreamPort();
|
||||
$live_dj_port = new Zend_Form_Element_Text('dj_harbor_input_port');
|
||||
|
@ -110,7 +110,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
|||
->addValidator('regex', false, array('pattern'=>'/^[0-9]+$/', 'messages'=>array('regexNotMatch'=>'Only numbers are allowed.')))
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($live_dj_port);
|
||||
|
||||
|
||||
$l_mount = Application_Model_StreamSetting::getDjLiveStreamMountPoint();
|
||||
$live_dj_mount = new Zend_Form_Element_Text('dj_harbor_input_mount_point');
|
||||
$live_dj_mount->setLabel("Show Source Mount Point")
|
||||
|
@ -132,27 +132,27 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function updateVariables(){
|
||||
global $CC_CONFIG;
|
||||
|
||||
|
||||
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||
$isDemo = isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1;
|
||||
$master_dj_connection_url = Application_Model_Preference::GetMasterDJSourceConnectionURL();
|
||||
$live_dj_connection_url = Application_Model_Preference::GetLiveDJSourceConnectionURL();
|
||||
|
||||
|
||||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/preferences_livestream.phtml', 'master_dj_connection_url'=>$master_dj_connection_url, 'live_dj_connection_url'=>$live_dj_connection_url, 'isSaas' => $isSaas, 'isDemo' => $isDemo))
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
public function isValid($data){
|
||||
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||
$isValid = parent::isValid($data);
|
||||
if (!$isSaas) {
|
||||
$master_harbor_input_port = $data['master_harbor_input_port'];
|
||||
$dj_harbor_input_port = $data['dj_harbor_input_port'];
|
||||
|
||||
|
||||
if($master_harbor_input_port == $dj_harbor_input_port && $master_harbor_input_port != ""){
|
||||
$element = $this->getElement("dj_harbor_input_port");
|
||||
$element->addError("You cannot use same port as Master DJ port.");
|
||||
|
@ -192,5 +192,5 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
|||
}
|
||||
return $isValid;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -4,17 +4,17 @@ class Application_Form_Login extends Zend_Form
|
|||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
// Set the method for the display form to POST
|
||||
|
||||
// Set the method for the display form to POST
|
||||
$this->setMethod('post');
|
||||
|
||||
|
||||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/login.phtml'))
|
||||
));
|
||||
|
||||
// Add username element
|
||||
// Add username element
|
||||
$this->addElement('text', 'username', array(
|
||||
'label' => 'Username:',
|
||||
'class' => 'input_text',
|
||||
|
@ -28,8 +28,8 @@ class Application_Form_Login extends Zend_Form
|
|||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
// Add password element
|
||||
|
||||
// Add password element
|
||||
$this->addElement('password', 'password', array(
|
||||
'label' => 'Password:',
|
||||
'class' => 'input_text',
|
||||
|
@ -43,7 +43,7 @@ class Application_Form_Login extends Zend_Form
|
|||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
|
||||
$recaptchaNeeded = false;
|
||||
if(Application_Model_LoginAttempts::getAttempts($_SERVER['REMOTE_ADDR']) >= 3){
|
||||
$recaptchaNeeded = true;
|
||||
|
@ -52,8 +52,8 @@ class Application_Form_Login extends Zend_Form
|
|||
// recaptcha
|
||||
$this->addRecaptcha();
|
||||
}
|
||||
|
||||
// Add the submit button
|
||||
|
||||
// Add the submit button
|
||||
$this->addElement('submit', 'submit', array(
|
||||
'ignore' => true,
|
||||
'label' => 'Login',
|
||||
|
@ -64,13 +64,13 @@ class Application_Form_Login extends Zend_Form
|
|||
));
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function addRecaptcha(){
|
||||
$pubKey = '6Ld4JsISAAAAAIxUKT4IjjOGi3DHqdoH2zk6WkYG';
|
||||
$privKey = '6Ld4JsISAAAAAJynYlXdrE4hfTReTSxYFe5szdyv';
|
||||
|
||||
|
||||
$recaptcha = new Zend_Service_ReCaptcha($pubKey, $privKey);
|
||||
|
||||
|
||||
$captcha = new Zend_Form_Element_Captcha('captcha',
|
||||
array(
|
||||
'label' => 'Type the characters you see in the picture below.',
|
||||
|
|
|
@ -9,7 +9,7 @@ class Application_Form_PasswordChange extends Zend_Form
|
|||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/password-change.phtml'))
|
||||
));
|
||||
|
||||
|
||||
$this->addElement('password', 'password', array(
|
||||
'label' => 'Password',
|
||||
'required' => true,
|
||||
|
|
|
@ -9,7 +9,7 @@ class Application_Form_PasswordRestore extends Zend_Form
|
|||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/password-restore.phtml'))
|
||||
));
|
||||
|
||||
|
||||
$this->addElement('text', 'email', array(
|
||||
'label' => 'E-mail',
|
||||
'required' => true,
|
||||
|
@ -29,7 +29,7 @@ class Application_Form_PasswordRestore extends Zend_Form
|
|||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
|
||||
$cancel = new Zend_Form_Element_Button("cancel");
|
||||
$cancel->class = 'ui-button ui-widget ui-state-default ui-button-text-only center';
|
||||
$cancel->setLabel("Cancel")
|
||||
|
|
|
@ -8,22 +8,22 @@ class Application_Form_Preferences extends Zend_Form
|
|||
{
|
||||
$this->setAction('/Preference');
|
||||
$this->setMethod('post');
|
||||
|
||||
|
||||
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||
$this->isSaas = $isSaas;
|
||||
|
||||
$this->isSaas = $isSaas;
|
||||
|
||||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/preferences.phtml', "isSaas" => $this->isSaas))
|
||||
));
|
||||
|
||||
|
||||
$general_pref = new Application_Form_GeneralPreferences();
|
||||
$this->addSubForm($general_pref, 'preferences_general');
|
||||
|
||||
|
||||
if (!$isSaas) {
|
||||
$email_pref = new Application_Form_EmailServerPreferences();
|
||||
$this->addSubForm($email_pref, 'preferences_email_server');
|
||||
}
|
||||
|
||||
|
||||
$soundcloud_pref = new Application_Form_SoundcloudPreferences();
|
||||
$this->addSubForm($soundcloud_pref, 'preferences_soundcloud');
|
||||
|
||||
|
|
|
@ -9,19 +9,19 @@ class Application_Form_RegisterAirtime extends Zend_Form
|
|||
{
|
||||
$this->setAction('/Showbuilder');
|
||||
$this->setMethod('post');
|
||||
|
||||
|
||||
$country_list = Application_Model_Preference::GetCountryList();
|
||||
|
||||
|
||||
$privacyChecked = false;
|
||||
if(Application_Model_Preference::GetPrivacyPolicyCheck() == 1){
|
||||
$privacyChecked = true;
|
||||
}
|
||||
|
||||
|
||||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/register-dialog.phtml', 'privacyChecked'=>$privacyChecked)),
|
||||
array('File', array('viewScript' => 'form/register-dialog.phtml', 'placement' => false)))
|
||||
);
|
||||
|
||||
|
||||
// Station Name
|
||||
$stnName = new Zend_Form_Element_Text("stnName");
|
||||
$stnName->setLabel("Station Name")
|
||||
|
@ -29,7 +29,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
|
|||
->setValue(Application_Model_Preference::GetStationName())
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($stnName);
|
||||
|
||||
|
||||
// Phone number
|
||||
$this->addElement('text', 'Phone', array(
|
||||
'class' => 'input_text',
|
||||
|
@ -63,20 +63,20 @@ class Application_Form_RegisterAirtime extends Zend_Form
|
|||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
));
|
||||
|
||||
// county list dropdown
|
||||
$this->addElement('select', 'Country', array(
|
||||
'label' => 'Country:',
|
||||
'required' => false,
|
||||
'value' => Application_Model_Preference::GetStationCountry(),
|
||||
'multiOptions' => $country_list,
|
||||
'decorators' => array(
|
||||
// county list dropdown
|
||||
$this->addElement('select', 'Country', array(
|
||||
'label' => 'Country:',
|
||||
'required' => false,
|
||||
'value' => Application_Model_Preference::GetStationCountry(),
|
||||
'multiOptions' => $country_list,
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
// Station city
|
||||
));
|
||||
|
||||
// Station city
|
||||
$this->addElement('text', 'City', array(
|
||||
'label' => 'City:',
|
||||
'required' => false,
|
||||
|
@ -85,29 +85,29 @@ class Application_Form_RegisterAirtime extends Zend_Form
|
|||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
// Station Description
|
||||
$description = new Zend_Form_Element_Textarea('Description');
|
||||
$description->class = 'input_text_area';
|
||||
$description->setLabel('Station Description:')
|
||||
->setRequired(false)
|
||||
->setValue(Application_Model_Preference::GetStationDescription())
|
||||
->setDecorators(array('ViewHelper'))
|
||||
->setAttrib('ROWS','2')
|
||||
->setAttrib('COLS','58');
|
||||
$this->addElement($description);
|
||||
|
||||
// Station Logo
|
||||
$upload = new Zend_Form_Element_File('Logo');
|
||||
$upload->setLabel('Station Logo:')
|
||||
->setRequired(false)
|
||||
->setDecorators(array('File'))
|
||||
->addValidator('Count', false, 1)
|
||||
->addValidator('Extension', false, 'jpg,jpeg,png,gif')
|
||||
->addFilter('ImageSize');
|
||||
$this->addElement($upload);
|
||||
|
||||
));
|
||||
|
||||
// Station Description
|
||||
$description = new Zend_Form_Element_Textarea('Description');
|
||||
$description->class = 'input_text_area';
|
||||
$description->setLabel('Station Description:')
|
||||
->setRequired(false)
|
||||
->setValue(Application_Model_Preference::GetStationDescription())
|
||||
->setDecorators(array('ViewHelper'))
|
||||
->setAttrib('ROWS','2')
|
||||
->setAttrib('COLS','58');
|
||||
$this->addElement($description);
|
||||
|
||||
// Station Logo
|
||||
$upload = new Zend_Form_Element_File('Logo');
|
||||
$upload->setLabel('Station Logo:')
|
||||
->setRequired(false)
|
||||
->setDecorators(array('File'))
|
||||
->addValidator('Count', false, 1)
|
||||
->addValidator('Extension', false, 'jpg,jpeg,png,gif')
|
||||
->addFilter('ImageSize');
|
||||
$this->addElement($upload);
|
||||
|
||||
//enable support feedback
|
||||
$this->addElement('checkbox', 'SupportFeedback', array(
|
||||
'label' => 'Send support feedback',
|
||||
|
@ -116,37 +116,37 @@ class Application_Form_RegisterAirtime extends Zend_Form
|
|||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
));
|
||||
|
||||
// checkbox for publicise
|
||||
$checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise");
|
||||
// checkbox for publicise
|
||||
$checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise");
|
||||
$checkboxPublicise->setLabel('Promote my station on Sourcefabric.org')
|
||||
->setRequired(false)
|
||||
->setDecorators(array('ViewHelper'))
|
||||
->setValue(Application_Model_Preference::GetPublicise());
|
||||
$this->addElement($checkboxPublicise);
|
||||
|
||||
// text area for sending detail
|
||||
|
||||
// text area for sending detail
|
||||
$this->addElement('textarea', 'SendInfo', array(
|
||||
'class' => 'sending_textarea',
|
||||
'required' => false,
|
||||
'class' => 'sending_textarea',
|
||||
'required' => false,
|
||||
'filters' => array('StringTrim'),
|
||||
'readonly' => true,
|
||||
'rows' => 5,
|
||||
'readonly' => true,
|
||||
'rows' => 5,
|
||||
'cols' => 61,
|
||||
'value' => Application_Model_Preference::GetSystemInfo(false, true),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
|
||||
// checkbox for privacy policy
|
||||
$checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy");
|
||||
$checkboxPrivacy->setLabel("By checking this box, I agree to Sourcefabric's <a id=\"link_to_privacy\" href=\"http://www.sourcefabric.org/en/about/policy/\" onclick=\"window.open(this.href); return false;\">privacy policy</a>.")
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($checkboxPrivacy);
|
||||
}
|
||||
|
||||
|
||||
// overriding isValid function
|
||||
public function isValid ($data)
|
||||
{
|
||||
|
|
|
@ -30,7 +30,7 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
|
|||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
|
||||
//enable downloadable for soundcloud
|
||||
$this->addElement('checkbox', 'SoundCloudDownloadbleOption', array(
|
||||
'label' => 'Automatically Mark Files "Downloadable" on SoundCloud',
|
||||
|
@ -51,7 +51,7 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
|
|||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
),
|
||||
|
||||
|
||||
// By default, 'allowEmpty' is true. This means that our custom
|
||||
// validators are going to be skipped if this field is empty,
|
||||
// which is something we don't want
|
||||
|
@ -71,7 +71,7 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
|
|||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
),
|
||||
|
||||
|
||||
// By default, 'allowEmpty' is true. This means that our custom
|
||||
// validators are going to be skipped if this field is empty,
|
||||
// which is something we don't want
|
||||
|
@ -79,7 +79,7 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
|
|||
'validators' => array(
|
||||
new ConditionalNotEmpty(array('UploadToSoundcloudOption'=>'1'))
|
||||
),
|
||||
'renderPassword' => true
|
||||
'renderPassword' => true
|
||||
));
|
||||
|
||||
// Add the description element
|
||||
|
@ -91,7 +91,7 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
|
|||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
));
|
||||
|
||||
//SoundCloud default genre
|
||||
$this->addElement('text', 'SoundCloudGenre', array(
|
||||
|
|
|
@ -37,7 +37,7 @@ class Application_Form_StreamSetting extends Zend_Form
|
|||
}
|
||||
$this->addElement($output_type);
|
||||
}
|
||||
|
||||
|
||||
$icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata');
|
||||
$icecast_vorbis_metadata->setLabel('Icecast Vorbis Metadata')
|
||||
->setRequired(false)
|
||||
|
|
|
@ -177,9 +177,9 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
|||
}
|
||||
$user->setAttrib('alt', 'regular_text');
|
||||
$this->addElement($user);
|
||||
|
||||
|
||||
$liquidsopa_error_msg = '<div class="stream-status status-info"><h3>Getting information from the server...</h3></div>';
|
||||
|
||||
|
||||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/stream-setting-form.phtml', "stream_number"=>$stream_number, "enabled"=>$enable->getValue(), "liquidsoap_error_msg"=>$liquidsopa_error_msg))
|
||||
));
|
||||
|
|
|
@ -5,18 +5,18 @@ require_once 'customfilters/ImageSize.php';
|
|||
class Application_Form_SupportSettings extends Zend_Form
|
||||
{
|
||||
private $isSass;
|
||||
|
||||
|
||||
public function init()
|
||||
{
|
||||
$country_list = Application_Model_Preference::GetCountryList();
|
||||
$isSass = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||
$this->isSass = $isSass;
|
||||
|
||||
|
||||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/support-setting.phtml', "isSaas" => $isSass)),
|
||||
array('File', array('viewScript' => 'form/support-setting.phtml', 'placement' => false)))
|
||||
);
|
||||
|
||||
|
||||
//Station name
|
||||
$this->addElement('text', 'stationName', array(
|
||||
'class' => 'input_text',
|
||||
|
@ -63,20 +63,20 @@ class Application_Form_SupportSettings extends Zend_Form
|
|||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
));
|
||||
|
||||
// county list dropdown
|
||||
$this->addElement('select', 'Country', array(
|
||||
'label' => 'Country:',
|
||||
'required' => false,
|
||||
'value' => Application_Model_Preference::GetStationCountry(),
|
||||
'multiOptions' => $country_list,
|
||||
'decorators' => array(
|
||||
// county list dropdown
|
||||
$this->addElement('select', 'Country', array(
|
||||
'label' => 'Country:',
|
||||
'required' => false,
|
||||
'value' => Application_Model_Preference::GetStationCountry(),
|
||||
'multiOptions' => $country_list,
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
// Station city
|
||||
));
|
||||
|
||||
// Station city
|
||||
$this->addElement('text', 'City', array(
|
||||
'label' => 'City:',
|
||||
'required' => false,
|
||||
|
@ -85,31 +85,31 @@ class Application_Form_SupportSettings extends Zend_Form
|
|||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
// Station Description
|
||||
$description = new Zend_Form_Element_Textarea('Description');
|
||||
$description->class = 'input_text_area';
|
||||
$description->setLabel('Station Description:')
|
||||
->setRequired(false)
|
||||
->setValue(Application_Model_Preference::GetStationDescription())
|
||||
->setDecorators(array('ViewHelper'))
|
||||
->setAttrib('ROWS','2')
|
||||
->setAttrib('COLS','58');
|
||||
$this->addElement($description);
|
||||
|
||||
// Station Logo
|
||||
$upload = new Zend_Form_Element_File('Logo');
|
||||
$upload->setLabel('Station Logo:')
|
||||
->setRequired(false)
|
||||
->setDecorators(array('File'))
|
||||
->addValidator('Count', false, 1)
|
||||
->addValidator('Extension', false, 'jpg,jpeg,png,gif')
|
||||
->addFilter('ImageSize');
|
||||
$upload->setAttrib('accept', 'image/*');
|
||||
$this->addElement($upload);
|
||||
|
||||
if(!$isSass){
|
||||
));
|
||||
|
||||
// Station Description
|
||||
$description = new Zend_Form_Element_Textarea('Description');
|
||||
$description->class = 'input_text_area';
|
||||
$description->setLabel('Station Description:')
|
||||
->setRequired(false)
|
||||
->setValue(Application_Model_Preference::GetStationDescription())
|
||||
->setDecorators(array('ViewHelper'))
|
||||
->setAttrib('ROWS','2')
|
||||
->setAttrib('COLS','58');
|
||||
$this->addElement($description);
|
||||
|
||||
// Station Logo
|
||||
$upload = new Zend_Form_Element_File('Logo');
|
||||
$upload->setLabel('Station Logo:')
|
||||
->setRequired(false)
|
||||
->setDecorators(array('File'))
|
||||
->addValidator('Count', false, 1)
|
||||
->addValidator('Extension', false, 'jpg,jpeg,png,gif')
|
||||
->addFilter('ImageSize');
|
||||
$upload->setAttrib('accept', 'image/*');
|
||||
$this->addElement($upload);
|
||||
|
||||
if(!$isSass){
|
||||
//enable support feedback
|
||||
$this->addElement('checkbox', 'SupportFeedback', array(
|
||||
'label' => 'Send support feedback',
|
||||
|
@ -118,9 +118,9 @@ class Application_Form_SupportSettings extends Zend_Form
|
|||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
// checkbox for publicise
|
||||
));
|
||||
|
||||
// checkbox for publicise
|
||||
$checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise");
|
||||
$checkboxPublicise->setLabel('Promote my station on Sourcefabric.org')
|
||||
->setRequired(false)
|
||||
|
@ -130,28 +130,28 @@ class Application_Form_SupportSettings extends Zend_Form
|
|||
$checkboxPublicise->setAttrib("disabled", "disabled");
|
||||
}
|
||||
$this->addElement($checkboxPublicise);
|
||||
|
||||
// text area for sending detail
|
||||
|
||||
// text area for sending detail
|
||||
$this->addElement('textarea', 'SendInfo', array(
|
||||
'class' => 'sending_textarea',
|
||||
'required' => false,
|
||||
'class' => 'sending_textarea',
|
||||
'required' => false,
|
||||
'filters' => array('StringTrim'),
|
||||
'readonly' => true,
|
||||
'cols' => 61,
|
||||
'rows' => 5,
|
||||
'readonly' => true,
|
||||
'cols' => 61,
|
||||
'rows' => 5,
|
||||
'value' => Application_Model_Preference::GetSystemInfo(false, true),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
|
||||
// checkbox for privacy policy
|
||||
$checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy");
|
||||
$checkboxPrivacy->setLabel("By checking this box, I agree to Sourcefabric's <a id=\"link_to_privacy\" href=\"http://www.sourcefabric.org/en/about/policy/\" onclick=\"window.open(this.href); return false;\">privacy policy</a>.")
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($checkboxPrivacy);
|
||||
}
|
||||
|
||||
|
||||
// submit button
|
||||
$submit = new Zend_Form_Element_Submit("submit");
|
||||
$submit->class = 'ui-button ui-state-default right-floated';
|
||||
|
@ -160,7 +160,7 @@ class Application_Form_SupportSettings extends Zend_Form
|
|||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($submit);
|
||||
}
|
||||
|
||||
|
||||
// overriding isValid function
|
||||
public function isValid ($data)
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@ class Zend_Filter_ImageSize implements Zend_Filter_Interface {
|
|||
$origWidth = imagesx($image);
|
||||
$origHeight = imagesy($image);
|
||||
$ratio = max($origWidth, $origHeight) / 600;
|
||||
|
||||
|
||||
if ($ratio > 1) {
|
||||
// img too big! create a scaled down image
|
||||
$newWidth = round($origWidth / $ratio);
|
||||
|
@ -34,7 +34,7 @@ class Zend_Filter_ImageSize implements Zend_Filter_Interface {
|
|||
$writeFunc($resized, $value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,34 +4,34 @@
|
|||
* Check if a field is empty but only when specific fields have specific values
|
||||
*/
|
||||
class ConditionalNotEmpty extends Zend_Validate_Abstract {
|
||||
|
||||
|
||||
const KEY_IS_EMPTY = 'keyIsEmpty';
|
||||
|
||||
|
||||
protected $_messageTemplates = array(
|
||||
self::KEY_IS_EMPTY => 'Value is required and can\'t be empty'
|
||||
);
|
||||
|
||||
|
||||
protected $_fieldValues;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new ConditionalNotEmpty validator.
|
||||
*
|
||||
*
|
||||
* @param array $fieldValues - the names and expected values of the fields we're depending on;
|
||||
* E.g., if we have a field that should only be validated when two other
|
||||
* fields PARENT_1 and PARENT_2 have values of '1' and '0' respectively, then
|
||||
* fields PARENT_1 and PARENT_2 have values of '1' and '0' respectively, then
|
||||
* $fieldValues should contain ('PARENT_1'=>'1', 'PARENT_2'=>'0')
|
||||
*/
|
||||
public function __construct($fieldValues)
|
||||
{
|
||||
$this->_fieldValues = $fieldValues;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implements Zend_Validate_Abstract.
|
||||
* Given names and expected values of the fields we're depending on ($_fieldValues),
|
||||
* this function returns true if the expected values doesn't match the actual user input,
|
||||
* or if $value is not empty. Returns false otherwise.
|
||||
*
|
||||
*
|
||||
* @param String $value - this field's value
|
||||
* @param array $context - names and values of the rest of the fields in this form
|
||||
* @return boolean - true if valid; false otherwise
|
||||
|
@ -41,7 +41,7 @@ class ConditionalNotEmpty extends Zend_Validate_Abstract {
|
|||
if ($value != "") {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (is_array($context)) {
|
||||
foreach($this->_fieldValues as $fieldName=>$fieldValue) {
|
||||
if (!isset($context[$fieldName]) || $context[$fieldName] != $fieldValue) {
|
||||
|
@ -53,7 +53,7 @@ class ConditionalNotEmpty extends Zend_Validate_Abstract {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->_error(self::KEY_IS_EMPTY);
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue