From d7e056a4eee643640583ab5ee1d4210d7a386f51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Sun, 20 Jul 2014 16:37:49 +0200 Subject: [PATCH] Added Highscore to programs/view --- www/css/styles.css | 4 ++++ www/protected/models/HighscoreGames.php | 11 +++++++++++ www/protected/models/Program.php | 14 +++++++++++++- www/protected/views/Highscores/listentries.php | 6 +++--- www/protected/views/programs/view.php | 12 +++++++----- 5 files changed, 38 insertions(+), 9 deletions(-) diff --git a/www/css/styles.css b/www/css/styles.css index ea6ec02..9640983 100644 --- a/www/css/styles.css +++ b/www/css/styles.css @@ -637,6 +637,10 @@ ul.nav li.dropdown-append:hover > ul.dropdown-menu { border-radius: 6px 6px 0px 0px; } +.progview_donwloadbtns > .btn-primary { + font-weight: 900; +} + /* blog/view -------------------------------------------------- */ diff --git a/www/protected/models/HighscoreGames.php b/www/protected/models/HighscoreGames.php index 59e5961..ff8bf9d 100644 --- a/www/protected/models/HighscoreGames.php +++ b/www/protected/models/HighscoreGames.php @@ -115,4 +115,15 @@ class HighscoreGames extends CActiveRecord { return '/Highscores/list?gameid=' . $this->ID; } + + /** + * @return HighscoreEntries + */ + public function getMaximumScore() + { + if (count($this->ENTRIES) > 0) + return $this->ENTRIES[0]; + else + return null; + } } diff --git a/www/protected/models/Program.php b/www/protected/models/Program.php index b468983..6d04606 100644 --- a/www/protected/models/Program.php +++ b/www/protected/models/Program.php @@ -204,6 +204,9 @@ class Program extends CActiveRecord return new DateTime($this->add_date); } + /** + * @return string + */ public function getStarHTML() { $out = ''; @@ -261,7 +264,16 @@ class Program extends CActiveRecord return $result; } - public function deleteDescriptions() { + public function deleteDescriptions() + { MsHelper::deleteDir("data/programs/desc/" . $this->Name . "/"); } + + /** + * @return HighscoreGames + */ + public function getHighscoreGame() + { + return HighscoreGames::model()->findByPk($this->highscore_gid); + } } diff --git a/www/protected/views/Highscores/listentries.php b/www/protected/views/Highscores/listentries.php index f9f18c9..74d8dbc 100644 --- a/www/protected/views/Highscores/listentries.php +++ b/www/protected/views/Highscores/listentries.php @@ -26,9 +26,9 @@ border-spacing: 0px; } - table td { - padding: 2px 0px; - } + table td { padding: 2px 0px; } + table td { width: 25%; } + table td:last-child { width: 50%; } caption { font-weight: bolder; diff --git a/www/protected/views/programs/view.php b/www/protected/views/programs/view.php index 9c94f97..66405c3 100644 --- a/www/protected/views/programs/view.php +++ b/www/protected/views/programs/view.php @@ -39,6 +39,12 @@ if (!$model->visible && Yii::app()->user->name != 'admin') { Downloads: Downloads, array('color' => TbHtml::BADGE_COLOR_SUCCESS)); ?> + highscore_gid >= 0): ?> + + Highscore: + getHighscoreGame()->getMaximumScore()->POINTS, array('color' => TbHtml::BADGE_COLOR_SUCCESS)); ?> + + Languages: getLanguageList() as $lang) echo TbHtml::badge($lang, array('color' => TbHtml::BADGE_COLOR_INFO)); ?> @@ -53,10 +59,6 @@ if (!$model->visible && Yii::app()->user->name != 'admin') { version->Version, array('color' => TbHtml::BADGE_COLOR_INFO)); ?> - @@ -138,7 +140,7 @@ if (!$model->visible && Yii::app()->user->name != 'admin') { 'block' => true, 'color' => TbHtml::BUTTON_COLOR_SUCCESS, 'size' => TbHtml::BUTTON_SIZE_DEFAULT, - 'url' => '#', //TODO-MS Add Highscore link + 'url' => '/Highscores/list?gameid=' . $model->highscore_gid, //TODO-MS Add Highscore link ]); ?>