CC-4090: Make code style PSR compliant - part 4
-forms directory
This commit is contained in:
parent
481616a0d6
commit
b2327472e8
29 changed files with 505 additions and 519 deletions
|
@ -9,7 +9,7 @@ class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm
|
||||||
array('ViewScript', array('viewScript' => 'form/add-show-rebroadcast-absolute.phtml'))
|
array('ViewScript', array('viewScript' => 'form/add-show-rebroadcast-absolute.phtml'))
|
||||||
));
|
));
|
||||||
|
|
||||||
for($i=1; $i<=10; $i++) {
|
for ($i=1; $i<=10; $i++) {
|
||||||
|
|
||||||
$text = new Zend_Form_Element_Text("add_show_rebroadcast_date_absolute_$i");
|
$text = new Zend_Form_Element_Text("add_show_rebroadcast_date_absolute_$i");
|
||||||
$text->setAttrib('class', 'input_text');
|
$text->setAttrib('class', 'input_text');
|
||||||
|
@ -30,43 +30,41 @@ class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function disable(){
|
public function disable()
|
||||||
|
{
|
||||||
$elements = $this->getElements();
|
$elements = $this->getElements();
|
||||||
foreach ($elements as $element)
|
foreach ($elements as $element) {
|
||||||
{
|
if ($element->getType() != 'Zend_Form_Element_Hidden') {
|
||||||
if ($element->getType() != 'Zend_Form_Element_Hidden')
|
|
||||||
{
|
|
||||||
$element->setAttrib('disabled','disabled');
|
$element->setAttrib('disabled','disabled');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkReliantFields($formData) {
|
public function checkReliantFields($formData)
|
||||||
|
{
|
||||||
$noError = true;
|
$noError = true;
|
||||||
|
|
||||||
for($i=1; $i<=10; $i++) {
|
for ($i=1; $i<=10; $i++) {
|
||||||
|
|
||||||
$valid = true;
|
$valid = true;
|
||||||
$day = $formData['add_show_rebroadcast_date_absolute_'.$i];
|
$day = $formData['add_show_rebroadcast_date_absolute_'.$i];
|
||||||
$time = $formData['add_show_rebroadcast_time_absolute_'.$i];
|
$time = $formData['add_show_rebroadcast_time_absolute_'.$i];
|
||||||
|
|
||||||
if(trim($day) == "" && trim($time) == "") {
|
if (trim($day) == "" && trim($time) == "") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trim($day) == ""){
|
if (trim($day) == "") {
|
||||||
$this->getElement('add_show_rebroadcast_date_absolute_'.$i)->setErrors(array("Day must be specified"));
|
$this->getElement('add_show_rebroadcast_date_absolute_'.$i)->setErrors(array("Day must be specified"));
|
||||||
$valid = false;
|
$valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (trim($time) == "") {
|
||||||
if (trim($time) == ""){
|
|
||||||
$this->getElement('add_show_rebroadcast_time_absolute_'.$i)->setErrors(array("Time must be specified"));
|
$this->getElement('add_show_rebroadcast_time_absolute_'.$i)->setErrors(array("Time must be specified"));
|
||||||
$valid = false;
|
$valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($valid === false) {
|
if ($valid === false) {
|
||||||
$noError = false;
|
$noError = false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -84,7 +82,7 @@ class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm
|
||||||
$rebroad_start = $day." ".$formData['add_show_rebroadcast_time_absolute_'.$i];
|
$rebroad_start = $day." ".$formData['add_show_rebroadcast_time_absolute_'.$i];
|
||||||
$rebroad_start = new DateTime($rebroad_start);
|
$rebroad_start = new DateTime($rebroad_start);
|
||||||
|
|
||||||
if($rebroad_start < $show_end) {
|
if ($rebroad_start < $show_end) {
|
||||||
$this->getElement('add_show_rebroadcast_time_absolute_'.$i)->setErrors(array("Must wait at least 1 hour to rebroadcast"));
|
$this->getElement('add_show_rebroadcast_time_absolute_'.$i)->setErrors(array("Must wait at least 1 hour to rebroadcast"));
|
||||||
$valid = false;
|
$valid = false;
|
||||||
$noError = false;
|
$noError = false;
|
||||||
|
@ -94,4 +92,3 @@ class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm
|
||||||
return $noError;
|
return $noError;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
|
||||||
$this->addElement($custom_password);
|
$this->addElement($custom_password);
|
||||||
|
|
||||||
$connection_url = Application_Model_Preference::GetLiveDJSourceConnectionURL();
|
$connection_url = Application_Model_Preference::GetLiveDJSourceConnectionURL();
|
||||||
if(trim($connection_url) == ""){
|
if (trim($connection_url) == "") {
|
||||||
$connection_url = "N/A";
|
$connection_url = "N/A";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,21 +53,23 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isValid($data){
|
public function isValid($data)
|
||||||
|
{
|
||||||
$isValid = parent::isValid($data);
|
$isValid = parent::isValid($data);
|
||||||
|
|
||||||
if($data['cb_custom_auth'] == 1){
|
if ($data['cb_custom_auth'] == 1) {
|
||||||
if(trim($data['custom_username']) == ''){
|
if (trim($data['custom_username']) == '') {
|
||||||
$element = $this->getElement("custom_username");
|
$element = $this->getElement("custom_username");
|
||||||
$element->addError("Username field cannot be empty.");
|
$element->addError("Username field cannot be empty.");
|
||||||
$isValid = false;
|
$isValid = false;
|
||||||
}
|
}
|
||||||
if(trim($data['custom_password']) == ''){
|
if (trim($data['custom_password']) == '') {
|
||||||
$element = $this->getElement("custom_password");
|
$element = $this->getElement("custom_password");
|
||||||
$element->addError("Password field cannot be empty.");
|
$element->addError("Password field cannot be empty.");
|
||||||
$isValid = false;
|
$isValid = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $isValid;
|
return $isValid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,16 +18,14 @@ class Application_Form_AddShowRR extends Zend_Form_SubForm
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function disable(){
|
public function disable()
|
||||||
|
{
|
||||||
$elements = $this->getElements();
|
$elements = $this->getElements();
|
||||||
foreach ($elements as $element)
|
foreach ($elements as $element) {
|
||||||
{
|
if ($element->getType() != 'Zend_Form_Element_Hidden') {
|
||||||
if ($element->getType() != 'Zend_Form_Element_Hidden')
|
|
||||||
{
|
|
||||||
$element->setAttrib('disabled','disabled');
|
$element->setAttrib('disabled','disabled');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,11 +11,11 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm
|
||||||
|
|
||||||
$relativeDates = array();
|
$relativeDates = array();
|
||||||
$relativeDates[""] = "";
|
$relativeDates[""] = "";
|
||||||
for($i=0; $i<=30; $i++) {
|
for ($i=0; $i<=30; $i++) {
|
||||||
$relativeDates["$i days"] = "+$i days";
|
$relativeDates["$i days"] = "+$i days";
|
||||||
}
|
}
|
||||||
|
|
||||||
for($i=1; $i<=10; $i++) {
|
for ($i=1; $i<=10; $i++) {
|
||||||
|
|
||||||
$select = new Zend_Form_Element_Select("add_show_rebroadcast_date_$i");
|
$select = new Zend_Form_Element_Select("add_show_rebroadcast_date_$i");
|
||||||
$select->setAttrib('class', 'input_select');
|
$select->setAttrib('class', 'input_select');
|
||||||
|
@ -35,43 +35,41 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function disable(){
|
public function disable()
|
||||||
|
{
|
||||||
$elements = $this->getElements();
|
$elements = $this->getElements();
|
||||||
foreach ($elements as $element)
|
foreach ($elements as $element) {
|
||||||
{
|
if ($element->getType() != 'Zend_Form_Element_Hidden') {
|
||||||
if ($element->getType() != 'Zend_Form_Element_Hidden')
|
|
||||||
{
|
|
||||||
$element->setAttrib('disabled','disabled');
|
$element->setAttrib('disabled','disabled');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkReliantFields($formData) {
|
public function checkReliantFields($formData)
|
||||||
|
{
|
||||||
$noError = true;
|
$noError = true;
|
||||||
|
|
||||||
for($i=1; $i<=10; $i++) {
|
for ($i=1; $i<=10; $i++) {
|
||||||
|
|
||||||
$valid = true;
|
$valid = true;
|
||||||
$days = $formData['add_show_rebroadcast_date_'.$i];
|
$days = $formData['add_show_rebroadcast_date_'.$i];
|
||||||
$time = $formData['add_show_rebroadcast_time_'.$i];
|
$time = $formData['add_show_rebroadcast_time_'.$i];
|
||||||
|
|
||||||
if(trim($days) == "" && trim($time) == "") {
|
if (trim($days) == "" && trim($time) == "") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trim($days) == ""){
|
if (trim($days) == "") {
|
||||||
$this->getElement('add_show_rebroadcast_date_'.$i)->setErrors(array("Day must be specified"));
|
$this->getElement('add_show_rebroadcast_date_'.$i)->setErrors(array("Day must be specified"));
|
||||||
$valid = false;
|
$valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (trim($time) == "") {
|
||||||
if (trim($time) == ""){
|
|
||||||
$this->getElement('add_show_rebroadcast_time_'.$i)->setErrors(array("Time must be specified"));
|
$this->getElement('add_show_rebroadcast_time_'.$i)->setErrors(array("Time must be specified"));
|
||||||
$valid = false;
|
$valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($valid === false) {
|
if ($valid === false) {
|
||||||
$noError = false;
|
$noError = false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +91,7 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm
|
||||||
$rebroad_start = new DateTime($rebroad_start);
|
$rebroad_start = new DateTime($rebroad_start);
|
||||||
$rebroad_start->add(new DateInterval("P".$day."D"));
|
$rebroad_start->add(new DateInterval("P".$day."D"));
|
||||||
|
|
||||||
if($rebroad_start < $show_end) {
|
if ($rebroad_start < $show_end) {
|
||||||
$this->getElement('add_show_rebroadcast_time_'.$i)->setErrors(array("Must wait at least 1 hour to rebroadcast"));
|
$this->getElement('add_show_rebroadcast_time_'.$i)->setErrors(array("Must wait at least 1 hour to rebroadcast"));
|
||||||
$valid = false;
|
$valid = false;
|
||||||
$noError = false;
|
$noError = false;
|
||||||
|
@ -103,4 +101,3 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm
|
||||||
return $noError;
|
return $noError;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,28 +56,28 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function disable(){
|
public function disable()
|
||||||
|
{
|
||||||
$elements = $this->getElements();
|
$elements = $this->getElements();
|
||||||
foreach ($elements as $element)
|
foreach ($elements as $element) {
|
||||||
{
|
if ($element->getType() != 'Zend_Form_Element_Hidden') {
|
||||||
if ($element->getType() != 'Zend_Form_Element_Hidden')
|
|
||||||
{
|
|
||||||
$element->setAttrib('disabled','disabled');
|
$element->setAttrib('disabled','disabled');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkReliantFields($formData) {
|
public function checkReliantFields($formData)
|
||||||
|
{
|
||||||
if (!$formData['add_show_no_end']){
|
if (!$formData['add_show_no_end']) {
|
||||||
$start_timestamp = $formData['add_show_start_date'];
|
$start_timestamp = $formData['add_show_start_date'];
|
||||||
$end_timestamp = $formData['add_show_end_date'];
|
$end_timestamp = $formData['add_show_end_date'];
|
||||||
|
|
||||||
$start_epoch = strtotime($start_timestamp);
|
$start_epoch = strtotime($start_timestamp);
|
||||||
$end_epoch = strtotime($end_timestamp);
|
$end_epoch = strtotime($end_timestamp);
|
||||||
|
|
||||||
if($end_epoch < $start_epoch) {
|
if ($end_epoch < $start_epoch) {
|
||||||
$this->getElement('add_show_end_date')->setErrors(array('End date must be after start date'));
|
$this->getElement('add_show_end_date')->setErrors(array('End date must be after start date'));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,4 +86,3 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@ class Application_Form_AddShowStyle extends Zend_Form_SubForm
|
||||||
array('stringLength', false, array(6, 6))
|
array('stringLength', false, array(6, 6))
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
||||||
// Add show color input
|
// Add show color input
|
||||||
$this->addElement('text', 'add_show_color', array(
|
$this->addElement('text', 'add_show_color', array(
|
||||||
'label' => 'Text Colour:',
|
'label' => 'Text Colour:',
|
||||||
|
@ -45,16 +44,14 @@ class Application_Form_AddShowStyle extends Zend_Form_SubForm
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function disable(){
|
public function disable()
|
||||||
|
{
|
||||||
$elements = $this->getElements();
|
$elements = $this->getElements();
|
||||||
foreach ($elements as $element)
|
foreach ($elements as $element) {
|
||||||
{
|
if ($element->getType() != 'Zend_Form_Element_Hidden') {
|
||||||
if ($element->getType() != 'Zend_Form_Element_Hidden')
|
|
||||||
{
|
|
||||||
$element->setAttrib('disabled','disabled');
|
$element->setAttrib('disabled','disabled');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,15 +66,13 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function disable(){
|
public function disable()
|
||||||
|
{
|
||||||
$elements = $this->getElements();
|
$elements = $this->getElements();
|
||||||
foreach ($elements as $element)
|
foreach ($elements as $element) {
|
||||||
{
|
if ($element->getType() != 'Zend_Form_Element_Hidden') {
|
||||||
if ($element->getType() != 'Zend_Form_Element_Hidden')
|
|
||||||
{
|
|
||||||
$element->setAttrib('disabled','disabled');
|
$element->setAttrib('disabled','disabled');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,8 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkReliantFields($formData, $validateStartDate, $originalStartDate=null, $update=false, $instanceId=null) {
|
public function checkReliantFields($formData, $validateStartDate, $originalStartDate=null, $update=false, $instanceId=null)
|
||||||
|
{
|
||||||
$valid = true;
|
$valid = true;
|
||||||
|
|
||||||
$hours;
|
$hours;
|
||||||
|
@ -96,14 +97,14 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
$nowDateTime = new DateTime();
|
$nowDateTime = new DateTime();
|
||||||
$showStartDateTime = new DateTime($start_time);
|
$showStartDateTime = new DateTime($start_time);
|
||||||
$showEndDateTime = new DateTime($end_time);
|
$showEndDateTime = new DateTime($end_time);
|
||||||
if ($validateStartDate){
|
if ($validateStartDate) {
|
||||||
if($showStartDateTime->getTimestamp() < $nowDateTime->getTimestamp()) {
|
if ($showStartDateTime->getTimestamp() < $nowDateTime->getTimestamp()) {
|
||||||
$this->getElement('add_show_start_time')->setErrors(array('Cannot create show in the past'));
|
$this->getElement('add_show_start_time')->setErrors(array('Cannot create show in the past'));
|
||||||
$valid = false;
|
$valid = false;
|
||||||
}
|
}
|
||||||
// if edit action, check if original show start time is in the past. CC-3864
|
// if edit action, check if original show start time is in the past. CC-3864
|
||||||
if($originalStartDate){
|
if ($originalStartDate) {
|
||||||
if($originalStartDate->getTimestamp() < $nowDateTime->getTimestamp()) {
|
if ($originalStartDate->getTimestamp() < $nowDateTime->getTimestamp()) {
|
||||||
$this->getElement('add_show_start_time')->setValue($originalStartDate->format("H:i"));
|
$this->getElement('add_show_start_time')->setValue($originalStartDate->format("H:i"));
|
||||||
$this->getElement('add_show_start_date')->setValue($originalStartDate->format("Y-m-d"));
|
$this->getElement('add_show_start_date')->setValue($originalStartDate->format("Y-m-d"));
|
||||||
$this->getElement('add_show_start_time')->setErrors(array('Cannot modify start date/time of the show that is already started'));
|
$this->getElement('add_show_start_time')->setErrors(array('Cannot modify start date/time of the show that is already started'));
|
||||||
|
@ -114,7 +115,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
}
|
}
|
||||||
|
|
||||||
// if end time is in the past, return error
|
// if end time is in the past, return error
|
||||||
if($showEndDateTime->getTimestamp() < $nowDateTime->getTimestamp()) {
|
if ($showEndDateTime->getTimestamp() < $nowDateTime->getTimestamp()) {
|
||||||
$this->getElement('add_show_end_time')->setErrors(array('End date/time cannot be in the past'));
|
$this->getElement('add_show_end_time')->setErrors(array('End date/time cannot be in the past'));
|
||||||
$valid = false;
|
$valid = false;
|
||||||
}
|
}
|
||||||
|
@ -124,20 +125,19 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
if (preg_match($pattern, $formData['add_show_duration'], $matches) && count($matches) == 3) {
|
if (preg_match($pattern, $formData['add_show_duration'], $matches) && count($matches) == 3) {
|
||||||
$hours = $matches[1];
|
$hours = $matches[1];
|
||||||
$minutes = $matches[2];
|
$minutes = $matches[2];
|
||||||
if( $formData["add_show_duration"] == "00h 00m" ) {
|
if ($formData["add_show_duration"] == "00h 00m") {
|
||||||
$this->getElement('add_show_duration')->setErrors(array('Cannot have duration 00h 00m'));
|
$this->getElement('add_show_duration')->setErrors(array('Cannot have duration 00h 00m'));
|
||||||
$valid = false;
|
$valid = false;
|
||||||
}elseif(strpos($formData["add_show_duration"], 'h') !== false && $hours >= 24) {
|
} elseif (strpos($formData["add_show_duration"], 'h') !== false && $hours >= 24) {
|
||||||
if ($hours > 24 || ($hours == 24 && $minutes > 0)) {
|
if ($hours > 24 || ($hours == 24 && $minutes > 0)) {
|
||||||
$this->getElement('add_show_duration')->setErrors(array('Cannot have duration greater than 24h'));
|
$this->getElement('add_show_duration')->setErrors(array('Cannot have duration greater than 24h'));
|
||||||
$valid = false;
|
$valid = false;
|
||||||
}
|
}
|
||||||
}elseif( strstr($formData["add_show_duration"], '-') ){
|
} elseif ( strstr($formData["add_show_duration"], '-') ) {
|
||||||
$this->getElement('add_show_duration')->setErrors(array('Cannot have duration < 0m'));
|
$this->getElement('add_show_duration')->setErrors(array('Cannot have duration < 0m'));
|
||||||
$valid = false;
|
$valid = false;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$valid = false;
|
$valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,11 +188,11 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
*/
|
*/
|
||||||
if (!$overlapping) {
|
if (!$overlapping) {
|
||||||
$startDow = date("w", $show_start->getTimestamp());
|
$startDow = date("w", $show_start->getTimestamp());
|
||||||
foreach($formData["add_show_day_check"] as $day) {
|
foreach ($formData["add_show_day_check"] as $day) {
|
||||||
$repeatShowStart = clone $show_start;
|
$repeatShowStart = clone $show_start;
|
||||||
$repeatShowEnd = clone $show_end;
|
$repeatShowEnd = clone $show_end;
|
||||||
$daysAdd=0;
|
$daysAdd=0;
|
||||||
if ($startDow !== $day){
|
if ($startDow !== $day) {
|
||||||
if ($startDow > $day)
|
if ($startDow > $day)
|
||||||
$daysAdd = 6 - $startDow + 1 + $day;
|
$daysAdd = 6 - $startDow + 1 + $day;
|
||||||
else
|
else
|
||||||
|
@ -263,34 +263,31 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
return $valid;
|
return $valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function disable(){
|
public function disable()
|
||||||
|
{
|
||||||
$elements = $this->getElements();
|
$elements = $this->getElements();
|
||||||
foreach ($elements as $element)
|
foreach ($elements as $element) {
|
||||||
{
|
if ($element->getType() != 'Zend_Form_Element_Hidden') {
|
||||||
if ($element->getType() != 'Zend_Form_Element_Hidden')
|
|
||||||
{
|
|
||||||
$element->setAttrib('disabled','disabled');
|
$element->setAttrib('disabled','disabled');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function disableRepeatCheckbox(){
|
public function disableRepeatCheckbox()
|
||||||
|
{
|
||||||
$element = $this->getElement('add_show_repeats');
|
$element = $this->getElement('add_show_repeats');
|
||||||
if ($element->getType() != 'Zend_Form_Element_Hidden')
|
if ($element->getType() != 'Zend_Form_Element_Hidden') {
|
||||||
{
|
|
||||||
$element->setAttrib('disabled','disabled');
|
$element->setAttrib('disabled','disabled');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function disableStartDateAndTime(){
|
public function disableStartDateAndTime()
|
||||||
|
{
|
||||||
$elements = array($this->getElement('add_show_start_date'), $this->getElement('add_show_start_time'));
|
$elements = array($this->getElement('add_show_start_date'), $this->getElement('add_show_start_time'));
|
||||||
foreach ($elements as $element)
|
foreach ($elements as $element) {
|
||||||
{
|
if ($element->getType() != 'Zend_Form_Element_Hidden') {
|
||||||
if ($element->getType() != 'Zend_Form_Element_Hidden')
|
|
||||||
{
|
|
||||||
$element->setAttrib('disabled','disabled');
|
$element->setAttrib('disabled','disabled');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,15 +27,13 @@ class Application_Form_AddShowWho extends Zend_Form_SubForm
|
||||||
$this->addElement($hosts);
|
$this->addElement($hosts);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function disable(){
|
public function disable()
|
||||||
|
{
|
||||||
$elements = $this->getElements();
|
$elements = $this->getElements();
|
||||||
foreach ($elements as $element)
|
foreach ($elements as $element) {
|
||||||
{
|
if ($element->getType() != 'Zend_Form_Element_Hidden') {
|
||||||
if ($element->getType() != 'Zend_Form_Element_Hidden')
|
|
||||||
{
|
|
||||||
$element->setAttrib('disabled','disabled');
|
$element->setAttrib('disabled','disabled');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,13 +92,14 @@ class Application_Form_AddUser extends Zend_Form
|
||||||
$this->addElement($submit);
|
$this->addElement($submit);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function validateLogin($data){
|
public function validateLogin($data)
|
||||||
|
{
|
||||||
if (strlen($data['user_id']) == 0){
|
if (strlen($data['user_id']) == 0) {
|
||||||
$count = CcSubjsQuery::create()->filterByDbLogin($data['login'])->count();
|
$count = CcSubjsQuery::create()->filterByDbLogin($data['login'])->count();
|
||||||
|
|
||||||
if ($count != 0){
|
if ($count != 0) {
|
||||||
$this->getElement('login')->setErrors(array("Login name is not unique."));
|
$this->getElement('login')->setErrors(array("Login name is not unique."));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,4 +107,3 @@ class Application_Form_AddUser extends Zend_Form
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -151,6 +151,4 @@ class Application_Form_EditAudioMD extends Zend_Form
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,6 +108,4 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
||||||
));
|
));
|
||||||
|
|
||||||
$defaultFade = Application_Model_Preference::GetDefaultFade();
|
$defaultFade = Application_Model_Preference::GetDefaultFade();
|
||||||
if($defaultFade == ""){
|
if ($defaultFade == "") {
|
||||||
$defaultFade = '0.500000';
|
$defaultFade = '0.500000';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,8 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
||||||
$this->addElement($week_start_day);
|
$this->addElement($week_start_day);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getTimezones(){
|
private function getTimezones()
|
||||||
|
{
|
||||||
$regions = array(
|
$regions = array(
|
||||||
'Africa' => DateTimeZone::AFRICA,
|
'Africa' => DateTimeZone::AFRICA,
|
||||||
'America' => DateTimeZone::AMERICA,
|
'America' => DateTimeZone::AMERICA,
|
||||||
|
@ -86,9 +87,9 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
||||||
|
|
||||||
$tzlist = array();
|
$tzlist = array();
|
||||||
|
|
||||||
foreach ($regions as $name => $mask){
|
foreach ($regions as $name => $mask) {
|
||||||
$ids = DateTimeZone::listIdentifiers($mask);
|
$ids = DateTimeZone::listIdentifiers($mask);
|
||||||
foreach ($ids as $id){
|
foreach ($ids as $id) {
|
||||||
$tzlist[$id] = str_replace("_", " ", $id);
|
$tzlist[$id] = str_replace("_", " ", $id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,8 +97,8 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
||||||
return $tzlist;
|
return $tzlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getWeekStartDays()
|
||||||
private function getWeekStartDays() {
|
{
|
||||||
$days = array(
|
$days = array(
|
||||||
'Sunday',
|
'Sunday',
|
||||||
'Monday',
|
'Monday',
|
||||||
|
@ -107,7 +108,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
||||||
'Friday',
|
'Friday',
|
||||||
'Saturday'
|
'Saturday'
|
||||||
);
|
);
|
||||||
|
|
||||||
return $days;
|
return $days;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
||||||
|
|
||||||
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||||
$defaultFade = Application_Model_Preference::GetDefaultTransitionFade();
|
$defaultFade = Application_Model_Preference::GetDefaultTransitionFade();
|
||||||
if($defaultFade == ""){
|
if ($defaultFade == "") {
|
||||||
$defaultFade = '00.000000';
|
$defaultFade = '00.000000';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,9 +50,9 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
||||||
$this->addElement($master_username);
|
$this->addElement($master_username);
|
||||||
|
|
||||||
//Master password
|
//Master password
|
||||||
if($isDemo){
|
if ($isDemo) {
|
||||||
$master_password = new Zend_Form_Element_Text('master_password');
|
$master_password = new Zend_Form_Element_Text('master_password');
|
||||||
}else{
|
} else {
|
||||||
$master_password = new Zend_Form_Element_Password('master_password');
|
$master_password = new Zend_Form_Element_Password('master_password');
|
||||||
$master_password->setAttrib('renderPassword','true');
|
$master_password->setAttrib('renderPassword','true');
|
||||||
}
|
}
|
||||||
|
@ -121,19 +121,18 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
||||||
$this->addElement($live_dj_mount);
|
$this->addElement($live_dj_mount);
|
||||||
}
|
}
|
||||||
// demo only code
|
// demo only code
|
||||||
if(!$isStreamConfigable){
|
if (!$isStreamConfigable) {
|
||||||
$elements = $this->getElements();
|
$elements = $this->getElements();
|
||||||
foreach ($elements as $element)
|
foreach ($elements as $element) {
|
||||||
{
|
if ($element->getType() != 'Zend_Form_Element_Hidden') {
|
||||||
if ($element->getType() != 'Zend_Form_Element_Hidden')
|
|
||||||
{
|
|
||||||
$element->setAttrib("disabled", "disabled");
|
$element->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateVariables(){
|
public function updateVariables()
|
||||||
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
|
||||||
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||||
|
@ -146,50 +145,52 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isValid($data){
|
public function isValid($data)
|
||||||
|
{
|
||||||
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||||
$isValid = parent::isValid($data);
|
$isValid = parent::isValid($data);
|
||||||
if (!$isSaas) {
|
if (!$isSaas) {
|
||||||
$master_harbor_input_port = $data['master_harbor_input_port'];
|
$master_harbor_input_port = $data['master_harbor_input_port'];
|
||||||
$dj_harbor_input_port = $data['dj_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 != ""){
|
if ($master_harbor_input_port == $dj_harbor_input_port && $master_harbor_input_port != "") {
|
||||||
$element = $this->getElement("dj_harbor_input_port");
|
$element = $this->getElement("dj_harbor_input_port");
|
||||||
$element->addError("You cannot use same port as Master DJ port.");
|
$element->addError("You cannot use same port as Master DJ port.");
|
||||||
}
|
}
|
||||||
if($master_harbor_input_port != ""){
|
if ($master_harbor_input_port != "") {
|
||||||
if(is_numeric($master_harbor_input_port)){
|
if (is_numeric($master_harbor_input_port)) {
|
||||||
if($master_harbor_input_port != Application_Model_StreamSetting::getMasterLiveStreamPort()){
|
if ($master_harbor_input_port != Application_Model_StreamSetting::getMasterLiveStreamPort()) {
|
||||||
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
|
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
|
||||||
$res = socket_bind($sock, 0, $master_harbor_input_port);
|
$res = socket_bind($sock, 0, $master_harbor_input_port);
|
||||||
if(!$res){
|
if (!$res) {
|
||||||
$element = $this->getElement("master_harbor_input_port");
|
$element = $this->getElement("master_harbor_input_port");
|
||||||
$element->addError("Port '$master_harbor_input_port' is not available.");
|
$element->addError("Port '$master_harbor_input_port' is not available.");
|
||||||
$isValid = false;
|
$isValid = false;
|
||||||
}
|
}
|
||||||
socket_close($sock);
|
socket_close($sock);
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
$isValid = false;
|
$isValid = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($dj_harbor_input_port != ""){
|
if ($dj_harbor_input_port != "") {
|
||||||
if(is_numeric($dj_harbor_input_port)){
|
if (is_numeric($dj_harbor_input_port)) {
|
||||||
if($dj_harbor_input_port != Application_Model_StreamSetting::getDjLiveStreamPort()){
|
if ($dj_harbor_input_port != Application_Model_StreamSetting::getDjLiveStreamPort()) {
|
||||||
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
|
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
|
||||||
$res = socket_bind($sock, 0, $dj_harbor_input_port);
|
$res = socket_bind($sock, 0, $dj_harbor_input_port);
|
||||||
if(!$res){
|
if (!$res) {
|
||||||
$element = $this->getElement("dj_harbor_input_port");
|
$element = $this->getElement("dj_harbor_input_port");
|
||||||
$element->addError("Port '$dj_harbor_input_port' is not available.");
|
$element->addError("Port '$dj_harbor_input_port' is not available.");
|
||||||
$isValid = false;
|
$isValid = false;
|
||||||
}
|
}
|
||||||
socket_close($sock);
|
socket_close($sock);
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
$isValid = false;
|
$isValid = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $isValid;
|
return $isValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,10 +45,10 @@ class Application_Form_Login extends Zend_Form
|
||||||
));
|
));
|
||||||
|
|
||||||
$recaptchaNeeded = false;
|
$recaptchaNeeded = false;
|
||||||
if(Application_Model_LoginAttempts::getAttempts($_SERVER['REMOTE_ADDR']) >= 3){
|
if (Application_Model_LoginAttempts::getAttempts($_SERVER['REMOTE_ADDR']) >= 3) {
|
||||||
$recaptchaNeeded = true;
|
$recaptchaNeeded = true;
|
||||||
}
|
}
|
||||||
if($recaptchaNeeded){
|
if ($recaptchaNeeded) {
|
||||||
// recaptcha
|
// recaptcha
|
||||||
$this->addRecaptcha();
|
$this->addRecaptcha();
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,8 @@ class Application_Form_Login extends Zend_Form
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRecaptcha(){
|
public function addRecaptcha()
|
||||||
|
{
|
||||||
$pubKey = '6Ld4JsISAAAAAIxUKT4IjjOGi3DHqdoH2zk6WkYG';
|
$pubKey = '6Ld4JsISAAAAAIxUKT4IjjOGi3DHqdoH2zk6WkYG';
|
||||||
$privKey = '6Ld4JsISAAAAAJynYlXdrE4hfTReTSxYFe5szdyv';
|
$privKey = '6Ld4JsISAAAAAJynYlXdrE4hfTReTSxYFe5szdyv';
|
||||||
|
|
||||||
|
@ -84,6 +85,4 @@ class Application_Form_Login extends Zend_Form
|
||||||
$this->addElement($captcha);
|
$this->addElement($captcha);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
|
||||||
$country_list = Application_Model_Preference::GetCountryList();
|
$country_list = Application_Model_Preference::GetCountryList();
|
||||||
|
|
||||||
$privacyChecked = false;
|
$privacyChecked = false;
|
||||||
if(Application_Model_Preference::GetPrivacyPolicyCheck() == 1){
|
if (Application_Model_Preference::GetPrivacyPolicyCheck() == 1) {
|
||||||
$privacyChecked = true;
|
$privacyChecked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,17 +151,17 @@ class Application_Form_RegisterAirtime extends Zend_Form
|
||||||
public function isValid ($data)
|
public function isValid ($data)
|
||||||
{
|
{
|
||||||
$isValid = parent::isValid($data);
|
$isValid = parent::isValid($data);
|
||||||
if($data['Publicise'] != 1){
|
if ($data['Publicise'] != 1) {
|
||||||
$isValid = true;
|
$isValid = true;
|
||||||
}
|
}
|
||||||
if(isset($data["Privacy"])){
|
if (isset($data["Privacy"])) {
|
||||||
$checkPrivacy = $this->getElement('Privacy');
|
$checkPrivacy = $this->getElement('Privacy');
|
||||||
if($data["SupportFeedback"] == "1" && $data["Privacy"] != "1"){
|
if ($data["SupportFeedback"] == "1" && $data["Privacy"] != "1") {
|
||||||
$checkPrivacy->addError("You have to agree to privacy policy.");
|
$checkPrivacy->addError("You have to agree to privacy policy.");
|
||||||
$isValid = false;
|
$isValid = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $isValid;
|
return $isValid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,4 @@ class Application_Form_ScheduleShow extends Zend_Form
|
||||||
/* Form Elements & Other Definitions Here ... */
|
/* Form Elements & Other Definitions Here ... */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,6 @@ class Application_Form_ShowBuilder extends Zend_Form_SubForm
|
||||||
$endTime->setAttrib('alt', 'time');
|
$endTime->setAttrib('alt', 'time');
|
||||||
$this->addElement($endTime);
|
$this->addElement($endTime);
|
||||||
|
|
||||||
|
|
||||||
// add a select to choose a show.
|
// add a select to choose a show.
|
||||||
$showSelect = new Zend_Form_Element_Select("sb_show_filter");
|
$showSelect = new Zend_Form_Element_Select("sb_show_filter");
|
||||||
$showSelect->setLabel("Show:");
|
$showSelect->setLabel("Show:");
|
||||||
|
@ -84,8 +83,8 @@ class Application_Form_ShowBuilder extends Zend_Form_SubForm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getShowNames() {
|
private function getShowNames()
|
||||||
|
{
|
||||||
$showNames = array("0" => "-------------------------");
|
$showNames = array("0" => "-------------------------");
|
||||||
|
|
||||||
$shows = CcShowQuery::create()
|
$shows = CcShowQuery::create()
|
||||||
|
|
|
@ -84,8 +84,8 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
||||||
"items" => "items"
|
"items" => "items"
|
||||||
);
|
);
|
||||||
|
|
||||||
public function init(){
|
public function init()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function startForm($p_blockId, $p_isValid = false)
|
public function startForm($p_blockId, $p_isValid = false)
|
||||||
|
@ -98,7 +98,6 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
||||||
$blockType = 1;
|
$blockType = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$spType = new Zend_Form_Element_Radio('sp_type');
|
$spType = new Zend_Form_Element_Radio('sp_type');
|
||||||
$spType->setLabel('Set smart block type:')
|
$spType->setLabel('Set smart block type:')
|
||||||
->setDecorators(array('viewHelper'))
|
->setDecorators(array('viewHelper'))
|
||||||
|
@ -174,13 +173,13 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
||||||
$criteriaModifers->setAttrib('disabled', 'disabled');
|
$criteriaModifers->setAttrib('disabled', 'disabled');
|
||||||
}
|
}
|
||||||
if (isset($criteriaKeys[$i])) {
|
if (isset($criteriaKeys[$i])) {
|
||||||
if($criteriaType == "s"){
|
if ($criteriaType == "s") {
|
||||||
$criteriaModifers->setMultiOptions($this->stringCriteriaOptions);
|
$criteriaModifers->setMultiOptions($this->stringCriteriaOptions);
|
||||||
}else{
|
} else {
|
||||||
$criteriaModifers->setMultiOptions($this->numericCriteriaOptions);
|
$criteriaModifers->setMultiOptions($this->numericCriteriaOptions);
|
||||||
}
|
}
|
||||||
$criteriaModifers->setValue($storedCrit["crit"][$criteriaKeys[$i]][$j]["modifier"]);
|
$criteriaModifers->setValue($storedCrit["crit"][$criteriaKeys[$i]][$j]["modifier"]);
|
||||||
}else{
|
} else {
|
||||||
$criteriaModifers->setMultiOptions(array('0' => 'Select modifier'));
|
$criteriaModifers->setMultiOptions(array('0' => 'Select modifier'));
|
||||||
}
|
}
|
||||||
$this->addElement($criteriaModifers);
|
$this->addElement($criteriaModifers);
|
||||||
|
@ -189,7 +188,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
||||||
$criteriaValue = new Zend_Form_Element_Text("sp_criteria_value_".$i."_".$j);
|
$criteriaValue = new Zend_Form_Element_Text("sp_criteria_value_".$i."_".$j);
|
||||||
$criteriaValue->setAttrib('class', 'input_text sp_input_text')
|
$criteriaValue->setAttrib('class', 'input_text sp_input_text')
|
||||||
->setDecorators(array('viewHelper'));
|
->setDecorators(array('viewHelper'));
|
||||||
if ($i != 0 && !isset($criteriaKeys[$i])){
|
if ($i != 0 && !isset($criteriaKeys[$i])) {
|
||||||
$criteriaValue->setAttrib('disabled', 'disabled');
|
$criteriaValue->setAttrib('disabled', 'disabled');
|
||||||
}
|
}
|
||||||
if (isset($criteriaKeys[$i])) {
|
if (isset($criteriaKeys[$i])) {
|
||||||
|
@ -204,7 +203,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
||||||
if (isset($criteriaKeys[$i]) && isset($storedCrit["crit"][$criteriaKeys[$i]][$j]["extra"])) {
|
if (isset($criteriaKeys[$i]) && isset($storedCrit["crit"][$criteriaKeys[$i]][$j]["extra"])) {
|
||||||
$criteriaExtra->setValue($storedCrit["crit"][$criteriaKeys[$i]][$j]["extra"]);
|
$criteriaExtra->setValue($storedCrit["crit"][$criteriaKeys[$i]][$j]["extra"]);
|
||||||
$criteriaValue->setAttrib('class', 'input_text sp_extra_input_text');
|
$criteriaValue->setAttrib('class', 'input_text sp_extra_input_text');
|
||||||
}else{
|
} else {
|
||||||
$criteriaExtra->setAttrib('disabled', 'disabled');
|
$criteriaExtra->setAttrib('disabled', 'disabled');
|
||||||
}
|
}
|
||||||
$this->addElement($criteriaExtra);
|
$this->addElement($criteriaExtra);
|
||||||
|
@ -267,14 +266,15 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
function preValidation($params) {
|
public function preValidation($params)
|
||||||
|
{
|
||||||
$data = Application_Model_Block::organizeSmartPlyalistCriteria($params['data']);
|
$data = Application_Model_Block::organizeSmartPlyalistCriteria($params['data']);
|
||||||
// add elelments that needs to be added
|
// add elelments that needs to be added
|
||||||
// set multioption for modifier according to creiteria_field
|
// set multioption for modifier according to creiteria_field
|
||||||
$modRowMap = array();
|
$modRowMap = array();
|
||||||
foreach ($data['criteria'] as $critKey=>$d) {
|
foreach ($data['criteria'] as $critKey=>$d) {
|
||||||
$count = 1;
|
$count = 1;
|
||||||
foreach($d as $modKey=>$modInfo) {
|
foreach ($d as $modKey=>$modInfo) {
|
||||||
if ($modKey == 0) {
|
if ($modKey == 0) {
|
||||||
$eleCrit = $this->getElement("sp_criteria_field_".$critKey."_".$modKey);
|
$eleCrit = $this->getElement("sp_criteria_field_".$critKey."_".$modKey);
|
||||||
$eleCrit->setValue($this->criteriaOptions[$modInfo['sp_criteria_field']]);
|
$eleCrit->setValue($this->criteriaOptions[$modInfo['sp_criteria_field']]);
|
||||||
|
@ -284,7 +284,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
||||||
$criteriaType = $this->criteriaTypes[$modInfo['sp_criteria_field']];
|
$criteriaType = $this->criteriaTypes[$modInfo['sp_criteria_field']];
|
||||||
if ($criteriaType == "s") {
|
if ($criteriaType == "s") {
|
||||||
$eleMod->setMultiOptions($this->stringCriteriaOptions);
|
$eleMod->setMultiOptions($this->stringCriteriaOptions);
|
||||||
} else if ($criteriaType == "n") {
|
} elseif ($criteriaType == "n") {
|
||||||
$eleMod->setMultiOptions($this->numericCriteriaOptions);
|
$eleMod->setMultiOptions($this->numericCriteriaOptions);
|
||||||
} else {
|
} else {
|
||||||
$eleMod->setMultiOptions(array('0' => 'Select modifier'));
|
$eleMod->setMultiOptions(array('0' => 'Select modifier'));
|
||||||
|
@ -322,7 +322,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
||||||
|
|
||||||
if ($criteriaType == "s") {
|
if ($criteriaType == "s") {
|
||||||
$criteriaModifers->setMultiOptions($this->stringCriteriaOptions);
|
$criteriaModifers->setMultiOptions($this->stringCriteriaOptions);
|
||||||
} else if ($criteriaType == "n") {
|
} elseif ($criteriaType == "n") {
|
||||||
$criteriaModifers->setMultiOptions($this->numericCriteriaOptions);
|
$criteriaModifers->setMultiOptions($this->numericCriteriaOptions);
|
||||||
} else {
|
} else {
|
||||||
$criteriaModifers->setMultiOptions(array('0' => 'Select modifier'));
|
$criteriaModifers->setMultiOptions(array('0' => 'Select modifier'));
|
||||||
|
@ -344,7 +344,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
||||||
if (isset($modInfo['sp_criteria_extra'])) {
|
if (isset($modInfo['sp_criteria_extra'])) {
|
||||||
$criteriaExtra->setValue($modInfo['sp_criteria_extra']);
|
$criteriaExtra->setValue($modInfo['sp_criteria_extra']);
|
||||||
$criteriaValue->setAttrib('class', 'input_text sp_extra_input_text');
|
$criteriaValue->setAttrib('class', 'input_text sp_extra_input_text');
|
||||||
}else{
|
} else {
|
||||||
$criteriaExtra->setAttrib('disabled', 'disabled');
|
$criteriaExtra->setAttrib('disabled', 'disabled');
|
||||||
}
|
}
|
||||||
$this->addElement($criteriaExtra);
|
$this->addElement($criteriaExtra);
|
||||||
|
@ -368,10 +368,12 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->populate($formData);
|
$this->populate($formData);
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isValid($params){
|
public function isValid($params)
|
||||||
|
{
|
||||||
$isValid = true;
|
$isValid = true;
|
||||||
$data = $this->preValidation($params);
|
$data = $this->preValidation($params);
|
||||||
$criteria2PeerMap = array(
|
$criteria2PeerMap = array(
|
||||||
|
@ -433,10 +435,10 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
||||||
if ($data['etc']['sp_limit_value'] == "" || floatval($data['etc']['sp_limit_value']) <= 0) {
|
if ($data['etc']['sp_limit_value'] == "" || floatval($data['etc']['sp_limit_value']) <= 0) {
|
||||||
$element->addError("Limit cannot be empty or smaller than 0");
|
$element->addError("Limit cannot be empty or smaller than 0");
|
||||||
$isValid = false;
|
$isValid = false;
|
||||||
} else if (!ctype_digit($data['etc']['sp_limit_value'])) {
|
} elseif (!ctype_digit($data['etc']['sp_limit_value'])) {
|
||||||
$element->addError("The value should be an integer");
|
$element->addError("The value should be an integer");
|
||||||
$isValid = false;
|
$isValid = false;
|
||||||
} else if (intval($data['etc']['sp_limit_value']) > 500) {
|
} elseif (intval($data['etc']['sp_limit_value']) > 500) {
|
||||||
$element->addError("500 is the max item limit value you can set");
|
$element->addError("500 is the max item limit value you can set");
|
||||||
$isValid = false;
|
$isValid = false;
|
||||||
}
|
}
|
||||||
|
@ -446,11 +448,11 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
||||||
|
|
||||||
if (isset($data['criteria'])) {
|
if (isset($data['criteria'])) {
|
||||||
foreach ($data['criteria'] as $rowKey=>$row) {
|
foreach ($data['criteria'] as $rowKey=>$row) {
|
||||||
foreach ($row as $key=>$d){
|
foreach ($row as $key=>$d) {
|
||||||
$element = $this->getElement("sp_criteria_field_".$rowKey."_".$key);
|
$element = $this->getElement("sp_criteria_field_".$rowKey."_".$key);
|
||||||
$error = array();
|
$error = array();
|
||||||
// check for not selected select box
|
// check for not selected select box
|
||||||
if ($d['sp_criteria_field'] == "0" || $d['sp_criteria_modifier'] == "0"){
|
if ($d['sp_criteria_field'] == "0" || $d['sp_criteria_modifier'] == "0") {
|
||||||
$element->addError("You must select Criteria and Modifier");
|
$element->addError("You must select Criteria and Modifier");
|
||||||
$isValid = false;
|
$isValid = false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -461,7 +463,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
||||||
$element->addError("'Length' should be in '00:00:00' format");
|
$element->addError("'Length' should be in '00:00:00' format");
|
||||||
$isValid = false;
|
$isValid = false;
|
||||||
}
|
}
|
||||||
} else if ($column->getType() == PropelColumnTypes::TIMESTAMP) {
|
} elseif ($column->getType() == PropelColumnTypes::TIMESTAMP) {
|
||||||
if (!preg_match("/(\d{4})-(\d{2})-(\d{2})/", $d['sp_criteria_value'])) {
|
if (!preg_match("/(\d{4})-(\d{2})-(\d{2})/", $d['sp_criteria_value'])) {
|
||||||
$element->addError("The value should be in timestamp format(eg. 0000-00-00 or 00-00-00 00:00:00");
|
$element->addError("The value should be in timestamp format(eg. 0000-00-00 or 00-00-00 00:00:00");
|
||||||
$isValid = false;
|
$isValid = false;
|
||||||
|
@ -487,7 +489,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ($column->getType() == PropelColumnTypes::INTEGER) {
|
} elseif ($column->getType() == PropelColumnTypes::INTEGER) {
|
||||||
if (!is_numeric($d['sp_criteria_value'])) {
|
if (!is_numeric($d['sp_criteria_value'])) {
|
||||||
$element->addError("The value has to be numeric");
|
$element->addError("The value has to be numeric");
|
||||||
$isValid = false;
|
$isValid = false;
|
||||||
|
@ -497,7 +499,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
||||||
$element->addError("The value should be less then 2147483648");
|
$element->addError("The value should be less then 2147483648");
|
||||||
$isValid = false;
|
$isValid = false;
|
||||||
}
|
}
|
||||||
} else if ($column->getType() == PropelColumnTypes::VARCHAR) {
|
} elseif ($column->getType() == PropelColumnTypes::VARCHAR) {
|
||||||
if (strlen($d['sp_criteria_value']) > $column->getSize()) {
|
if (strlen($d['sp_criteria_value']) > $column->getSize()) {
|
||||||
$element->addError("The value should be less ".$column->getSize()." characters");
|
$element->addError("The value should be less ".$column->getSize()." characters");
|
||||||
$isValid = false;
|
$isValid = false;
|
||||||
|
@ -512,6 +514,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
||||||
}//end foreach
|
}//end foreach
|
||||||
}//for loop
|
}//for loop
|
||||||
}//if
|
}//if
|
||||||
|
|
||||||
return $isValid;
|
return $isValid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,6 +149,4 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
|
||||||
$this->addElement($select);
|
$this->addElement($select);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,19 +9,21 @@ class Application_Form_StreamSetting extends Zend_Form
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setSetting($setting){
|
public function setSetting($setting)
|
||||||
|
{
|
||||||
$this->setting = $setting;
|
$this->setting = $setting;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function startFrom() {
|
public function startFrom()
|
||||||
|
{
|
||||||
$setting = $this->setting;
|
$setting = $this->setting;
|
||||||
if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
|
if (Application_Model_Preference::GetPlanLevel() == 'disabled') {
|
||||||
$output_sound_device = new Zend_Form_Element_Checkbox('output_sound_device');
|
$output_sound_device = new Zend_Form_Element_Checkbox('output_sound_device');
|
||||||
$output_sound_device->setLabel('Hardware Audio Output')
|
$output_sound_device->setLabel('Hardware Audio Output')
|
||||||
->setRequired(false)
|
->setRequired(false)
|
||||||
->setValue(($setting['output_sound_device'] == "true")?1:0)
|
->setValue(($setting['output_sound_device'] == "true")?1:0)
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
if (Application_Model_Preference::GetEnableStreamConf() == "false"){
|
if (Application_Model_Preference::GetEnableStreamConf() == "false") {
|
||||||
$output_sound_device->setAttrib("readonly", true);
|
$output_sound_device->setAttrib("readonly", true);
|
||||||
}
|
}
|
||||||
$this->addElement($output_sound_device);
|
$this->addElement($output_sound_device);
|
||||||
|
@ -32,7 +34,7 @@ class Application_Form_StreamSetting extends Zend_Form
|
||||||
->setMultiOptions($output_types)
|
->setMultiOptions($output_types)
|
||||||
->setValue($setting['output_sound_device_type'])
|
->setValue($setting['output_sound_device_type'])
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
if($setting['output_sound_device'] != "true"){
|
if ($setting['output_sound_device'] != "true") {
|
||||||
$output_type->setAttrib("disabled", "disabled");
|
$output_type->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
$this->addElement($output_type);
|
$this->addElement($output_type);
|
||||||
|
@ -43,7 +45,7 @@ class Application_Form_StreamSetting extends Zend_Form
|
||||||
->setRequired(false)
|
->setRequired(false)
|
||||||
->setValue(($setting['icecast_vorbis_metadata'] == "true")?1:0)
|
->setValue(($setting['icecast_vorbis_metadata'] == "true")?1:0)
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
if (Application_Model_Preference::GetEnableStreamConf() == "false"){
|
if (Application_Model_Preference::GetEnableStreamConf() == "false") {
|
||||||
$icecast_vorbis_metadata->setAttrib("readonly", true);
|
$icecast_vorbis_metadata->setAttrib("readonly", true);
|
||||||
}
|
}
|
||||||
$this->addElement($icecast_vorbis_metadata);
|
$this->addElement($icecast_vorbis_metadata);
|
||||||
|
@ -58,18 +60,20 @@ class Application_Form_StreamSetting extends Zend_Form
|
||||||
$this->addElement($stream_format);
|
$this->addElement($stream_format);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isValid($data){
|
public function isValid($data)
|
||||||
if(isset($data['output_sound_device'])){
|
{
|
||||||
|
if (isset($data['output_sound_device'])) {
|
||||||
$d = array();
|
$d = array();
|
||||||
$d["output_sound_device"] = $data['output_sound_device'];
|
$d["output_sound_device"] = $data['output_sound_device'];
|
||||||
$d["icecast_vorbis_metadata"] = $data['icecast_vorbis_metadata'];
|
$d["icecast_vorbis_metadata"] = $data['icecast_vorbis_metadata'];
|
||||||
if(isset($data['output_sound_device_type'])){
|
if (isset($data['output_sound_device_type'])) {
|
||||||
$d["output_sound_device_type"] = $data['output_sound_device_type'];
|
$d["output_sound_device_type"] = $data['output_sound_device_type'];
|
||||||
}
|
}
|
||||||
$d["streamFormat"] = $data['streamFormat'];
|
$d["streamFormat"] = $data['streamFormat'];
|
||||||
$this->populate($d);
|
$this->populate($d);
|
||||||
}
|
}
|
||||||
$isValid = parent::isValid($data);
|
$isValid = parent::isValid($data);
|
||||||
|
|
||||||
return $isValid;
|
return $isValid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
|
||||||
|
{
|
||||||
private $prefix;
|
private $prefix;
|
||||||
private $setting;
|
private $setting;
|
||||||
private $stream_types;
|
private $stream_types;
|
||||||
|
@ -10,23 +11,28 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setPrefix($prefix){
|
public function setPrefix($prefix)
|
||||||
|
{
|
||||||
$this->prefix = $prefix;
|
$this->prefix = $prefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setSetting($setting){
|
public function setSetting($setting)
|
||||||
|
{
|
||||||
$this->setting = $setting;
|
$this->setting = $setting;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setStreamTypes($stream_types){
|
public function setStreamTypes($stream_types)
|
||||||
|
{
|
||||||
$this->stream_types = $stream_types;
|
$this->stream_types = $stream_types;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setStreamBitrates($stream_bitrates){
|
public function setStreamBitrates($stream_bitrates)
|
||||||
|
{
|
||||||
$this->stream_bitrates = $stream_bitrates;
|
$this->stream_bitrates = $stream_bitrates;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function startForm(){
|
public function startForm()
|
||||||
|
{
|
||||||
$prefix = "s".$this->prefix;
|
$prefix = "s".$this->prefix;
|
||||||
$stream_number = $this->prefix;
|
$stream_number = $this->prefix;
|
||||||
$setting = $this->setting;
|
$setting = $this->setting;
|
||||||
|
@ -36,16 +42,13 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
$this->setIsArray(true);
|
$this->setIsArray(true);
|
||||||
$this->setElementsBelongTo($prefix."_data");
|
$this->setElementsBelongTo($prefix."_data");
|
||||||
|
|
||||||
$disable_all = false;
|
$disable_all = Application_Model_Preference::GetEnableStreamConf() == "false";
|
||||||
if(Application_Model_Preference::GetEnableStreamConf() == "false"){
|
|
||||||
$disable_all = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$enable = new Zend_Form_Element_Checkbox('enable');
|
$enable = new Zend_Form_Element_Checkbox('enable');
|
||||||
$enable->setLabel('Enabled:')
|
$enable->setLabel('Enabled:')
|
||||||
->setValue($setting[$prefix.'_enable'] == 'true' ? 1 : 0)
|
->setValue($setting[$prefix.'_enable'] == 'true' ? 1 : 0)
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
if($disable_all){
|
if ($disable_all) {
|
||||||
$enable->setAttrib("disabled", "disabled");
|
$enable->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
$this->addElement($enable);
|
$this->addElement($enable);
|
||||||
|
@ -55,7 +58,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
->setMultiOptions($stream_types)
|
->setMultiOptions($stream_types)
|
||||||
->setValue(isset($setting[$prefix.'_type'])?$setting[$prefix.'_type']:0)
|
->setValue(isset($setting[$prefix.'_type'])?$setting[$prefix.'_type']:0)
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
if($disable_all){
|
if ($disable_all) {
|
||||||
$type->setAttrib("disabled", "disabled");
|
$type->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
$this->addElement($type);
|
$this->addElement($type);
|
||||||
|
@ -65,7 +68,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
->setMultiOptions($stream_bitrates)
|
->setMultiOptions($stream_bitrates)
|
||||||
->setValue(isset($setting[$prefix.'_bitrate'])?$setting[$prefix.'_bitrate']:0)
|
->setValue(isset($setting[$prefix.'_bitrate'])?$setting[$prefix.'_bitrate']:0)
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
if($disable_all){
|
if ($disable_all) {
|
||||||
$bitrate->setAttrib("disabled", "disabled");
|
$bitrate->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
$this->addElement($bitrate);
|
$this->addElement($bitrate);
|
||||||
|
@ -75,7 +78,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
->setMultiOptions(array("icecast"=>"Icecast", "shoutcast"=>"SHOUTcast"))
|
->setMultiOptions(array("icecast"=>"Icecast", "shoutcast"=>"SHOUTcast"))
|
||||||
->setValue(isset($setting[$prefix.'_output'])?$setting[$prefix.'_output']:"icecast")
|
->setValue(isset($setting[$prefix.'_output'])?$setting[$prefix.'_output']:"icecast")
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
if($disable_all){
|
if ($disable_all) {
|
||||||
$output->setAttrib("disabled", "disabled");
|
$output->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
$this->addElement($output);
|
$this->addElement($output);
|
||||||
|
@ -86,7 +89,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
->setValidators(array(
|
->setValidators(array(
|
||||||
array('regex', false, array('/^[0-9a-zA-Z-_.]+$/', 'messages' => 'Invalid character entered'))))
|
array('regex', false, array('/^[0-9a-zA-Z-_.]+$/', 'messages' => 'Invalid character entered'))))
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
if($disable_all){
|
if ($disable_all) {
|
||||||
$host->setAttrib("disabled", "disabled");
|
$host->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
$host->setAttrib('alt', 'domain');
|
$host->setAttrib('alt', 'domain');
|
||||||
|
@ -98,7 +101,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
->setValidators(array(new Zend_Validate_Between(array('min'=>0, 'max'=>99999))))
|
->setValidators(array(new Zend_Validate_Between(array('min'=>0, 'max'=>99999))))
|
||||||
->addValidator('regex', false, array('pattern'=>'/^[0-9]+$/', 'messages'=>array('regexNotMatch'=>'Only numbers are allowed.')))
|
->addValidator('regex', false, array('pattern'=>'/^[0-9]+$/', 'messages'=>array('regexNotMatch'=>'Only numbers are allowed.')))
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
if($disable_all){
|
if ($disable_all) {
|
||||||
$port->setAttrib("disabled", "disabled");
|
$port->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
$this->addElement($port);
|
$this->addElement($port);
|
||||||
|
@ -109,7 +112,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
->setValidators(array(
|
->setValidators(array(
|
||||||
array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered'))))
|
array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered'))))
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
if($disable_all){
|
if ($disable_all) {
|
||||||
$pass->setAttrib("disabled", "disabled");
|
$pass->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
$pass->setAttrib('alt', 'regular_text');
|
$pass->setAttrib('alt', 'regular_text');
|
||||||
|
@ -119,7 +122,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
$genre->setLabel("Genre")
|
$genre->setLabel("Genre")
|
||||||
->setValue(isset($setting[$prefix.'_genre'])?$setting[$prefix.'_genre']:"")
|
->setValue(isset($setting[$prefix.'_genre'])?$setting[$prefix.'_genre']:"")
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
if($disable_all){
|
if ($disable_all) {
|
||||||
$genre->setAttrib("disabled", "disabled");
|
$genre->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
$this->addElement($genre);
|
$this->addElement($genre);
|
||||||
|
@ -130,7 +133,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
->setValidators(array(
|
->setValidators(array(
|
||||||
array('regex', false, array('/^[0-9a-zA-Z\-_.:\/]+$/', 'messages' => 'Invalid character entered'))))
|
array('regex', false, array('/^[0-9a-zA-Z\-_.:\/]+$/', 'messages' => 'Invalid character entered'))))
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
if($disable_all){
|
if ($disable_all) {
|
||||||
$url->setAttrib("disabled", "disabled");
|
$url->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
$url->setAttrib('alt', 'url');
|
$url->setAttrib('alt', 'url');
|
||||||
|
@ -140,7 +143,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
$name->setLabel("Name")
|
$name->setLabel("Name")
|
||||||
->setValue(isset($setting[$prefix.'_name'])?$setting[$prefix.'_name']:"")
|
->setValue(isset($setting[$prefix.'_name'])?$setting[$prefix.'_name']:"")
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
if($disable_all){
|
if ($disable_all) {
|
||||||
$name->setAttrib("disabled", "disabled");
|
$name->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
$this->addElement($name);
|
$this->addElement($name);
|
||||||
|
@ -149,7 +152,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
$description->setLabel("Description")
|
$description->setLabel("Description")
|
||||||
->setValue(isset($setting[$prefix.'_description'])?$setting[$prefix.'_description']:"")
|
->setValue(isset($setting[$prefix.'_description'])?$setting[$prefix.'_description']:"")
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
if($disable_all){
|
if ($disable_all) {
|
||||||
$description->setAttrib("disabled", "disabled");
|
$description->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
$this->addElement($description);
|
$this->addElement($description);
|
||||||
|
@ -160,7 +163,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
->setValidators(array(
|
->setValidators(array(
|
||||||
array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered'))))
|
array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered'))))
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
if($disable_all){
|
if ($disable_all) {
|
||||||
$mount->setAttrib("disabled", "disabled");
|
$mount->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
$mount->setAttrib('alt', 'regular_text');
|
$mount->setAttrib('alt', 'regular_text');
|
||||||
|
@ -172,7 +175,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
->setValidators(array(
|
->setValidators(array(
|
||||||
array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered'))))
|
array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered'))))
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
if($disable_all){
|
if ($disable_all) {
|
||||||
$user->setAttrib("disabled", "disabled");
|
$user->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
$user->setAttrib('alt', 'regular_text');
|
$user->setAttrib('alt', 'regular_text');
|
||||||
|
@ -185,28 +188,30 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isValid ($data){
|
public function isValid ($data)
|
||||||
|
{
|
||||||
$f_data = $data['s'.$this->prefix."_data"];
|
$f_data = $data['s'.$this->prefix."_data"];
|
||||||
$isValid = parent::isValid($f_data);
|
$isValid = parent::isValid($f_data);
|
||||||
if($f_data['enable'] == 1){
|
if ($f_data['enable'] == 1) {
|
||||||
if($f_data['host'] == ''){
|
if ($f_data['host'] == '') {
|
||||||
$element = $this->getElement("host");
|
$element = $this->getElement("host");
|
||||||
$element->addError("Server cannot be empty.");
|
$element->addError("Server cannot be empty.");
|
||||||
$isValid = false;
|
$isValid = false;
|
||||||
}
|
}
|
||||||
if($f_data['port'] == ''){
|
if ($f_data['port'] == '') {
|
||||||
$element = $this->getElement("port");
|
$element = $this->getElement("port");
|
||||||
$element->addError("Port cannot be empty.");
|
$element->addError("Port cannot be empty.");
|
||||||
$isValid = false;
|
$isValid = false;
|
||||||
}
|
}
|
||||||
if($f_data['output'] == 'icecast'){
|
if ($f_data['output'] == 'icecast') {
|
||||||
if($f_data['mount'] == ''){
|
if ($f_data['mount'] == '') {
|
||||||
$element = $this->getElement("mount");
|
$element = $this->getElement("mount");
|
||||||
$element->addError("Mount cannot be empty with Icecast server.");
|
$element->addError("Mount cannot be empty with Icecast server.");
|
||||||
$isValid = false;
|
$isValid = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $isValid;
|
return $isValid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,7 @@ class Application_Form_SupportSettings extends Zend_Form
|
||||||
$upload->setAttrib('accept', 'image/*');
|
$upload->setAttrib('accept', 'image/*');
|
||||||
$this->addElement($upload);
|
$this->addElement($upload);
|
||||||
|
|
||||||
if(!$isSass){
|
if (!$isSass) {
|
||||||
//enable support feedback
|
//enable support feedback
|
||||||
$this->addElement('checkbox', 'SupportFeedback', array(
|
$this->addElement('checkbox', 'SupportFeedback', array(
|
||||||
'label' => 'Send support feedback',
|
'label' => 'Send support feedback',
|
||||||
|
@ -126,7 +126,7 @@ class Application_Form_SupportSettings extends Zend_Form
|
||||||
->setRequired(false)
|
->setRequired(false)
|
||||||
->setDecorators(array('ViewHelper'))
|
->setDecorators(array('ViewHelper'))
|
||||||
->setValue(Application_Model_Preference::GetPublicise());
|
->setValue(Application_Model_Preference::GetPublicise());
|
||||||
if(Application_Model_Preference::GetSupportFeedback() == '0'){
|
if (Application_Model_Preference::GetSupportFeedback() == '0') {
|
||||||
$checkboxPublicise->setAttrib("disabled", "disabled");
|
$checkboxPublicise->setAttrib("disabled", "disabled");
|
||||||
}
|
}
|
||||||
$this->addElement($checkboxPublicise);
|
$this->addElement($checkboxPublicise);
|
||||||
|
@ -165,19 +165,19 @@ class Application_Form_SupportSettings extends Zend_Form
|
||||||
public function isValid ($data)
|
public function isValid ($data)
|
||||||
{
|
{
|
||||||
$isValid = parent::isValid($data);
|
$isValid = parent::isValid($data);
|
||||||
if(!$this->isSass){
|
if (!$this->isSass) {
|
||||||
if($data['Publicise'] != 1){
|
if ($data['Publicise'] != 1) {
|
||||||
$isValid = true;
|
$isValid = true;
|
||||||
}
|
}
|
||||||
if(isset($data["Privacy"])){
|
if (isset($data["Privacy"])) {
|
||||||
$checkPrivacy = $this->getElement('Privacy');
|
$checkPrivacy = $this->getElement('Privacy');
|
||||||
if($data["SupportFeedback"] == "1" && $data["Privacy"] != "1"){
|
if ($data["SupportFeedback"] == "1" && $data["Privacy"] != "1") {
|
||||||
$checkPrivacy->addError("You have to agree to privacy policy.");
|
$checkPrivacy->addError("You have to agree to privacy policy.");
|
||||||
$isValid = false;
|
$isValid = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $isValid;
|
return $isValid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,20 +32,20 @@ class Application_Form_WatchedDirPreferences extends Zend_Form_SubForm
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function verifyChosenFolder($p_form_element_id) {
|
public function verifyChosenFolder($p_form_element_id)
|
||||||
|
{
|
||||||
$element = $this->getElement($p_form_element_id);
|
$element = $this->getElement($p_form_element_id);
|
||||||
|
|
||||||
if (!is_dir($element->getValue())) {
|
if (!is_dir($element->getValue())) {
|
||||||
$element->setErrors(array('Not a valid Directory'));
|
$element->setErrors(array('Not a valid Directory'));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$element->setValue("");
|
$element->setValue("");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Zend_Filter_ImageSize implements Zend_Filter_Interface {
|
class Zend_Filter_ImageSize implements Zend_Filter_Interface
|
||||||
public function filter($value) {
|
{
|
||||||
|
public function filter($value)
|
||||||
|
{
|
||||||
if (!file_exists($value)) {
|
if (!file_exists($value)) {
|
||||||
throw new Zend_Filter_Exception('Image does not exist: ' . $value);
|
throw new Zend_Filter_Exception('Image does not exist: ' . $value);
|
||||||
}
|
}
|
||||||
|
@ -38,5 +40,3 @@ class Zend_Filter_ImageSize implements Zend_Filter_Interface {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
/**
|
/**
|
||||||
* Check if a field is empty but only when specific fields have specific values
|
* Check if a field is empty but only when specific fields have specific values
|
||||||
*/
|
*/
|
||||||
class ConditionalNotEmpty extends Zend_Validate_Abstract {
|
class ConditionalNotEmpty extends Zend_Validate_Abstract
|
||||||
|
{
|
||||||
const KEY_IS_EMPTY = 'keyIsEmpty';
|
const KEY_IS_EMPTY = 'keyIsEmpty';
|
||||||
|
|
||||||
protected $_messageTemplates = array(
|
protected $_messageTemplates = array(
|
||||||
|
@ -43,7 +43,7 @@ class ConditionalNotEmpty extends Zend_Validate_Abstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($context)) {
|
if (is_array($context)) {
|
||||||
foreach($this->_fieldValues as $fieldName=>$fieldValue) {
|
foreach ($this->_fieldValues as $fieldName=>$fieldValue) {
|
||||||
if (!isset($context[$fieldName]) || $context[$fieldName] != $fieldValue) {
|
if (!isset($context[$fieldName]) || $context[$fieldName] != $fieldValue) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -55,8 +55,7 @@ class ConditionalNotEmpty extends Zend_Validate_Abstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_error(self::KEY_IS_EMPTY);
|
$this->_error(self::KEY_IS_EMPTY);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class PasswordNotEmpty extends ConditionalNotEmpty {
|
class PasswordNotEmpty extends ConditionalNotEmpty
|
||||||
|
{
|
||||||
public function isValid($value, $context = null)
|
public function isValid($value, $context = null)
|
||||||
{
|
{
|
||||||
$result = parent::isValid($value, $context);
|
$result = parent::isValid($value, $context);
|
||||||
|
@ -11,8 +12,7 @@ class PasswordNotEmpty extends ConditionalNotEmpty {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue