本文整理汇总了PHP中Zend_Form_Element_Checkbox类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Checkbox类的具体用法?PHP Zend_Form_Element_Checkbox怎么用?PHP Zend_Form_Element_Checkbox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Form_Element_Checkbox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($options = null)
{
$periods = new Periods();
$period_actives = $periods->getCoinsPeriod();
parent::__construct($options);
$decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li')));
$this->setName('coinsclass');
$referenceName = new Zend_Form_Element_Text('referenceName');
$referenceName->setLabel('Reference volume title: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators)->setAttrib('size', 60);
$valid = new Zend_Form_Element_Checkbox('valid');
$valid->SetLabel('Is this volume currently valid: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators);
$period = new Zend_Form_Element_Select('period');
$period->setLabel('Period: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('inArray', false, array(array_keys($period_actives)))->addMultiOptions(array(NULL => NULL, 'Choose period:' => $period_actives))->addErrorMessage('You must enter a period for this mint')->setDecorators($decorators);
//Submit button
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submit')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag');
$hash = new Zend_Form_Element_Hash('csrf');
$hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60);
$this->addElement($hash);
$this->addElements(array($referenceName, $valid, $period, $submit));
$this->addDisplayGroup(array('referenceName', 'period', 'valid'), 'details')->removeDecorator('HtmlTag');
$this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
$this->details->setLegend('Mint details: ');
$this->details->removeDecorator('DtDdWrapper');
$this->addDisplayGroup(array('submit'), 'submit');
}
示例2: init
public function init()
{
$this->setName(strtolower(get_class()));
$this->setMethod("post");
$oFormName = new Zend_Form_Element_Hidden("form_name");
$oFormName->setValue(get_class());
$oFormName->setIgnore(FALSE)->removeDecorator("Label");
$this->addElement($oFormName);
$oMessage = new Zend_Form_Element_Textarea("message");
$oMessage->setFilters($this->_aFilters);
$oMessage->setRequired(FALSE);
$oMessage->removeDecorator("label");
$this->addElement($oMessage);
$oIsDing = new Zend_Form_Element_Checkbox("is_ding");
$oIsDing->setLabel("Włącz dźwięk");
$oIsDing->setValue(1);
$this->addElement($oIsDing);
$oSubmit = new Zend_Form_Element_Submit("send_message");
$oSubmit->setLabel("Wyślij wiadomość");
$this->addElement($oSubmit);
$oViewScript = new Zend_Form_Decorator_ViewScript();
$oViewScript->setViewModule("admin");
$oViewScript->setViewScript("_forms/chat.phtml");
$this->clearDecorators();
$this->setDecorators(array(array($oViewScript)));
$oElements = $this->getElements();
foreach ($oElements as $oElement) {
$oElement->setFilters($this->_aFilters);
$oElement->removeDecorator("Errors");
}
}
示例3: render
/**
* @param string $content
* @return string
*/
public function render($content)
{
$prepend = $this->getElement()->getAttrib('prepend');
$append = $this->getElement()->getAttrib('append');
if (null === $prepend && null === $append) {
return $content;
}
$placement = 'prepend';
$addOn = $prepend;
if (null !== $append) {
$placement = 'append';
$addOn = $append;
}
if (is_array($addOn)) {
$addOn = new Zend_Config($addOn, true);
}
$addOnClass = 'add-on';
if ($addOn instanceof Zend_Config) {
if (isset($addOn->active) && true === $addOn->active) {
$addOnClass .= ' active';
unset($addOn->active);
}
$prependedElement = new Zend_Form_Element_Checkbox($addOn);
$prependedElement->setDecorators(array(array('ViewHelper')));
$addOn = $prependedElement->render($this->getElement()->getView());
}
$this->getElement()->setAttrib('prepend', null);
$this->getElement()->setAttrib('append', null);
$span = '<span class="' . $addOnClass . '">' . $addOn . '</span>';
return '<div class="input-' . $placement . '">
' . ('prepend' == $placement ? $span : '') . $content . ('append' == $placement ? $span : '') . '
</div>';
}
示例4: init
/**
*
* Themes & styles
*
*/
public function init()
{
$cname = explode('_', get_class());
$this->preInit(end($cname));
// use template file
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/SettingsStyles.phtml'))));
// load settings
$AppOptions = new Application_Model_AppOptions();
$all_meta = $AppOptions->getAllOptions();
// fields
$themes_array = array('/bootstrap/css/bootstrap.min.css' => 'Bootstrap');
$css_theme = new Zend_Form_Element_Select('css_theme');
$css_theme->setDecorators(array('ViewHelper', 'Errors'))->setMultiOptions($themes_array)->setErrorMessages(array($this->translator->translate('Please select')))->setLabel($this->translator->translate('Choose css theme'))->setRequired(true)->setValue(isset($all_meta['css_theme']) ? $all_meta['css_theme'] : 'bootstrap')->setAttrib('class', 'form-control');
$wide_layout = new Zend_Form_Element_Checkbox('wide_layout');
$wide_layout->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['wide_layout']) && $all_meta['wide_layout'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Extra-wide layout on large screens'))->setCheckedValue("1")->setUncheckedValue("0");
$cover_ysize = new Zend_Form_Element_Text('cover_ysize');
$cover_ysize->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Cover image height'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['cover_ysize']) ? $all_meta['cover_ysize'] : '220')->setAttrib('class', 'form-control');
$user_background = new Zend_Form_Element_Checkbox('user_background');
$user_background->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['user_background']) && $all_meta['user_background'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Users can have custom background image'))->setCheckedValue("1")->setUncheckedValue("0");
$subscriber_background = new Zend_Form_Element_Checkbox('subscriber_background');
$subscriber_background->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['subscriber_background']) && $all_meta['subscriber_background'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Subscribers can have custom background image'))->setCheckedValue("1")->setUncheckedValue("0");
$custom_css = new Zend_Form_Element_Textarea('css_custom');
$custom_css->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '15')->setValue(isset($all_meta['css_custom']) ? $all_meta['css_custom'] : '')->setLabel($this->translator->translate('Custom css'))->setAttrib('class', 'form-control');
$submit = new Zend_Form_Element_Submit('submitbtn');
$submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Update'))->setAttrib('class', 'submit btn btn-default');
$this->addElements(array($css_theme, $wide_layout, $cover_ysize, $user_background, $subscriber_background, $custom_css, $submit));
$this->postInit();
}
示例5: init
public function init()
{
$obj = new Application_Model_DbTable_Juego();
$primaryKey = $obj->getPrimaryKey();
$this->setMethod('post');
$this->setEnctype('multipart/form-data');
$this->setAttrib('idjuego', $primaryKey);
$this->setAction('/admin/juego/new');
$e = new Zend_Form_Element_Hidden($primaryKey);
$this->addElement($e);
$this->addElement($e);
$e = new Zend_Form_Element_Checkbox('estado');
$e->setValue(true);
$this->addElement($e);
$e = new Zend_Form_Element_Text('url');
$this->addElement($e);
$e = new Zend_Form_Element_Text('nombre');
$this->addElement($e);
$i = new Zend_Form_Element_File('avanzado');
$this->addElement($i);
$this->getElement('avanzado')->setDestination(ROOT_IMG_DINAMIC . '/juego/avanzado/')->addValidator('Size', false, 10024000)->addValidator('Extension', true, 'jpg,png,gif,jpeg')->setRequired(false);
$i = new Zend_Form_Element_File('basico360');
$this->addElement($i);
$this->getElement('basico360')->setDestination(ROOT_IMG_DINAMIC . '/juego/basico360/')->addValidator('Size', false, 10024000)->addValidator('Extension', true, 'jpg,png,gif,jpeg')->setRequired(false);
foreach ($this->getElements() as $element) {
$element->removeDecorator('Label');
$element->removeDecorator('DtDdWrapper');
$element->removeDecorator('HtmlTag');
}
}
示例6: init
/**
* Form initialization
*
* @return void
*/
public function init()
{
$this->setName('loginForm');
$this->setElementsBelongTo('loginForm');
$element = new Zend_Form_Element_Text('username');
$element->setLabel('Username')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim');
$this->addElement($element);
$element = new Zend_Form_Element_Password('password');
$element->setLabel('Password')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim');
$this->addElement($element);
$element = new Zend_Form_Element_Checkbox('rememberMe');
$element->setLabel('Remember me');
$this->addElement($element);
/**
* @var $request Zend_Controller_Request_Http
*/
$request = Zend_Controller_Front::getInstance()->getRequest();
$element = new Zend_Form_Element_Hidden('redirect');
$element->setValue($request->getParam('from', '/'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim');
$element->getDecorator('HtmlTag')->setOption('class', 'hidden');
$element->getDecorator('Label')->setOption('tagClass', 'hidden');
$this->addElement($element);
$element = new Zend_Form_Element_Submit('submit');
$element->setLabel('Connection');
$this->addElement($element);
}
示例7: __construct
public function __construct($options = null)
{
parent::__construct($options);
$this->setName('Decmethods');
$decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'apppend', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li')));
$term = new Zend_Form_Element_Text('term');
$term->setLabel('Decoration style term: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter a valid title for this decorative method!')->setDecorators($decorators);
$termdesc = new Pas_Form_Element_RTE('termdesc');
$termdesc->setLabel('Description of decoration style: ')->setRequired(false)->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilters(array('BasicHtml', 'EmptyParagraph'))->addFilter('WordChars');
$valid = new Zend_Form_Element_Checkbox('valid');
$valid->setLabel('Is this term valid?: ')->setRequired(true)->setDecorators($decorators);
$hash = new Zend_Form_Element_Hash('csrf');
$hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60);
$this->addElement($hash);
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag');
$this->addElements(array($term, $termdesc, $valid, $submit));
$this->addDisplayGroup(array('term', 'termdesc', 'valid'), 'details')->removeDecorator('HtmlTag');
$this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
$this->details->removeDecorator('DtDdWrapper');
$this->details->removeDecorator('HtmlTag');
$this->addDisplayGroup(array('submit'), 'submit');
$this->submit->removeDecorator('DtDdWrapper');
$this->submit->removeDecorator('HtmlTag');
$this->details->setLegend('Decoration method details: ');
}
示例8: __construct
public function __construct($options = null)
{
$projecttypes = new ProjectTypes();
$projectype_list = $projecttypes->getTypes();
ZendX_JQuery::enableForm($this);
parent::__construct($options);
$this->setName('research');
$decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li')));
$investigator = new Zend_Form_Element_Text('investigator');
$investigator->setLabel('Principal work conducted by: ')->setRequired(true)->setAttrib('size', 60)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a lead for this project.')->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true));
$level = new Zend_Form_Element_Select('level');
$level->setLabel('Level of research: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => NULL, 'Choose type of research' => $projectype_list))->addValidator('inArray', false, array(array_keys($projectype_list)))->setDecorators($decorators);
$title = new Zend_Form_Element_Text('title');
$title->setLabel('Project title: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 60)->addErrorMessage('Choose title for the project.')->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true));
$description = $this->addElement('RTE', 'description', array('label' => 'Short description of project: '));
$description = $this->getElement('description')->setRequired(false)->addFilter('stringTrim')->setAttribs(array('cols' => 80, 'rows' => 10))->addFilters(array('BasicHtml', 'StringTrim', 'EmptyParagraph'))->addDecorator('HtmlTag', array('tag' => 'li'));
$startDate = new ZendX_JQuery_Form_Element_DatePicker('startDate');
$startDate->setLabel('Start date of project')->setAttrib('size', 20)->setJQueryParam('dateFormat', 'yy-mm-dd')->addValidator('Date')->setRequired(false)->addErrorMessage('You must enter a start date for this project')->setDecorators($decorators);
$endDate = new ZendX_JQuery_Form_Element_DatePicker('endDate');
$endDate->setLabel('End date of project')->setAttrib('size', 20)->setJQueryParam('dateFormat', 'yy-mm-dd')->setRequired(false)->addValidator('Date')->addErrorMessage('You must enter an end date for this project')->setDecorators($decorators);
$valid = new Zend_Form_Element_Checkbox('valid');
$valid->setLabel('Make public: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Digits')->setDecorators($decorators);
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submit')->removeDecorator('label')->setAttrib('class', 'large')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper');
$hash = new Zend_Form_Element_Hash('csrf');
$hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800);
$this->addElements(array($title, $description, $level, $startDate, $endDate, $valid, $investigator, $submit, $hash));
$this->addDisplayGroup(array('title', 'investigator', 'level', 'description', 'startDate', 'endDate', 'valid'), 'details')->removeDecorator('HtmlTag');
$this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
$this->details->removeDecorator('DtDdWrapper');
$this->addDisplayGroup(array('submit'), 'submit');
}
示例9: init
public function init()
{
$tr = Zend_Registry::get('tr');
$name = new Zend_Form_Element_Text('name');
$name->setLabel($tr->_('NAME'));
$name->setRequired(true);
$this->addElement($name);
$enabled = new Zend_Form_Element_Checkbox('enabled');
$enabled->setLabel($tr->_('IS_ACTION_ENABLED'));
$this->addElement($enabled);
$public = new Zend_Form_Element_Checkbox('public');
$public->setLabel($tr->_('IS_ACTION_PUBLIC'));
$this->addElement($public);
$route = new Zend_Form_Element_Text('route');
$route->setLabel($tr->_('ROUTE'));
$route->setRequired(true);
$this->addElement($route);
$desc = new Zend_Form_Element_Textarea('description');
$desc->cols = 35;
$desc->rows = 15;
$desc->setLabel($tr->_('DESCRIPTION'));
$desc->setRequired(false);
$this->addElement($desc);
parent::init();
}
示例10: init
public function init()
{
$tr = Zend_Registry::get('tr');
$locale = Zend_Registry::get('Zend_Locale');
$available_languages = array (
'en' => 'English',
'fr' => 'Francais',
'it' => 'Italiano',
'ru' => 'Русский',
);
$this->setAction('/language');
$this->setAttrib('id', 'language-form');
$languages = new Zend_Form_Element_Select('languages');
$languages->setLabel($tr->_('LANGUAGE'));
$languages->addMultiOptions($available_languages);
$languages->setValue(isset($locale->value) ? $locale->value : 'en');
$this->addElement($languages);
$system_wide = new Zend_Form_Element_Checkbox('system_wide');
$system_wide->setLabel($tr->_('UPDATE_SYSTEM_WIDE') . '?');
$system_wide->setRequired(false);
$this->addElement($system_wide);
$this->addElement(new Zend_Form_Element_Submit($tr->_('SAVE')));
parent::init();
}
示例11: __construct
/**
*
* @param array $options Options to build the form
*/
public function __construct($options = null)
{
parent::__construct($options);
// Title
$title = new Zend_Form_Element_Text('FSI_Title');
$title->setLabel($this->getView()->getCibleText('form_section_title_label') . " <span class='field_required'>*</span>")->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'section_title_edit', 'id' => 'title'))))->setAttrib('class', 'stdTextInput');
$this->addElement($title);
// Show title
$showTitle = new Zend_Form_Element_Checkbox('FS_ShowTitle');
$showTitle->setLabel($this->getView()->getCibleText('form_section_showtitle_label'));
$showTitle->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox'))));
$this->addElement($showTitle);
// Repeat section
$repeat = new Zend_Form_Element_Checkbox('FS_Repeat');
$repeat->setLabel($this->getView()->getCibleText('form_label_has_profil'));
$repeat->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox'))));
$this->addElement($repeat);
// Repeat min
$repeatMin = new Zend_Form_Element_Text('FS_RepeatMin');
$repeatMin->setLabel($this->getView()->getCibleText('form_section_repeatMin_label') . " <span class='field_required'>*</span>")->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'section_RepeatMin');
$this->addElement($repeatMin);
// Repeat max
$repeatMax = new Zend_Form_Element_Text('FS_RepeatMax');
$repeatMax->setLabel($this->getView()->getCibleText('form_section_repeatMax_label') . " <span class='field_required'>*</span>")->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'section_RepeatMax');
$this->addElement($repeatMax);
// Sequence - hidden input
$sequence = new Zend_Form_Element_Hidden('FS_Seq');
$this->addElement($sequence);
// page break - hiden input
$pageBreak = new Zend_Form_Element_Hidden('FS_PageBreak');
$this->addElement($pageBreak);
// Set the form id
$this->setAttrib('id', 'section');
}
示例12: init
public function init()
{
$obj = new Application_Model_DbTable_Link();
$primaryKey = $obj->getPrimaryKey();
$this->setMethod('post');
$this->setEnctype('multipart/form-data');
$this->setAttrib('idlink', $primaryKey);
$this->setAction('/link/index');
$e = new Zend_Form_Element_Hidden($primaryKey);
$this->addElement($e);
$e = new Zend_Form_Element_Checkbox('chkEstado[]');
$e->setValue(true);
$this->addElement($e);
$e = new Zend_Form_Element_Text('txtTitulo[]');
$this->addElement($e);
$e = new Zend_Form_Element_Text('txtLink[]');
$this->addElement($e);
$e = new Zend_Form_Element_Hidden('txtImagen[]');
$this->addElement($e);
foreach ($this->getElements() as $element) {
$element->removeDecorator('Label');
$element->removeDecorator('DtDdWrapper');
$element->removeDecorator('HtmlTag');
}
}
示例13: __construct
public function __construct($options = null)
{
parent::__construct($options);
$services = new WebServices();
$servicesListed = $services->getValidServices();
$decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'apppend', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li')));
$this->setName('socialweb');
$username = new Zend_Form_Element_Text('account');
$username->setLabel('Account username: ')->setRequired(true)->addFilters(array('StringTrim', 'StripTags'))->setAttrib('size', 30)->addErrorMessage('Please enter a valid username!')->setDecorators($decorators);
$service = new Zend_Form_Element_Select('accountName');
$service->setLabel('Social services: ')->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(NULL => 'Choose a service', 'Valid services' => $servicesListed))->addValidator('InArray', false, array(array_keys($servicesListed)))->setDecorators($decorators);
$public = new Zend_Form_Element_Checkbox('public');
$public->setLabel('Show this to public users?: ')->addFilters(array('StringTrim', 'StripTags'))->setRequired(true)->setDecorators($decorators)->addErrorMessage('You must set the status of this account');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submit')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag');
$hash = new Zend_Form_Element_Hash('csrf');
$hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800);
$this->addElements(array($service, $hash, $username, $public, $submit));
$this->addDisplayGroup(array('accountName', 'account', 'public'), 'details')->removeDecorator('HtmlTag');
$this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
$this->details->removeDecorator('DtDdWrapper');
$this->details->removeDecorator('HtmlTag');
$this->addDisplayGroup(array('submit'), 'submit');
$this->submit->removeDecorator('DtDdWrapper');
$this->submit->removeDecorator('HtmlTag');
}
示例14: init
public function init()
{
$this->setName('add_video_link');
//$this->setAction('newExpert');
$this->setMethod('Post');
$this->setAttrib('enctype', 'multipart/form-data');
$title = new Zend_Form_Element_Text('title', array('disableLoadDefaultDecorators' => true));
$title->setRequired(true)->setLabel('* Video Title:')->setAttrib('id', 'video_title')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
$url_video = new Zend_Form_Element_Text('url_video', array('disableLoadDefaultDecorators' => true));
$url_video->setRequired(true)->setLabel('* Video URL:')->setAttrib('id', 'url_video')->addValidator('NotEmpty')->setAttrib("class", "form-control")->addFilter('StripTags')->addFilter('StringTrim')->removeDecorator('htmlTag');
$short_description = new Zend_Form_Element_Textarea('short_description', array('disableLoadDefaultDecorators' => true));
$short_description->setRequired(true)->setAttrib("id", "short_description")->setLabel(' *Short Description:')->setAttrib("class", "form-control")->setAttrib('ROWS', '5')->setAttrib('COLS', '3')->addFilter('StringTrim');
$video_img = new Zend_Form_Element_File('video_img');
//$video_img->setRequired(true)
$video_img->addValidator('Count', false, 1)->addValidator('ImageSize', false, array('minwidth' => 100, 'maxwidth' => 1000, 'minheight' => 100, 'maxheight' => 1000))->addValidator('Size', false, 1000240000)->setErrorMessages(array("Upload an image:"))->addValidator('Extension', false, 'jpg,png,gif,jpeg');
// only JPEG, PNG, and GIFs
$is_featured = new Zend_Form_Element_Checkbox('is_featured', array('disableLoadDefaultDecorators' => true));
$is_featured->setAttrib("id", "is_featured")->setLabel('Featured:')->setAttrib("class", "form-control")->addFilter('StripTags')->addFilter('StringTrim');
$is_main = new Zend_Form_Element_Checkbox('is_main', array('disableLoadDefaultDecorators' => true));
$is_main->setAttrib("id", "is_main")->setLabel('Mark main video:')->setAttrib("class", "form-control")->addFilter('StripTags')->addFilter('StringTrim');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submit-btn');
$submit->setAttrib('class', 'btn btn-lg btn-primary float-right')->removeDecorator('HtmlTag')->removeDecorator('Label')->setLabel("Save");
$this->setElementDecorators(array('Errors', 'ViewHelper', array('decorator' => array('td' => 'HtmlTag'), 'options' => array('tag' => 'td')), array('Label', array('tag' => 'td')), array('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag' => 'tr'))), array('title', 'short_description', 'url_video', 'video_img', 'is_featured', 'is_main'));
//$this->addElement('hash', 'csrf', array('ignore' => true,));
$this->addElements(array($title, $short_description, $video_img, $url_video, $is_featured, $is_main, $submit));
}
示例15: init
/**
*
* Edit Group form
*
*/
public function init()
{
$cname = explode('_', get_class());
$this->preInit(end($cname));
// use template file
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/EditGroup.phtml'))));
// get group from database
$request = Zend_Controller_Front::getInstance()->getRequest();
$group = $request->getParam('name');
$Profiles = new Application_Model_Profiles();
$ProfilesMeta = new Application_Model_ProfilesMeta();
$profile = $Profiles->getProfile($group, false, true);
$owners_profile = $Profiles->getProfileByField('id', $profile->owner);
$username_minchars = Zend_Registry::get('config')->get('username_minchars');
$username_maxchars = Zend_Registry::get('config')->get('username_maxchars');
// fields
$id = new Zend_Form_Element_Hidden('id');
$id->setValue($profile->id);
$name = new Zend_Form_Element_Text('name');
$name->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Group Name'))->setValue($profile->name)->setIgnore(true)->setAttrib('readonly', true)->setAttrib('class', 'form-control');
$screenname = new Zend_Form_Element_Text('screen_name');
$screenname->setDecorators(array('ViewHelper', 'Errors'))->addFilter('StringTrim')->setValue($profile->screen_name)->addValidator('alnum', false, array('allowWhiteSpace' => true))->addValidator('stringLength', false, array($username_minchars, $username_maxchars))->setErrorMessages(array(sprintf($this->translator->translate('Please choose a valid name between %d and %d characters'), $username_minchars, $username_maxchars)))->setLabel($this->translator->translate('Screen Name'))->setRequired(true)->setAttrib('class', 'form-control');
$description = new Zend_Form_Element_Textarea('description');
$description->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '4')->addFilter('StripTags')->setValue($ProfilesMeta->getMetaValue('description', $profile->id))->setLabel($this->translator->translate('About this group'))->setAttrib('class', 'form-control');
$profile_privacy = new Zend_Form_Element_Select('profile_privacy');
$profile_privacy->setDecorators(array('ViewHelper', 'Errors'))->setMultiOptions(Zend_Registry::get('group_privacy_array'))->setErrorMessages(array($this->translator->translate('Select group visibility')))->setLabel($this->translator->translate('Select group visibility'))->setRequired(true)->setValue($profile->profile_privacy)->setAttrib('class', 'form-control');
$is_hidden = new Zend_Form_Element_Checkbox('is_hidden');
$is_hidden->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($profile->is_hidden) && $profile->is_hidden == 1 ? 1 : 0)->setLabel($this->translator->translate('Remove?'))->setCheckedValue("1")->setUncheckedValue("0");
$submit = new Zend_Form_Element_Submit('formsubmit');
$submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Save'))->setAttrib('class', 'submit btn btn-default');
$this->addElements(array($id, $name, $screenname, $profile_privacy, $description, $is_hidden, $submit));
$this->postInit();
}