本文整理汇总了PHP中Zend_Form_SubForm::setLegend方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_SubForm::setLegend方法的具体用法?PHP Zend_Form_SubForm::setLegend怎么用?PHP Zend_Form_SubForm::setLegend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_SubForm
的用法示例。
在下文中一共展示了Zend_Form_SubForm::setLegend方法的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: buildFromArray
public function buildFromArray(array $array)
{
$translator = $this->getTranslator();
foreach ($array as $language => $data) {
$languageForm = new Zend_Form_SubForm();
$languageForm->setLegend($translator->translate("setup_language_{$language}"));
$this->addSubForm($languageForm, $language);
foreach ($data as $key => $values) {
switch ($key) {
case 'file':
$fileForm = new Zend_Form_SubForm();
$languageForm->addSubForm($fileForm, 'file');
$fileForm->addElement('hidden', 'filename');
$fileForm->addElement('textarea', 'contents', array('label' => $translator->translate('setup_page_content')));
break;
case 'key':
$keyForm = new Zend_Form_SubForm();
$languageForm->addSubForm($keyForm, 'key');
$translationUnits = array_keys($values);
foreach ($translationUnits as $translationUnit) {
$keyForm->addElement('text', $translationUnit, array('label' => $translator->translate("setup_{$translationUnit}"), 'size' => 90));
}
break;
}
}
}
return $this;
}
示例3: 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;
}
示例4: 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));
}
示例5: addItemXpathsToExtend
protected function addItemXpathsToExtend($itemXpathsToExtend)
{
if (count($itemXpathsToExtend) == 0) {
$itemXpathsToExtend = array(new Kaltura_Client_Type_ExtendingItemMrssParameter());
}
$mainSubForm = new Zend_Form_SubForm();
$mainSubForm->setLegend('Item XPaths To Extend');
$mainSubForm->setDecorators(array('FormElements', array('ViewScript', array('viewScript' => 'distribution-item-xpath-to-extend.phtml', 'placement' => 'APPEND')), 'Fieldset'));
$i = 1;
$extendCategory = false;
$extendParentCategory = false;
foreach ($itemXpathsToExtend as $itemXPath) {
/* @var $itemXPath Kaltura_Client_Type_ExtendingItemMrssParameter */
//if it a category identifier
if ($itemXPath->identifier instanceof Kaltura_Client_Type_CategoryIdentifier) {
/* @var $identifier Kaltura_Client_Type_CategoryIdentifier */
$identifier = $itemXPath->identifier;
//if the parameters are set exactly as the admin console sets.
if ($itemXPath->xpath == '//category' && $itemXPath->extensionMode == Kaltura_Client_Enum_MrssExtensionMode::REPLACE && $identifier->identifier == Kaltura_Client_Enum_CategoryIdentifierField::FULL_NAME) {
foreach (explode(',', $identifier->extendedFeatures) as $extendedFeature) {
if ($extendedFeature == Kaltura_Client_Enum_ObjectFeatureType::METADATA) {
$extendCategory = true;
} elseif ($extendedFeature == Kaltura_Client_Enum_ObjectFeatureType::ANCESTOR_RECURSIVE) {
$extendParentCategory = true;
}
}
}
continue;
}
$subForm = new Zend_Form_SubForm(array('disableLoadDefaultDecorators' => true));
$subForm->setDecorators(array('FormElements'));
$subForm->addElement('text', 'itemXpathsToExtend', array('decorators' => array('ViewHelper', array('HtmlTag', array('tag' => 'div'))), 'isArray' => true, 'value' => $itemXPath->xpath));
$mainSubForm->addSubForm($subForm, 'itemXpathsToExtend_subform_' . $i++);
}
//set the extend category metadata checkbox
$subForm = new Zend_Form_SubForm(array('disableLoadDefaultDecorators' => true));
$subForm->setDecorators(array('FormElements'));
$subForm->addElement('checkbox', 'includeCategoryInMrss', array('label' => 'Include category-level custom metadata in MRSS', 'isArray' => true, 'value' => $extendCategory));
$subForm->getElement('includeCategoryInMrss')->getDecorator('Label')->setOption('placement', 'APPEND');
$subForm->getElement('includeCategoryInMrss')->setChecked($extendCategory);
$mainSubForm->addSubForm($subForm, 'itemXpathsToExtend_subform_' . $i++, 99);
//set the extend category parent metadata checkbox
$subForm = new Zend_Form_SubForm(array('disableLoadDefaultDecorators' => true));
$subForm->setDecorators(array('FormElements'));
$subForm->addElement('checkbox', 'includeCategoryParentInMrss', array('label' => 'Include parent categories', 'isArray' => true, 'value' => $extendParentCategory));
$subForm->getElement('includeCategoryParentInMrss')->getDecorator('Label')->setOption('placement', 'APPEND');
$subForm->getElement('includeCategoryParentInMrss')->setChecked($extendParentCategory);
$mainSubForm->addSubForm($subForm, 'itemXpathsToExtend_subform_' . $i++, 100);
$this->addSubForm($mainSubForm, 'itemXpathsToExtend_group');
}
示例6: init
public function init()
{
$translator = $this->getTranslator();
foreach (array('de', 'en') as $lang) {
$langForm = new Zend_Form_SubForm();
$langForm->setLegend($translator->translate("setup_language_{$lang}"));
$keyForm = new Zend_Form_SubForm();
$keyForm->addElement('text', 'home_index_index_pagetitle', array('label' => $translator->translate('setup_home_index_index_pagetitle'), 'attribs' => array('size' => 90)));
$keyForm->addElement('text', 'home_index_index_title', array('label' => $translator->translate('setup_home_index_index_title'), 'attribs' => array('size' => 90)));
$keyForm->addElement('textarea', 'home_index_index_welcome', array('label' => $translator->translate('setup_home_index_index_welcome'), 'attribs' => array('size' => 90)));
$keyForm->addElement('textarea', 'home_index_index_instructions', array('label' => $translator->translate('setup_home_index_index_instructions'), 'attribs' => array('size' => 90)));
$langForm->addSubForm($keyForm, 'key');
$this->addSubForm($langForm, $lang);
}
}
示例7: 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);
}
示例8: addItemXpathsToExtend
protected function addItemXpathsToExtend($itemXpathsToExtend)
{
if (count($itemXpathsToExtend) == 0) {
$itemXpathsToExtend = array(new Kaltura_Client_Type_String());
}
$mainSubForm = new Zend_Form_SubForm();
$mainSubForm->setLegend('Item XPaths To Extend');
$mainSubForm->setDecorators(array('FormElements', array('ViewScript', array('viewScript' => 'distribution-item-xpath-to-extend.phtml', 'placement' => 'APPEND')), 'Fieldset'));
$i = 1;
foreach ($itemXpathsToExtend as $stringObject) {
$subForm = new Zend_Form_SubForm(array('disableLoadDefaultDecorators' => true));
$subForm->setDecorators(array('FormElements'));
$subForm->addElement('text', 'itemXpathsToExtend', array('decorators' => array('ViewHelper', array('HtmlTag', array('tag' => 'div'))), 'isArray' => true, 'value' => $stringObject->value));
$mainSubForm->addSubForm($subForm, 'itemXpathsToExtend_subform_' . $i++);
}
$this->addSubForm($mainSubForm, 'itemXpathsToExtend_group');
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:17,代码来源:ConfigurableProfileConfiguration.php
示例9: _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);
}
示例10: init
public function init()
{
/* Form Elements & Other Definitions Here ... */
/*
$tablaOpcion = new Encuesta_Model_DbTable_Opcion;
$rowsetOpciones = $tablaOpcion->fetchAll();
//$eOpciones = new Zend_Form_Element_Multiselect("opciones");
$eOpciones = new Zend_Form_Element_MultiCheckbox("opciones");
$eOpciones->setLabel("Opciones Disponibles:");
//$eOpciones->setAttrib("class", "form-control");
foreach ($rowsetOpciones as $opcion) {
$eOpciones->addMultiOption($opcion->idOpcion, $opcion->opcion);
}
$eSubmit = new Zend_Form_Element_Submit("submit");
$eSubmit->setLabel("Guardar Opciones");
$eSubmit->setAttrib("class", "btn btn-success");
$this->addElement($eOpciones);
$this->addElement($eSubmit);
*/
$categoriaDAO = new Encuesta_DAO_Categoria();
$opcionDAO = new Encuesta_DAO_Opcion();
$modelCategorias = $categoriaDAO->obtenerCategorias();
foreach ($modelCategorias as $modelCategoria) {
$sub = new Zend_Form_SubForm();
$sub->setLegend($modelCategoria->getCategoria() . " :: " . $modelCategoria->getDescripcion());
$modelOpciones = $categoriaDAO->obtenerOpciones($modelCategoria->getIdCategoria());
$eElement = new Zend_Form_Element_MultiCheckbox($modelCategoria->getIdCategoria());
foreach ($modelOpciones as $modelOpcion) {
$eElement->addMultiOption($modelOpcion->getIdOpcion(), $modelOpcion->getOpcion());
}
$sub->addElement($eElement);
$this->addSubForm($sub, $modelCategoria->getIdCategoria());
}
$eSubmit = new Zend_Form_Element_Submit("submit");
$eSubmit->setLabel("Guardar Opciones");
$eSubmit->setAttrib("class", "btn btn-success");
$this->addElement($eSubmit);
}
示例11: init
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));
}
示例12: testGetJumpLinks
public function testGetJumpLinks()
{
$testForm = new Zend_Form();
$subform = new Zend_Form_SubForm();
$subform->setLegend('Subform 1');
$testForm->addSubForm($subform, 'form1');
$subform = new Zend_Form_SubForm();
$subform->setLegend('Subform 2');
$testForm->addSubForm($subform, 'form2');
$subform = new Zend_Form_SubForm();
$subform->setLegend(null);
$testForm->addSubForm($subform, 'form3');
$form = new Admin_Form_ActionBox($testForm);
$links = $form->getJumpLinks();
$this->assertEquals(2, count($links));
$this->assertArrayHasKey('#fieldset-form1', $links);
$this->assertEquals('Subform 1', $links['#fieldset-form1']);
$this->assertArrayHasKey('#fieldset-form2', $links);
$this->assertEquals('Subform 2', $links['#fieldset-form2']);
}
示例13: _prepareForm
/**
* 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);
}
示例14: _prepareForm
/**
* 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);
}
示例15: _prepareForm
/**
* 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);
}