From e8c7ef440c0961118992dc24cc96c77fd1532d01 Mon Sep 17 00:00:00 2001 From: emkael Date: Wed, 6 Apr 2016 11:31:34 +0200 Subject: * calendar image path, with asset publication --- app/php/model/Calendar.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'app/php/model/Calendar.php') 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; + } + } + } ?> -- cgit v1.2.3