public function init()
 {
     $this->setMethod(self::METHOD_POST);
     $this->setName('fillTest');
     $questions = $this->_test->getQuestions();
     foreach ($questions as $q) {
         $options = $q->getOptions();
         if (count($options) == 0) {
             // otevrena odpoved
             $text = $this->createElement('textarea', $q->getid_otazka());
             $text->addFilter('StringTrim');
             $text->setRequired(true);
             $text->setLabel($q->getobsah());
             $text->setDecorators(array(array('ViewScript', array('viewScript' => 'TextArea.php', 'languageId' => $q->getid_jazyk()))));
             $this->addElement($text);
         } else {
             // multicheckbox
             $multicheck = new Zend_Form_Element_MultiCheckbox($q->getid_otazka());
             $multicheck->setLabel($q->getobsah());
             $multicheck->setRequired(true);
             foreach ($options as $o) {
                 $multicheck->addMultiOption($o->getid_moznost(), $o->getobsah());
             }
             $multicheck->setDecorators(array(array('ViewScript', array('viewScript' => 'MultiCheckbox.php', 'languageId' => $q->getid_jazyk()))));
             $this->addElement($multicheck);
         }
     }
     //submit button
     $button = $this->createElement('submit', 'Submit');
     $button->setAttrib('class', 'btn btn-success btn-lg dd-test');
     $this->addElement($button);
 }
 public function init()
 {
     // profissional_beleza_nome
     $profissional_beleza_nome = new Zend_Form_Element_Text("profissional_beleza_nome");
     $profissional_beleza_nome->setLabel("Nome: ");
     $profissional_beleza_nome->setAttribs(array('class' => 'form-control'));
     $profissional_beleza_nome->setRequired();
     $profissional_beleza_nome->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
     // profissional_beleza_email
     $profissional_beleza_email = new Zend_Form_Element_Text("profissional_beleza_email");
     $profissional_beleza_email->setLabel("E-mail: ");
     $profissional_beleza_email->setValidators(array('EmailAddress'));
     $profissional_beleza_email->addValidator(new App_Validate_ProfissionalBeleza());
     $profissional_beleza_email->setAttribs(array('class' => 'form-control'));
     $profissional_beleza_email->setRequired();
     $profissional_beleza_email->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
     /**
      * profisional_beleza_sexo
      */
     $profissional_beleza_sexo = new Zend_Form_Element_Radio("profissional_beleza_sexo");
     $profissional_beleza_sexo->setLabel("Sexo:");
     $profissional_beleza_sexo->setRequired();
     $profissional_beleza_sexo->setDecorators(App_Forms_Decorators::$checkboxElementDecorators);
     $profissional_beleza_sexo->setMultiOptions(array('M' => ' Masculino', 'F' => ' Feminino'));
     // profissional_beleza_avatar
     $profissional_beleza_avatar = new Zend_Form_Element_File("profissional_beleza_avatar");
     $profissional_beleza_avatar->setLabel(" \n            Foto: \n        ");
     $profissional_beleza_avatar->addDecorators(App_Forms_Decorators::$ElementDecoratorFile);
     $profissional_beleza_avatar->setAttribs(array('class' => 'filestyle', 'data-buttonText' => 'Selecione a foto', 'data-iconName' => 'fa fa-user'));
     $profissional_beleza_avatar->setRequired();
     $profissional_beleza_avatar->setDestination(Zend_Registry::get('config')->profissional->avatar->path);
     $profissional_beleza_avatar->addValidators(array(array('Extension', false, 'jpg,jpeg,png')));
     $profissional_beleza_avatar->addFilter(new Skoch_Filter_File_Resize(array('width' => 160, 'keepRatio' => true)));
     // especialidade_id
     $especialidade_id = new Zend_Form_Element_MultiCheckbox("especialidade_id");
     $especialidade_id->setLabel("Selecione as especialidades: ");
     $especialidade_id->setAttribs(array('class' => ''));
     $especialidade_id->setRequired();
     $especialidade_id->setDecorators(App_Forms_Decorators::$checkboxElementDecorators);
     $especialidade_id->setSeparator(' ');
     $especialidade_id->setMultiOptions($this->getEspecialidades());
     // addElements
     $this->addElements(array($profissional_beleza_nome, $profissional_beleza_email, $profissional_beleza_sexo, $profissional_beleza_avatar, $especialidade_id));
     parent::init();
 }
 public function __construct($options = null)
 {
     $this->_disabledDefaultActions = false;
     unset($options['object']);
     parent::__construct($options);
     $label = new Cible_Form_Element_Html('txtAddToNewsletter', array('value' => $this->getView()->getCibleText('profile_addto_newletter_label')));
     $label->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'h2'))));
     $newsletterCategories = $this->getView()->GetAllNewsletterCategories();
     $newsletterCategories = $newsletterCategories->toArray();
     foreach ($newsletterCategories as $cat) {
         $catLst[$cat['C_ID']] = $cat['CI_Title'];
     }
     $chkCat = new Zend_Form_Element_MultiCheckbox("NP_Categories");
     $chkCat->addMultiOptions($catLst);
     $chkCat->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'id' => '', 'class' => 'label_after_checkbox'))));
     $this->addElement($label);
     $this->addElement($chkCat);
 }
 public function __construct($options = null, $groupsData = array())
 {
     // variable
     parent::__construct($options);
     $baseDir = $options['baseDir'];
     // html text
     $textAdministratorGroup = new Cible_Form_Element_Html('htmlAdministratorGroup', array('value' => $this->getView()->getCibleText('label_administrator_actives')));
     $this->addElement($textAdministratorGroup);
     $checkBox = new Zend_Form_Element_MultiCheckbox('groups');
     $checkBox->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'checkbox_list'))));
     //$checkBox->setDescription('<em>Example:</em> mydomain.com')
     //->addDecorator('Description', array('escape' => false));
     //show administrator group (first level)
     $groupAdmin = Cible_FunctionsAdministrators::getAdministratorGroupData(1)->toArray();
     $checkBox->addMultiOption("1", $groupAdmin['EGI_Name'] . " (" . $groupAdmin['EGI_Description'] . ")");
     $i = 0;
     foreach ($groupsData as $group) {
         if ($group['EG_Status'] == 'active') {
             $checkBox->addMultiOption($group['EG_ID'], $group['EGI_Name'] . " (" . $group['EGI_Description'] . ")");
         }
         $i++;
     }
     $this->addElement($checkBox);
 }
 /**
  * @group ZF-9689
  */
 public function testRenderWithListSeparatorForMulticheckbox()
 {
     require_once 'Zend/Form/Element/MultiCheckbox.php';
     $element = new Zend_Form_Element_MultiCheckbox('foo');
     $options = array('foo' => 'Foo', 'bar' => 'Bar');
     $element->setMultiOptions($options);
     $element->setSeparator('</p><p>');
     $element->setDecorators(array(array('ViewHelper', array('separator' => '')), array('HtmlTag', array('tag' => 'p'))));
     $expected = '<p><label><input type="checkbox" name="foo[]" id="foo-foo" value="foo">Foo</label></p>' . '<p><label><input type="checkbox" name="foo[]" id="foo-bar" value="bar">Bar</label></p>';
     $actual = $element->render($this->getView());
     $this->assertEquals($expected, $actual);
 }
 public function agregarPregunta(Zend_Form $contenedor, Encuesta_Model_Pregunta $pregunta)
 {
     $ePregunta = null;
     if ($pregunta->getTipo() == "AB") {
         $ePregunta = new Zend_Form_Element_Text($pregunta->getIdPregunta());
         $ePregunta->setAttrib("class", "form-control");
     } else {
         //Obtenemos las Opciones
         $opciones = $this->opcionDAO->obtenerOpcionesPregunta($pregunta->getIdPregunta());
         if ($pregunta->getTipo() == "SS") {
             $ePregunta = new Zend_Form_Element_Radio($pregunta->getIdPregunta());
         } elseif ($pregunta->getTipo() == "MS") {
             $ePregunta = new Zend_Form_Element_MultiCheckbox($pregunta->getIdPregunta());
         }
         foreach ($opciones as $opcion) {
             $ePregunta->addMultiOption($opcion->getIdOpcion(), $opcion->getOpcion())->setSeparator("");
         }
     }
     $ePregunta->setLabel($pregunta->getPregunta());
     //$ePregunta->setAttrib("class", "form-control");
     $ePregunta->setDecorators($this->decoratorsPregunta);
     $contenedor->addElement($ePregunta);
     return $contenedor;
 }
Example #7
0
 public function __construct($options = null, $groupsData = array())
 {
     // variable
     parent::__construct($options);
     $baseDir = $options['baseDir'];
     if (array_key_exists('profile', $options)) {
         $profile = $options['profile'];
     } else {
         $profile = false;
     }
     // lastname
     $lname = new Zend_Form_Element_Text('EU_LName');
     $lname->setLabel($this->getView()->getCibleText('form_label_lname'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput')->setAttrib('escape', false);
     $this->addElement($lname);
     // firstname
     $fname = new Zend_Form_Element_Text('EU_FName');
     $fname->setLabel($this->getView()->getCibleText('form_label_fname'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput');
     $this->addElement($fname);
     // email
     $regexValidate = new Cible_Validate_Email();
     $regexValidate->setMessage($this->getView()->getCibleText('validation_message_emailAddressInvalid'), 'regexNotMatch');
     $email = new Zend_Form_Element_Text('EU_Email');
     $email->setLabel($this->getView()->getCibleText('form_label_email'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->addValidator($regexValidate)->setAttrib('class', 'stdTextInput');
     $this->addElement($email);
     // username
     $username = new Zend_Form_Element_Text('EU_Username');
     $username->setLabel($this->getView()->getCibleText('form_label_username'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput')->setAttrib('autocomplete', 'off');
     $this->addElement($username);
     // new password
     $password = new Zend_Form_Element_Password('EU_Password');
     $password->setLabel($this->getView()->getCibleText('form_label_newPwd'))->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextInput')->setAttrib('autocomplete', 'off');
     $this->addElement($password);
     // password confirmation
     $passwordConfirmation = new Zend_Form_Element_Password('PasswordConfirmation');
     $passwordConfirmation->setLabel($this->getView()->getCibleText('form_label_confirmNewPwd'))->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextInput');
     if (!empty($_POST['EU_Password'])) {
         $passwordConfirmation->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('error_message_password_isEmpty'))));
         $Identical = new Zend_Validate_Identical($_POST['EU_Password']);
         $Identical->setMessages(array('notSame' => $this->getView()->getCibleText('error_message_password_notSame')));
         $passwordConfirmation->addValidator($Identical);
     }
     $this->addElement($passwordConfirmation);
     if ($profile != true) {
         // html text
         $textAdministratorGroup = new Cible_Form_Element_Html('htmlAdministratorGroup', array('value' => $this->getView()->getCibleText('label_administrator_actives')));
         $this->addElement($textAdministratorGroup);
         $checkBox = new Zend_Form_Element_MultiCheckbox('groups');
         $checkBox->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'checkbox_list'))));
         //$checkBox->setDescription('<em>Example:</em> mydomain.com')
         //->addDecorator('Description', array('escape' => false));
         //show administrator group (first level)
         $groupAdmin = Cible_FunctionsAdministrators::getAdministratorGroupData(1)->toArray();
         $checkBox->addMultiOption("1", $groupAdmin['EGI_Name'] . " (" . $groupAdmin['EGI_Description'] . ")");
         $i = 0;
         foreach ($groupsData as $group) {
             if ($group['EG_Status'] == 'active') {
                 $checkBox->addMultiOption($group['EG_ID'], $group['EGI_Name'] . " (" . $group['EGI_Description'] . ")");
             }
             $i++;
         }
         $this->addElement($checkBox);
     }
 }
 /**
  * getFolderSecurity
  * @param Zend_Db_Table_Rowset_Abstract $objRowset
  * @author Thomas Schedler <*****@*****.**>
  * @version 1.0
  */
 public function getFolderSecurity($objRowset)
 {
     $this->core->logger->debug('core->views->helpers->FolderHelper->getFolderSecurity()');
     $strOutput = '';
     $arrZooluSecurity = array();
     $arrWebsiteSecurity = array();
     foreach ($objRowset as $objRow) {
         if ($this->core->sysConfig->zone->zoolu == $objRow->zone) {
             $arrZooluSecurity[] = $objRow->id;
         } else {
             if ($this->core->sysConfig->zone->website == $objRow->zone) {
                 $arrWebsiteSecurity[] = $objRow->id;
             }
         }
     }
     $arrGroups = array();
     $sqlStmt = $this->core->dbh->query("SELECT `id`, `title` FROM `groups` ORDER BY `title`")->fetchAll();
     foreach ($sqlStmt as $arrSql) {
         $arrGroups[$arrSql['id']] = $arrSql['title'];
     }
     $objZooluSecurityElement = new Zend_Form_Element_MultiCheckbox('ZooluSecurity', array('value' => $arrZooluSecurity, 'label' => $this->core->translate->_('groups', false), 'multiOptions' => $arrGroups, 'columns' => 6, 'class' => 'multiCheckbox'));
     $objZooluSecurityElement->addPrefixPath('Form_Decorator', GLOBAL_ROOT_PATH . 'library/massiveart/generic/forms/decorators/', 'decorator');
     $objZooluSecurityElement->setDecorators(array('Input'));
     $objWebsiteSecurityElement = new Zend_Form_Element_MultiCheckbox('WebsiteSecurity', array('value' => $arrWebsiteSecurity, 'label' => $this->core->translate->_('groups', false), 'multiOptions' => $arrGroups, 'columns' => 6, 'class' => 'multiCheckbox'));
     $objWebsiteSecurityElement->addPrefixPath('Form_Decorator', GLOBAL_ROOT_PATH . 'library/massiveart/generic/forms/decorators/', 'decorator');
     $objWebsiteSecurityElement->setDecorators(array('Input'));
     $strOutput .= '
 <div id="divTab_ZOOLU">
   ' . $objZooluSecurityElement->render() . '
 </div>
 <div id="divTab_Website" style="display:none;">
   ' . $objWebsiteSecurityElement->render() . '
 </div>';
     /**
      * return html output
      */
     return $strOutput;
 }