Blame view

vendor/mihaildev/yii2-elfinder/UserPath.php 618 Bytes
ad2e91f7   Mihail   move multyparser ...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
  <?php
  /**
   * Date: 22.01.14
   * Time: 14:13
   */
  
  namespace mihaildev\elfinder;
  
  use Yii;
  
  class UserPath extends LocalPath{
  	public function isAvailable(){
  		if(Yii::$app->user->isGuest)
  			return false;
  
  		return parent::isAvailable();
  	}
  
  	public function getUrl(){
  		$path = strtr($this->path, ['{id}'=>Yii::$app->user->id]);
  		return Yii::getAlias($this->baseUrl.'/'.trim($path,'/'));
  	}
  
  	public function getRealPath(){
  		$path = strtr($this->path, ['{id}'=>Yii::$app->user->id]);
  		$path = Yii::getAlias($this->basePath.'/'.trim($path,'/'));
  		if(!is_dir($path))
  			mkdir($path, 0777, true);
  
  		return $path;
  	}
  }