本文整理汇总了PHP中Zend_Form_SubForm::addElements方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_SubForm::addElements方法的具体用法?PHP Zend_Form_SubForm::addElements怎么用?PHP Zend_Form_SubForm::addElements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_SubForm
的用法示例。
在下文中一共展示了Zend_Form_SubForm::addElements方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareForm
/**
* 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: populate
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: addTripLines
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: init
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: init
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: indexAction
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: init
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: init
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));
}
示例9: _prepareForm
/**
* 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: init
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: init
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: init
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: init
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: init
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: _prepareForm
/**
* 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);
}