コード例 #1
0
 protected function renderControlEditable()
 {
     if ($this->getDisabledValue()) {
         return $this->renderControlNonEditable();
     }
     assert('$this->model instanceof WizardForm || $this->model instanceof Item || $this->model->getModel() instanceof Item');
     $existingFilesInformation = array();
     foreach ($this->model->files as $existingFile) {
         $existingFileInformation = array('name' => $existingFile->name, 'size' => FileModelDisplayUtil::convertSizeToHumanReadableAndGet((int) $existingFile->size), 'id' => $existingFile->id);
         if ($this->getAllowDownloadOnEditable()) {
             $existingFileInformation['filelink'] = FileModelDisplayUtil::resolveDownloadUrlByRelationModelIdAndRelationModelClassNameAndFileIdAndFileName($this->model->id, get_class($this->model), $existingFile->id);
         }
         $existingFilesInformation[] = $existingFileInformation;
     }
     $inputNameAndId = $this->getEditableInputId('files');
     $cClipWidget = new CClipWidget();
     $cClipWidget->beginClip("filesElement");
     $cClipWidget->widget('application.core.widgets.FileUpload', array('uploadUrl' => Yii::app()->createUrl("zurmo/fileModel/upload", array('filesVariableName' => $inputNameAndId)), 'deleteUrl' => Yii::app()->createUrl("zurmo/fileModel/delete"), 'inputName' => $inputNameAndId, 'inputId' => $inputNameAndId, 'hiddenInputName' => 'filesIds', 'formName' => $this->form->id, 'allowMultipleUpload' => true, 'existingFiles' => $existingFilesInformation, 'maxSize' => (int) InstallUtil::getMaxAllowedFileSize(), 'showMaxSize' => $this->getShowMaxSize(), 'id' => $this->getId(), 'renderFileDownloadLinks' => $this->getAllowDownloadOnEditable()));
     $cClipWidget->endClip();
     return $cClipWidget->getController()->clips['filesElement'];
 }