コード例 #1
0
ファイル: UploadTest.php プロジェクト: vegas-cmf/media
 public function testRender()
 {
     $name = 'upload';
     $upload = new Upload($name);
     $output = $upload->render();
     $this->assertEquals($output, '<input type="file" id="upload" name="upload" vegas-cmf="upload" max-files="1" upload-url="/upload" min-file-size="1B" max-file-size="10MB" browser-type="button" browser-label="Select file" allowed-extensions="" forbidden-extensions="" allowed-mime-types="" forbidden-mime-types="" />');
 }
コード例 #2
0
ファイル: Fake.php プロジェクト: vegas-cmf/media
 public function initialize()
 {
     $image = new Upload('fake_file');
     $image->setModel(new FakeFileModel());
     $image->setPreviewSize(array('width' => 100, 'height' => 100));
     $image->getDecorator()->setTemplateName('jquery');
     $image->setUploadUrl($this->url->get(['for' => 'testcrud', 'action' => 'upload']));
     $image->setMode(Upload::MODE_MULTI);
     $image->setMaxFiles(3);
     $image->setExtensions(['jpg', 'png']);
     $image->setMimeTypes(['image/jpeg', 'image/png']);
     $image->setRenderPreview(true);
     $image->setLabel('Image');
     $image->getDecorator()->setDI($this->di);
     $image->setAutoUpload(false);
     $image->setButtonLabels(array('add' => 'Add image'));
     $image->setTriggerType('button');
     $image->setMaxFileSize('10MB');
     $this->add($image);
     $field = new Text('fake_field');
     $field->addValidator(new PresenceOf());
     $this->add($field);
 }