예제 #1
0
 /**
  * Redactor file list.
  *
  * @param string $name Model name
  * @param string $attr Model attribute
  * @param string $type Format type
  * @return array List of files
  */
 public function actionRedactorList($name, $attr, $type = 'image')
 {
     /** @var $module \vladdnepr\ycm\Module */
     $module = $this->module;
     $name = (string) $name;
     $attribute = (string) $attr;
     $attributePath = $module->getAttributePath($name, $attribute);
     $attributeUrl = $module->getAttributeUrl($name, $attribute, '');
     $format = 0;
     $options = ['url' => $attributeUrl, 'only' => ['*.png', '*.gif', '*.jpg', '*.jpeg'], 'caseSensitive' => false];
     if ((string) $type == 'file') {
         $format = 1;
         $options = ['url' => $attributeUrl];
     }
     Yii::$app->response->format = Response::FORMAT_JSON;
     return RedactorFileHelper::findFiles($attributePath, $options, $format);
 }
 /**
  * @inheritdoc
  */
 public function run()
 {
     Yii::$app->response->format = Response::FORMAT_JSON;
     return FileHelper::findFiles($this->path, $this->options, $this->type);
 }
예제 #3
0
 public function getPath()
 {
     return FileHelper::normalizePath(Yii::getAlias(Yii::$app->getModule('filesystem')->uploadPath . $this->subdir . '/' . $this->file_name));
 }