From 09488796d8f07cf585832ddc50073e52cf96461f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Sat, 19 Jul 2014 18:25:35 +0200 Subject: [PATCH] Finished BlogPost --- www/css/styles.css | 32 +++++++++++++++++++++++++++ www/protected/config/main.php | 1 + www/protected/models/BlogPost.php | 18 ++++++++++++++- www/protected/views/blogPost/view.php | 13 ++++++++++- www/protected/views/msmain/admin.php | 10 ++++----- www/protected/yiic.php | 3 +++ 6 files changed, 70 insertions(+), 7 deletions(-) diff --git a/www/css/styles.css b/www/css/styles.css index 77ccd03..ea6ec02 100644 --- a/www/css/styles.css +++ b/www/css/styles.css @@ -635,4 +635,36 @@ ul.nav li.dropdown-append:hover > ul.dropdown-menu { margin-bottom: 28px; border-radius: 6px 6px 0px 0px; +} + +/* blog/view +-------------------------------------------------- */ + +.blogOwner { + border: 1px solid #D7E0E2; + + padding-top: 0px; +} + +.blogFooter { + background-color: #D7E0E2; + + margin-top: 40px; + + margin-bottom: -19px; + margin-left: -19px; + margin-right: -19px; + + min-height: 22px; + padding: 2px 8px; +} + +.blogFooterLeft { + float:left; + + font-weight: bold; +} + +.blogFooterRight { + float: right; } \ No newline at end of file diff --git a/www/protected/config/main.php b/www/protected/config/main.php index 653c91c..14a031c 100644 --- a/www/protected/config/main.php +++ b/www/protected/config/main.php @@ -88,6 +88,7 @@ return ArrayX::merge( 'blog/index' => 'blogPost/index', 'blog/update' => 'blogPost/update', 'blog/' => 'blogPost/view/id/', + 'blog//' => 'blogPost/view/id/', 'downloads/details.php' => 'programs/index', // Compatibility 'downloads/downloads.php' => 'programs/index', // Compatibility diff --git a/www/protected/models/BlogPost.php b/www/protected/models/BlogPost.php index 2374f3e..b1d6753 100644 --- a/www/protected/models/BlogPost.php +++ b/www/protected/models/BlogPost.php @@ -97,10 +97,26 @@ class BlogPost extends CActiveRecord return parent::model($className); } + //#################################### + //########### MY FUNCTIONS ########### + //#################################### + + /** + * @return DateTime + */ + public function getDateTime() { + return new DateTime($this->Date); + } + /** * @return string */ public function getLink() { - return '/blog/' . $this->ID; + $name = $this->Title; + + $name = str_replace(' ', '_', $name); + $name = preg_replace("/[^A-Za-z0-9_]/", '', $name); + + return '/blog/' . $this->ID . '/' . $name; } } diff --git a/www/protected/views/blogPost/view.php b/www/protected/views/blogPost/view.php index 0a2b4ed..e7a93fb 100644 --- a/www/protected/views/blogPost/view.php +++ b/www/protected/views/blogPost/view.php @@ -15,8 +15,19 @@ $this->breadcrumbs = array(
-
+ + +
Content); ?> + +
+
+ Title; ?> +
+
+ getDateTime()->format('d.m.Y'); ?> +
+
diff --git a/www/protected/views/msmain/admin.php b/www/protected/views/msmain/admin.php index 690f51d..bf86f94 100644 --- a/www/protected/views/msmain/admin.php +++ b/www/protected/views/msmain/admin.php @@ -55,15 +55,15 @@ $this->breadcrumbs = ); ?>
-