本文整理汇总了PHP中Zend_Form_Element_File::getDecorator方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_File::getDecorator方法的具体用法?PHP Zend_Form_Element_File::getDecorator怎么用?PHP Zend_Form_Element_File::getDecorator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_File
的用法示例。
在下文中一共展示了Zend_Form_Element_File::getDecorator方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
/* Form Elements & Other Definitions Here ... */
$this->setMethod("POST");
$name = new Zend_Form_Element_Text("name");
$name->setRequired();
$name->setLabel("material name:");
$name->setAttrib("placeholder", "Enter material name");
$name->addValidator(new Zend_Validate_Alnum("true"));
$name->setAttrib("class", "form-control");
$name->getDecorator("Label")->setOption("class", "control-label");
$name->getDecorator("Errors")->setOption("class", "alert alert-danger");
$name->getDecorator("Errors")->setOption("style", " list-style-type:none");
$path = new Zend_Form_Element_File('path');
$path->setLabel('Select File:');
$path->setRequired();
$path->setAttrib("class", "form-control");
$path->setAttrib("class", "file-loading");
$path->getDecorator("Label")->setOption("class", "control-label");
$path->getDecorator("Errors")->setOption("class", "alert alert-danger");
$path->getDecorator("Errors")->setOption("style", " list-style-type:none");
$course = new Zend_Form_Element_Select('cid');
$course->setLabel('Course Name:');
//$course ->setMultiOptions(array( '5'=>'a','6'=>'c'));
$course->setRequired(true)->addValidator('NotEmpty', true);
$course->setAttrib("class", "form-control");
$course->getDecorator("Label")->setOption("class", "control-label");
$course->getDecorator("Errors")->setOption("class", "alert alert-danger");
$course->getDecorator("Errors")->setOption("style", " list-style-type:none");
$type = new Zend_Form_Element_Select('tid');
$type->setLabel('Material Type:');
//$type->setMultiOptions(array( '1'=>'pdf','2'=>'ppt'));
$type->setRequired(true)->addValidator('NotEmpty', true);
$type->setAttrib("class", "form-control");
$type->getDecorator("Label")->setOption("class", "control-label");
$type->getDecorator("Errors")->setOption("class", "alert alert-danger");
$type->getDecorator("Errors")->setOption("style", " list-style-type:none");
$mdate = new Zend_Form_Element_Hidden("mdate");
$submit = new Zend_Form_Element_Submit("submit");
$submit->setAttrib("class", "btn btn-xl center-block");
//$submit->setAttrib("class", "btn");
$this->addElements(array($name, $path, $course, $type, $mdate, $submit));
}
示例2: init
public function init()
{
$this->setName('f3')->setAttrib('enctype', 'multipart/form-data')->setMethod('post')->setAttribs(array('onsubmit' => 'return kiem_tra()', 'name' => 'f3'));
$baseUrl = Khcn_View_Helper_GetBaseUrl::getBaseUrl();
$file = new Zend_Form_Element_File('file');
$file->setLabel('Upload file')->setRequired(true)->setDescription('(*.xlsx, *.xls)<br/> Click <a href="' . $baseUrl . '/../application/templates/admin/files/bai_bao_khoa_hoc_import.xlsx">here</a> to download sample file.')->setDestination(BASE_PATH . '/upload/files/temp/')->addValidator(new Zend_Validate_File_Extension(array('xls', 'xlsx')))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'file'));
$file->getDecorator('Description')->setOption('escape', false);
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel('Lưu vào csdl')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span', 'class' => 'filter_btn_l'))))->setAttribs(array('class' => 'button'));
$this->addElements(array($file, $submit));
$this->addDisplayGroup(array('submit'), 'import', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'td')), array('HtmlTag', array('tag' => 'tr', 'id' => 'import')))));
$this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'import_dt')), 'Form'));
}
示例3: testDefaultDecoratorsContainDescription
public function testDefaultDecoratorsContainDescription()
{
$element = new Zend_Form_Element_File('baz');
$decorators = $element->getDecorator('Description');
$this->assertTrue($decorators instanceof Zend_Form_Decorator_Description);
}
示例4: testCallbackFunctionAtHtmlTag
/**
* @group GH-247
*/
public function testCallbackFunctionAtHtmlTag()
{
$this->assertEquals(array('callback' => array('Zend_Form_Element_File', 'resolveElementId')), $this->element->getDecorator('HtmlTag')->getOption('id'));
}