Ejemplo n.º 1
0
 /**
  * @param $src
  * @param $fileType
  * @param $toolArray
  * @param $alt_text
  * @return mixed
  */
 public function renderGridBox($src, $fileType, $toolArray, $alt_text)
 {
     $gridBox = new GridBox(['owner' => $this, 'src' => $src, 'fileType' => $fileType, 'toolArray' => $toolArray, 'alt_text' => $alt_text]);
     return $gridBox->renderGridBox();
 }
 /**
  * @return mixed
  * @throws NotFoundHttpException
  */
 public function actionUse()
 {
     $fileId = Yii::$app->request->post('id');
     $model = $this->findModel($fileId);
     $fileType = $model->mime_type;
     if ($model->dimension) {
         $src = $model->object_url . $model->thumbnail_name;
         $fileType = 'image';
     } else {
         $src = $model->object_url . $model->src_file_name;
     }
     $toolArray = [['tagType' => 'i', 'options' => ['class' => 'fa-icon fa fa-times fm-remove', 'title' => \Yii::t('filemanager', 'Remove')]]];
     $gridBox = new GridBox(['src' => $src, 'fileType' => $fileType, 'toolArray' => $toolArray, 'thumbnailSize' => $this->module->thumbnailSize]);
     $selectedFileView = $gridBox->renderGridBox();
     Yii::$app->response->format = Response::FORMAT_JSON;
     return ArrayHelper::merge($model->attributes, ['selectedFile' => $selectedFileView]);
 }