diff --git a/.idea/workspace.xml b/.idea/workspace.xml index dde04d6..e4ca424 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -63,56 +63,33 @@ - - + + - + + + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + @@ -130,9 +107,6 @@ @@ -362,6 +339,10 @@ - + @@ -642,8 +619,8 @@ - - + + @@ -701,19 +678,19 @@ - + - - - - + - + + + + + - @@ -742,35 +719,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -874,13 +826,6 @@ - - - - - - - @@ -901,13 +846,6 @@ - - - - - - - @@ -950,20 +888,6 @@ - - - - - - - - - - - - - - @@ -999,20 +923,6 @@ - - - - - - - - - - - - - - @@ -1020,34 +930,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1055,6 +937,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/css/styles.css b/www/css/styles.css index 34bb28a..6e4720d 100644 --- a/www/css/styles.css +++ b/www/css/styles.css @@ -2,7 +2,7 @@ -------------------------------------------------- */ .footer { - padding: 70px 0; + padding: 45px 0; margin-top: 70px; border-top: 1px solid #e5e5e5; background-color: #f5f5f5; diff --git a/www/protected/components/ProgramHelper.php b/www/protected/components/ProgramHelper.php index 67a377f..9a9de8f 100644 --- a/www/protected/components/ProgramHelper.php +++ b/www/protected/components/ProgramHelper.php @@ -43,24 +43,30 @@ class ProgramHelper { } /** + * @param DateTime $date * @return Program */ - public static function GetRecentProg() + public static function GetRecentProg($date) { $criteria = new CDbCriteria; $criteria->order = "add_date DESC"; - $criteria->condition = "DATEDIFF(CURDATE(), add_date) <= 14 AND visible=1 AND enabled=1"; + $criteria->condition = "DATEDIFF('" . $date->format('Y-m-d') . "', add_date) <= 14 AND visible=1 AND enabled=1"; $criteria->limit = 1; return Program::model()->find($criteria); } /** + * @param string $date * @return Program */ - public static function GetDailyProg() + public static function GetDailyProg($date = 'now') { - $recent = self::GetRecentProg(); + if ($date == 'now') { + $date = new DateTime(); + } + + $recent = self::GetRecentProg($date); if ($recent != null) return $recent; @@ -68,7 +74,7 @@ class ProgramHelper { $toparray = self::GetHighlightedProgList(false); $msrand = new SeededRandom(); - $msrand->seedWithDailySeed(); + $msrand->seedWithDailySeed($date); $result = $msrand->getRandomElement($toparray); diff --git a/www/protected/components/SeededRandom.php b/www/protected/components/SeededRandom.php index 27bfbd9..81cd33e 100644 --- a/www/protected/components/SeededRandom.php +++ b/www/protected/components/SeededRandom.php @@ -16,9 +16,13 @@ class SeededRandom $this->get(); } - function seedWithDailySeed() + function seedWithDailySeed($date) { - $this->seed($this->getDailySeed()); + $this->seed(($date->format('Y') % 100) * 10459); + $max = $date->format('z'); + for ($i = 0; $i < $max; $i++) { + $this->get(); + } } function get($min = 0, $max = 9999999) @@ -35,11 +39,4 @@ class SeededRandom { return $arr[$this->get(0, count($arr))]; } - - function getDailySeed() - { - $now = getdate(); - - return ($now['year'] % 100) * 366 + $now['yday'] /* * $now['seconds'] */; - } } \ No newline at end of file diff --git a/www/protected/views/msmain/admin.php b/www/protected/views/msmain/admin.php index 4eda1e6..690f51d 100644 --- a/www/protected/views/msmain/admin.php +++ b/www/protected/views/msmain/admin.php @@ -7,9 +7,9 @@ $this->pageTitle = 'Manage - ' . Yii::app()->name; $this->breadcrumbs = - [ - 'Admin', - ]; + [ + 'Admin', + ]; ?>
@@ -22,9 +22,9 @@ $this->breadcrumbs = echo MsHtml::stackedTabs( [ - ['label' => 'Show', 'url' => '/log'], - ['label' => 'Manage', 'url' => '/log/admin'], - ['label' => 'Create', 'url' => '/log/create'], + ['label' => 'Show', 'url' => '/log'], + ['label' => 'Manage', 'url' => '/log/admin'], + ['label' => 'Create', 'url' => '/log/create'], ] ); ?>
@@ -35,9 +35,9 @@ $this->breadcrumbs = echo MsHtml::stackedTabs( [ - ['label' => 'Show', 'url' => '/programs'], - ['label' => 'Manage', 'url' => '/programs/admin'], - ['label' => 'Create', 'url' => '/programs/create'], + ['label' => 'Show', 'url' => '/programs'], + ['label' => 'Manage', 'url' => '/programs/admin'], + ['label' => 'Create', 'url' => '/programs/create'], ] ); ?> @@ -48,8 +48,8 @@ $this->breadcrumbs = echo MsHtml::stackedTabs( [ - ['label' => 'Show', 'url' => '/programupdates'], - ['label' => 'Manage', 'url' => '/programupdates/admin'], + ['label' => 'Show', 'url' => '/programupdates'], + ['label' => 'Manage', 'url' => '/programupdates/admin'], ['label' => 'Create', 'url' => '/programupdates/create'], ] ); ?> @@ -61,8 +61,8 @@ $this->breadcrumbs = echo MsHtml::stackedTabs( [ - ['label' => 'Home', 'url' => '#'], - ['label' => 'Profile', 'url' => '#'], + ['label' => 'Home', 'url' => '#'], + ['label' => 'Profile', 'url' => '#'], ['label' => 'Messages', 'url' => '#'], ] ); ?> @@ -71,7 +71,7 @@ $this->breadcrumbs =
loadFinishedData(); + $egh = $egh = (new ExtendedGitGraph('Mikescher'))->loadFinishedData(); ?>

ExtendedGitGraph

@@ -86,4 +86,41 @@ $this->breadcrumbs = Update
+ +
+ +

Program of the day

+
+ + $now->format('d.m.Y :: D'), + 'Name' => ProgramHelper::GetDailyProg($now)->Name, + ]; + + $now->modify('+1 day'); + } + + $this->widget('bootstrap.widgets.TbGridView', + [ + 'type' => TbHtml::GRID_TYPE_CONDENSED, + 'dataProvider' => new CArrayDataProvider($data, + [ + 'keyField' => 'Date', + 'Pagination' => + [ + 'PageSize' => 14, + ] + ]), + ] + ); ?> + +
\ No newline at end of file