protected function renderControlEditable()
 {
     assert('$this->model instanceof ImportWizardForm');
     assert('$this->attribute == null');
     $existingFilesInformation = array();
     if (!empty($this->model->fileUploadData)) {
         $existingFilesInformation[] = $this->model->fileUploadData;
         $existingFilesInformation[0]['id'] = $this->model->id;
     }
     $content = $this->renderDelimiterAndEnclosureContent($existingFilesInformation);
     $inputNameAndId = $this->getEditableInputId('file');
     $beforeUploadAction = "\$('#{$this->getEditableInputId('rowColumnDelimiter')}').attr('readonly', true);";
     $beforeUploadAction .= "\$('#{$this->getEditableInputId('rowColumnDelimiter')}').addClass('readonly-field');";
     $beforeUploadAction .= "\$('#{$this->getEditableInputId('rowColumnEnclosure')}').attr('readonly', true);";
     $beforeUploadAction .= "\$('#{$this->getEditableInputId('rowColumnEnclosure')}').addClass('readonly-field');";
     $afterDeleteAction = "\$('#{$this->getEditableInputId('rowColumnDelimiter')}').removeAttr('readonly');";
     $afterDeleteAction .= "\$('#{$this->getEditableInputId('rowColumnDelimiter')}').removeClass('readonly-field');";
     $afterDeleteAction .= "\$('#{$this->getEditableInputId('rowColumnEnclosure')}').removeAttr('readonly');";
     $afterDeleteAction .= "\$('#{$this->getEditableInputId('rowColumnEnclosure')}').removeClass('readonly-field');";
     $cClipWidget = new CClipWidget();
     $cClipWidget->beginClip("filesElement");
     $cClipWidget->widget('application.core.widgets.FileUpload', array('uploadUrl' => Yii::app()->createUrl("import/default/uploadFile", array('filesVariableName' => $inputNameAndId, 'id' => $this->model->id)), 'deleteUrl' => Yii::app()->createUrl("import/default/deleteFile"), 'inputName' => $inputNameAndId, 'inputId' => $inputNameAndId, 'hiddenInputName' => 'fileId', 'formName' => $this->form->id, 'existingFiles' => $existingFilesInformation, 'maxSize' => (int) InstallUtil::getMaxAllowedFileSize(), 'beforeUploadAction' => $beforeUploadAction, 'afterDeleteAction' => $afterDeleteAction));
     $cClipWidget->endClip();
     $content .= '<tr><td></td><td colspan="3"><div class="file-upload-box">' . $cClipWidget->getController()->clips['filesElement'] . '</div></td></tr>';
     return $content;
 }
 protected function renderImagesUploadInput()
 {
     $inputNameAndId = 'file';
     $cClipWidget = new CClipWidget();
     $cClipWidget->beginClip("imageFilesElement");
     $cClipWidget->widget('application.core.widgets.ImageFileUpload', array('uploadUrl' => Yii::app()->createUrl("zurmo/imageModel/upload"), 'deleteUrl' => Yii::app()->createUrl("zurmo/imageModel/delete"), 'inputName' => $inputNameAndId, 'inputId' => $inputNameAndId, 'hiddenInputName' => 'filesIds', 'allowMultipleUpload' => true, 'existingFiles' => array(), 'maxSize' => (int) InstallUtil::getMaxAllowedFileSize(), 'showMaxSize' => true, 'id' => __CLASS__, 'onSuccessAction' => "\$('#{$this->listViewGridId}').yiiGridView('update');", 'formData' => "{'" . Yii::app()->request->csrfTokenName . "' : '" . Yii::app()->request->csrfToken . "'}"));
     $cClipWidget->endClip();
     return $cClipWidget->getController()->clips['imageFilesElement'];
 }
Example #3
0
 protected function renderControlEditable()
 {
     assert('$this->model instanceof Item || $this->model->getModel() instanceof Item');
     $existingFilesInformation = array();
     foreach ($this->model->files as $existingFile) {
         $existingFilesInformation[] = array('name' => $existingFile->name, 'size' => FileModelDisplayUtil::convertSizeToHumanReadableAndGet((int) $existingFile->size), 'id' => $existingFile->id);
     }
     $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()));
     $cClipWidget->endClip();
     return $cClipWidget->getController()->clips['filesElement'];
 }
 protected function renderControlEditable()
 {
     //            assert('$this->model instanceof ZurmoUserInterfaceConfigurationForm');
     $existingFilesInformation = array();
     if (!empty($this->model->logoFileData)) {
         $existingFilesInformation[] = $this->model->logoFileData;
         $existingFilesInformation[0]['id'] = $this->model->id;
     }
     $inputNameAndId = $this->getEditableInputId('logo');
     $cClipWidget = new CClipWidget();
     $cClipWidget->beginClip("logoFileElement");
     $cClipWidget->widget('application.core.widgets.LogoFileUpload', array('uploadUrl' => Yii::app()->createUrl("zurmo/default/uploadLogo", array('filesVariableName' => $inputNameAndId)), 'deleteUrl' => Yii::app()->createUrl("zurmo/default/deleteLogo"), 'inputName' => $inputNameAndId, 'inputId' => $inputNameAndId, 'hiddenInputName' => 'logoFileName', 'formName' => $this->form->id, 'existingFiles' => $existingFilesInformation, 'maxSize' => (int) InstallUtil::getMaxAllowedFileSize(), 'beforeUploadAction' => null, 'afterDeleteAction' => null));
     $cClipWidget->endClip();
     $content = '<div class="file-upload-box">' . $cClipWidget->getController()->clips['logoFileElement'] . '</div>';
     return $content;
 }