123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- <?php
- require_once 'customfilters/ImageSize.php';
- class Application_Form_RegisterAirtime extends Zend_Form
- {
- public function init()
- {
- $this->setAction(Application_Common_OsPath::getBaseDir().'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)))
- );
-
- $stnName = new Zend_Form_Element_Text("stnName");
- $stnName->setLabel(_("Station Name"))
- ->setRequired(true)
- ->setValue(Application_Model_Preference::GetStationName())
- ->setDecorators(array('ViewHelper'));
- $this->addElement($stnName);
-
- $this->addElement('text', 'Phone', array(
- 'class' => 'input_text',
- 'label' => _('Phone:'),
- 'required' => false,
- 'filters' => array('StringTrim'),
- 'value' => Application_Model_Preference::GetPhone(),
- 'decorators' => array(
- 'ViewHelper'
- )
- ));
-
- $this->addElement('text', 'Email', array(
- 'class' => 'input_text',
- 'label' => _('Email:'),
- 'required' => false,
- 'filters' => array('StringTrim'),
- 'value' => Application_Model_Preference::GetEmail(),
- 'decorators' => array(
- 'ViewHelper'
- )
- ));
-
- $this->addElement('text', 'StationWebSite', array(
- 'label' => _('Station Web Site:'),
- 'required' => false,
- 'class' => 'input_text',
- 'value' => Application_Model_Preference::GetStationWebSite(),
- 'decorators' => array(
- 'ViewHelper'
- )
- ));
-
- $this->addElement('select', 'Country', array(
- 'label' => _('Country:'),
- 'required' => false,
- 'value' => Application_Model_Preference::GetStationCountry(),
- 'multiOptions' => $country_list,
- 'decorators' => array(
- 'ViewHelper'
- )
- ));
-
- $this->addElement('text', 'City', array(
- 'label' => _('City:'),
- 'required' => false,
- 'class' => 'input_text',
- 'value' => Application_Model_Preference::GetStationCity(),
- 'decorators' => array(
- 'ViewHelper'
- )
- ));
-
- $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);
-
- $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);
-
- $this->addElement('checkbox', 'SupportFeedback', array(
- 'label' => _('Send support feedback'),
- 'required' => false,
- 'value' => 1,
- 'decorators' => array(
- 'ViewHelper'
- )
- ));
-
- $checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise");
- $checkboxPublicise->setLabel(sprintf(_('Promote my station on %s'), COMPANY_SITE))
- ->setRequired(false)
- ->setDecorators(array('ViewHelper'))
- ->setValue(Application_Model_Preference::GetPublicise());
- $this->addElement($checkboxPublicise);
-
- $this->addElement('textarea', 'SendInfo', array(
- 'class' => 'sending_textarea',
- 'required' => false,
- 'filters' => array('StringTrim'),
- 'readonly' => true,
- 'rows' => 5,
- 'cols' => 61,
- 'value' => Application_Model_Preference::GetSystemInfo(false, true),
- 'decorators' => array(
- 'ViewHelper'
- )
- ));
- $privacyPolicyAnchorOpen = "<a id='link_to_privacy' href='" . PRIVACY_POLICY_URL
- . "' onclick='window.open(this.href); return false;'>";
-
- $checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy");
- $checkboxPrivacy->setLabel(
- sprintf(_('By checking this box, I agree to %s\'s %sprivacy policy%s.'),
- COMPANY_NAME,
- $privacyPolicyAnchorOpen,
- "</a>"))
- ->setDecorators(array('ViewHelper'));
- $this->addElement($checkboxPrivacy);
- }
-
- public function isValid ($data)
- {
- $isValid = parent::isValid($data);
- if ($data['Publicise'] != 1) {
- $isValid = true;
- }
- if (isset($data["Privacy"])) {
- $checkPrivacy = $this->getElement('Privacy');
- if ($data["SupportFeedback"] == "1" && $data["Privacy"] != "1") {
- $checkPrivacy->addError(_("You have to agree to privacy policy."));
- $isValid = false;
- }
- }
- return $isValid;
- }
- }
|