本文整理汇总了PHP中Zend_Form_Element_Checkbox::setAttrib方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Checkbox::setAttrib方法的具体用法?PHP Zend_Form_Element_Checkbox::setAttrib怎么用?PHP Zend_Form_Element_Checkbox::setAttrib使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Checkbox
的用法示例。
在下文中一共展示了Zend_Form_Element_Checkbox::setAttrib方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _admin
private function _admin()
{
$e = new Zend_Form_Element_Checkbox('admin');
$e->setLabel(_('Is administrator?') . ":");
$e->setAttrib('data-on-color', 'success');
$e->setAttrib('data-off-color', 'danger');
$e->setAttrib('data-on-text', _('Yes'));
$e->setAttrib('data-off-text', _('No'));
return $e;
}
示例2: init
public function init()
{
$this->setName('add_new_post');
$this->setMethod('Post');
$this->setAttrib('encrypt', 'multipart/form-data');
$heading = new Zend_Form_Element_Text('heading', array('disableLoadDefaultDecorators' => true));
$heading->setRequired(true)->setLabel('* Blog Post Title:')->setAttrib('id', 'heading')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
$url = new Zend_Form_Element_Text('url');
$url->setRequired(true)->setAttrib('id', 'url')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib("class", "form-control set-txt")->removeDecorator('htmlTag');
$description = new Zend_Form_Element_Textarea('description', array('disableLoadDefaultDecorators' => true));
$description->setRequired(true)->setLabel('* Description:')->setAttrib('id', 'description')->setAttrib('contenteditable', 'true')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
/*$categories = new Zend_Form_Element_Text('categories',array('disableLoadDefaultDecorators' =>true));
$categories->setLabel(' Category:')
->setAttrib('id', 'categories')
->addFilter('StripTags')
->addFilter('StringTrim')
->addValidator('NotEmpty')
->setAttrib("class", "form-control")
->removeDecorator('htmlTag');*/
$is_comment = new Zend_Form_Element_Checkbox('is_comment', array('disableLoadDefaultDecorators' => true));
$is_comment->setAttrib("id", "is_comment")->setLabel('Mark as No Comments:')->setAttrib("class", "form-control")->addFilter('StripTags')->addFilter('StringTrim');
$tags = new Zend_Form_Element_Text('tags', array('disableLoadDefaultDecorators' => true));
$tags->setLabel('Tags:')->setAttrib('id', 'tags')->setAttrib('placeholder', 'Separate tags with comma,')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
$image = new Zend_Form_Element_File('image');
$image->addValidator('Count', false, 1)->addValidator('ImageSize', false, array('minwidth' => 700, 'maxwidth' => 1000, 'minheight' => 500))->addValidator('Size', false, 1000240000)->setErrorMessages(array("Upload an image:"))->addValidator('Extension', false, 'jpg,png,gif,jpeg,jpg');
// only JPEG, PNG, and GIFs
$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("Publish");
$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('heading', 'is_comment', 'url', 'image', 'description', 'tags'));
$this->addElements(array($heading, $url, $is_comment, $image, $description, $tags, $submit));
}
示例3: 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));
}
示例4: startFrom
public function startFrom()
{
$setting = $this->setting;
if (Application_Model_Preference::GetPlanLevel() == 'disabled') {
$output_sound_device = new Zend_Form_Element_Checkbox('output_sound_device');
$output_sound_device->setLabel('Hardware Audio Output')->setRequired(false)->setValue($setting['output_sound_device'] == "true" ? 1 : 0)->setDecorators(array('ViewHelper'));
if (Application_Model_Preference::GetEnableStreamConf() == "false") {
$output_sound_device->setAttrib("readonly", true);
}
$this->addElement($output_sound_device);
$output_types = array("ALSA" => "ALSA", "AO" => "AO", "OSS" => "OSS", "Portaudio" => "Portaudio", "Pulseaudio" => "Pulseaudio");
$output_type = new Zend_Form_Element_Select('output_sound_device_type');
$output_type->setLabel("Output Type")->setMultiOptions($output_types)->setValue($setting['output_sound_device_type'])->setDecorators(array('ViewHelper'));
if ($setting['output_sound_device'] != "true") {
$output_type->setAttrib("disabled", "disabled");
}
$this->addElement($output_type);
}
$icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata');
$icecast_vorbis_metadata->setLabel('Icecast Vorbis Metadata')->setRequired(false)->setValue($setting['icecast_vorbis_metadata'] == "true" ? 1 : 0)->setDecorators(array('ViewHelper'));
if (Application_Model_Preference::GetEnableStreamConf() == "false") {
$icecast_vorbis_metadata->setAttrib("readonly", true);
}
$this->addElement($icecast_vorbis_metadata);
$stream_format = new Zend_Form_Element_Radio('streamFormat');
$stream_format->setLabel('Stream Label:');
$stream_format->setMultiOptions(array("Artist - Title", "Show - Artist - Title", "Station name - Show name"));
$stream_format->setValue(Application_Model_Preference::GetStreamLabelFormat());
$stream_format->setDecorators(array('ViewHelper'));
$this->addElement($stream_format);
}
示例5: init
public function init()
{
$this->setName('add_testimonial');
//$this->setAction('newExpert');
$this->setMethod('Post');
$this->setAttrib('enctype', 'multipart/form-data');
$first_name = new Zend_Form_Element_Text('first_name', array('disableLoadDefaultDecorators' => true));
$first_name->setRequired(true)->setLabel('* First Name:')->setAttrib('id', 'video_title')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
$last_name = new Zend_Form_Element_Text('last_name', array('disableLoadDefaultDecorators' => true));
$last_name->setRequired(true)->setLabel('* Last Name:')->setAttrib('id', 'url_video')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
$email = new Zend_Form_Element_Text('email', array('disableLoadDefaultDecorators' => true));
$email->setRequired(true)->setLabel('* Email:')->setAttrib('id', 'email')->setAttrib('size', '30')->addFilter('StripTags')->addFilter('StringTrim')->setErrorMessages(array("Write Email"))->addValidator('EmailAddress', true)->setAttrib("class", "form-control")->removeDecorator('htmlTag');
$short_description = new Zend_Form_Element_Textarea('short_description', array('disableLoadDefaultDecorators' => true));
$short_description->setRequired(true)->setAttrib("id", "short_description")->setLabel(' *Testimonial:')->setAttrib("class", "form-control")->setAttrib('ROWS', '5')->setAttrib('COLS', '3')->setErrorMessages(array("Write Description for Testimonial"))->addFilter('StringTrim');
$image1 = new Zend_Form_Element_File('image1');
//$image1->setRequired(true)
$image1->addValidator('Count', false, 1)->addValidator('ImageSize', false, array('minwidth' => 100, 'maxwidth' => 400, 'minheight' => 100, 'maxheight' => 400))->addValidator('Size', false, 1000240000)->setErrorMessages(array("*Upload an image:"))->addValidator('Extension', false, 'jpg,png,gif');
// 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');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$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('first_name', 'last_name', 'email', 'short_description', 'image1', 'is_featured'));
//$this->addElement('hash', 'csrf', array('ignore' => true,));
$this->addElements(array($first_name, $last_name, $image1, $email, $is_featured, $short_description, $submit));
}
示例6: _prepareForm
/**
* Builds a form form data
* @return unknown_type
*/
private function _prepareForm()
{
!isset($this->_options) ? $this->_options = array() : null;
!isset($this->_options[self::DATA]) ? $this->_options[self::DATA] = array() : null;
$action = $this->_options[self::ACTION];
$model = $this->_options[self::MODEL];
$this->setAction($action);
$this->setMethod('post');
foreach ($this->_options[self::DATA] as $fieldName => $fieldValue) {
if ($model->isLocked($fieldName)) {
continue;
}
$typeElement = $model->getTypeElement($fieldName);
try {
if ($typeElement == Fgsl_Form_Constants::TEXT) {
$text = new Zend_Form_Element_Text($fieldName);
}
if ($typeElement == Fgsl_Form_Constants::PASSWORD) {
$text = new Zend_Form_Element_Password($fieldName);
}
if ($typeElement == Fgsl_Form_Constants::SELECT) {
$text = new Zend_Form_Element_Select($fieldName);
$selectOptions = $model->getSelectOptions($fieldName);
$text->addMultiOptions($selectOptions);
}
if ($typeElement == Fgsl_Form_Constants::CHECKBOX) {
$text = new Zend_Form_Element_Checkbox($fieldName);
}
$text->setLabel($model->getFieldLabel($fieldName));
isset($this->_options[self::DATA][$fieldName]) ? $text->setValue($this->_options[self::DATA][$fieldName]) : '';
if (isset($this->_options['readonly'])) {
if (array_key_exists($fieldName, $this->_options['readonly'])) {
$text->setAttrib('readonly', 'readonly');
}
}
$this->addElement($text);
} catch (Exception $e) {
return null;
}
}
/**
* Stores primary key value into a HTML hidden element
*/
if ($this->_options[self::DATA][$model->getFieldKey()] !== '') {
$text = new Zend_Form_Element_Hidden($model->getFieldKey());
$text->setValue($model->getKeyValue($this->_options[self::DATA]));
$this->addElement($text);
}
$formType = $this->_options[self::DATA][$model->getFieldKey()] === '' ? $this->_getLabel(self::INSERT_LABEL) : $this->_getLabel(self::EDIT_LABEL);
$text = new Zend_Form_Element_Submit(ucfirst($formType));
$this->addElement($text);
$text = new Zend_Form_Element_Submit('Return');
$text->setAttrib('name', 'return');
$this->addElement($text);
return $this;
}
示例7: init
public function init()
{
$penaltyname = new Zend_Form_Element_Text('penaltyname');
$penaltyname->addValidator(new Zend_Validate_Db_NoRecordExists('ob_penalty_details', 'penalty_name', 'recordstatus_id=3'));
$penaltyname->setAttrib('class', 'txt_put');
$penaltyname->setAttrib('id', 'penaltyname');
$penaltyname->setLabel('penaltyname')->setRequired(true)->addValidators(array(array('NotEmpty')));
$penalty_per_month = new Zend_Form_Element_Text('penalty_per_month');
$penalty_per_month->setAttrib('class', 'txt_put');
$penalty_per_month->setAttrib('id', 'penalty_per_month');
$penalty_per_month->setLabel('penalty_per_month')->setRequired(true)->addValidators(array(array('NotEmpty')));
$penalty_per_day = new Zend_Form_Element_Text('penalty_per_day');
$penalty_per_day->setAttrib('class', 'txt_put');
$penalty_per_day->setAttrib('id', 'penalty_per_day');
$penalty_per_day->setLabel('penalty_per_day')->setRequired(true)->addValidators(array(array('NotEmpty')));
$status = new Zend_Form_Element_Checkbox('status');
$status->setAttrib('class', 'txt_put');
$status->setAttrib('id', 'status');
$status->setLabel('Active')->setRequired(true);
$unit_per_month = new Zend_Form_Element_Select('unit_per_month');
$unit_per_month->addMultiOption('', 'Select...');
$unit_per_month->addMultiOptions(array('Rs' => 'Flat', '%' => 'Percentage'));
$unit_per_month->setAttrib('class', 'txt_put');
$unit_per_month->setAttrib('id', 'unit_per_month');
$unit_per_month->setRequired(true);
$unit_per_day = new Zend_Form_Element_Select('unit_per_day');
$unit_per_day->addMultiOption('', 'Select...');
$unit_per_day->addMultiOptions(array('Rs' => 'Flat', '%' => 'Percentage'));
$unit_per_day->setAttrib('class', 'txt_put');
$unit_per_day->setAttrib('id', 'unit_per_day');
$unit_per_day->setRequired(true);
$creditlinename = new Zend_Form_Element_Select('creditlinename');
$creditlinename->addMultiOption('', 'Select...');
$creditlinename->setAttrib('class', 'txt_put');
$creditlinename->setAttrib('id', 'creditlinename');
$creditlinename->setRequired(true);
$submit = new Zend_Form_Element_Submit('Submit');
$submit->setAttrib('class', 'savings');
$submit->setAttrib('id', 'Submit');
$this->addElements(array($penaltyname, $penalty_per_month, $penalty_per_day, $status, $unit_per_month, $unit_per_day, $creditlinename, $submit));
}
示例8: checkBoxChildConstruct
public function checkBoxChildConstruct($form, $childs, $class = 1)
{
foreach ($childs as $child) {
$checkBox = new Zend_Form_Element_Checkbox($child['P_ID']);
$checkBox->setLabel($child['PI_PageTitle']);
$checkBox->setAttrib('class', "childNiveau_{$class}");
$form->addElement($checkBox);
if (count($child['child'] > 0)) {
FormExtranetGroupAssociate::checkBoxChildConstruct($this, $child['child'], $class++);
}
}
}
示例9: init
public function init()
{
$country_list = Application_Model_Preference::GetCountryList();
$isSass = Application_Model_Preference::GetPlanLevel() == 'disabled' ? false : true;
$this->isSass = $isSass;
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/support-setting.phtml', "isSaas" => $isSass)), array('File', array('viewScript' => 'form/support-setting.phtml', 'placement' => false))));
//Station name
$this->addElement('text', 'stationName', array('class' => 'input_text', 'label' => 'Station Name', 'required' => true, 'filters' => array('StringTrim'), 'validator' => array('NotEmpty'), 'value' => Application_Model_Preference::GetStationName(), 'decorators' => array('ViewHelper')));
// Phone number
$this->addElement('text', 'Phone', array('class' => 'input_text', 'label' => 'Phone:', 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetPhone(), 'decorators' => array('ViewHelper')));
//Email
$this->addElement('text', 'Email', array('class' => 'input_text', 'label' => 'Email:', 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetEmail(), 'decorators' => array('ViewHelper')));
// Station Web Site
$this->addElement('text', 'StationWebSite', array('label' => 'Station Web Site:', 'required' => false, 'class' => 'input_text', 'value' => Application_Model_Preference::GetStationWebSite(), 'decorators' => array('ViewHelper')));
// county list dropdown
$this->addElement('select', 'Country', array('label' => 'Country:', 'required' => false, 'value' => Application_Model_Preference::GetStationCountry(), 'multiOptions' => $country_list, 'decorators' => array('ViewHelper')));
// Station city
$this->addElement('text', 'City', array('label' => 'City:', 'required' => false, 'class' => 'input_text', 'value' => Application_Model_Preference::GetStationCity(), 'decorators' => array('ViewHelper')));
// Station Description
$description = new Zend_Form_Element_Textarea('Description');
$description->class = 'input_text_area';
$description->setLabel('Station Description:')->setRequired(false)->setValue(Application_Model_Preference::GetStationDescription())->setDecorators(array('ViewHelper'))->setAttrib('ROWS', '2')->setAttrib('COLS', '58');
$this->addElement($description);
// Station Logo
$upload = new Zend_Form_Element_File('Logo');
$upload->setLabel('Station Logo:')->setRequired(false)->setDecorators(array('File'))->addValidator('Count', false, 1)->addValidator('Extension', false, 'jpg,jpeg,png,gif')->addFilter('ImageSize');
$upload->setAttrib('accept', 'image/*');
$this->addElement($upload);
if (!$isSass) {
//enable support feedback
$this->addElement('checkbox', 'SupportFeedback', array('label' => 'Send support feedback', 'required' => false, 'value' => Application_Model_Preference::GetSupportFeedback(), 'decorators' => array('ViewHelper')));
// checkbox for publicise
$checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise");
$checkboxPublicise->setLabel('Promote my station on Sourcefabric.org')->setRequired(false)->setDecorators(array('ViewHelper'))->setValue(Application_Model_Preference::GetPublicise());
if (Application_Model_Preference::GetSupportFeedback() == '0') {
$checkboxPublicise->setAttrib("disabled", "disabled");
}
$this->addElement($checkboxPublicise);
// text area for sending detail
$this->addElement('textarea', 'SendInfo', array('class' => 'sending_textarea', 'required' => false, 'filters' => array('StringTrim'), 'readonly' => true, 'cols' => 61, 'rows' => 5, 'value' => Application_Model_Preference::GetSystemInfo(false, true), 'decorators' => array('ViewHelper')));
// checkbox for privacy policy
$checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy");
$checkboxPrivacy->setLabel("By checking this box, I agree to Sourcefabric's <a id=\"link_to_privacy\" href=\"http://www.sourcefabric.org/en/about/policy/\" onclick=\"window.open(this.href); return false;\">privacy policy</a>.")->setDecorators(array('ViewHelper'));
$this->addElement($checkboxPrivacy);
}
// submit button
$submit = new Zend_Form_Element_Submit("submit");
$submit->class = 'ui-button ui-state-default right-floated';
$submit->setIgnore(true)->setLabel("Save")->setDecorators(array('ViewHelper'));
$this->addElement($submit);
}
示例10: __construct
/**
* Create a module selection form for system installation
*
* @param array|Zend_Config $options
*/
public function __construct($options = null)
{
parent::__construct($options);
$this->setName('modules');
$this->setLegend('Modules');
$mod_dir = ZfApplication::$_base_path . "/app";
$iterator = new DirectoryIterator($mod_dir);
foreach ($iterator as $file) {
if ($file->isDir() && $file->getFilename() != "." && $file->getFilename() != ".." && substr($file->getFilename(), 0, 1) != ".") {
$module = new Zend_Form_Element_Checkbox($file->getFilename(), array('value' => 1));
$module->setAttrib('id', 'modules_' . $file->getFilename())->setLabel($file->getFilename());
$this->addElement($module);
}
}
}
示例11: init
public function init()
{
$this->setName('add_main_banner');
$this->setMethod('Post');
$this->setAttrib('enctype', 'multipart/form-data');
$targetUrl = new Zend_Form_Element_Text('target_url', array('disableLoadDefaultDecorators' => true));
$targetUrl->setRequired(true)->setLabel('* Target Url:')->setAttrib('id', 'target_url')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
$banner_img = new Zend_Form_Element_File('banner_img');
$banner_img->addValidator('Count', false, 1)->addValidator('ImageSize', false, array('minwidth' => 1600, 'maxwidth' => 1700, 'minheight' => 500))->addValidator('Size', false, 1000240000)->setErrorMessages(array("Upload an image:"))->addValidator('Extension', false, 'jpg,png,gif,jpeg,jpg');
// only JPEG, PNG, and GIFs
$is_main = new Zend_Form_Element_Checkbox('is_main', array('disableLoadDefaultDecorators' => true));
$is_main->setAttrib("id", "is_main")->setLabel('Mark main Banner:')->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('targetUrl', 'banner_img', 'is_main'));
$this->addElements(array($targetUrl, $banner_img, $is_main, $submit));
}
示例12: init
public function init()
{
$this->setName('image_block');
$block = new Zend_Form_Element_File('block');
$block->setRequired(true)->addValidator('Count', false, 1)->addValidator('FilesSize', false, array('min' => '1kB', 'max' => '5MB'))->addValidator('ImageSize', false, array('minwidth' => 10, 'minheight' => 10))->addFilter('StringTrim')->setErrorMessages(array("Upload an image"))->addValidator('Extension', false, 'jpeg,jpg,png,gif');
// only JPEG, PNG, and GIFs
$name = new Zend_Form_Element_Text('name', array('disableLoadDefaultDecorators' => true));
$name->setRequired(true)->setAttrib('id', 'image-name')->addFilter('StringTrim')->addFilter('StripTags')->addValidator('NotEmpty')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
$caption = new Zend_Form_Element_Text('caption', array('disableLoadDefaultDecorators' => true));
$caption->setAttrib('id', 'caption')->addFilter('StringTrim')->addFilter('StripTags')->addFilter('htmlentities')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
$disable_link = new Zend_Form_Element_Checkbox('disable_link', array('disableLoadDefaultDecorators' => true));
$disable_link->setAttrib("id", "disable_link")->setAttrib("class", "float-left")->addFilter('StringTrim')->removeDecorator('htmlTag');
$link = new Zend_Form_Element_Text('link', array('disableLoadDefaultDecorators' => true));
$link->setAttrib('id', 'link')->addFilter('StringTrim')->addFilter('StripTags')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$submit->setAttrib('class', 'btn btn-middium btn-primary pull-right')->removeDecorator('HtmlTag')->removeDecorator('Label')->setLabel("Update");
$this->setElementDecorators(array('Errors', 'ViewHelper', array('decorator' => array('td' => 'HtmlTag'), 'options' => array('tag' => 'td')), array('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag' => 'tr'))), array('block', 'name', 'link', 'caption', 'disable_link'));
$this->addElements(array($block, $name, $link, $caption, $disable_link, $submit));
}
示例13: startFrom
public function startFrom()
{
$setting = $this->setting;
if (Application_Model_Preference::GetPlanLevel() == 'disabled') {
$output_sound_device = new Zend_Form_Element_Checkbox('output_sound_device');
$output_sound_device->setLabel(_('Hardware Audio Output'))->setRequired(false)->setValue($setting['output_sound_device'] == "true" ? 1 : 0)->setDecorators(array('ViewHelper'));
if (Application_Model_Preference::GetEnableStreamConf() == "false") {
$output_sound_device->setAttrib("readonly", true);
}
$this->addElement($output_sound_device);
$output_types = array("ALSA" => "ALSA", "AO" => "AO", "OSS" => "OSS", "Portaudio" => "Portaudio", "Pulseaudio" => "Pulseaudio");
$output_type = new Zend_Form_Element_Select('output_sound_device_type');
$output_type->setLabel(_("Output Type"))->setMultiOptions($output_types)->setValue($setting['output_sound_device_type'])->setDecorators(array('ViewHelper'));
if ($setting['output_sound_device'] != "true") {
$output_type->setAttrib("disabled", "disabled");
}
$this->addElement($output_type);
}
$icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata');
$icecast_vorbis_metadata->setLabel(_('Icecast Vorbis Metadata'))->setRequired(false)->setValue($setting['icecast_vorbis_metadata'] == "true" ? 1 : 0)->setDecorators(array('ViewHelper'));
if (Application_Model_Preference::GetEnableStreamConf() == "false") {
$icecast_vorbis_metadata->setAttrib("readonly", true);
}
$this->addElement($icecast_vorbis_metadata);
$stream_format = new Zend_Form_Element_Radio('streamFormat');
$stream_format->setLabel(_('Stream Label:'));
$stream_format->setMultiOptions(array(_("Artist - Title"), _("Show - Artist - Title"), _("Station name - Show name")));
$stream_format->setValue(Application_Model_Preference::GetStreamLabelFormat());
$stream_format->setDecorators(array('ViewHelper'));
$this->addElement($stream_format);
$offAirMeta = new Zend_Form_Element_Text('offAirMeta');
$offAirMeta->setLabel(_('Off Air Metadata'))->setValue(Application_Model_StreamSetting::getOffAirMeta())->setDecorators(array('ViewHelper'));
$this->addElement($offAirMeta);
$enable_replay_gain = new Zend_Form_Element_Checkbox("enableReplayGain");
$enable_replay_gain->setLabel(_("Enable Replay Gain"))->setValue(Application_Model_Preference::GetEnableReplayGain())->setDecorators(array('ViewHelper'));
$this->addElement($enable_replay_gain);
$replay_gain = new Zend_Form_Element_Hidden("replayGainModifier");
$replay_gain->setLabel(_("Replay Gain Modifier"))->setValue(Application_Model_Preference::getReplayGainModifier())->setAttribs(array('style' => "border: 0; color: #f6931f; font-weight: bold;"))->setDecorators(array('ViewHelper'));
$this->addElement($replay_gain);
}
示例14: init
public function init()
{
$this->setName('add_testimonial');
$first_name = new Zend_Form_Element_Text('first_name', array('disableLoadDefaultDecorators' => true));
$first_name->setRequired(true)->setAttrib('id', 'first_name')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
$last_name = new Zend_Form_Element_Text('last_name', array('disableLoadDefaultDecorators' => true));
$last_name->setRequired(true)->setAttrib('id', 'last_name')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib("class", "form-control")->removeDecorator('htmlTag');
$email = new Zend_Form_Element_Text('email', array('disableLoadDefaultDecorators' => true));
$email->setRequired(true)->setAttrib('id', 'email')->setAttrib('size', '30')->addFilter('StripTags')->addFilter('StringTrim')->setErrorMessages(array("Write Email"))->addValidator('EmailAddress', true)->setAttrib("class", "form-control")->removeDecorator('htmlTag');
$short_description = new Zend_Form_Element_Textarea('short_description', array('disableLoadDefaultDecorators' => true));
$short_description->setRequired(true)->setAttrib("id", "editor1")->setAttrib("class", "form-control")->setAttrib('name', 'short_description')->setErrorMessages(array("Write Description for Testimonial"))->addFilter('StringTrim');
$image1 = new Zend_Form_Element_File('image1');
$image1->addValidator('Count', false, 1)->addValidator('FilesSize', false, array('min' => '1kB', 'max' => '5MB'))->addValidator('ImageSize', false, array('minwidth' => 10, 'minheight' => 10))->addFilter('StringTrim')->setErrorMessages(array("Upload an image"))->addValidator('Extension', false, 'jpeg,jpg,png,gif');
// only JPEG, PNG, and GIFs
$is_featured = new Zend_Form_Element_Checkbox('is_featured', array('disableLoadDefaultDecorators' => true));
$is_featured->setAttrib("id", "is_featured")->setAttrib("class", "form-control")->addFilter('StripTags')->addFilter('StringTrim');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$submit->setAttrib('class', 'btn btn-md 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('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag' => 'tr'))), array('first_name', 'last_name', 'email', 'short_description', 'image1', 'is_featured'));
$this->addElements(array($first_name, $last_name, $image1, $email, $is_featured, $short_description, $submit));
}
示例15: init
public function init()
{
$this->setName('add_video_link');
$this->setAttrib('enctype', 'multipart/form-data');
$title = new Zend_Form_Element_Text('title', array('disableLoadDefaultDecorators' => true));
$title->setRequired(true)->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)->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", "editor1")->setAttrib("class", "form-control")->addFilter('StringTrim');
$video_img = new Zend_Form_Element_File('video_img');
$video_img->addValidator('Count', false, 1)->addValidator('FilesSize', false, array('min' => '1kB', 'max' => '5MB'))->addValidator('ImageSize', false, array('minwidth' => 10, 'minheight' => 10))->addFilter('StringTrim')->setErrorMessages(array("Upload an image"))->addValidator('Extension', false, 'jpeg,jpg,png,gif');
// only JPEG, PNG, and GIFs
$is_featured = new Zend_Form_Element_Checkbox('is_featured', array('disableLoadDefaultDecorators' => true));
$is_featured->setAttrib("id", "is_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")->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-md 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('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag' => 'tr'))), array('title', 'short_description', 'url_video', 'video_img', 'is_featured', 'is_main'));
$this->addElements(array($title, $short_description, $video_img, $url_video, $is_featured, $is_main, $submit));
}