Esempio n. 1
0
 /** File list  */
 public function run()
 {
     $model = $this->getOwner();
     if (isset($model)) {
         // Temporal files in session + files associated to the model
         $tempFiles = UploadUtils::getSessionFiles();
         $files = UploadUtils::findFiles(get_class($this->model), $this->model->getPrimaryKey(), $this->tag);
         $files = array_merge($files, $tempFiles);
         $this->getController()->renderPartial('ext.upload.plupload.views.fileList', array('files' => $files));
     } elseif (isset($_REQUEST['entity']) && isset($_REQUEST['EXid'])) {
         $files = UploadUtils::findFiles($_REQUEST['entity'], $_REQUEST['EXid']);
         $this->getController()->renderPartial('ext.upload.plupload.views.fileList', array('files' => $files));
     }
 }
Esempio n. 2
0
 /** Default view (upload widget) */
 public function run()
 {
     $this->registerScripts();
     // File list
     // Temporal files in session + files associated to the model
     $tempFiles = array();
     $sessionFiles = Yii::app()->session['temp_files'];
     if (isset($sessionFiles)) {
         foreach ($sessionFiles as $f) {
             $tempFiles[] = File::buildFromArray($f);
         }
     }
     if (isset($this->model)) {
         $files = UploadUtils::findFiles(get_class($this->model), $this->model->getPrimaryKey());
     }
     $files = array_merge($files, $tempFiles);
     $this->getController()->renderPartial('ext.upload.plupload.views.draggableFileList', array('files' => $files));
     // Upload widget
     $this->render('uploadWidget', array('assetsDir' => $this->assetsUrlBase));
 }