예제 #1
0
 public function init()
 {
     $this->setName(strtolower(get_class()));
     $this->setMethod("post");
     $oFormName = new Zend_Form_Element_Hidden("form_name");
     $oFormName->setValue(get_class());
     $oFormName->setIgnore(FALSE)->removeDecorator("Label");
     $this->addElement($oFormName);
     $oRobots = new Zend_Form_Element_Select("site_seo_robots_id");
     $oRobots->setLabel("Tryb indeksowania przez roboty:");
     $oRobots->setRequired(FALSE);
     $oRobots->addMultiOptions($this->_aAllSiteSeoRobots);
     $oRobots->setValue(1);
     $this->addElement($oRobots);
     $oSeoTagTitle = new Zend_Form_Element_Textarea("head_title");
     $oSeoTagTitle->setLabel("Tytuł strony (meta titile):")->setFilters($this->_aFilters);
     $oSeoTagTitle->setRequired(FALSE);
     $this->addElement($oSeoTagTitle);
     $oAdditionalSeoTagKeywords = new Zend_Form_Element_Text("additional_seo_tag_keywords");
     $oAdditionalSeoTagKeywords->setLabel("Dodaj nowe słowo kluczowe:");
     $oAdditionalSeoTagKeywords->setRequired(FALSE);
     $oAdditionalSeoTagKeywords->addValidator(new Zend_Validate_StringLength(array("min" => 1, "max" => 45)));
     $oAdditionalSeoTagKeywords->setAttrib("class", "valid");
     $this->addElement($oAdditionalSeoTagKeywords);
     $oAddAdditionalSeoTagKeywords = new Zend_Form_Element_Button("add_additional_seo_tag_keywords");
     $oAddAdditionalSeoTagKeywords->setLabel("Dodaj");
     $oAddAdditionalSeoTagKeywords->setIgnore(FALSE)->removeDecorator("Label");
     $this->addElement($oAddAdditionalSeoTagKeywords);
     $oSeoTagKeywords = new Zend_Form_Element_Multiselect("keywords");
     $oSeoTagKeywords->addMultiOptions($this->_aAllSiteSeoKeywords);
     $oSeoTagKeywords->setRequired(FALSE);
     $oSeoTagKeywords->setLabel("Słowa kluczowe (meta keywords):");
     $oSeoTagKeywords->setAttrib("class", "chosen");
     $this->addElement($oSeoTagKeywords);
     $oSeoTagDescription = new Zend_Form_Element_Textarea("description");
     $oSeoTagDescription->setLabel("Opis strony (meta description):")->setFilters($this->_aFilters);
     $oSeoTagDescription->setRequired(FALSE);
     $this->addElement($oSeoTagDescription);
     $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 7200));
     $this->getElement("csrf_token")->removeDecorator("Label");
     $oSubmit = $this->createElement("submit", "submit");
     $oSubmit->setLabel("Zapisz");
     $this->addElement($oSubmit);
     $oViewScript = new Zend_Form_Decorator_ViewScript();
     $oViewScript->setViewModule("admin");
     $oViewScript->setViewScript("_forms/siteseo.phtml");
     $this->clearDecorators();
     $this->setDecorators(array(array($oViewScript)));
     $oElements = $this->getElements();
     foreach ($oElements as $oElement) {
         $oElement->setFilters($this->_aFilters);
         $oElement->removeDecorator("Errors");
     }
 }
예제 #2
0
 public function init()
 {
     $this->setName(strtolower(get_class()));
     $this->setMethod("post");
     $oFormName = new Zend_Form_Element_Hidden("form_name");
     $oFormName->setValue(get_class());
     $oFormName->setIgnore(FALSE)->removeDecorator("Label");
     $this->addElement($oFormName);
     $oNotificationId = new Zend_Form_Element_Hidden("notification_id");
     $oNotificationId->setValue(0);
     $oNotificationId->setIgnore(FALSE)->removeDecorator("Label");
     $this->addElement($oNotificationId);
     $oMailSessionId = new Zend_Form_Element_Hidden("mail_session_id");
     $oMailSessionId->setValue(0);
     $oMailSessionId->setIgnore(FALSE)->removeDecorator("Label");
     $this->addElement($oMailSessionId);
     $oMessage = new Zend_Form_Element_Textarea("message");
     $oMessage->setFilters($this->_aFilters);
     $oMessage->setRequired(FALSE);
     $oMessage->setAttrib("class", "ckeditor");
     $oMessage->setLabel("Wiadomość");
     $this->addElement($oMessage);
     $this->addFileIdElement();
     $oAddFile = new Zend_Form_Element_Button("add_file_button");
     $oAddFile->setLabel("Dodaj załącznik");
     $oAddFile->setIgnore(FALSE)->removeDecorator("Label");
     $this->addElement($oAddFile);
     $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 7200));
     $this->getElement("csrf_token")->removeDecorator("Label");
     $oSubmit = new Zend_Form_Element_Submit("submit_send_message");
     $oSubmit->setLabel("Wyślij wiadomość");
     $this->addElement($oSubmit);
     $oViewScript = new Zend_Form_Decorator_ViewScript();
     $oViewScript->setViewModule("admin");
     $oViewScript->setViewScript("_forms/mailnotification.phtml");
     $this->clearDecorators();
     $this->setDecorators(array(array($oViewScript)));
     $oElements = $this->getElements();
     foreach ($oElements as $oElement) {
         $oElement->setFilters($this->_aFilters);
         $oElement->removeDecorator("Errors");
     }
 }
예제 #3
0
 public function init()
 {
     $this->setName(strtolower(get_class()));
     $this->setMethod("post");
     $oFormName = new Zend_Form_Element_Hidden("form_name");
     $oFormName->setValue(get_class());
     $oFormName->setIgnore(FALSE)->removeDecorator("Label");
     $this->addElement($oFormName);
     $oNewsEditId = new Zend_Form_Element_Hidden("news_edit_id");
     $oNewsEditId->setValue(0);
     $oNewsEditId->setIgnore(FALSE)->removeDecorator("Label");
     $this->addElement($oNewsEditId);
     $oTranslation = new Zend_Form_Element_Select("translation");
     $oTranslation->setLabel("Tłumaczenie:");
     $oTranslation->setRequired(TRUE)->setAttrib("class", "valid");
     $oTranslation->addMultiOptions($this->_aAllLang);
     $this->addElement($oTranslation);
     $oImagePreview = new Zend_Form_Element_Hidden("image_preview");
     $oImagePreview->setValue(0);
     $oImagePreview->setRequired(FALSE)->removeDecorator("Label");
     $this->addElement($oImagePreview);
     $oImageId = new Zend_Form_Element_Select("image_id");
     $oImageId->setLabel("Zdjęcie:")->setFilters($this->_aFilters);
     $oImageId->setRequired(FALSE);
     $oImageId->addMultiOptions($this->_aAllImage);
     $this->addElement($oImageId);
     $oCreatedDate = new Zend_Form_Element_Text("created_date");
     $oCreatedDate->setLabel("Data utworzenia:");
     $oCreatedDate->setRequired(TRUE);
     $oCreatedDate->setAttrib("class", "valid");
     $this->addElement($oCreatedDate);
     $oName = new Zend_Form_Element_Text("news_title");
     $oName->setLabel("Tytuł:");
     $oName->addValidator(new Zend_Validate_StringLength(array("min" => 3, "max" => 255)));
     $oName->setRequired(TRUE)->setAttrib("class", "valid");
     $this->addElement($oName);
     $oContent = new Zend_Form_Element_Textarea("news_content");
     $oContent->setLabel("Treść:");
     $oContent->setRequired(FALSE);
     $oContent->setAttrib("class", "ckeditor");
     $this->addElement($oContent);
     $oAdditionalCategoryTag = new Zend_Form_Element_Text("additional_category_tag");
     $oAdditionalCategoryTag->setLabel("Dodaj nowe tagi:");
     $oAdditionalCategoryTag->setRequired(FALSE);
     $oAdditionalCategoryTag->addValidator(new Zend_Validate_StringLength(array("min" => 1, "max" => 45)));
     $oAdditionalCategoryTag->setAttrib("class", "valid");
     $this->addElement($oAdditionalCategoryTag);
     $oAddAdditionalCategoryTag = new Zend_Form_Element_Button("add_additional_category_tag");
     $oAddAdditionalCategoryTag->setLabel("Dodaj");
     $oAddAdditionalCategoryTag->setIgnore(FALSE)->removeDecorator("Label");
     $this->addElement($oAddAdditionalCategoryTag);
     $oCategoryTag = new Zend_Form_Element_Multiselect("category_tag");
     $oCategoryTag->addMultiOptions(array());
     $oCategoryTag->setRequired(FALSE);
     $oCategoryTag->setLabel("Tagi:");
     $oCategoryTag->setAttrib("class", "chosen");
     $this->addElement($oCategoryTag);
     $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 7200));
     $this->getElement("csrf_token")->removeDecorator("Label");
     $oSubmit = $this->createElement("submit", "submit");
     $oSubmit->setLabel("Zapisz");
     $this->addElement($oSubmit);
     $oViewScript = new Zend_Form_Decorator_ViewScript();
     $oViewScript->setViewModule("admin");
     $oViewScript->setViewScript("_forms/_defaultform.phtml");
     $this->clearDecorators();
     $this->setDecorators(array(array($oViewScript)));
     $oElements = $this->getElements();
     foreach ($oElements as $oElement) {
         $oElement->setFilters($this->_aFilters);
         $oElement->removeDecorator("Errors");
     }
 }
 public function startForm($p_blockId, $p_isValid = false)
 {
     // load type
     $out = CcBlockQuery::create()->findPk($p_blockId);
     if ($out->getDbType() == "static") {
         $blockType = 0;
     } else {
         $blockType = 1;
     }
     $spType = new Zend_Form_Element_Radio('sp_type');
     $spType->setLabel(_('Set smart block type:'))->setDecorators(array('viewHelper'))->setMultiOptions(array('static' => _('Static'), 'dynamic' => _('Dynamic')))->setValue($blockType);
     $this->addElement($spType);
     $bl = new Application_Model_Block($p_blockId);
     $storedCrit = $bl->getCriteria();
     //need to convert criteria to be displayed in the user's timezone if there's some timestamp type.
     self::convertTimestamps($storedCrit["crit"]);
     /* $modRoadMap stores the number of same criteria
      * Ex: 3 Album titles, and 2 Track titles
      * We need to know this so we display the form elements properly
      */
     $modRowMap = array();
     $openSmartBlockOption = false;
     if (!empty($storedCrit)) {
         $openSmartBlockOption = true;
     }
     $criteriaKeys = array();
     if (isset($storedCrit["crit"])) {
         $criteriaKeys = array_keys($storedCrit["crit"]);
     }
     $numElements = count($this->getCriteriaOptions());
     for ($i = 0; $i < $numElements; $i++) {
         $criteriaType = "";
         if (isset($criteriaKeys[$i])) {
             $critCount = count($storedCrit["crit"][$criteriaKeys[$i]]);
         } else {
             $critCount = 1;
         }
         $modRowMap[$i] = $critCount;
         /* Loop through all criteria with the same field
          * Ex: all criteria for 'Album'
          */
         for ($j = 0; $j < $critCount; $j++) {
             /****************** CRITERIA ***********/
             if ($j > 0) {
                 $invisible = ' sp-invisible';
             } else {
                 $invisible = '';
             }
             $criteria = new Zend_Form_Element_Select("sp_criteria_field_" . $i . "_" . $j);
             $criteria->setAttrib('class', 'input_select sp_input_select' . $invisible)->setValue('Select criteria')->setDecorators(array('viewHelper'))->setMultiOptions($this->getCriteriaOptions());
             if ($i != 0 && !isset($criteriaKeys[$i])) {
                 $criteria->setAttrib('disabled', 'disabled');
             }
             if (isset($criteriaKeys[$i])) {
                 $criteriaType = $this->criteriaTypes[$storedCrit["crit"][$criteriaKeys[$i]][$j]["criteria"]];
                 $criteria->setValue($storedCrit["crit"][$criteriaKeys[$i]][$j]["criteria"]);
             }
             $this->addElement($criteria);
             /****************** MODIFIER ***********/
             $criteriaModifers = new Zend_Form_Element_Select("sp_criteria_modifier_" . $i . "_" . $j);
             $criteriaModifers->setValue('Select modifier')->setAttrib('class', 'input_select sp_input_select')->setDecorators(array('viewHelper'));
             if ($i != 0 && !isset($criteriaKeys[$i])) {
                 $criteriaModifers->setAttrib('disabled', 'disabled');
             }
             if (isset($criteriaKeys[$i])) {
                 if ($criteriaType == "s") {
                     $criteriaModifers->setMultiOptions($this->getStringCriteriaOptions());
                 } else {
                     $criteriaModifers->setMultiOptions($this->getNumericCriteriaOptions());
                 }
                 $criteriaModifers->setValue($storedCrit["crit"][$criteriaKeys[$i]][$j]["modifier"]);
             } else {
                 $criteriaModifers->setMultiOptions(array('0' => _('Select modifier')));
             }
             $this->addElement($criteriaModifers);
             /****************** VALUE ***********/
             $criteriaValue = new Zend_Form_Element_Text("sp_criteria_value_" . $i . "_" . $j);
             $criteriaValue->setAttrib('class', 'input_text sp_input_text')->setDecorators(array('viewHelper'));
             if ($i != 0 && !isset($criteriaKeys[$i])) {
                 $criteriaValue->setAttrib('disabled', 'disabled');
             }
             if (isset($criteriaKeys[$i])) {
                 $criteriaValue->setValue($storedCrit["crit"][$criteriaKeys[$i]][$j]["value"]);
             }
             $this->addElement($criteriaValue);
             /****************** EXTRA ***********/
             $criteriaExtra = new Zend_Form_Element_Text("sp_criteria_extra_" . $i . "_" . $j);
             $criteriaExtra->setAttrib('class', 'input_text sp_extra_input_text')->setDecorators(array('viewHelper'));
             if (isset($criteriaKeys[$i]) && isset($storedCrit["crit"][$criteriaKeys[$i]][$j]["extra"])) {
                 $criteriaExtra->setValue($storedCrit["crit"][$criteriaKeys[$i]][$j]["extra"]);
                 $criteriaValue->setAttrib('class', 'input_text sp_extra_input_text');
             } else {
                 $criteriaExtra->setAttrib('disabled', 'disabled');
             }
             $this->addElement($criteriaExtra);
         }
         //for
     }
     //for
     $repeatTracks = new Zend_Form_Element_Checkbox('sp_repeat_tracks');
     $repeatTracks->setDecorators(array('viewHelper'))->setLabel(_('Allow Repeat Tracks:'));
     if (isset($storedCrit["repeat_tracks"])) {
         $repeatTracks->setChecked($storedCrit["repeat_tracks"]["value"] == 1 ? true : false);
     }
     $this->addElement($repeatTracks);
     $limit = new Zend_Form_Element_Select('sp_limit_options');
     $limit->setAttrib('class', 'sp_input_select')->setDecorators(array('viewHelper'))->setMultiOptions($this->getLimitOptions());
     if (isset($storedCrit["limit"])) {
         $limit->setValue($storedCrit["limit"]["modifier"]);
     }
     $this->addElement($limit);
     $limitValue = new Zend_Form_Element_Text('sp_limit_value');
     $limitValue->setAttrib('class', 'sp_input_text_limit')->setLabel(_('Limit to'))->setDecorators(array('viewHelper'));
     $this->addElement($limitValue);
     if (isset($storedCrit["limit"])) {
         $limitValue->setValue($storedCrit["limit"]["value"]);
     } else {
         // setting default to 1 hour
         $limitValue->setValue(1);
     }
     //getting block content candidate count that meets criteria
     $bl = new Application_Model_Block($p_blockId);
     if ($p_isValid) {
         $files = $bl->getListofFilesMeetCriteria();
         $showPoolCount = true;
     } else {
         $files = null;
         $showPoolCount = false;
     }
     $generate = new Zend_Form_Element_Button('generate_button');
     $generate->setAttrib('class', 'btn btn-small');
     $generate->setAttrib('title', _('Generate playlist content and save criteria'));
     $generate->setIgnore(true);
     $generate->setLabel(_('Generate'));
     $generate->setDecorators(array('viewHelper'));
     $this->addElement($generate);
     $shuffle = new Zend_Form_Element_Button('shuffle_button');
     $shuffle->setAttrib('class', 'btn btn-small');
     $shuffle->setAttrib('title', _('Shuffle playlist content'));
     $shuffle->setIgnore(true);
     $shuffle->setLabel(_('Shuffle'));
     $shuffle->setDecorators(array('viewHelper'));
     $this->addElement($shuffle);
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/smart-block-criteria.phtml', "openOption" => $openSmartBlockOption, 'criteriasLength' => count($this->getCriteriaOptions()), 'poolCount' => $files['count'], 'modRowMap' => $modRowMap, 'showPoolCount' => $showPoolCount))));
 }
예제 #5
0
 public function init()
 {
     /*
             $this->addElementPrefixPath('Application_Validate',
                                         '../application/validate',
                                         'validate');
                                         * */
     $notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
     $emailValidator = Application_Form_Helper_ValidationTypes::overrideEmailAddressValidator();
     $notDemoValidator = new Application_Validate_NotDemoValidate();
     $this->setAttrib('id', 'user_form');
     $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:'******'class', 'input_text');
     $login->setRequired(true);
     $login->addValidator($notEmptyValidator);
     $login->addFilter('StringTrim');
     //$login->addValidator('UserNameValidate');
     $this->addElement($login);
     $password = new Zend_Form_Element_Password('password');
     $password->setLabel(_('Password:'******'class', 'input_text');
     $password->setRequired(true);
     $password->addFilter('StringTrim');
     $password->addValidator($notEmptyValidator);
     $this->addElement($password);
     $passwordVerify = new Zend_Form_Element_Password('passwordVerify');
     $passwordVerify->setLabel(_('Verify Password:'******'class', 'input_text');
     $passwordVerify->setRequired(true);
     $passwordVerify->addFilter('StringTrim');
     $passwordVerify->addValidator($notEmptyValidator);
     $passwordVerify->addValidator($notDemoValidator);
     $this->addElement($passwordVerify);
     $firstName = new Zend_Form_Element_Text('first_name');
     $firstName->setLabel(_('Firstname:'));
     $firstName->setAttrib('class', 'input_text');
     $firstName->addFilter('StringTrim');
     $this->addElement($firstName);
     $lastName = new Zend_Form_Element_Text('last_name');
     $lastName->setLabel(_('Lastname:'));
     $lastName->setAttrib('class', 'input_text');
     $lastName->addFilter('StringTrim');
     $this->addElement($lastName);
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel(_('Email:'));
     $email->setAttrib('class', 'input_text');
     $email->addFilter('StringTrim');
     $email->setRequired(true);
     $email->addValidator($notEmptyValidator);
     $email->addValidator($emailValidator);
     $this->addElement($email);
     $cellPhone = new Zend_Form_Element_Text('cell_phone');
     $cellPhone->setLabel(_('Mobile Phone:'));
     $cellPhone->setAttrib('class', 'input_text');
     $cellPhone->addFilter('StringTrim');
     $this->addElement($cellPhone);
     $skype = new Zend_Form_Element_Text('skype');
     $skype->setLabel(_('Skype:'));
     $skype->setAttrib('class', 'input_text');
     $skype->addFilter('StringTrim');
     $this->addElement($skype);
     $jabber = new Zend_Form_Element_Text('jabber');
     $jabber->setLabel(_('Jabber:'));
     $jabber->setAttrib('class', 'input_text');
     $jabber->addFilter('StringTrim');
     $jabber->addValidator($emailValidator);
     $this->addElement($jabber);
     $select = new Zend_Form_Element_Select('type');
     $select->setLabel(_('User Type:'));
     $select->setAttrib('class', 'input_select');
     $select->setAttrib('style', 'width: 40%');
     $select->setMultiOptions(array("G" => _("Guest"), "H" => _("DJ"), "P" => _("Program Manager"), "A" => _("Admin")));
     $select->setRequired(true);
     $this->addElement($select);
     $saveBtn = new Zend_Form_Element_Button('save_user');
     $saveBtn->setAttrib('class', 'btn btn-small right-floated');
     $saveBtn->setIgnore(true);
     $saveBtn->setLabel(_('Save'));
     $this->addElement($saveBtn);
 }