diff options
Diffstat (limited to 'app/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; + } + } + } ?> |