/**
  * Prepare form
  * 
  * @param Uni_Core_Form $form 
  */
 protected function _prepareForm(Uni_Core_Form $form)
 {
     $form->setName('menu')->setMethod('post');
     $subForm1 = new Zend_Form_SubForm();
     $subForm1->setLegend('Menu Item Information');
     $subForm1->setDescription('Menu Item Information');
     $idField = new Zend_Form_Element_Hidden('id');
     $title = new Zend_Form_Element_Text('title', array('class' => 'required', 'maxlength' => 200));
     $title->setRequired(true)->setLabel('Title')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $link = new Zend_Form_Element_Text('link', array('maxlength' => 200));
     $link->setLabel('Link')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDescription('Use module/controller/action for internal links or http://www.example.com for external links');
     $open_window = new Zend_Form_Element_Select('open_window', array('class' => 'required', 'maxlength' => 200));
     $open_window->setRequired(true)->setLabel('Open Window')->setMultiOptions(Fox::getModel('navigation/menu')->getAllTargetWindows());
     $status = new Zend_Form_Element_Select('status', array('class' => 'required', 'maxlength' => 200));
     $status->setRequired(true)->setLabel('Status')->setMultiOptions(Fox::getModel('navigation/menu')->getAllStatuses());
     $sort_order = new Zend_Form_Element_Text('sort_order', array('class' => 'required', 'maxlength' => 200));
     $sort_order->setRequired(true)->setLabel('Sort Order')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $style_class = new Zend_Form_Element_Text('style_class');
     $style_class->setLabel('Style Class')->addFilter('StripTags')->addFilter('StringTrim');
     $menugroup = new Zend_Form_Element_Multiselect('menu_group', array('class' => 'required'));
     $menugroup->setRequired(true)->setLabel('Menu Group')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setMultiOptions(Fox::getModel('navigation/menugroup')->getMenuGroupOptions());
     $subForm1->addElements(array($idField, $title, $link, $open_window, $sort_order, $style_class, $status, $menugroup));
     $form->addSubForm($subForm1, 'subform1');
     parent::_prepareForm($form);
 }
Пример #2
0
 public function populate(array $values)
 {
     $diseasesList = $this->_object->_diseasesSrc();
     $oDiseases = new DiseasesDetailsObject();
     $dData = $oDiseases->findData(array($oDiseases->getForeignKey() => $values[$this->_object->getForeignKey()]));
     $fieldSet = $this->getDisplayGroup('diseases');
     $i = 6;
     foreach ($diseasesList as $id => $disease) {
         $tmpForm = new FormDiseasesDetails(array('object' => $oDiseases, 'isXmlHttpRequest' => true));
         if (!empty($values['MR_Diseases']) && in_array($id, $values['MR_Diseases'])) {
             $oDiseases->setFilters(array($oDiseases->getForeignKey() => $values[$this->_object->getForeignKey()], 'DD_DiseaseId' => $id));
             $data = $oDiseases->getAll();
             $data[0]['DD_TypeMedic'] = explode(',', $data[0]['DD_TypeMedic']);
             $tmpForm->populate($data[0]);
         }
         $elems = $tmpForm->getElements();
         $test = new Zend_Form_SubForm();
         $test->setDisableLoadDefaultDecorators(true);
         $test->addElements($elems);
         $test->removeDecorator('DtDdWrapper');
         $test->setLegend('Détails pour ' . $disease);
         $test->setAttrib('class', 'infosFieldsetParent fieldsetDiseaseDetails');
         $test->setOrder($i++);
         $this->addSubForm($test, 'dd_' . $id);
     }
     parent::populate($values);
 }
Пример #3
0
 public function addTripLines($tripCount = 1, $startDate, $buses = array())
 {
     // create subform
     $tripLinePanel = new Zend_Form_SubForm();
     $tripLinePanel->setDecorators($this->_displayGroupDecorators)->addAttribs(array('class' => 'fieldsetForm span-8'));
     for ($i = 1; $i <= $tripCount; ++$i) {
         // create bus element
         $bus = $this->_createBusElement($buses);
         // create departure time element
         $departureTime = $this->_createElement('text', 'departureTime', 'Ngày giờ đi', 'Làm ơn nhập ngày giờ đi', true);
         $departureTime->setValue($startDate . ' 00:00:00');
         $departureTime->addValidator(new TBB_Validate_DepartureTime($startDate));
         // create arrival time element
         $arrivalTime = $this->_createElement('text', 'arrivalTime', 'Ngày giờ đến', 'Làm ơn nhập ngày giờ đến', true);
         $arrivalTime->setValue($startDate . ' 00:00:00');
         $arrivalTime->addValidator(new TBB_Validate_ArrivalTime());
         $fare = $this->_createElement('text', 'fare', 'Giá vé', 'Làm ơn nhập giá vé', false, true);
         // create trip line
         $tripLine = new Zend_Form_SubForm();
         $tripLine->setDecorators($this->_displayGroupDecorators)->addAttribs(array('class' => 'span-7'))->setLegend('Chuyến #' . $i);
         // add elements to the tripline
         $tripLine->addElements(array($bus, $departureTime, $arrivalTime, $fare));
         $tripLinePanel->addSubForm($tripLine, $i);
     }
     // add submit button
     $submit = $this->_createSubmitButton();
     $tripLinePanel->addElement($submit);
     $this->addSubForm($tripLinePanel, 'tripLines');
 }
Пример #4
0
 public function init()
 {
     $this->setAction('/core/submit/new');
     $type = new Zend_Form_Element_MultiCheckbox('submission_type');
     $type->setLabel('')->setRequired(false)->setAttrib('class', 'tiny')->addMultiOptions($this->_getFieldValues('submission_type'))->setSeparator('<br />')->setDecorators(array('Composite'));
     $title = new Zend_Form_Element_Text('title');
     $title->setLabel('Title')->setRequired(true)->addValidator('StringLength', true, array(2, 64, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Please provide a longer title', Zend_Validate_StringLength::TOO_LONG => 'Your title is too long')))->setAttrib('class', 'medium')->setDescription('Must be between 2 and 64 characters')->setAttrib('maxLength', 64)->setDecorators(array('Composite'));
     $audience = new Zend_Form_Element_Radio('target_audience');
     $audience->setLabel('Please mark the target audience for your presentation')->setRequired(true)->setAttrib('class', 'tiny')->addMultiOptions($this->_getFieldValues('target_audience'))->setSeparator('<br />')->setDecorators(array('Composite'));
     $publish = new Zend_Form_Element_Radio('publish_paper');
     $publish->setLabel('Please indicate whether you wish to prepare a full paper for possible publication')->setRequired(true)->setAttrib('class', 'tiny')->addMultiOptions($this->_getFieldValues('publish_paper', 'submit'))->setSeparator('<br />')->setDecorators(array('Composite'));
     $topicModel = new Core_Model_Topic();
     $topicsForSelect = $topicModel->getTopicsForSelect();
     $topicsel = new Zend_Form_Element_MultiCheckbox('topic');
     $topicsel->setLabel('Topic')->setRequired(false)->setAttrib('class', 'tiny')->setMultiOptions($topicsForSelect)->setSeparator('<br />')->setDecorators(array('Composite'));
     $keywords = new Zend_Form_Element_Text('keywords');
     $keywords->setLabel('Keywords')->setRequired(false)->addValidator('StringLength', true, array(2, 500, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Please provide longer keywords', Zend_Validate_StringLength::TOO_LONG => 'Your keywords are too long')))->setAttrib('class', 'medium')->setDescription('Must be between 2 and 500 characters')->setDecorators(array('Composite'));
     $abstract = new Zend_Form_Element_Textarea('abstract');
     $abstract->setLabel('Submission Summary (If your submission is accepted, this will be publicly visible!)')->setAttrib('class', 'small')->setDescription('Must be between 5 and 2000 characters')->setRequired(false)->addValidator('StringLength', true, array(5, 2000, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Please provide a longer abstract', Zend_Validate_StringLength::TOO_LONG => 'Your abstract is too long')))->setDecorators(array('Composite'));
     $comment = new Zend_Form_Element_Textarea('comment');
     $comment->setLabel('Information for Reviewers')->setAttrib('class', 'small')->setDescription('Must be between 5 and 1000 characters')->setRequired(false)->addValidator('StringLength', true, array(5, 1000, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Please provide a longer description', Zend_Validate_StringLength::TOO_LONG => 'Your description is too long')))->setDecorators(array('Composite'));
     $file = new TA_Form_Element_MagicFile('file');
     $file->setLabel('Your submission (File must be pdf and no bigger than 10Mb) *')->setRequired(false)->addDecorators($this->_magicFileElementDecorator)->addValidators(array(array('Count', true, 1), array('Size', true, 10000000), array('Extension', true, array('pdf', 'case' => true)), array('MimeType', false, array('application/pdf'))));
     $file->getValidator('Extension')->setMessage('Only pdf files are allowed!');
     $subform = new Zend_Form_SubForm();
     $subform->setDecorators(array('FormElements'));
     $subform->addElements(array($type, $file, $title, $audience, $topicsel, $keywords, $abstract, $comment));
     $this->addSubForm($subform, 'submission');
     $this->addElement('submit', 'submit', array('label' => 'Submit', 'decorators' => $this->_buttonElementDecorator));
 }
Пример #5
0
 public function init()
 {
     $this->setAttrib('class', 'horizontal-form');
     $elements = array();
     $elements[] = $this->createElement('hidden', 'id_fe_registration')->setDecorators(array('ViewHelper'));
     $elements[] = $this->createElement('hidden', 'fk_id_perdata')->setDecorators(array('ViewHelper'));
     $elements[] = $this->createElement('hidden', 'entity')->setIsArray(true);
     $elements[] = $this->createElement('text', 'client_name')->setDecorators($this->getDefaultElementDecorators())->setAttrib('readOnly', true)->setRequired(true)->setAttrib('class', 'm-wrap span12 focused')->setLabel('Naran Kompletu');
     $elements[] = $this->createElement('text', 'client_fone')->setDecorators($this->getDefaultElementDecorators())->setAttrib('readOnly', true)->setAttrib('class', 'm-wrap span12 focused')->setLabel('Kontatu');
     $elements[] = $this->createElement('text', 'email')->setDecorators($this->getDefaultElementDecorators())->setAttrib('readOnly', true)->setAttrib('class', 'm-wrap span12 focused')->setLabel('E-mail');
     $elements[] = $this->createElement('text', 'evidence')->setDecorators($this->getDefaultElementDecorators())->setAttrib('readOnly', true)->setRequired(true)->setAttrib('class', 'm-wrap span12 focused')->setLabel('Kartaun Evidensia');
     $elements[] = $this->createElement('text', 'electoral')->setDecorators($this->getDefaultElementDecorators())->setAttrib('readOnly', true)->setRequired(true)->setAttrib('class', 'm-wrap span12 focused')->setLabel('Kartaun Eleitoral');
     $elements[] = $this->createElement('text', 'date_inserted')->setDecorators($this->getDefaultElementDecorators())->setAttrib('maxlength', 10)->setAttrib('class', 'm-wrap span12')->setLabel('Data');
     $mapperScholarityArea = new Register_Model_Mapper_ScholarityArea();
     $sections = $mapperScholarityArea->fetchAll();
     $optScholarityArea[''] = '';
     foreach ($sections as $section) {
         $optScholarityArea[$section['id_scholarity_area']] = $section['scholarity_area'];
     }
     $dbOccupationTimor = App_Model_DbTable_Factory::get('PROFOcupationTimor');
     $occupations = $dbOccupationTimor->fetchAll();
     $optOccupations[''] = '';
     foreach ($occupations as $occupation) {
         $optOccupations[$occupation['id_profocupationtimor']] = $occupation['acronym'] . ' ' . $occupation['ocupation_name_timor'];
     }
     $dbScholarityLevel = App_Model_DbTable_Factory::get('PerLevelScholarity');
     $levels = $dbScholarityLevel->fetchAll(array(), array('id_perlevelscholarity'));
     $optLevel[''] = '';
     foreach ($levels as $level) {
         $optLevel[$level->id_perlevelscholarity] = $level->level_scholarity;
     }
     $elementsProfessional = array();
     $elementsProfessional[] = $this->createElement('select', 'area')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen focused')->setLabel('Area Kursu')->setBelongsTo('professional')->addMultiOptions($optScholarityArea);
     $elementsProfessional[] = $this->createElement('select', 'occupation')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->setLabel('Dezignasaun')->setBelongsTo('professional')->addMultiOptions($optOccupations);
     $elementsProfessional[] = $this->createElement('select', 'level')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->addMultiOptions($optLevel)->setBelongsTo('professional')->setLabel('Nivel');
     $professionalSubForm = new Zend_Form_SubForm();
     $professionalSubForm->addElements($elementsProfessional);
     $this->addSubForm($professionalSubForm, 'professional');
     $elementsFormation = array();
     $elementsFormation[] = $this->createElement('select', 'area')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen focused')->setLabel('Area Kursu')->setBelongsTo('formation')->addMultiOptions($optScholarityArea);
     $elementsFormation[] = $this->createElement('select', 'occupation')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->setLabel('Dezignasaun')->setBelongsTo('formation')->addMultiOptions($optOccupations);
     $elementsFormation[] = $this->createElement('select', 'level')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->addMultiOptions($optLevel)->setBelongsTo('formation')->setLabel('Nivel');
     $formationSubForm = new Zend_Form_SubForm();
     $formationSubForm->addElements($elementsFormation);
     $this->addSubForm($formationSubForm, 'formation');
     $selectedElements = array();
     $selectedElements[] = $this->createElement('select', 'area')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen focused')->setLabel('Area Kursu')->setBelongsTo('selected')->setRequired(true)->addMultiOptions($optScholarityArea);
     $selectedElements[] = $this->createElement('select', 'occupation')->setDecorators($this->getDefaultElementDecorators())->setAttrib('class', 'm-wrap span12 chosen')->setLabel('Dezignasaun')->setBelongsTo('selected')->setRequired(true)->addMultiOptions($optOccupations);
     $selectedSubForm = new Zend_Form_SubForm();
     $selectedSubForm->addElements($selectedElements);
     $this->addSubForm($selectedSubForm, 'selected');
     $this->addElements($elements);
     App_Form_Toolbar::build($this, self::ID);
     $this->setDecorators($this->getDefaultFormDecorators());
 }
Пример #6
0
 public function indexAction()
 {
     // action body
     $idEncuesta = $this->getParam("idEncuesta");
     $encuesta = $this->encuestaDAO->obtenerEncuesta($idEncuesta);
     $secciones = $this->seccionDAO->obtenerSecciones($idEncuesta);
     $formulario = new Zend_Form($encuesta->getHash());
     //debemos agregar a este formulario campos para identificar quien es el que esta llenando esta encuesta
     $eSubCabecera = new Zend_Form_SubForm();
     $eSubCabecera->setLegend("Datos Personales: ");
     $eEncuesta = new Zend_Form_Element_Hidden("idEncuesta");
     $eEncuesta->setValue($idEncuesta);
     $eReferencia = new Zend_Form_Element_Text("referencia");
     $eReferencia->setLabel("Boleta o Clave : ");
     $eReferencia->setAttrib("class", "form-control");
     $eReferencia->setDecorators($this->decoratorsPregunta);
     $eSubCabecera->addElements(array($eEncuesta, $eReferencia));
     $eSubCabecera->setDecorators($this->decoratorsSeccion);
     $formulario->addSubForm($eSubCabecera, "referencia");
     //============================================= Iteramos a traves de las secciones del grupo
     foreach ($secciones as $seccion) {
         //============================================= Cada seccion es una subforma
         $subFormSeccion = new Zend_Form_SubForm($seccion->getHash());
         $subFormSeccion->setLegend("Sección: " . $seccion->getNombre());
         //============================================= Obtenemos los elemntos de la seccion
         $elementos = $this->seccionDAO->obtenerElementos($seccion->getIdSeccion());
         foreach ($elementos as $elemento) {
             //============================================= Verificamos que tipo de elemento es
             if ($elemento instanceof Encuesta_Model_Pregunta) {
                 //============================================= Aqui ya la agregamos a la seccion
                 $this->agregarPregunta($subFormSeccion, $elemento);
             } elseif ($elemento instanceof Encuesta_Model_Grupo) {
                 //============================================= un grupo es otra subform
                 $subFormGrupo = new Zend_Form_SubForm($elemento->getHash());
                 $subFormGrupo->setLegend("Grupo: " . $elemento->getNombre());
                 $preguntasGrupo = $this->grupoDAO->obtenerPreguntas($elemento->getIdGrupo());
                 foreach ($preguntasGrupo as $pregunta) {
                     //============================================= Aqui ya la agregamos al grupo
                     $this->agregarPregunta($subFormGrupo, $pregunta);
                 }
                 $subFormGrupo->setDecorators($this->decoratorsGrupo);
                 $subFormSeccion->addSubForm($subFormGrupo, $elemento->getIdGrupo());
             }
         }
         $subFormSeccion->setDecorators($this->decoratorsSeccion);
         $formulario->addSubForm($subFormSeccion, $seccion->getIdSeccion());
     }
     $eSubmit = new Zend_Form_Element_Submit("submit");
     $eSubmit->setLabel("Enviar Encuesta");
     $eSubmit->setAttrib("class", "btn btn-success");
     $formulario->addElement($eSubmit);
     $formulario->setDecorators($this->formDecorators);
     $this->view->encuesta = $encuesta;
     $this->view->formulario = $formulario;
 }
Пример #7
0
 public function init()
 {
     $this->setName('addApplicant');
     $id = new Zend_Form_Element_Hidden('id');
     $id->addFilter('Int');
     $product = new Zend_Form_Element_Text('product');
     $product->setLabel('* product:')->setRequired(true)->addFilter('StripTags')->addFilter('stringTrim')->addValidators(array(array('regex', false, array('pattern' => "/^[а,б,в,г,ґ,д,е,є,ж,з,и,ы,і,ї,й,к,л,м,н,о,п,р,с,т,у,ф,х,ц,ч,ш,щ,ь,ю,я,А,Б,В,С,Г,Д,Е,Є,Ж,З,И,Ы,І,Ї,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Ь,Ю,Я,A,a,B,b,C,c,D,d,E,e,F,f,G,g,H,h,I,i,J,j,K,k,L,l,M,m,N,n,O,o,P,p,Q,q,R,r,S,s,T,t,U,u,V,v,W,w,X,x,Y,y,Z,z,1,2,3,4,5,6,7,8,9,0'.]{2,}\$/", 'messages' => 'В полі присутні заборонені символи!!'))));
     $category = new Zend_Form_Element_Text('category');
     $category->setLabel("* category:")->setRequired(true)->addFilter('StripTags')->addFilter('stringTrim')->addValidators(array(array('regex', false, array('pattern' => "/^[а,б,в,г,ґ,д,е,є,ж,з,и,ы,і,ї,й,к,л,м,н,о,п,р,с,т,у,ф,х,ц,ч,ш,щ,ь,ю,я,А,Б,В,С,Г,Д,Е,Є,Ж,З,И,Ы,І,Ї,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Ь,Ю,Я,A,a,B,b,C,c,D,d,E,e,F,f,G,g,H,h,I,i,J,j,K,k,L,l,M,m,N,n,O,o,P,p,Q,q,R,r,S,s,T,t,U,u,V,v,W,w,X,x,Y,y,Z,z,1,2,3,4,5,6,7,8,9,0'.]{2,}\$/", 'messages' => 'В полі присутні заборонені символи!!'))));
     $group = new Zend_Form_Element_Text('group');
     $group->setLabel("* group:")->setRequired(true)->addFilter('StripTags')->addFilter('stringTrim')->addValidators(array(array('regex', false, array('pattern' => "/^[а,б,в,г,ґ,д,е,є,ж,з,и,ы,і,ї,й,к,л,м,н,о,п,р,с,т,у,ф,х,ц,ч,ш,щ,ь,ю,я,А,Б,В,С,Г,Д,Е,Є,Ж,З,И,Ы,І,Ї,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Ь,Ю,Я,A,a,B,b,C,c,D,d,E,e,F,f,G,g,H,h,I,i,J,j,K,k,L,l,M,m,N,n,O,o,P,p,Q,q,R,r,S,s,T,t,U,u,V,v,W,w,X,x,Y,y,Z,z,1,2,3,4,5,6,7,8,9,0'.]{2,}\$/", 'messages' => 'В полі присутні заборонені символи!!'))));
     $this->addElements(array($id, $product, $category, $group));
     //-------------------- add attr
     $institutions = new Zend_Form_SubForm();
     $institutions->setName('attr');
     $session = new Zend_Session_Namespace('form');
     foreach ($session->attr as $inst) {
         $rowForm = new Zend_Form_SubForm();
         $rowForm->setName($inst);
         if ($inst === '__template1__') {
             $rowForm->setAttrib('style', 'display: none;');
         }
         $instName = new Zend_Form_Element_Text('instName');
         $instName->setLabel('attribute')->addFilter('StripTags')->addFilter('stringTrim')->setAttrib('class', 'institution')->setAttrib('onfocus', 'institutionAutocomplete(this)');
         if ($inst !== '__template1__') {
             $instName->setRequired(true);
         }
         $inst_remove = new Zend_Form_Element_Button('remove');
         $inst_remove->setLabel('remove')->setAttrib('class', 'remove')->setAttrib('onclick', 'removeInst(this)');
         $elements = array($instName, $inst_remove);
         foreach ($elements as $element) {
             if ($inst !== '__template1__' && $element->getName() !== 'remove') {
                 $element->setRequired(true);
             }
         }
         $rowForm->addElements($elements);
         $rowForm->setElementDecorators($this->getElementDecorators());
         $rowForm->getElement('remove')->removeDecorator('Label');
         $rowForm->setDecorators($this->getSubFormDecorators());
         $institutions->addSubForm($rowForm, $inst);
     }
     $institutions->setDecorators($this->getSubFormDecorators());
     $inst_add = new Zend_Form_Element_Button('addInst');
     $inst_add->setLabel('add attribute')->setAttrib('class', 'addInst');
     $institutions->addElement($inst_add);
     $institutions->setElementDecorators($this->getElementDecorators());
     $institutions->getElement('addInst')->removeDecorator('Label');
     $this->addSubForm($institutions, 'institutions');
     $this->postSetup();
 }
Пример #8
0
 public function init()
 {
     /* Form Elements & Other Definitions Here ... */
     $subForm = new Zend_Form_SubForm();
     $subForm->setLegend("Alta de Municipio");
     $eMunicipio = new Zend_Form_Element_Text('municipio');
     $eMunicipio->setLabel('Municipio:');
     $eMunicipio->setAttrib("class", "form-control");
     $eAgregar = new Zend_Form_Element_Submit('agregar');
     $eAgregar->setLabel('Agregar');
     $eAgregar->setAttrib("class", "btn btn-primary");
     $subForm->addElements(array($eMunicipio, $eAgregar));
     $this->addElements(array($eMunicipio, $eAgregar));
 }
 /**
  * Prepare form
  * 
  * @param Uni_Core_Form $form
  */
 protected function _prepareForm(Uni_Core_Form $form)
 {
     $form->setName('admin_email_template')->setMethod('post');
     $id = $this->getRequest()->getParam('id');
     $subForm1 = new Zend_Form_SubForm();
     $subForm1->setLegend('Email Template Information');
     $subForm1->setDescription('Email Template Information');
     $idField = new Zend_Form_Element_Hidden('id');
     $templateName = new Zend_Form_Element_Select('template_name', array('onchange' => 'getTemplateRecord(this)'));
     $templateName->setRequired(false)->setLabel('Template Name')->setDescription('Choose existing template to load its content')->setMultiOptions(Fox::getModel('core/email/template')->getAllTemplates());
     $name = new Zend_Form_Element_Text('name', array('size' => '30', 'maxlength' => 200, 'class' => 'required'));
     $name->setRequired(true)->setLabel('Name')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $subject = new Zend_Form_Element_Text('subject', array('size' => '30', 'maxlength' => 200, 'class' => 'required'));
     $subject->setRequired(true)->setLabel('Subject')->addValidator('NotEmpty');
     $content = new Uni_Core_Form_Element_Editor('content', array('size' => '30', 'maxlength' => 200, 'class' => 'required'));
     $content->setRequired(true)->setLabel('Content')->addValidator('NotEmpty');
     if (!$id) {
         $subForm1->addElements(array($idField, $templateName, $name, $subject, $content));
     } else {
         $subForm1->addElements(array($idField, $name, $subject, $content));
     }
     $form->addSubForm($subForm1, 'subform1');
     parent::_prepareForm($form);
 }
Пример #10
0
 public function init()
 {
     // Create user sub form: username and password
     $user = new Zend_Form_SubForm();
     $user->addElements(array(new Zend_Form_Element_Text('username', array('required' => true, 'label' => 'Username:'******'filters' => array('StringTrim', 'StringToLower'), 'validators' => array('Alnum', array('Regex', false, array('/^[a-z][a-z0-9]{2,}$/'))))), new Zend_Form_Element_Password('password', array('required' => true, 'label' => 'Password:'******'filters' => array('StringTrim'), 'validators' => array('NotEmpty', array('StringLength', false, array(6)))))));
     // Create demographics sub form: given name, family name, and
     // location
     $demog = new Zend_Form_SubForm();
     $demog->addElements(array(new Zend_Form_Element_Text('givenName', array('required' => true, 'label' => 'Given (First) Name:', 'filters' => array('StringTrim'), 'validators' => array(array('Regex', false, array('/^[a-z][a-z0-9., \'-]{2,}$/i'))))), new Zend_Form_Element_Text('familyName', array('required' => true, 'label' => 'Family (Last) Name:', 'filters' => array('StringTrim'), 'validators' => array(array('Regex', false, array('/^[a-z][a-z0-9., \'-]{2,}$/i'))))), new Zend_Form_Element_Text('location', array('required' => true, 'label' => 'Your Location:', 'filters' => array('StringTrim'), 'validators' => array(array('StringLength', false, array(2)))))));
     // Create mailing lists sub form
     $listOptions = array('none' => 'No lists, please', 'fw-general' => 'Zend Framework General List', 'fw-mvc' => 'Zend Framework MVC List', 'fw-auth' => 'Zend Framwork Authentication and ACL List', 'fw-services' => 'Zend Framework Web Services List');
     $lists = new Zend_Form_SubForm();
     $lists->addElements(array(new Zend_Form_Element_MultiCheckbox('subscriptions', array('disableTranslator' => true, 'label' => 'Which lists would you like to subscribe to?', 'multiOptions' => $listOptions, 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('InArray', false, array(array_keys($listOptions))))))));
     // Attach sub forms to main form
     $this->addSubForms(array('user' => $user, 'demog' => $demog, 'lists' => $lists));
 }
Пример #11
0
 public function init()
 {
     parent::init();
     $this->setAction('/core/session/files');
     $this->setAttrib('enctype', 'multipart/form-data');
     $id = new Zend_Form_Element_Hidden('session_id');
     $id->setRequired(true)->addValidators(array('Int'))->setDecorators(array('Composite'));
     // the name of this form element must be of an existing filetype
     $file1 = new TA_Form_Element_MagicFile('slides');
     $file1->setLabel('Session slide')->setDescription('')->addDecorators($this->_magicFileElementDecorator)->setValueDisabled(true)->addValidators(array(array('Count', true, 1), array('Size', true, array('max' => '4Mb'))));
     $subForm = new Zend_Form_SubForm();
     $subForm->addElements(array($file1))->setDecorators(array('FormElements'));
     $this->addSubForm($subForm, 'files');
     $this->addElements(array($id));
     $this->addElement('submit', 'submit', array('label' => 'Submit', 'decorators' => $this->_buttonElementDecorator));
 }
Пример #12
0
 public function init()
 {
     $subForm = new Zend_Form_SubForm();
     $subForm->setLegend('adsFields');
     $validateNonZeroValue = new Zend_Validate_GreaterThan(0);
     $validateDate = new Zend_Validate_Date('Y-m-d');
     $elementUserId = new Zend_Form_Element_Hidden('user_id');
     $elementLanguageId = new Zend_Form_Element_Hidden('language_id');
     $elementActive = new Zend_Form_Element_Hidden('active');
     $elementActive->setValue(1);
     $elementAdsCategoryId = new Zend_Form_Element_Select('ads_category_id');
     $elementAdsCategoryId->setLabel('adsCategoryId');
     $elementAdsCategoryId->setMultiOptions(Ads_Categories::getSelectOptions());
     $elementAdsCategoryId->addValidator($validateNonZeroValue);
     $elementAdsCategoryId->setRequired(true);
     $elementAdsTypeId = new Zend_Form_Element_Select('ads_type_id');
     $elementAdsTypeId->setLabel('adsTypeId');
     $elementAdsTypeId->setMultiOptions(Ads_Types::getSelectOptions());
     $elementAdsTypeId->addValidator($validateNonZeroValue);
     $elementAdsTypeId->setRequired(true);
     $elementValidBefore = new Standart_Form_Element_Date('valid_until');
     $elementValidBefore->setLabel('adsValidUntil');
     $elementValidBefore->addValidator($validateDate);
     $elementValidBefore->setRequired(true);
     $elementTitle = new Zend_Form_Element_Text('title');
     $elementTitle->setLabel('adsTitle');
     $elementTitle->setAttrib('size', 75);
     $elementTitle->setRequired(true);
     $elementDescription = new Zend_Form_Element_Textarea('description');
     $elementDescription->setLabel('adsDescription');
     $elementDescription->setRequired(true);
     $captchaImage = new Zend_Captcha_Image();
     $captchaImage->setFont(Standart_Main::getDirs('fonts', 'arial.ttf'));
     $captchaImage->setFontSize(30);
     $captchaImage->setWordlen(6);
     $captchaImage->setImgDir(Standart_Main::getDirs('wwwStatic', array('images', 'captcha')));
     $captchaImage->setImgUrl(Zend_Registry::get('config')->host->static . '/images/captcha/');
     $captchaImage->setWidth(175);
     $captchaImage->setHeight(75);
     $captchaImage->setName('captcha');
     $elementCaptcha = new Zend_Form_Element_Captcha('captcha', array('captcha' => $captchaImage));
     $elementDoSave = new Zend_Form_Element_Submit('doSave');
     $subForm->addElements(array($elementUserId, $elementLanguageId, $elementActive, $elementAdsCategoryId, $elementAdsTypeId, $elementValidBefore, $elementTitle, $elementDescription, $elementCaptcha));
     $this->addSubForm($subForm, 'ads');
     $this->addElement($elementDoSave);
 }
Пример #13
0
 public function init()
 {
     parent::init();
     $this->setAttrib('enctype', 'multipart/form-data');
     $id = new Zend_Form_Element_Hidden('presentation_id');
     $id->setRequired(true)->addValidators(array('Int'))->setDecorators(array('Composite'));
     $paper = new TA_Form_Element_MagicFile('paper');
     $paper->setLabel('Paper')->setDescription('OpenOffice, PDF, and Microsoft Word are acceptable formats.')->addDecorators($this->_magicFileElementDecorator)->setValueDisabled(true)->addValidators(array(array('Count', true, 1), array('Size', true, array('max' => '64Mb'))));
     $slides = new TA_Form_Element_MagicFile('slides');
     $slides->setLabel('Slides')->setDescription('Microsoft Powerpoint, OpenOffice, and PDF are acceptable formats.')->addDecorators($this->_magicFileElementDecorator)->setValueDisabled(true)->addValidators(array(array('Count', true, 1), array('Size', true, array('max' => '64Mb'))));
     $file1 = new TA_Form_Element_MagicFile('misc');
     $file1->setLabel('Extra file')->setDescription('')->addDecorators($this->_magicFileElementDecorator)->setValueDisabled(true)->addValidators(array(array('Count', true, 1), array('Size', true, array('max' => '64Mb'))));
     $subForm = new Zend_Form_SubForm();
     $subForm->addElements(array($paper, $slides, $file1))->setDecorators(array('FormElements'));
     $this->addSubForm($subForm, 'files');
     $this->addElements(array($id));
     $this->addElement('submit', 'submit', array('label' => 'Submit', 'decorators' => $this->_buttonElementDecorator));
 }
Пример #14
0
 public function init()
 {
     parent::init();
     $this->setAction('/core/conference/timeslots');
     $conferenceId = new Zend_Form_Element_Hidden('conference_id');
     $conferenceId->setRequired(true)->addValidators(array('Int'))->setDecorators($this->_hiddenElementDecorator);
     $timeslot = new TA_Form_Element_Timeslot('timeslot_1');
     $timeslot->clearDecorators()->addDecorator(new TA_Form_Decorator_Timeslot())->setIgnore(true)->setAttrib('class', 'hidden');
     // since this element will be used as a template, hide it!
     // add timeslot elements to subform so in isValid() I only have to loop over that form
     $subform = new Zend_Form_SubForm();
     $subform->setDecorators(array('FormElements'));
     $subform->addElements(array($timeslot));
     $this->addSubForm($subform, 'dynamic');
     $this->addElements(array($conferenceId));
     $this->addElement('button', 'add', array('label' => 'Add new timeslot', 'decorators' => $this->_buttonElementDecorator));
     $this->addElement('submit', 'submit', array('label' => 'Submit', 'decorators' => $this->_buttonElementDecorator));
 }
Пример #15
0
 /**
  * Prepare form
  * 
  * @param Uni_Core_Form $form
  */
 protected function _prepareForm(Uni_Core_Form $form)
 {
     $form->setName('cms_block')->setMethod('post');
     $subForm1 = new Zend_Form_SubForm();
     $subForm1->setLegend('Block Information');
     $subForm1->setDescription('Block Information');
     $idField = new Zend_Form_Element_Hidden('id');
     $title = new Zend_Form_Element_Text('title', array('size' => '30', 'maxlength' => 200, 'class' => 'required'));
     $title->setRequired(true)->setLabel('Title')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $identifer = new Zend_Form_Element_Text('identifier_key', array('size' => '30', 'maxlength' => 200, 'class' => 'required'));
     $identifer->setRequired(true)->setLabel('Identifer Key')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $content = new Uni_Core_Form_Element_Editor('content', array('cols' => '50', 'rows' => '20', 'class' => 'required'));
     $content->setRequired(true)->setLabel('Content');
     $status = new Zend_Form_Element_Select('status', array('class' => 'required'));
     $status->setRequired(true)->setLabel('Status')->setMultiOptions(Fox::getModel('cms/block')->getAllStatuses());
     $subForm1->addElements(array($idField, $title, $identifer, $content, $status));
     $form->addSubForm($subForm1, 'subform1');
     parent::_prepareForm($form);
 }
Пример #16
0
 public function init()
 {
     /* Form Elements & Other Definitions Here ... */
     $subForm = new Zend_Form_SubForm();
     $subForm->setLegend("Alta de Estado");
     $eEstado = new Zend_Form_Element_Text('estado');
     $eEstado->setLabel('Estado:');
     $eEstado->setAttrib("class", "form-control");
     $eCapital = new Zend_Form_Element_Text('capital');
     $eCapital->setLabel('Capital:');
     $eCapital->setAttrib("class", "form-control");
     $eAgregar = new Zend_Form_Element_Submit('agregar');
     $eAgregar->setLabel('Agregar');
     $eAgregar->setAttrib("class", "btn btn-primary");
     $subForm->addElements(array($eEstado, $eCapital, $eAgregar));
     //$this->addSubForm($subForm, "alta");
     //$this->addElement($eEstado);
     //$this->addElement($eAgregar);
     $this->addElements(array($eEstado, $eCapital, $eAgregar));
 }
Пример #17
0
 /**
  * Prepare form
  * 
  * @param Uni_Core_Form $form 
  */
 protected function _prepareForm(Uni_Core_Form $form)
 {
     $form->setName('menugroup')->setMethod('post');
     $subForm1 = new Zend_Form_SubForm();
     $subForm1->setLegend('Menu Group Information');
     $subForm1->setDescription('Menu Group Information');
     $idField = new Zend_Form_Element_Hidden('id');
     $name = new Zend_Form_Element_Text('name', array('class' => 'required', 'maxlength' => 200));
     $name->setRequired(true)->setLabel('Name')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $status = new Zend_Form_Element_Select('status', array('class' => 'required', 'maxlength' => 200));
     $status->setRequired(true)->setLabel('Status')->setMultiOptions(Fox::getModel('navigation/menugroup')->getAllStatuses());
     $sort_order = new Zend_Form_Element_Text('sort_order', array('class' => 'required', 'maxlength' => 200));
     $sort_order->setRequired(true)->setLabel('Sort Order')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $key = new Zend_Form_Element_Text('key', array('class' => 'required', 'maxlength' => 200));
     $key->setRequired(true)->setLabel('Key')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $description = new Zend_Form_Element_Textarea('description', array('cols' => '60', 'rows' => '10'));
     $subForm1->addElements(array($idField, $name, $sort_order, $key, $status, $description));
     $form->addSubForm($subForm1, 'subform1');
     parent::_prepareForm($form);
 }
Пример #18
0
 /**
  * Prepare form
  * 
  * @param Uni_Core_Form $form 
  */
 protected function _prepareForm(Uni_Core_Form $form)
 {
     $userId = $this->getRequest()->getParam('id', FALSE);
     $form->setName('admin_user')->setMethod('post');
     $subForm1 = new Zend_Form_SubForm();
     $subForm1->setLegend('User Information');
     $subForm1->setDescription('General User Information');
     $subForm2 = new Zend_Form_SubForm();
     $subForm2->setLegend('User Role');
     $subForm2->setDescription('User Role');
     $idField = new Zend_Form_Element_Hidden('id');
     $username = new Zend_Form_Element_Text('username', array('size' => '30', 'maxlength' => 200, 'class' => 'required'));
     $username->setRequired(true)->setLabel('Username')->addFilter('StripTags')->addFilter('StringTrim')->setDescription('Username should be unique')->addValidator('NotEmpty');
     $firstname = new Zend_Form_Element_Text('firstname', array('size' => '30', 'maxlength' => 200, 'class' => 'required'));
     $firstname->setRequired(true)->setLabel('First Name')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $lastname = new Zend_Form_Element_Text('lastname', array('size' => '30', 'maxlength' => 200, 'class' => 'required'));
     $lastname->setRequired(true)->setLabel('Last Name')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $password = new Zend_Form_Element_Password('password', array('size' => '30', 'maxlength' => 200, 'class' => !$userId ? 'required' : ''));
     if (!$userId) {
         $password->setRequired(true);
     }
     $password->setLabel('Password')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $cPassword = new Zend_Form_Element_Password('c_password', array('size' => '30', 'maxlength' => 200, 'class' => !$userId ? 'required' : ''));
     if (!$userId) {
         $cPassword->setRequired(true);
     }
     $cPassword->setLabel('Confirm Password')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $email = new Zend_Form_Element_Text('email', array('size' => '30', 'maxlength' => 200, 'class' => 'required'));
     $email->setRequired(true)->setLabel('Email ID')->addFilter('StripTags')->setDescription('Email ID should be unique')->addFilter('StringTrim')->addValidator('NotEmpty');
     $contact = new Zend_Form_Element_Text('contact', array('size' => '30', 'maxlength' => 200));
     $contact->setLabel('Contact')->addFilter('StripTags')->addFilter('StringTrim');
     $status = new Zend_Form_Element_Select('status', array('class' => 'required'));
     $status->setRequired(true)->setLabel('Status')->setMultiOptions(Fox::getModel('admin/user')->getAllStatuses());
     $roleId = new Zend_Form_Element_Select('role_id', array('class' => 'required'));
     $roleId->setRequired(true)->setLabel('Role')->setMultiOptions(Fox::getModel('admin/role')->getUserRole());
     $subForm1->addElements(array($idField, $username, $firstname, $lastname, $email, $password, $cPassword, $contact, $status));
     $subForm2->addElements(array($roleId));
     $form->addSubForm($subForm1, 'subform1');
     $form->addSubForm($subForm2, 'subform2');
     parent::_prepareForm($form);
 }
Пример #19
0
 /**
  * Prepare form
  * 
  * @param Uni_Core_Form $form 
  */
 protected function _prepareForm(Uni_Core_Form $form)
 {
     $form->setName('contact_reply')->setMethod('post');
     $subForm1 = new Zend_Form_SubForm();
     $subForm1->setLegend('Contact Information');
     $subForm1->setDescription('Contact Information');
     $idField = new Zend_Form_Element_Hidden('id');
     $name = new Zend_Form_Element_Text('name', array('size' => '30', 'maxlength' => 200, 'class' => 'required', 'readonly' => 'readonly'));
     $name->setRequired(true)->setLabel('Name')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $email = new Zend_Form_Element_Text('email', array('size' => '30', 'maxlength' => 200, 'class' => 'email required', 'readonly' => 'readonly'));
     $email->setRequired(true)->setLabel('Email')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $subject = new Zend_Form_Element_Text('subject', array('size' => '30', 'maxlength' => 200, 'class' => 'required', 'readonly' => 'readonly'));
     $subject->setRequired(true)->setLabel('Subject')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $message = new Zend_Form_Element_Textarea('message', array('cols' => '30', 'rows' => '5', 'class' => 'required', 'readonly' => 'readonly'));
     $message->setRequired(true)->setLabel('Message')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $reply = new Zend_Form_Element_Textarea('reply_message', array('cols' => '30', 'rows' => '5', 'class' => 'required'));
     $reply->setRequired(true)->setLabel('Reply Message')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $subForm1->addElements(array($idField, $name, $subject, $email, $message, $reply));
     $form->addSubForm($subForm1, 'subform1');
     parent::_prepareForm($form);
 }
Пример #20
0
 /**
  * Prepare form
  * 
  * @param Uni_Core_Form $form 
  */
 protected function _prepareForm(Uni_Core_Form $form)
 {
     $form->setName('change_password')->setMethod('post');
     $subForm1 = new Zend_Form_SubForm();
     $subForm1->setLegend('Change Member Password');
     $subForm1->setDescription('Change Member Password');
     $idField = new Zend_Form_Element_Hidden('id');
     $emailFieldOptions = array('size' => '30', 'maxlength' => 200, 'class' => 'required email');
     if ($this->getRequest()->getParam('id') && Fox::getModel('member/member')->load($this->getRequest()->getParam('id'))) {
         $emailFieldOptions['readonly'] = 'readonly';
     }
     $emailId = new Zend_Form_Element_Text('email_id', $emailFieldOptions);
     $emailId->setRequired(true)->setLabel('Email Id')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $password = new Zend_Form_Element_Password('password', array('size' => '30', 'maxlength' => 200, 'class' => 'required'));
     $password->setRequired(true)->setLabel('Password')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $cPassword = new Zend_Form_Element_Password('c_password', array('size' => '30', 'maxlength' => 200, 'class' => 'required'));
     $cPassword->setRequired(true)->setLabel('Confirm Password')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $subForm1->addElements(array($idField, $emailId, $password, $cPassword));
     $form->addSubForm($subForm1, 'subform1');
     parent::_prepareForm($form);
 }
Пример #21
0
 public function getMultiForm()
 {
     $multiform = new Core_Form_Multipage();
     $multiform->setNamespace('Core_Form_Multipage');
     $filedOne = new Zend_Form_Element_Text('field1');
     $filedOne->setLabel('Field #1')->setRequired(true);
     $filedTwo = new Zend_Form_Element_Text('field2');
     $filedTwo->setLabel('Field #2')->setRequired(true)->addValidator('Alnum');
     $filedThree = new Zend_Form_Element_Text('field3');
     $filedThree->setLabel('Field #3')->setRequired(true);
     $subFormOne = new Zend_Form_SubForm();
     $subFormOne->addElements(array($filedOne));
     $subFormTwo = new Zend_Form_SubForm();
     $subFormTwo->addElements(array($filedTwo));
     $subFormThree = new Zend_Form_SubForm();
     $subFormThree->addElements(array($filedThree));
     $multiform->addSubForm($subFormOne, 'step1', 1);
     $multiform->addSubForm($subFormTwo, 'step2', 2);
     $multiform->addSubForm($subFormThree, 'step3', 3);
     return $multiform;
 }
Пример #22
0
 public function init()
 {
     $this->setAction('/core/submit/new');
     $title = new Zend_Form_Element_Text('title');
     $title->setLabel('Title of paper')->setRequired(true)->addValidator('StringLength', true, array(2, 150, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Please provide a longer title', Zend_Validate_StringLength::TOO_LONG => 'Your title is too long')))->setAttrib('class', 'medium')->setDescription('Must be between 2 and 150 characters')->setDecorators(array('Composite'));
     $audience = new Zend_Form_Element_Radio('target_audience');
     $audience->setLabel('Please mark the target audience for your presentation')->setRequired(true)->setAttrib('class', 'tiny')->addMultiOptions($this->_getFieldValues('target_audience'))->setSeparator('<br />')->setDecorators(array('Composite'));
     $publish = new Zend_Form_Element_Radio('publish_paper');
     $publish->setLabel('Please indicate whether you wish to prepare a full paper for possible publication')->setRequired(true)->setAttrib('class', 'tiny')->addMultiOptions($this->_getFieldValues('publish_paper', 'submit'))->setSeparator('<br />')->setDecorators(array('Composite'));
     $topicsel = new Zend_Form_Element_Radio('topic');
     $topicsel->setLabel('Topic')->setRequired(true)->setAttrib('class', 'tiny')->addMultiOptions($this->_getFieldValues('topic'))->setSeparator('<br />')->setDecorators(array('Composite'));
     $keywords = new Zend_Form_Element_Text('keywords');
     $keywords->setLabel('Keywords')->setRequired(false)->addValidator('StringLength', true, array(2, 500, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Please provide longer keywords', Zend_Validate_StringLength::TOO_LONG => 'Your keywords are too long')))->setAttrib('class', 'medium')->setDescription('Must be between 2 and 500 characters')->setDecorators(array('Composite'));
     $comment = new Zend_Form_Element_Textarea('comment');
     $comment->setLabel('Comment')->setAttrib('class', 'small')->setDescription('Must be between 5 and 1000 characters')->setRequired(false)->addValidator('StringLength', true, array(5, 1000, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Please provide a longer description', Zend_Validate_StringLength::TOO_LONG => 'Your description is too long')))->setDecorators(array('Composite'));
     $file = new TA_Form_Element_MagicFile('file');
     $file->setLabel('Your submission')->setRequired(true)->addDecorators($this->_magicFileElementDecorator)->setDescription('File must be a maximum of 10Mb')->addValidators(array(array('Count', true, 1), array('Size', true, 10000000)));
     $subform = new Zend_Form_SubForm();
     $subform->setDecorators(array('FormElements'));
     $subform->addElements(array($title, $audience, $publish, $topicsel, $keywords, $comment, $file));
     $this->addSubForm($subform, 'submission');
     $this->addElement('submit', 'submit', array('label' => 'Submit', 'decorators' => $this->_buttonElementDecorator));
 }
Пример #23
0
 /**
  * Prepare form
  * 
  * @param Uni_Core_Form $form 
  */
 protected function _prepareForm(Uni_Core_Form $form)
 {
     $form->setName('cms_page')->setMethod('post');
     $subForm1 = new Zend_Form_SubForm();
     $subForm1->setLegend('Page Information');
     $subForm1->setDescription('Page Information');
     $subForm2 = new Zend_Form_SubForm();
     $subForm2->setLegend('Layout Settings');
     $subForm2->setDescription('Page Layout Settings');
     $subForm3 = new Zend_Form_SubForm();
     $subForm3->setLegend('Meta Data');
     $subForm3->setDescription('Page Meta Data Information');
     $idField = new Zend_Form_Element_Hidden('id');
     $title = new Zend_Form_Element_Text('title', array('size' => '30', 'maxlength' => 200, 'class' => 'required'));
     $title->setRequired(true)->setLabel('Title')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $urlKey = new Zend_Form_Element_Text('url_key', array('size' => '30', 'maxlength' => 200, 'class' => 'required'));
     $urlKey->setRequired(true)->setLabel('Url Key')->addFilter('StripTags')->setDescription('Relative to Website Base URL')->addFilter('StringTrim')->addValidator('NotEmpty');
     $content = new Uni_Core_Form_Element_Editor('content', array('cols' => '50', 'rows' => '20', 'class' => 'required'));
     $content->setRequired(true)->setLabel('Content');
     $layout = new Zend_Form_Element_Select('layout', array('class' => 'required'));
     $layout->setLabel('Layout')->setRequired(true)->setMultiOptions(Fox::getModel('cms/page')->getAvailableLayouts());
     $layoutUpdate = new Zend_Form_Element_Textarea('layout_update', array('cols' => '60', 'rows' => '10'));
     $layoutUpdate->setLabel('Layout Update');
     $metaKey = new Zend_Form_Element_Textarea('meta_keywords', array('cols' => '60', 'rows' => '5'));
     $metaKey->setLabel('Meta Keywords')->addFilter('StripTags')->addFilter('StringTrim');
     $metaDesc = new Zend_Form_Element_Textarea('meta_description', array('cols' => '60', 'rows' => '5'));
     $metaDesc->setLabel('Meta Description')->addFilter('StripTags')->addFilter('StringTrim');
     $status = new Zend_Form_Element_Select('status', array('class' => 'required'));
     $status->setRequired(true)->setLabel('Status')->setMultiOptions(Fox::getModel('cms/page')->getAllStatuses());
     $subForm1->addElements(array($idField, $title, $urlKey, $content, $status));
     $subForm2->addElements(array($layout, $layoutUpdate));
     $subForm3->addElements(array($metaKey, $metaDesc));
     $form->addSubForm($subForm1, 'subform1');
     $form->addSubForm($subForm2, 'subform2');
     $form->addSubForm($subForm3, 'subform3');
     parent::_prepareForm($form);
 }
Пример #24
0
 public function init()
 {
     //parent::__construct($options);
     $this->setName('addnewdevotee')->setAttrib('id', 'addnewdevotee')->setEnctype(Zend_Form::ENCTYPE_MULTIPART);
     //SUB FORM for Preliminary Information aboout Devotee
     $SubForm_BasicInfo = new Zend_Form_SubForm();
     $DevPic = new Zend_Form_Element_File('uplphoto');
     $DevPic->setLabel('Upload Your Photo Here')->setName('uplphoto');
     $path = 'photos/';
     $DevPic->setDestination($path)->addValidator('Size', true, array('max' => '4096000', 'messages' => 'The maximum permitted image file size is %max% selected image file size is %size%.'))->addValidator('Extension', true, array('jpg,jpeg', 'messages' => 'photo with only jpg, jpeg or gif format 
                                                                  are accepted for uploading profile.'));
     //->setRequired(true)
     //->addValidator('NotEmpty');
     //->setValidators(array('Size'=>array('min' => 20,'max' =>2097152),'Count' =>array('min' => 1,'max' => 3)))
     //->addValidator('IsImage');
     //to disable the viewrenderer use
     //$this->_helper->viewRenderer->setNoRender(true);
     $Fname = new Zend_Form_Element_Text('first_name');
     $Fname->setLabel('First Name*')->setName('first_name')->setAttrib('placeholder', 'First Name')->addValidator(new Zend_Validate_Alnum(array('allowWhiteSpace' => true)))->setRequired(true)->addValidator('NotEmpty')->addFilters(array('StripTags', 'StringTrim'));
     $Mname = new Zend_Form_Element_Text('middle_name');
     $Mname->setLabel('Middle Name*')->setName('middle_name')->setAttrib('placeholder', 'Middle Name')->addValidator(new Zend_Validate_Alnum(array('allowWhiteSpace' => true)))->setRequired(true)->addValidator('NotEmpty')->addFilters(array('StripTags', 'StringTrim'));
     $Lname = new Zend_Form_Element_Text('last_name');
     $Lname->setLabel('Last Name*')->setName('last_name')->setAttrib('placeholder', 'Last Name')->addValidator(new Zend_Validate_Alnum(array('allowWhiteSpace' => true)))->setRequired(true)->addValidator('NotEmpty')->addFilters(array('StripTags', 'StringTrim'));
     $Day = new Zend_Form_Element_Select('day');
     $Day->setLabel('Date of Birth*')->setName('day')->setRequired(true)->setMultiOptions(Rgm_Basics::getDates())->addValidator('NotEmpty')->addFilters(array('StripTags', 'StringTrim'));
     $Month = new Zend_Form_Element_Select('month');
     $Month->setName('month')->setRequired(true)->setMultiOptions(Rgm_Basics::getMonths())->addValidator('NotEmpty')->addFilters(array('StripTags', 'StringTrim'));
     $Year = new Zend_Form_Element_Select('year');
     $Year->setName('year')->setRequired(true)->setMultiOptions(Rgm_Basics::getYears(1912, 2012))->addValidator('NotEmpty')->addFilters(array('StripTags', 'StringTrim'));
     $Gender = new Zend_Form_Element_Radio('gender');
     $Gender->setName('gender')->setLabel('Gender*')->addValidator(new Zend_Validate_Alnum(array('allowWhiteSpace' => true)))->setRequired(true)->setMultiOptions(array('M' => 'Male', 'F' => 'Female'))->setSeparator('')->addFilters(array('StripTags', 'StringTrim'));
     $centr = new Application_Model_DbTable_MstCenter();
     $CenterOptions = $centr->getKeyValues();
     $Center = new Zend_Form_Element_Select('center');
     $Center->setName('center')->setLabel('Center*')->setMultiOptions($CenterOptions)->setRequired(false)->addValidator('NotEmpty');
     $con = new Application_Model_DbTable_MstCounselor();
     $Counselor = new Zend_Form_Element_Select('counselor');
     $CounselorOptions = $con->getKeyValues();
     $Counselor->setName('counselor')->setMultiOptions($CounselorOptions)->setLabel('Counselor')->setRequired(false)->addValidator('NotEmpty')->addValidator(new Zend_Validate_Alnum(array('allowWhiteSpace' => true)))->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $mentr = new Application_Model_DbTable_MstAstCounselor();
     $MentorOptions = $mentr->getKeyValues();
     $Mentor = new Zend_Form_Element_Select('mentor');
     $Mentor->setName('mentor')->setLabel('Mentor')->setMultioptions($MentorOptions)->addValidator(new Zend_Validate_Alnum(array('allowWhiteSpace' => true)))->setRequired(false)->addValidator('NotEmpty')->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $Mobile = new Zend_Form_Element_Text('mobile');
     $Mobile->setName('mobile')->setLabel('Mobile No')->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty')->addValidator(new Rgm_Validate_MobileNumber())->addValidator(new Zend_Validate_Alnum(array('allowWhiteSpace' => true)));
     $CC = new Application_Model_DbTable_MstCountry();
     $CCOptions = $CC->getPairWithTelCode();
     $CountryCode = new Zend_Form_Element_Select('cc');
     $CountryCode->setName('cc')->setLabel('Country Code*')->setMultiOptions($CCOptions)->setRequired(true)->addValidator('NotEmpty');
     $PhoneNumber = new Zend_Form_Element_Text('phone_number');
     $PhoneNumber->setName('phone_number')->setLabel('Phone Number(R/O)')->addValidator(new Zend_Validate_Alnum(array('allowWhiteSpace' => true)))->addFilters(array('StripTags', 'StringTrim'))->setRequired(false);
     $Email = new Zend_Form_Element_Text('email');
     $Email->setName('email')->setLabel('Email Id:')->addValidator('NotEmpty')->addValidator('EmailAddress')->addFilters(array('StripTags', 'StringTrim'));
     $CounseleeStatus = new Application_Model_DbTable_MstCounseleeStatus();
     $CounseleeStatusOptions = $CounseleeStatus->getCounseleeStatus();
     $CounsellingStatus = new Zend_Form_Element_Select('counselee_status');
     $CounsellingStatus->setName('counselee_status')->setLabel('Counselling Status*')->setRequired(true)->setMultiOptions($CounseleeStatusOptions);
     $ActiveStatus = new Zend_Form_Element_Select('active_status');
     $ActiveStatus->setName('active_status')->setLabel('Active Status*')->setMultiOptions(array('A' => 'Active', 'I' => 'Inactive', 'E' => 'Deceased'))->setRequired(true);
     $SubForm_BasicInfo->addElements(array($DevPic, $Fname, $Mname, $Lname, $Day, $Month, $Year, $Gender, $CountryCode, $Mobile, $PhoneNumber, $Email, $Center, $Counselor, $Mentor, $CounsellingStatus, $ActiveStatus));
     /*Personal Information */
     $SubForm_Personal_Info = new Zend_Form_SubForm();
     $langsknownOptions = new Application_Model_DbTable_MstLanguage();
     $langsknownOptions = $langsknownOptions->getLanguagelist();
     $MotherTongue = new Zend_Form_Element_select('mother_tongue');
     $MotherTongue->setName('mother_tongue')->setLabel('Mother Tongue*')->setMultiOptions($langsknownOptions)->addFilters(array('StripTags', 'StringTrim'))->setRequired(true);
     $LanguagesKnown = new Zend_Form_Element_MultiSelect('languages_known');
     $LanguagesKnown->setName('languages_known')->setLabel('Languages Known* ')->setMultiOptions($langsknownOptions)->setRequired(true);
     $BldGrp = new Zend_Form_Element_Select('bld_grp');
     $BldGrp->setName('bld_grp')->setLabel('Blood Group')->setMultiOptions(Rgm_Basics::getBloodGroupsAsoArr());
     $Religion = new Application_Model_DbTable_MstReligion();
     $ReligionOptions = $Religion->getReligionslist();
     $PrevReligion = new Zend_Form_Element_Select('previous_religion');
     $PrevReligion->setName('previous_religion')->setLabel('Previous Religion*')->setMultiOptions($ReligionOptions)->setRequired(true);
     $SubForm_Personal_Info->addElements(array($MotherTongue, $BldGrp, $PrevReligion, $LanguagesKnown));
     //PRESENT AND PERMENANT ADDRESS INFORMATION
     $SubForm_Address_Info = new Zend_Form_SubForm();
     $NativePlace = new Zend_Form_Element_Text('native_place');
     $NativePlace->setName('native_place')->setLabel('Native Place* ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $NativeStatedb = new Application_Model_DbTable_MstState();
     $NativeStateOptions = $NativeStatedb->getStateKeyValues();
     $NativeState = new Zend_Form_Element_Select('native_state');
     $NativeState->setName('native_state')->SetLabel('Native State* ')->setMultiOptions($NativeStateOptions)->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $PresentAddLine1 = new Zend_Form_Element_Text('present_addline1');
     $PresentAddLine1->setName('addline1')->setLabel('PlotNo.\\Room No.\\Wing*')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $PresentAddLine2 = new Zend_Form_Element_Text('present_addline2');
     $PresentAddLine2->setName('addline2')->setLabel('Bulding\\Chawl')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $PresentLocality = new Zend_Form_Element_Text('present_locality');
     $PresentLocality->setName('present_locality')->setLabel('Locality*')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $PresentCity = new Zend_Form_Element_Text('present_city');
     $PresentCity->setName('present_city')->SetLabel('City')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $PresentState = new Zend_Form_Element_Text('present_state');
     $PresentState->setName('present_state')->setLabel('State* ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $PresentCountry = new Zend_Form_Element_Text('present_country');
     $PresentCountry->setName('present_country')->SetLabel('Country* ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $PresentZipCode = new Zend_Form_Element_Text('present_zip_code');
     $PresentZipCode->setName('present_zip_code')->setLabel('Zip Code* ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $PermenantAddLine1 = new Zend_Form_Element_Text('permenant_addline1');
     $PermenantAddLine1->setName('permenant_addline1')->setLabel('PlotNo.\\Room No.\\Wing*')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $PermenantAddLine2 = new Zend_Form_Element_Text('permenant_addline2');
     $PermenantAddLine2->setName('permenant_addline2')->setLabel('Bulding\\Chawl')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $PermenantLocality = new Zend_Form_Element_Text('permenant_locality');
     $PermenantLocality->setName('permenant_locality')->setLabel('Locality*')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $PermenantCity = new Zend_Form_Element_Text('permenant_city');
     $PermenantCity->setName('permenant_city')->SetLabel('City')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $PermenantState = new Zend_Form_Element_Text('permenant_state');
     $PermenantState->setName('permenant_state')->setLabel('State* ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $PermenantCountry = new Zend_Form_Element_Text('permenant_country');
     $PermenantCountry->setName('permenant_country')->SetLabel('Country* ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $PermenantZipCode = new Zend_Form_Element_Text('permenant_zip_code');
     $PermenantZipCode->setName('permenant_zip_code')->setLabel('Zip Code* ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $SubForm_Address_Info->addElements(array($NativePlace, $PresentAddLine1, $PresentAddLine2, $PresentLocality, $PresentCity, $PresentState, $PresentCountry, $PermenantZipCode, $PermenantAddLine1, $PermenantAddLine2, $PermenantCity, $PermenantCountry, $PermenantLocality, $PermenantState, $PermenantZipCode));
     //SUB FORM for Family Information
     $SubForm_Family_Info = new Zend_Form_SubForm();
     $Father = new Zend_Form_Element_Text('father_name');
     $Father->setName('father_name')->SetLabel('Father Name* ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $Mother = new Zend_Form_Element_Text('mother_name');
     $Mother->setName('mother_name')->setLabel('Mother Name* ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $AsramStatus = new Application_Model_DbTable_MstAsram();
     $AsramStatusOptions = $AsramStatus->listPairs();
     $MaritalStatus = new Zend_Form_Element_Select('marital_status');
     $MaritalStatus->setName('marital_status')->setLabel('Marital Status* ')->setMultiOptions($AsramStatusOptions)->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $SubForm_Family_Info->addElements(array($Father, $Mother, $MaritalStatus));
     //SUB FORM Education Info
     $SubForm_Education_Info = new Zend_Form_SubForm();
     $isgurukuli = new Zend_Form_Element_Radio('gurukuli');
     $isgurukuli->setName('gurukuli')->setLabel('IS Gurukuli* ')->setMultiOptions(array(array('value' => 'Yes', 'key' => 'Y'), array('value' => 'No', 'key' => 'N')))->setRequired(false)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $highesteducationdb = new Application_Model_DbTable_MstEducationCategory();
     $highesteducationOptions = $highesteducationdb->getEduCategory();
     $HighEducation = new Zend_Form_Element_Select('highest_education');
     $HighEducation->setName('highest_education')->setLabel('Highest Education* ')->setMultiOptions($highesteducationOptions)->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $EduDescription = new Zend_Form_Element_Text('education_description');
     $EduDescription->setName('education_description')->setLabel('Education Description* ')->addValidator(new Zend_Validate_Alnum(array('allowWhiteSpace' => true)))->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $Occupationdb = new Application_Model_DbTable_MstOccupation();
     $OccupationOptions = $Occupationdb->listOccupation();
     $Occupation = new Zend_Form_Element_Select('occupation');
     $Occupation->setName('education_description')->setLabel('Education Description* ')->setMultiOptions($OccupationOptions)->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $PresDesignation = new Zend_Form_Element_Text('present_designation');
     $PresDesignation->setName('present_designation')->setLabel('Present Designation ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $Merits_Awards = new Zend_Form_Element_Text('merits_awards');
     $Merits_Awards->setName('merits_awards')->setLabel('Merits Awards')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $SkillSet = new Zend_Form_Element_Text('skill_sets');
     $SkillSet->setName('skill_sets')->setLabel('Skill Sets ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $SubForm_Education_Info->addElements(array($isgurukuli, $HighEducation, $EduDescription, $Occupation, $PresDesignation, $Merits_Awards, $SkillSet));
     //SUBFORM for Office  Information
     $SubForm_Office_Info = new Zend_Form_SubForm();
     $Organization = new Zend_Form_Element_Text('organization');
     $Organization->setName('organization')->setLabel('Organization ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $OffAddress = new Zend_Form_Element_Text('office_address');
     $OffAddress->setName('office_address')->setLabel('Address')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $OffLocality = new Zend_Form_Element_Text('office_locality');
     $OffLocality->setName('office_locality')->setLabel('Locality ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $OffCity = new Zend_Form_Element_Text('office_city');
     $OffCity->setName('office_city')->setLabel('City')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $OffState = new Zend_Form_Element_Text('office_state');
     $OffState->setName('office_state')->setLabel('State')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $OffCountry = new Zend_Form_Element_Text('office_country');
     $OffCountry->setName('office_country')->setLabel('Country')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $OffZip = new Zend_Form_Element_Text('Office_zip_code');
     $OffZip->setName('Office_zip_code')->setLabel('Zip-Code')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
     $SubForm_Office_Info->addElements(array($Organization, $OffAddress, $OffLocality, $OffCity, $OffState, $OffCountry, $OffZip));
     //SUB FORM for Devotional Information
     $SubForm_Devotional_Info = new Zend_Form_SubForm();
     $BeganChantingFromDay = new Zend_Form_Element_Select('bgn_chan_from_day');
     $BeganChantingFromDay->setLabel('Started Chanting From')->setName('bgn_chan_from_day')->setMultiOptions(Rgm_Basics::getDates())->addValidator('NotEmpty')->addFilters(array('StripTags', 'StringTrim'));
     $BeganChantingFromMonth = new Zend_Form_Element_Select('bgn_chan_from_month');
     $BeganChantingFromMonth->setLabel('Started Chanting From')->setName('bgn_chan_from_month')->setMultiOptions(Rgm_Basics::getMonths())->addValidator('NotEmpty')->addFilters(array('StripTags', 'StringTrim'));
     $BeganChantingFromYear = new Zend_Form_Element_Select('bgn_chan_from_year');
     $BeganChantingFromYear->setLabel('Started Chanting From')->setName('bgn_chan_from_year')->setMultiOptions(Rgm_Basics::getYears(1965, 2012))->addValidator('NotEmpty')->addFilters(array('StripTags', 'StringTrim'));
     $BeganChantingNA = new Zend_Form_Element_Select('bgn_chan_from_na');
     $BeganChantingNA->setLabel('Chants Hare Krishna Mahamantra?')->setName('bgn_chan_from_na')->SetMultiOptions(array(array('value' => 'Yes', 'key' => 'Y'), array('value' => 'No', 'key' => 'N')));
     $NumberOfRoundsPresentlyChanting = new Zend_Form_Element_Select('no_rou_pres_chanting');
     $NumberOfRoundsPresentlyChanting->setLabel('Number Of Rounds Presently Chanting')->setName('no_rou_pres_chanting')->SetMultiOptions(array(array('value' => '1', 'key' => '1'), array('value' => '2', 'key' => '2'), array('value' => '3', 'key' => '3'), array('value' => '4', 'key' => '4'), array('value' => '5', 'key' => '5'), array('value' => '6', 'key' => '6'), array('value' => '7', 'key' => '7'), array('value' => '8', 'key' => '8'), array('value' => '9', 'key' => '9'), array('value' => '10', 'key' => '10'), array('value' => '11', 'key' => '11'), array('value' => '12', 'key' => '12'), array('value' => '13', 'key' => '13'), array('value' => '14', 'key' => '14'), array('value' => '15', 'key' => '15'), array('value' => '16', 'key' => '16')));
     $Chanting16RoundsSinceDay = new Zend_Form_Element_Select('chan_16_rounds_day');
     $Chanting16RoundsSinceDay->setLabel('Chanting 16 Rounds(or more) Since')->setName('chan_16_rounds_since')->setMultiOptions(Rgm_Basics::getDates());
     $Chanting16RoundsSince = new Zend_Form_Element_Select('chan_16_rounds_month');
     $Chanting16RoundsSince->setLabel('Chanting 16 Rounds(or more) Since')->setName('chan_16_rounds_since')->setMultiOptions(Rgm_Basics::getMonths());
     $Chanting16RoundsSince = new Zend_Form_Element_Select('chan_16_rounds_year');
     $Chanting16RoundsSince->setLabel('Chanting 16 Rounds(or more) Since')->setName('chan_16_rounds_since')->setMultiOptions(Rgm_Basics::getYears(1965, 2012));
     $IntroBy = new Zend_Form_Element_Text('intro_by');
     $IntroBy->setName('intro_by')->setLabel('Introduced By*')->setRequired(true);
     $IntroCenter = new Zend_Form_Element_Select('intro_center');
     $IntroCenter->setName('intro_center')->setLabel('Introduction center*')->setMultiOptions($CenterOptions)->setRequired(true);
     $YearOfIntroduction = new Zend_Form_Element_Select('year_introduction');
     $YearOfIntroduction->setName('year_introduction')->setLabel('Year of Introduction')->setMultiOptions(Rgm_Basics::getYears(1965, 2012))->setRequired(true);
     $HarinamInitiated = new Zend_Form_Element_Select('harinam_initiatn_na');
     $HarinamInitiated->setLabel('Harinam Initiated')->setName('harinam_initiatn_na')->setMultiOptions(array(array('value' => 'Yes', 'key' => 'y'), array('value' => 'No', 'key' => 'n')));
     $DayOfHarinamInitiation = new Zend_Form_Element_Select('harinam_initiatn_day');
     $DayOfHarinamInitiation->setLabel('Date Of Harinam Initiation')->setName('harinam_initiation_day')->setMultiOptions(Rgm_Basics::getDates());
     $MonthOfHarinamInitiation = new Zend_Form_Element_Select('harinam_initiatn_month');
     $MonthOfHarinamInitiation->setName('harinam_initiation_month')->setMultiOptions(Rgm_Basics::getMonths());
     $YearOfHarinamInitiation = new Zend_Form_Element_Select('harinam_initiatn_year');
     $YearOfHarinamInitiation->setName('harinam_initiation_year')->setMultiOptions(Rgm_Basics::getYears(1965, 2012));
     //$InitiatedName = new Zend_Form_Element_Select('initiated_name_combo');
     //$InitiatedName->setName('initiated_name_combo')
     //            ->setLabel('Initiated Name')
     //          ->setRequired(false);
     //$AddNewInitiatedName = new Zend_Form_Element_Button('add_new_initiated_name');
     //$AddNewInitiatedName->setName('add_new_initiated_name')
     //                  ->setValue('New');
     $SpiritualMasterdb = new Application_Model_DbTable_MstGuru();
     $SpiritualMasterOptions = $SpiritualMasterdb->seekGuru();
     $SpiritualMaster = new Zend_Form_Element_Select('spiritual_master');
     $SpiritualMaster->setName('spiritual_master')->setLabel('Spiritual Master')->setMultiOptions($SpiritualMasterOptions);
     $BrahmanInitiated = new Zend_Form_Element_Select('harinam_initiated');
     $BrahmanInitiated->setName('harinam_initiated')->setLabel('Brahman Initiated')->setMultiOptions(array(array('value' => 'Yes', 'key' => 'Y'), array('value' => 'No', 'key' => 'N')));
     $DayOfBrahmanInitiation = new Zend_Form_Element_Select('date_of_brahman_initiation');
     $DayOfBrahmanInitiation->setName('date_of_brahman_initiation')->setLabel('Date Of Brahman Initiation')->setMultiOptions(Rgm_Basics::getDates());
     $MonthOfBrahmanInitiation = new Zend_Form_Element_Select('brahman_initiation_month');
     $MonthOfBrahmanInitiation->setName('brahman_initiation_month')->setMultiOptions(Rgm_Basics::getMonths());
     $YearOfBrahmanInitiation = new Zend_Form_Element_Select('brahman_initiation_year');
     $YearOfBrahmanInitiation->setName('brahman_initiation_year')->setMultiOptions(Rgm_Basics::getYears(1965, 2012));
     $DayOfSanyasInitiation = new Zend_Form_Element_Select('sanyas_initiation_day');
     $DayOfSanyasInitiation->setName('sanyas_initiation_day')->setLabel('Date of Sanyas Initiation')->setMultiOptions(Rgm_Basics::getDates());
     $MonthOfSanyasInitiation = new Zend_Form_Element_Select('sanyas_initiation_month');
     $MonthOfSanyasInitiation->setName('sanyas_initiation_month')->setMultiOptions(Rgm_Basics::getMonths());
     $YearOfSanyasInitiation = new Zend_Form_Element_Select('sanyas_initiation_year');
     $YearOfSanyasInitiation->setName('sanyas_initiation_year')->setMultiOptions(Rgm_Basics::getYears(1965, 2012));
     $SanyasSpiritualMaster = new Zend_Form_Element_Select('sanyas_spiritual_master');
     $SanyasSpiritualMaster->setName('sanyas_spiritual_master')->setLabel('Sanyas Spiritual Master')->setMultiOptions($SpiritualMasterOptions);
     $SpiritualNamedb = new Application_Model_DbTable_MstSpiritualName();
     $SpiritualNameOptions = $SpiritualNamedb->getKeyValues();
     $SanyasName = new Zend_Form_Element_Select('sanyas_name');
     $SanyasName->setLabel('Sanyas Name')->setMultiOptions($SpiritualNameOptions);
     $SanyasTitle = new Zend_Form_Element_Radio('sanyas_title');
     $SanyasTitle->setName('sanyas_title')->setLabel('Sanyas Title')->setMultiOptions(array(array('value' => 'Goswami', 'key' => 'GOSWAMI'), array('value' => 'Swami', 'key' => 'SWAMI')));
     $SubForm_Devotional_Info->addElements(array($BeganChantingFromDay, $BeganChantingFromMonth, $BeganChantingFromYear, $BeganChantingNA, $NumberOfRoundsPresentlyChanting, $Chanting16RoundsSince, $IntroBy, $IntroCenter, $YearOfIntroduction, $HarinamInitiated, $DayOfHarinamInitiation, $MonthOfHarinamInitiation, $YearOfHarinamInitiation, $SpiritualMasterdb, $SpiritualMaster, $BrahmanInitiated, $DayOfBrahmanInitiation, $MonthOfBrahmanInitiation, $YearOfBrahmanInitiation, $DayOfSanyasInitiation, $MonthOfSanyasInitiation, $YearOfSanyasInitiation, $SanyasSpiritualMaster, $SpiritualNamedb, $SanyasName, $SanyasTitle));
     $SubForm_ServicesRendered_Info = new Zend_Form_SubForm();
     $ServicesRenderedDB = new Application_Model_DbTable_MstServices();
     $ServicesRenderedOptions = $ServicesRenderedDB->getKeyValues();
     $ServicesRendered = new Zend_Form_Element_Multiselect('services_rendered');
     $ServicesRendered->setName('services_rendered')->setLabel('Services Rendered')->setMultiOptions($ServicesRenderedOptions);
     $ServicesInterestedToRender = new Zend_Form_Element_Multiselect('interest_render_services');
     $ServicesInterestedToRender->setName('interest_render_services')->setLabel('Interested in Rendering Services')->setMultiOptions($ServicesRenderedOptions);
     $SubForm_ServicesRendered_Info->addElements(array($ServicesRendered, $ServicesInterestedToRender));
     //Adding SUBFORMS
     $this->addSubForms(array('basic_info' => $SubForm_BasicInfo, 'personal_info' => $SubForm_Personal_Info, 'address_info' => $SubForm_Address_Info, 'family_info' => $SubForm_Family_Info, 'education_info' => $SubForm_Education_Info, 'office_info' => $SubForm_Office_Info, 'devotional_info' => $SubForm_Devotional_Info, 'services_info' => $SubForm_ServicesRendered_Info));
 }
Пример #25
0
    public function testRemovingFormItemsShouldNotRaiseExceptionsDuringIteration()
    {
        $this->setupElements();
        $bar = $this->form->bar;
        $this->form->removeElement('bar');

        try {
            foreach ($this->form as $item) {
            }
        } catch (Exception $e) {
            $this->fail('Exceptions should not be raised by iterator when elements are removed; error message: ' . $e->getMessage());
        }

        $this->form->addElement($bar);
        $this->form->addDisplayGroup(array('baz', 'bar'), 'bazbar');
        $this->form->removeDisplayGroup('bazbar');

        try {
            foreach ($this->form as $item) {
            }
        } catch (Exception $e) {
            $this->fail('Exceptions should not be raised by iterator when elements are removed; error message: ' . $e->getMessage());
        }

        $subForm = new Zend_Form_SubForm;
        $subForm->addElements(array('foo' => 'text', 'bar' => 'text'));
        $this->form->addSubForm($subForm, 'page1');
        $this->form->removeSubForm('page1');

        try {
            foreach ($this->form as $item) {
            }
        } catch (Exception $e) {
            $this->fail('Exceptions should not be raised by iterator when elements are removed; error message: ' . $e->getMessage());
        }
    }
Пример #26
0
 public function form($values = array())
 {
     $config = Zend_Registry::get('config');
     $form = new Zend_Form();
     $form->setAttrib('id', 'eventForm')->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'div', 'class' => 'zend_form')), 'Form'));
     $workshop = new Workshop();
     $where = $workshop->getAdapter()->quoteInto('status = ?', 'enabled');
     $workshops = $workshop->fetchAll($where, 'title');
     $workshopList = array();
     foreach ($workshops as $w) {
         $workshopList[$w->workshopId] = $w->title;
     }
     $workshopElement = $form->createElement('select', 'workshop', array('label' => 'Workshop:'));
     $workshopElement->setMultiOptions($workshopList)->setValue(isset($values['workshopId']) ? $values['workshopId'] : '');
     $location = new Location();
     $where = $location->getAdapter()->quoteInto('status = ?', 'enabled');
     $locations = $location->fetchAll($where, 'name');
     $locationList = array();
     $locationCapacity = array();
     foreach ($locations as $l) {
         $locationList[$l->locationId] = $l->name;
         $locationCapacity['loc_' . $l->locationId] = $l->capacity;
     }
     $locationIds = array_keys($locationList);
     // add the location capacities to the page in js so we can process it as a json object for the "live" max size changing with location selection
     Zend_Layout::getMvcInstance()->getView()->headScript()->appendScript('var locationCapacitiesString = ' . Zend_Json::encode($locationCapacity) . ';');
     $locationElement = $form->createElement('select', 'location', array('label' => 'Location:'));
     $locationElement->setMultiOptions($locationList)->setValue(isset($values['locationId']) ? $values['locationId'] : $locationCapacity['loc_' . $locationIds[0]]);
     $date = $form->createElement('text', 'date', array('label' => 'Date:'));
     $date->setRequired(true)->addFilter('StringTrim')->addFilter('StripTags')->setAttrib('maxlength', '128')->setAttrib('style', 'width: 200px')->setValue(isset($values['date']) ? strftime('%A, %B %e, %Y', strtotime($values['date'])) : '');
     $password = $form->createElement('text', 'password', array('label' => 'Event Password:'******'StringTrim')->addFilter('StripTags')->setAttrib('maxlength', '100')->setValue(isset($values['password']) ? $values['password'] : '');
     // add the start time selector
     $startTimeSub = new Zend_Form_SubForm();
     $startTimeSub->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'div', 'class' => 'zend_form'))));
     $startTimeSub->setAttrib('class', 'sub');
     $startTimeHour = $startTimeSub->createElement('select', 'hour', array('label' => 'Start Time:'));
     for ($i = 1; $i <= 12; $i++) {
         $startTimeHour->addMultiOption($i, $i);
     }
     $startTimeHour->setDecorators(array(array('ViewHelper', array('helper' => 'formSelect')), array('Label')));
     $startTimeHour->setValue(isset($values['startTime']) ? date('g', strtotime($values['startTime'])) : date('g'));
     $startTimeMinute = $startTimeSub->createElement('select', 'minute');
     for ($i = 0; $i < 60; $i += 5) {
         $startTimeMinute->addMultiOption(str_pad($i, 2, '0', STR_PAD_LEFT), str_pad($i, 2, '0', STR_PAD_LEFT));
     }
     $startTimeMinute->setDecorators(array(array('ViewHelper', array('helper' => 'formSelect'))));
     $startTimeMinute->setValue(isset($values['startTime']) ? date('i', strtotime($values['startTime'])) : date('i'));
     $startTimeMeridian = $startTimeSub->createElement('select', 'meridian');
     $startTimeMeridian->addMultiOption('am', 'AM')->addMultiOption('pm', 'PM')->setDecorators(array(array('ViewHelper', array('helper' => 'formSelect'))));
     $startTimeMeridian->setValue(isset($values['startTime']) ? date('a', strtotime($values['startTime'])) : date('a'));
     $startTimeSub->addElements(array($startTimeHour, $startTimeMinute, $startTimeMeridian));
     // add the end time selector
     $endTimeSub = new Zend_Form_SubForm();
     $endTimeSub->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'div', 'class' => 'zend_form'))));
     $endTimeSub->setAttrib('class', 'sub');
     $endTimeHour = $endTimeSub->createElement('select', 'hour', array('label' => 'End Time:'));
     for ($i = 1; $i <= 12; $i++) {
         $endTimeHour->addMultiOption($i, $i);
     }
     $endTimeHour->setDecorators(array(array('ViewHelper', array('helper' => 'formSelect')), array('Label')));
     $endTimeHour->setValue(isset($values['endTime']) ? date('g', strtotime($values['endTime'])) : date('g'));
     $endTimeMinute = $endTimeSub->createElement('select', 'minute');
     for ($i = 0; $i < 60; $i += 5) {
         $endTimeMinute->addMultiOption(str_pad($i, 2, '0', STR_PAD_LEFT), str_pad($i, 2, '0', STR_PAD_LEFT));
     }
     $endTimeMinute->setDecorators(array(array('ViewHelper', array('helper' => 'formSelect'))));
     $endTimeMinute->setValue(isset($values['endTime']) ? date('i', strtotime($values['endTime'])) : date('i'));
     $endTimeMeridian = $endTimeSub->createElement('select', 'meridian');
     $endTimeMeridian->addMultiOption('am', 'AM')->addMultiOption('pm', 'PM')->setDecorators(array(array('ViewHelper', array('helper' => 'formSelect'))));
     $endTimeMeridian->setValue(isset($values['endTime']) ? date('a', strtotime($values['endTime'])) : date('a'));
     $endTimeSub->addElements(array($endTimeHour, $endTimeMinute, $endTimeMeridian));
     // get all the users available for the instructor list
     $otAccount = new Ot_Account();
     $accounts = $otAccount->fetchAll(null, array('lastName', 'firstName'))->toArray();
     $instructorList = array();
     foreach ($accounts as $a) {
         $instructorList[$a['accountId']] = $a['lastName'] . ", " . $a['firstName'];
     }
     $instructorElement = $form->createElement('multiselect', 'instructors', array('label' => 'Instructor(s):'));
     $instructorElement->setMultiOptions($instructorList)->setAttrib('size', 10)->setValue(isset($values['instructorIds']) ? $values['instructorIds'] : '');
     $minSize = $form->createElement('text', 'minSize', array('label' => 'Min Size:'));
     $minSize->setRequired(true)->addFilter('StringTrim')->addFilter('StripTags')->setAttrib('maxlength', '64')->setAttrib('style', 'width: 50px;')->setValue(isset($values['minSize']) ? $values['minSize'] : $config->user->defaultMinWorkshopSize->val);
     $maxSize = $form->createElement('text', 'maxSize', array('label' => 'Max Size:'));
     $maxSize->setRequired(true)->addFilter('StringTrim')->addFilter('StripTags')->setAttrib('maxlength', '64')->setAttrib('style', 'width: 50px;')->setValue(isset($values['maxSize']) ? $values['maxSize'] : $locationElement->getValue());
     $waitlistSize = $form->createElement('text', 'waitlistSize', array('label' => 'Waitlist Size:'));
     $waitlistSize->setRequired(true)->addFilter('StringTrim')->addFilter('StripTags')->setAttrib('maxlength', '64')->setAttrib('style', 'width: 50px;')->setValue(isset($values['waitlistSize']) ? $values['waitlistSize'] : $config->user->defaultWorkshopWaitlistSize->val);
     $evaluationType = $form->createElement('select', 'evaluationType', array('label' => 'Evaluation Type:'));
     $evaluationType->setMultiOptions(array('default' => 'Default', 'google' => 'Google Form'))->setRequired(true)->setValue(isset($values['evaluationType']) ? $values['evaluationType'] : 'default');
     $formKey = $form->createElement('textarea', 'formKey', array('label' => 'Google Form Question Key:'));
     $formKey->setAttribs(array('cols' => '10', 'rows' => '5', 'style' => 'width : 250px;'))->addDecorators(array('ViewHelper', 'Errors', 'HtmlTag', array('Label', array('tag' => 'span')), array(array('elementDiv' => 'HtmlTag'), array('tag' => 'div', 'id' => 'formKey', 'class' => 'elm'))))->setValue(isset($values['formKey']) ? $values['formKey'] : '');
     $answerKey = $form->createElement('textarea', 'answerKey', array('label' => 'Google Form Answer Key:'));
     $answerKey->addFilter('StringTrim')->addFilter('StripTags')->setAttribs(array('cols' => '10', 'rows' => '3', 'style' => 'width : 250px;'))->addDecorators(array('ViewHelper', 'Errors', 'HtmlTag', array('Label', array('tag' => 'span')), array(array('elementDiv' => 'HtmlTag'), array('tag' => 'div', 'id' => 'answerKey', 'class' => 'elm'))))->setValue(isset($values['answerKey']) ? $values['answerKey'] : '');
     $submit = $form->createElement('submit', 'submitButton', array('label' => 'Submit'));
     $submit->setDecorators(array(array('ViewHelper', array('helper' => 'formSubmit'))));
     $cancel = $form->createElement('button', 'cancel', array('label' => 'Cancel'));
     $cancel->setAttrib('id', 'cancel');
     $cancel->setDecorators(array(array('ViewHelper', array('helper' => 'formButton'))));
     $form->addElements(array($workshopElement, $locationElement, $password, $date, $evaluationType))->addSubForms(array('startTime' => $startTimeSub, 'endTime' => $endTimeSub))->addElements(array($minSize, $maxSize, $waitlistSize, $instructorElement));
     $form->addDisplayGroup(array('instructors'), 'instructors-group', array('legend' => 'Instructors'));
     $form->addDisplayGroup(array('workshop', 'password', 'location', 'minSize', 'maxSize', 'waitlistSize'), 'generalInformation', array('legend' => 'General Information'));
     $form->setElementDecorators(array('ViewHelper', 'Errors', array('HtmlTag', array('tag' => 'div', 'class' => 'elm')), array('Label', array('tag' => 'span'))))->addElements(array($submit, $cancel));
     $form->addElements(array($evaluationType, $formKey, $answerKey));
     $form->addDisplayGroup(array('evaluationType', 'formKey', 'answerKey'), 'evaluationTypes', array('legend' => 'Evaluations'));
     $form->addDisplayGroup(array('submitButton', 'cancel'), 'buttons');
     $form->setDisplayGroupDecorators(array('FormElements', array('HtmlTag', array('tag' => 'div', 'class' => 'widget-content')), array(array('elementDiv' => 'HtmlTag'), array('tag' => 'div', 'class' => array('widget-footer', 'ui-corner-bottom'), 'placement' => Zend_Form_Decorator_Abstract::APPEND)), array('FieldSet', array('class' => 'formField'))));
     $buttons = $form->getDisplayGroup('buttons');
     $buttons->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'div', 'style' => 'clear : both;'))));
     if (isset($values['eventId'])) {
         $eventId = $form->createElement('hidden', 'eventId');
         $eventId->setValue($values['eventId']);
         $eventId->setDecorators(array(array('ViewHelper', array('helper' => 'formHidden'))));
         $form->addElement($eventId);
     }
     return $form;
 }
Пример #27
0
 public function addRoleCheckboxes($userID = null)
 {
     ///////////////////// create role checkboxes /////////////////////
     // get role array
     $roleModel = new Admin_Model_Role();
     $roleArray = $roleModel->getRoleArray();
     // create subform
     $subForm = new Zend_Form_SubForm(array('class' => 'roleGroup'));
     $subForm->setDecorators($this->_displayGroupDecorators);
     $subForm->setOptions(array('class' => 'fieldsetForm span-7'));
     // this case is for updating user
     if ($userID) {
         $checkboxes = $this->_createCheckboxesForUpdatingUser($userID);
     } else {
         $checkboxes = $this->_createCheckboxesForCreatingUser();
     }
     $subForm->addElements($checkboxes);
     $this->addSubForm($subForm, 'roles');
 }
Пример #28
0
 /** Init the form and display fields
  * @access public
  * @return void
  */
 public function init()
 {
     // Create user sub form: username and password
     $user = new Zend_Form_SubForm();
     // Create demographics sub form: given name, family name, and
     // location
     $meta = new Zend_Form_SubForm();
     $period = new Zend_Form_Element_Select('period');
     $period->setLabel('Period: ')->setRequired(true)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow required')->addErrorMessage('You must enter a period for the image')->addMultiOptions(array(null => 'Select a period', 'Valid periods' => $this->getPeriods()))->addValidator('inArray', false, array(array_keys($this->getPeriods())));
     $country = new Zend_Form_Element_Select('country');
     $country->setLabel('Country: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow required')->setRequired(true)->addErrorMessage('You must enter a country of origin')->addMultiOptions(array(null => 'Select a country of origin', 'Valid countries' => array('England' => 'England', 'Wales' => 'Wales')))->addValidator('inArray', false, array(array_keys(array('England' => 'England', 'Wales' => 'Wales'))));
     $county = new Zend_Form_Element_Select('county');
     $county->setLabel('County: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow required')->setRequired(true)->addErrorMessage('You must enter a county of origin')->addMultiOptions(array(null => 'Select a county of origin', 'Valid counties' => $this->getCounties()))->addValidator('inArray', false, array(array_keys($this->getCounties())));
     $meta->addElements(array($period, $country, $county));
     $images = new Zend_Form_SubForm();
     // Attach sub forms to main form
     $this->addSubForms(array('metadata' => $meta, 'images' => $images));
 }