diff options
author | emkael <emkael@tlen.pl> | 2016-04-06 11:31:34 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2016-04-06 11:31:34 +0200 |
commit | e8c7ef440c0961118992dc24cc96c77fd1532d01 (patch) | |
tree | f1d3d3a2de72a76d39949074c9b66c1f88dc91aa /app/php/model/Calendar.php | |
parent | d87c5d7963747aca41969af44eefaf2a6c3a305f (diff) |
* calendar image path, with asset publication
Diffstat (limited to 'app/php/model/Calendar.php')
-rw-r--r-- | app/php/model/Calendar.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/app/php/model/Calendar.php b/app/php/model/Calendar.php index ab0b2e8..23a0818 100644 --- a/app/php/model/Calendar.php +++ b/app/php/model/Calendar.php @@ -42,6 +42,27 @@ class Calendar extends ActiveRecord { return parent::finder($className); } + const CUSTOM_IMAGE_PATH = '../../resources/images/calendars/'; + + public function getCustomImageUrl() { + if ($this->CustomImage) { + if (!preg_match('#^//#', $this->CustomImage)) { + return Prado::getApplication()->getAssetManager()->publishFilePath( + implode( + DIRECTORY_SEPARATOR, + [ + Prado::getApplication()->getBasePath(), + self::CUSTOM_IMAGE_PATH, + $this->CustomImage + ] + ), + TRUE + ); + } + return $this->CustomImage; + } + } + } ?> |