diff options
-rw-r--r-- | app/php/model/Calendar.php | 21 | ||||
-rw-r--r-- | resources/images/calendars/.gitignore | 1 |
2 files changed, 22 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; + } + } + } ?> diff --git a/resources/images/calendars/.gitignore b/resources/images/calendars/.gitignore new file mode 100644 index 0000000..72e8ffc --- /dev/null +++ b/resources/images/calendars/.gitignore @@ -0,0 +1 @@ +* |