本文整理汇总了PHP中Zend_Form_Element_File::setDisableTranslator方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_File::setDisableTranslator方法的具体用法?PHP Zend_Form_Element_File::setDisableTranslator怎么用?PHP Zend_Form_Element_File::setDisableTranslator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_File
的用法示例。
在下文中一共展示了Zend_Form_Element_File::setDisableTranslator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testTranslatingValidatorErrors
public function testTranslatingValidatorErrors()
{
require_once 'Zend/Translate.php';
$translate = new Zend_Translate('array', array('unused', 'foo' => 'bar'), 'en');
$this->element->setTranslator($translate);
$adapter = $this->element->getTranslator();
$this->assertTrue($adapter instanceof Zend_Translate_Adapter_Array);
$adapter = $this->element->getTransferAdapter();
$adapter = $adapter->getTranslator();
$this->assertTrue($adapter instanceof Zend_Translate_Adapter_Array);
$this->assertFalse($this->element->translatorIsDisabled());
$this->element->setDisableTranslator($translate);
$this->assertTrue($this->element->translatorIsDisabled());
}
示例2: _createFileuploadField
/**
* Method shows the fields for file uploads by looking in config file
* @return <Zend_Element>
*/
private function _createFileuploadField()
{
// get path to store files
$tempPath = $this->_config->form->first->temp;
if (true === empty($tempPath)) {
$tempPath = APPLICATION_PATH . '/workspace/tmp/';
}
// get allowed filetypes
$filetypes = $this->_config->publish->filetypes->allowed;
if (true === empty($filetypes)) {
$filetypes = 'pdf,txt,html,htm';
}
//get allowed file size
$maxFileSize = (int) $this->_config->publish->maxfilesize;
if (true === empty($maxFileSize)) {
$maxFileSize = 1024000;
//1MB
}
// Upload-fields required to enter second stage
$requireUpload = $this->_config->form->first->require_upload;
if (true === empty($requireUpload)) {
$requireUpload = 0;
}
//file upload field(s)
$fileupload = new Zend_Form_Element_File('fileupload');
$fileupload->setDisableTranslator(true)->setLabel('fileupload')->setDestination($tempPath)->addValidator('Size', false, $maxFileSize)->setMaxFileSize($maxFileSize)->addValidator('Extension', false, $filetypes)->setValueDisabled(true)->setAttrib('enctype', 'multipart/form-data');
if (1 == $requireUpload) {
if (!isset($this->_session->fulltext) || $this->_session->fulltext == '0') {
$fileupload->setRequired(true);
}
} else {
$fileupload->setRequired(false);
}
$this->addElement($fileupload);
$this->addSubmitButton('addAnotherFile', 'addAnotherFile');
$comment = $this->createElement('textarea', 'uploadComment');
$comment->setDisableTranslator(true);
$comment->setLabel('uploadComment');
$this->addElement($comment);
$group = array($fileupload->getName(), 'addAnotherFile', $comment->getName());
return $group;
}