當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Form_Element_File::setDisableTranslator方法代碼示例

本文整理匯總了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());
 }
開發者ID:jsnshrmn,項目名稱:Suma,代碼行數:14,代碼來源:FileTest.php

示例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;
 }
開發者ID:belapp,項目名稱:opus4-application,代碼行數:46,代碼來源:PublishingFirst.php


注:本文中的Zend_Form_Element_File::setDisableTranslator方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。