Added custom Blogposts for ProblemEulerBefunge
This commit is contained in:
parent
144ded4750
commit
58eb50f0ad
76
www/css/blogpost_ProjectEulerBefunge_style.css
Normal file
76
www/css/blogpost_ProjectEulerBefunge_style.css
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
.PEB_tableProblems {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.PEB_tablerowProblems {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.PEB_tablecellProblems {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.PEB_TC_Value:not(:hover) {
|
||||||
|
color: transparent;
|
||||||
|
|
||||||
|
-o-transition:.5s;
|
||||||
|
-ms-transition:.5s;
|
||||||
|
-moz-transition:.5s;
|
||||||
|
-webkit-transition:.5s;
|
||||||
|
transition:.5s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.PEB_TC_Value:hover {
|
||||||
|
color: black;
|
||||||
|
|
||||||
|
-o-transition:.5s;
|
||||||
|
-ms-transition:.5s;
|
||||||
|
-moz-transition:.5s;
|
||||||
|
-webkit-transition:.5s;
|
||||||
|
transition:.5s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.PEB_TC_Time {
|
||||||
|
border-radius: 5px;
|
||||||
|
|
||||||
|
display: inline-block;
|
||||||
|
padding: 1px 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.PEB_TC_Timelevel_0 { background-color: #0A0 !important; }
|
||||||
|
|
||||||
|
.PEB_TC_Timelevel_1 { background-color: #84FF0A !important; }
|
||||||
|
|
||||||
|
.PEB_TC_Timelevel_2 { background-color: #FF0 !important; }
|
||||||
|
|
||||||
|
.PEB_TC_Timelevel_3 { background-color: #F60 !important; }
|
||||||
|
|
||||||
|
.PEB_TC_Timelevel_4 { background-color: #F11 !important; }
|
||||||
|
|
||||||
|
.PEB_TC_Size_93 {
|
||||||
|
display: inline-flex;
|
||||||
|
float: right;
|
||||||
|
|
||||||
|
|
||||||
|
border-radius: 5px;
|
||||||
|
background-color: #0A0;
|
||||||
|
|
||||||
|
display: inline-block;
|
||||||
|
padding: 1px 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.PEB_TC_Size_98 {
|
||||||
|
display: inline-flex;
|
||||||
|
float: right;
|
||||||
|
|
||||||
|
|
||||||
|
border-radius: 5px;
|
||||||
|
background-color: #FF0;
|
||||||
|
|
||||||
|
display: inline-block;
|
||||||
|
padding: 1px 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.PEB_TC_Title a {
|
||||||
|
color: #2C3E50;
|
||||||
|
}
|
@ -768,3 +768,132 @@ ul.nav li.dropdown-append:hover > ul.dropdown-menu {
|
|||||||
font-size: small;
|
font-size: small;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Pagination
|
||||||
|
-------------------------------------------------- */
|
||||||
|
|
||||||
|
.pagination {
|
||||||
|
margin:20px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination ul {
|
||||||
|
display:inline-block;
|
||||||
|
*display:inline;
|
||||||
|
*zoom:1;
|
||||||
|
margin-left:0;
|
||||||
|
margin-bottom:0;
|
||||||
|
-webkit-border-radius:4px;
|
||||||
|
-moz-border-radius:4px;
|
||||||
|
border-radius:4px;
|
||||||
|
-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.05);
|
||||||
|
-moz-box-shadow:0 1px 2px rgba(0,0,0,0.05);
|
||||||
|
box-shadow:0 1px 2px rgba(0,0,0,0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination ul>li {
|
||||||
|
display:inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination ul>li>a,.pagination ul>li>span{
|
||||||
|
float:left;
|
||||||
|
padding:4px 12px;
|
||||||
|
line-height:20px;
|
||||||
|
text-decoration:none;
|
||||||
|
background-color:#fff;
|
||||||
|
border:1px solid #ddd;
|
||||||
|
border-left-width:0;
|
||||||
|
|
||||||
|
color: #888;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination ul>li>a:hover,.pagination ul>.active>a,.pagination ul>.active>span{
|
||||||
|
background-color:#f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination ul>.active>a,.pagination ul>.active>span{
|
||||||
|
color:#999;
|
||||||
|
cursor:default;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination ul>.disabled>span,.pagination ul>.disabled>a,.pagination ul>.disabled>a:hover{
|
||||||
|
color:#999;
|
||||||
|
background-color:transparent;
|
||||||
|
cursor:default;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination ul>li:first-child>a,.pagination ul>li:first-child>span{
|
||||||
|
border-left-width:1px;
|
||||||
|
-webkit-border-top-left-radius:4px;
|
||||||
|
-moz-border-radius-topleft:4px;
|
||||||
|
border-top-left-radius:4px;
|
||||||
|
-webkit-border-bottom-left-radius:4px;
|
||||||
|
-moz-border-radius-bottomleft:4px;
|
||||||
|
border-bottom-left-radius:4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination ul>li:last-child>a,.pagination ul>li:last-child>span{
|
||||||
|
-webkit-border-top-right-radius:4px;
|
||||||
|
-moz-border-radius-topright:4px;
|
||||||
|
border-top-right-radius:4px;
|
||||||
|
-webkit-border-bottom-right-radius:4px;
|
||||||
|
-moz-border-radius-bottomright:4px;
|
||||||
|
border-bottom-right-radius:4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination-centered {
|
||||||
|
text-align:center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination-right{
|
||||||
|
text-align:right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination-large ul>li>a, .pagination-large ul>li>span {
|
||||||
|
padding:11px 19px;
|
||||||
|
font-size:17.5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination-large ul>li:first-child>a, .pagination-large ul>li:first-child>span {
|
||||||
|
-webkit-border-top-left-radius:6px;
|
||||||
|
-moz-border-radius-topleft:6px;
|
||||||
|
border-top-left-radius:6px;
|
||||||
|
-webkit-border-bottom-left-radius:6px;
|
||||||
|
-moz-border-radius-bottomleft:6px;
|
||||||
|
border-bottom-left-radius:6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination-large ul>li:last-child>a,.pagination-large ul>li:last-child>span {
|
||||||
|
-webkit-border-top-right-radius:6px;
|
||||||
|
-moz-border-radius-topright:6px;
|
||||||
|
border-top-right-radius:6px;
|
||||||
|
-webkit-border-bottom-right-radius:6px;
|
||||||
|
-moz-border-radius-bottomright:6px;
|
||||||
|
border-bottom-right-radius:6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination-mini ul>li:first-child>a, .pagination-small ul>li:first-child>a, .pagination-mini ul>li:first-child>span, .pagination-small ul>li:first-child>span {
|
||||||
|
-webkit-border-top-left-radius:3px;
|
||||||
|
-moz-border-radius-topleft:3px;
|
||||||
|
border-top-left-radius:3px;
|
||||||
|
-webkit-border-bottom-left-radius:3px;
|
||||||
|
-moz-border-radius-bottomleft:3px;
|
||||||
|
border-bottom-left-radius:3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination-mini ul>li:last-child>a, .pagination-small ul>li:last-child>a, .pagination-mini ul>li:last-child>span, .pagination-small ul>li:last-child>span {
|
||||||
|
-webkit-border-top-right-radius:3px;
|
||||||
|
-moz-border-radius-topright:3px;
|
||||||
|
border-top-right-radius:3px;
|
||||||
|
-webkit-border-bottom-right-radius:3px;
|
||||||
|
-moz-border-radius-bottomright:3px;
|
||||||
|
border-bottom-right-radius:3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination-small ul>li>a, .pagination-small ul>li>span{
|
||||||
|
padding:2px 10px;
|
||||||
|
font-size:11.9px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination-mini ul>li>a,.pagination-mini ul>li>span{
|
||||||
|
padding:0 6px;
|
||||||
|
font-size:10.5px;
|
||||||
|
}
|
1
www/data/blog/Befunge/.gitignore
vendored
Normal file
1
www/data/blog/Befunge/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
*.b93
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
@ -55,9 +55,4 @@ defined('YII_DEBUG') or define('YII_DEBUG',true);
|
|||||||
defined('YII_CUSTOM_ENV') or define('YII_CUSTOM_ENV', 'prod');
|
defined('YII_CUSTOM_ENV') or define('YII_CUSTOM_ENV', 'prod');
|
||||||
|
|
||||||
require_once($yii);
|
require_once($yii);
|
||||||
Yii::createWebApplication($config)->run();
|
Yii::createWebApplication($config)->run();
|
||||||
|
|
||||||
|
|
||||||
// TODO-MS Add Blog
|
|
||||||
// TODO-MS Add Search (Blog + progs + log) jew auch metadata / desc ...
|
|
||||||
// TODO-MS Add Prog Display
|
|
@ -12,6 +12,11 @@ class MSController extends CController
|
|||||||
public $selectedNav = '';
|
public $selectedNav = '';
|
||||||
|
|
||||||
public $js_scripts = array();
|
public $js_scripts = array();
|
||||||
|
public $css_files =
|
||||||
|
[
|
||||||
|
"/css/styles.css",
|
||||||
|
"/css/prism.css",
|
||||||
|
];
|
||||||
|
|
||||||
public $title = null;
|
public $title = null;
|
||||||
|
|
||||||
|
@ -54,4 +54,54 @@ class MsHelper {
|
|||||||
}
|
}
|
||||||
rmdir($dirPath);
|
rmdir($dirPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function formatMilliseconds($millis)
|
||||||
|
{
|
||||||
|
if ($millis < 1000)
|
||||||
|
{
|
||||||
|
return $millis . 'ms';
|
||||||
|
}
|
||||||
|
else if ($millis < 10 * 1000)
|
||||||
|
{
|
||||||
|
return number_format($millis / (1000), 2) . 's';
|
||||||
|
}
|
||||||
|
else if ($millis < 60 * 1000)
|
||||||
|
{
|
||||||
|
return floor($millis / (1000)) . 's';
|
||||||
|
}
|
||||||
|
else if ($millis < 10 * 60 * 1000)
|
||||||
|
{
|
||||||
|
return floor($millis / (60 * 1000)) . 'min ' . floor(($millis % (60 * 1000)) / 1000) . 's';
|
||||||
|
}
|
||||||
|
else if ($millis < 60 * 60 * 1000)
|
||||||
|
{
|
||||||
|
return floor($millis / (60 * 1000)) . 'min';
|
||||||
|
}
|
||||||
|
else if ($millis < 10 * 60 * 60 * 1000)
|
||||||
|
{
|
||||||
|
return number_format($millis / (60 * 60 * 1000), 2) . ' hours';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return floor($millis / (60 * 60 * 1000)) . ' hours';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Appends/Prepends $before/$after to every line in $input
|
||||||
|
*
|
||||||
|
* @param $input
|
||||||
|
* @param $before
|
||||||
|
* @param $after
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function encloseLines($input, $before, $after)
|
||||||
|
{
|
||||||
|
$array = preg_split("/\r\n|\n|\r/", $input);
|
||||||
|
|
||||||
|
for($i = 0; $i < count($array); $i++)
|
||||||
|
$array[$i] = $before . $array[$i] . $after;
|
||||||
|
|
||||||
|
return implode(PHP_EOL, $array);
|
||||||
|
}
|
||||||
}
|
}
|
@ -100,6 +100,8 @@ return ArrayX::merge(
|
|||||||
'blog/<id>' => 'blogPost/view/id/<id>',
|
'blog/<id>' => 'blogPost/view/id/<id>',
|
||||||
'blog/<id>/<name>' => 'blogPost/view/id/<id>',
|
'blog/<id>/<name>' => 'blogPost/view/id/<id>',
|
||||||
|
|
||||||
|
'eulerProblem/' => 'eulerProblem/index',
|
||||||
|
|
||||||
'Highscores/list.php' => 'Highscores/list', // Compatibility
|
'Highscores/list.php' => 'Highscores/list', // Compatibility
|
||||||
'Highscores/insert.php' => 'Highscores/insert', // Compatibility
|
'Highscores/insert.php' => 'Highscores/insert', // Compatibility
|
||||||
'Highscores/update.php' => 'Highscores/update', // Compatibility
|
'Highscores/update.php' => 'Highscores/update', // Compatibility
|
||||||
|
@ -22,19 +22,16 @@ class BlogPostController extends MSController
|
|||||||
public function accessRules()
|
public function accessRules()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('allow', // allow all users to perform 'index' and 'view' actions
|
array('allow',
|
||||||
'actions'=>array('index','view', 'ajaxMarkdownPreview'),
|
'actions'=>array('index','view', 'ajaxMarkdownPreview'),
|
||||||
'users'=>array('*'),
|
'users'=>array('*'),
|
||||||
),
|
),
|
||||||
array('allow', // allow authenticated user to perform 'create' and 'update' actions
|
array('allow',
|
||||||
'actions'=>array('create','update','admin','delete'),
|
'actions'=>array('create','update','admin','delete'),
|
||||||
'users'=>array('@'),
|
'users'=>array('@'),
|
||||||
),
|
),
|
||||||
// array('allow', // allow admin user to perform 'admin' and 'delete' actions
|
|
||||||
// 'actions'=>array(),
|
array('deny',
|
||||||
// 'users'=>array('admin'),
|
|
||||||
// ),
|
|
||||||
array('deny', // deny everythign else to all users
|
|
||||||
'users'=>array('*'),
|
'users'=>array('*'),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -45,17 +42,30 @@ class BlogPostController extends MSController
|
|||||||
* @param integer $id the ID of the model to be displayed
|
* @param integer $id the ID of the model to be displayed
|
||||||
* @throws CHttpException if Enabled is false
|
* @throws CHttpException if Enabled is false
|
||||||
*/
|
*/
|
||||||
public function actionView($id)
|
public function actionView($id) //TODO-MS add BFJoust to Blog
|
||||||
{
|
{
|
||||||
$model = $this->loadModel($id);
|
$model = $this->loadModel($id);
|
||||||
|
|
||||||
if (! $model->Enabled && Yii::app()->user->name != 'admin')
|
if (! $model->Enabled && Yii::app()->user->name != 'admin')
|
||||||
throw new CHttpException(403, 'This Blogpost is locked');
|
throw new CHttpException(403, 'This Blogpost is locked');
|
||||||
|
|
||||||
$this->render('view',
|
if ($model->isSpecialBlogPost())
|
||||||
[
|
{
|
||||||
'model' => $model,
|
$controllerMethod = 'viewBlogpost' . $model->ControllerID;
|
||||||
]);
|
if(is_callable([$this, $controllerMethod]))
|
||||||
|
$this->$controllerMethod($model);
|
||||||
|
else
|
||||||
|
throw new CHttpException(500, 'Unknown ControllerID: ' . $controllerMethod);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->render('view',
|
||||||
|
[
|
||||||
|
'model' => $model,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -71,16 +81,19 @@ class BlogPostController extends MSController
|
|||||||
// Uncomment the following line if AJAX validation is needed
|
// Uncomment the following line if AJAX validation is needed
|
||||||
// $this->performAjaxValidation($model);
|
// $this->performAjaxValidation($model);
|
||||||
|
|
||||||
if (isset($_POST['BlogPost'])) {
|
if (isset($_POST['BlogPost']))
|
||||||
|
{
|
||||||
$model->attributes=$_POST['BlogPost'];
|
$model->attributes=$_POST['BlogPost'];
|
||||||
if ($model->save()) {
|
if ($model->save())
|
||||||
|
{
|
||||||
$this->redirect(array('view','id'=>$model->ID));
|
$this->redirect(array('view','id'=>$model->ID));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->render('create',array(
|
$this->render('create',
|
||||||
'model'=>$model,
|
[
|
||||||
));
|
'model'=>$model,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -97,16 +110,19 @@ class BlogPostController extends MSController
|
|||||||
// Uncomment the following line if AJAX validation is needed
|
// Uncomment the following line if AJAX validation is needed
|
||||||
// $this->performAjaxValidation($model);
|
// $this->performAjaxValidation($model);
|
||||||
|
|
||||||
if (isset($_POST['BlogPost'])) {
|
if (isset($_POST['BlogPost']))
|
||||||
|
{
|
||||||
$model->attributes=$_POST['BlogPost'];
|
$model->attributes=$_POST['BlogPost'];
|
||||||
if ($model->save()) {
|
if ($model->save())
|
||||||
$this->redirect(array('view','id'=>$model->ID));
|
{
|
||||||
|
$this->redirect(['view','id'=>$model->ID]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->render('update',array(
|
$this->render('update',
|
||||||
'model'=>$model,
|
[
|
||||||
));
|
'model'=>$model,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -122,7 +138,8 @@ class BlogPostController extends MSController
|
|||||||
$this->loadModel($id)->delete();
|
$this->loadModel($id)->delete();
|
||||||
|
|
||||||
// if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
|
// if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
|
||||||
if (!isset($_GET['ajax'])) {
|
if (!isset($_GET['ajax']))
|
||||||
|
{
|
||||||
$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
|
$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -150,14 +167,18 @@ class BlogPostController extends MSController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function actionAjaxMarkdownPreview() {
|
public function actionAjaxMarkdownPreview()
|
||||||
if(Yii::app()->request->isAjaxRequest){
|
{
|
||||||
|
if(Yii::app()->request->isAjaxRequest)
|
||||||
|
{
|
||||||
$this->renderPartial('_ajaxMarkdownPreview',
|
$this->renderPartial('_ajaxMarkdownPreview',
|
||||||
[
|
[
|
||||||
'Content' => $_POST['Content'],
|
'Content' => $_POST['Content'],
|
||||||
],
|
],
|
||||||
false, true);
|
false, true);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
throw new CHttpException(400,'Invalid request. This is a Ajax only action.');
|
throw new CHttpException(400,'Invalid request. This is a Ajax only action.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -171,13 +192,15 @@ class BlogPostController extends MSController
|
|||||||
|
|
||||||
$model=new BlogPost('search');
|
$model=new BlogPost('search');
|
||||||
$model->unsetAttributes(); // clear any default values
|
$model->unsetAttributes(); // clear any default values
|
||||||
if (isset($_GET['BlogPost'])) {
|
if (isset($_GET['BlogPost']))
|
||||||
|
{
|
||||||
$model->attributes=$_GET['BlogPost'];
|
$model->attributes=$_GET['BlogPost'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->render('admin',array(
|
$this->render('admin',
|
||||||
'model'=>$model,
|
[
|
||||||
));
|
'model'=>$model,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -190,7 +213,8 @@ class BlogPostController extends MSController
|
|||||||
public function loadModel($id)
|
public function loadModel($id)
|
||||||
{
|
{
|
||||||
$model=BlogPost::model()->findByPk($id);
|
$model=BlogPost::model()->findByPk($id);
|
||||||
if ($model===null) {
|
if ($model===null)
|
||||||
|
{
|
||||||
throw new CHttpException(404,'The requested page does not exist.');
|
throw new CHttpException(404,'The requested page does not exist.');
|
||||||
}
|
}
|
||||||
return $model;
|
return $model;
|
||||||
@ -207,4 +231,57 @@ class BlogPostController extends MSController
|
|||||||
Yii::app()->end();
|
Yii::app()->end();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#########################################################################
|
||||||
|
//##################### Special Blogpost Controllers ######################
|
||||||
|
//#########################################################################
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param BlogPost $model
|
||||||
|
*/
|
||||||
|
protected function viewBlogpostProjectEulerBefunge($model)
|
||||||
|
{
|
||||||
|
$problems = EulerProblem::model()->findAll(['order'=>'Problemnumber']);
|
||||||
|
|
||||||
|
$problemnumber = 0;
|
||||||
|
if (isset($_GET['problem']) AND is_numeric($_GET['problem']))
|
||||||
|
$problemnumber = $_GET['problem'];
|
||||||
|
|
||||||
|
$criteria=new CDbCriteria;
|
||||||
|
$criteria->condition='Problemnumber = ' . $problemnumber;
|
||||||
|
$currproblem = EulerProblem::model()->find($criteria);
|
||||||
|
|
||||||
|
if (is_null($currproblem))
|
||||||
|
{
|
||||||
|
$problemID = -1;
|
||||||
|
$currproblem = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$problemID = -1;
|
||||||
|
for($i = 0; $i < count($problems); $i++)
|
||||||
|
if ($problems[$i]->Problemnumber == $problemnumber)
|
||||||
|
{
|
||||||
|
$problemID = $i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($problemID == -1)
|
||||||
|
{
|
||||||
|
$problemID = -1;
|
||||||
|
$currproblem = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->render('view_ProjectEulerBefunge',
|
||||||
|
[
|
||||||
|
'model' => $model,
|
||||||
|
'problems' => $problems,
|
||||||
|
'currproblem' => $currproblem,
|
||||||
|
'currproblemID' => $problemID,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//#########################################################################
|
||||||
|
//#########################################################################
|
||||||
}
|
}
|
169
www/protected/controllers/EulerProblemController.php
Normal file
169
www/protected/controllers/EulerProblemController.php
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class EulerProblemController extends MSController
|
||||||
|
{
|
||||||
|
public $layout='//layouts/column2';
|
||||||
|
|
||||||
|
public $menu=array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array action filters
|
||||||
|
*/
|
||||||
|
public function filters()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'accessControl', // perform access control for CRUD operations
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies the access control rules.
|
||||||
|
* This method is used by the 'accessControl' filter.
|
||||||
|
* @return array access control rules
|
||||||
|
*/
|
||||||
|
public function accessRules()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
array('allow',
|
||||||
|
'actions'=>array('index','view','create','update','admin','delete'),
|
||||||
|
'users'=>array('@'),
|
||||||
|
),
|
||||||
|
array('deny',
|
||||||
|
'users'=>array('*'),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays a particular model.
|
||||||
|
* @param integer $id the ID of the model to be displayed
|
||||||
|
*/
|
||||||
|
public function actionView($id)
|
||||||
|
{
|
||||||
|
$this->render('view',array(
|
||||||
|
'model'=>$this->loadModel($id),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new model.
|
||||||
|
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||||
|
*/
|
||||||
|
public function actionCreate()
|
||||||
|
{
|
||||||
|
$model=new EulerProblem;
|
||||||
|
|
||||||
|
// Uncomment the following line if AJAX validation is needed
|
||||||
|
// $this->performAjaxValidation($model);
|
||||||
|
|
||||||
|
if (isset($_POST['EulerProblem'])) {
|
||||||
|
$model->attributes=$_POST['EulerProblem'];
|
||||||
|
if ($model->save()) {
|
||||||
|
$this->redirect(array('view','id'=>$model->Problemnumber));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->render('create',array(
|
||||||
|
'model'=>$model,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates a particular model.
|
||||||
|
* If update is successful, the browser will be redirected to the 'view' page.
|
||||||
|
* @param integer $id the ID of the model to be updated
|
||||||
|
*/
|
||||||
|
public function actionUpdate($id)
|
||||||
|
{
|
||||||
|
$model=$this->loadModel($id);
|
||||||
|
|
||||||
|
// Uncomment the following line if AJAX validation is needed
|
||||||
|
// $this->performAjaxValidation($model);
|
||||||
|
|
||||||
|
if (isset($_POST['EulerProblem'])) {
|
||||||
|
$model->attributes=$_POST['EulerProblem'];
|
||||||
|
if ($model->save()) {
|
||||||
|
$this->redirect(array('view','id'=>$model->Problemnumber));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->render('update',array(
|
||||||
|
'model'=>$model,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes a particular model.
|
||||||
|
* If deletion is successful, the browser will be redirected to the 'admin' page.
|
||||||
|
* @param integer $id the ID of the model to be deleted
|
||||||
|
*/
|
||||||
|
public function actionDelete($id)
|
||||||
|
{
|
||||||
|
if (Yii::app()->request->isPostRequest) {
|
||||||
|
// we only allow deletion via POST request
|
||||||
|
$this->loadModel($id)->delete();
|
||||||
|
|
||||||
|
// if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
|
||||||
|
if (!isset($_GET['ajax'])) {
|
||||||
|
$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new CHttpException(400,'Invalid request. Please do not repeat this request again.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists all models.
|
||||||
|
*/
|
||||||
|
public function actionIndex()
|
||||||
|
{
|
||||||
|
$dataProvider=new CActiveDataProvider('EulerProblem');
|
||||||
|
$this->render('index',array(
|
||||||
|
'dataProvider'=>$dataProvider,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manages all models.
|
||||||
|
*/
|
||||||
|
public function actionAdmin()
|
||||||
|
{
|
||||||
|
$model=new EulerProblem('search');
|
||||||
|
$model->unsetAttributes(); // clear any default values
|
||||||
|
if (isset($_GET['EulerProblem'])) {
|
||||||
|
$model->attributes=$_GET['EulerProblem'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->render('admin',array(
|
||||||
|
'model'=>$model,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the data model based on the primary key given in the GET variable.
|
||||||
|
* If the data model is not found, an HTTP exception will be raised.
|
||||||
|
* @param integer $id the ID of the model to be loaded
|
||||||
|
* @return EulerProblem the loaded model
|
||||||
|
* @throws CHttpException
|
||||||
|
*/
|
||||||
|
public function loadModel($id)
|
||||||
|
{
|
||||||
|
$model=EulerProblem::model()->findByPk($id);
|
||||||
|
if ($model===null) {
|
||||||
|
throw new CHttpException(404,'The requested page does not exist.');
|
||||||
|
}
|
||||||
|
return $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs the AJAX validation.
|
||||||
|
* @param EulerProblem $model the model to be validated
|
||||||
|
*/
|
||||||
|
protected function performAjaxValidation($model)
|
||||||
|
{
|
||||||
|
if (isset($_POST['ajax']) && $_POST['ajax']==='euler-problem-form') {
|
||||||
|
echo CActiveForm::validate($model);
|
||||||
|
Yii::app()->end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -43,7 +43,7 @@ class MSMainController extends MSController
|
|||||||
/* @var $all_log Log[] */
|
/* @var $all_log Log[] */
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
$data['program'] = ProgramHelper::GetDailyProg();
|
$data['program'] = ProgramHelper::GetDailyProg(); //TODO-MS Show last BlogEntry
|
||||||
$data['logs'] = $all_log;
|
$data['logs'] = $all_log;
|
||||||
|
|
||||||
$this->render('index', $data);
|
$this->render('index', $data);
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
* @property string $Date
|
* @property string $Date
|
||||||
* @property string $Title
|
* @property string $Title
|
||||||
* @property string $Content
|
* @property string $Content
|
||||||
|
* @property string $ControllerID
|
||||||
* @property string $Visible
|
* @property string $Visible
|
||||||
* @property string $Enabled
|
* @property string $Enabled
|
||||||
*/
|
*/
|
||||||
@ -29,10 +30,10 @@ class BlogPost extends CActiveRecord
|
|||||||
// NOTE: you should only define rules for those attributes that
|
// NOTE: you should only define rules for those attributes that
|
||||||
// will receive user inputs.
|
// will receive user inputs.
|
||||||
return array(
|
return array(
|
||||||
array('Date, Title, Content, Visible, Enabled', 'required'),
|
array('Date, Title, Content, ControllerID, Visible, Enabled', 'required'),
|
||||||
array('Visible, Enabled', 'numerical', 'integerOnly'=>true),
|
array('Visible, Enabled', 'numerical', 'integerOnly'=>true),
|
||||||
|
|
||||||
array('ID, Date, Title, Content, Visible, Enabled', 'safe', 'on'=>'search'),
|
array('ID, Date, Title, Content, ControllerID, Visible, Enabled', 'safe', 'on'=>'search'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,6 +58,7 @@ class BlogPost extends CActiveRecord
|
|||||||
'Date' => 'Date',
|
'Date' => 'Date',
|
||||||
'Title' => 'Title',
|
'Title' => 'Title',
|
||||||
'Content' => 'Content',
|
'Content' => 'Content',
|
||||||
|
'ControllerID' => 'ControllerID',
|
||||||
'Visible' => 'Visible',
|
'Visible' => 'Visible',
|
||||||
'Enabled' => 'Enabled',
|
'Enabled' => 'Enabled',
|
||||||
);
|
);
|
||||||
@ -82,6 +84,7 @@ class BlogPost extends CActiveRecord
|
|||||||
$criteria->compare('Date',$this->Date,true);
|
$criteria->compare('Date',$this->Date,true);
|
||||||
$criteria->compare('Title',$this->Title,true);
|
$criteria->compare('Title',$this->Title,true);
|
||||||
$criteria->compare('Content',$this->Content,true);
|
$criteria->compare('Content',$this->Content,true);
|
||||||
|
$criteria->compare('ControllerID',$this->ControllerID,true);
|
||||||
$criteria->compare('Visible',$this->Visible,true);
|
$criteria->compare('Visible',$this->Visible,true);
|
||||||
$criteria->compare('Enabled',$this->Enabled,true);
|
$criteria->compare('Enabled',$this->Enabled,true);
|
||||||
|
|
||||||
@ -167,4 +170,9 @@ class BlogPost extends CActiveRecord
|
|||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isSpecialBlogPost()
|
||||||
|
{
|
||||||
|
return ! empty($this->ControllerID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
177
www/protected/models/EulerProblem.php
Normal file
177
www/protected/models/EulerProblem.php
Normal file
@ -0,0 +1,177 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the model class for table "{{eulerproblem}}".
|
||||||
|
*
|
||||||
|
* The followings are the available columns in table '{{eulerproblem}}':
|
||||||
|
* @property integer $Problemnumber
|
||||||
|
* @property string $Problemtitle
|
||||||
|
* @property string $Problemdescription
|
||||||
|
* @property string $Code
|
||||||
|
* @property string $Explanation
|
||||||
|
* @property integer $AbbreviatedCode
|
||||||
|
* @property string $SolutionSteps
|
||||||
|
* @property string $SolutionTime
|
||||||
|
* @property string $SolutionWidth
|
||||||
|
* @property string $SolutionHeight
|
||||||
|
* @property string $SolutionValue
|
||||||
|
*/
|
||||||
|
class EulerProblem extends CActiveRecord
|
||||||
|
{
|
||||||
|
const TIMELEVEL_PERFECT = 0;
|
||||||
|
const TIMELEVEL_GOOD = 1;
|
||||||
|
const TIMELEVEL_OK = 2;
|
||||||
|
const TIMELEVEL_BAD = 3;
|
||||||
|
const TIMELEVEL_FAIL = 4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string the associated database table name
|
||||||
|
*/
|
||||||
|
public function tableName()
|
||||||
|
{
|
||||||
|
return '{{eulerproblem}}';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array validation rules for model attributes.
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
// NOTE: you should only define rules for those attributes that
|
||||||
|
// will receive user inputs.
|
||||||
|
return array(
|
||||||
|
array('Problemnumber, Problemtitle, Problemdescription, Code, Explanation, AbbreviatedCode, SolutionSteps, SolutionTime, SolutionWidth, SolutionHeight, SolutionValue', 'required'),
|
||||||
|
array('AbbreviatedCode', 'numerical', 'integerOnly'=>true),
|
||||||
|
array('SolutionSteps, SolutionTime, SolutionValue', 'length', 'max'=>20),
|
||||||
|
array('Problemtitle', 'length', 'max'=>50),
|
||||||
|
|
||||||
|
array('Problemnumber, Problemtitle, Problemdescription, Code, Explanation, AbbreviatedCode, SolutionSteps, SolutionTime, SolutionValue', 'safe', 'on'=>'search'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array relational rules.
|
||||||
|
*/
|
||||||
|
public function relations()
|
||||||
|
{
|
||||||
|
// NOTE: you may need to adjust the relation name and the related
|
||||||
|
// class name for the relations automatically generated below.
|
||||||
|
return array(
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array customized attribute labels (name=>label)
|
||||||
|
*/
|
||||||
|
public function attributeLabels()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'Problemnumber' => 'Problemnumber',
|
||||||
|
'Problemtitle' => 'Problemtitle',
|
||||||
|
'Problemdescription' => 'Problemdescription',
|
||||||
|
'Code' => 'Code',
|
||||||
|
'Explanation' => 'Explanation',
|
||||||
|
'AbbreviatedCode' => 'Abbreviated Code',
|
||||||
|
'SolutionSteps' => 'Solution Steps',
|
||||||
|
'SolutionTime' => 'Solution Time',
|
||||||
|
'SolutionWidth' => 'Solution Width',
|
||||||
|
'SolutionHeight' => 'Solution Height',
|
||||||
|
'SolutionValue' => 'Solution Value',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a list of models based on the current search/filter conditions.
|
||||||
|
*
|
||||||
|
* Typical usecase:
|
||||||
|
* - Initialize the model fields with values from filter form.
|
||||||
|
* - Execute this method to get CActiveDataProvider instance which will filter
|
||||||
|
* models according to data in model fields.
|
||||||
|
* - Pass data provider to CGridView, CListView or any similar widget.
|
||||||
|
*
|
||||||
|
* @return CActiveDataProvider the data provider that can return the models
|
||||||
|
* based on the search/filter conditions.
|
||||||
|
*/
|
||||||
|
public function search()
|
||||||
|
{
|
||||||
|
$criteria=new CDbCriteria;
|
||||||
|
|
||||||
|
$criteria->compare('Problemnumber',$this->Problemnumber);
|
||||||
|
$criteria->compare('Problemtitle',$this->Problemdescription,true);
|
||||||
|
$criteria->compare('Problemdescription',$this->Problemdescription,true);
|
||||||
|
$criteria->compare('Code',$this->Code,true);
|
||||||
|
$criteria->compare('Explanation',$this->Explanation,true);
|
||||||
|
$criteria->compare('AbbreviatedCode',$this->AbbreviatedCode);
|
||||||
|
$criteria->compare('SolutionSteps',$this->SolutionSteps,true);
|
||||||
|
$criteria->compare('SolutionTime',$this->SolutionTime,true);
|
||||||
|
$criteria->compare('SolutionWidth',$this->SolutionWidth);
|
||||||
|
$criteria->compare('SolutionHeight',$this->SolutionHeight);
|
||||||
|
$criteria->compare('SolutionValue',$this->SolutionValue,true);
|
||||||
|
|
||||||
|
return new CActiveDataProvider($this, array(
|
||||||
|
'criteria'=>$criteria,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the static model of the specified AR class.
|
||||||
|
* Please note that you should have this exact method in all your CActiveRecord descendants!
|
||||||
|
* @param string $className active record class name.
|
||||||
|
* @return EulerProblem the static model class
|
||||||
|
*/
|
||||||
|
public static function model($className=__CLASS__)
|
||||||
|
{
|
||||||
|
return parent::model($className);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSourcecodefile($absolute = true)
|
||||||
|
{
|
||||||
|
return ($absolute ? '/' : '') . 'data/blog/Befunge/Euler_Problem-' . str_pad($this->Problemnumber, 3, '0', STR_PAD_LEFT) . '.b93';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTimeScore()
|
||||||
|
{
|
||||||
|
if ($this->SolutionTime < 100) // < 100ms
|
||||||
|
return EulerProblem::TIMELEVEL_PERFECT;
|
||||||
|
|
||||||
|
else if ($this->SolutionTime < 15 * 1000) // < 5s
|
||||||
|
return EulerProblem::TIMELEVEL_GOOD;
|
||||||
|
|
||||||
|
else if ($this->SolutionTime < 60 * 1000) // < 1min
|
||||||
|
return EulerProblem::TIMELEVEL_OK;
|
||||||
|
|
||||||
|
else if ($this->SolutionTime < 5 * 60 * 1000) // < 5min
|
||||||
|
return EulerProblem::TIMELEVEL_BAD;
|
||||||
|
|
||||||
|
else
|
||||||
|
return EulerProblem::TIMELEVEL_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isBefunge93()
|
||||||
|
{
|
||||||
|
return $this->SolutionWidth <= 80 AND $this->SolutionHeight <= 25;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function generateMarkdown()
|
||||||
|
{
|
||||||
|
$num_padded = str_pad($this->Problemnumber, 3, '0', STR_PAD_LEFT);
|
||||||
|
|
||||||
|
return
|
||||||
|
'Problem [' . $num_padded. '](http://projecteuler.net/problem=' . $num_padded . '): ' . $this->Problemtitle . PHP_EOL .
|
||||||
|
'--------' . PHP_EOL .
|
||||||
|
'' . PHP_EOL .
|
||||||
|
MsHelper::encloseLines($this->Problemdescription, '> ', '') . PHP_EOL .
|
||||||
|
'' . PHP_EOL .
|
||||||
|
'```befunge' . PHP_EOL .
|
||||||
|
$this->Code . PHP_EOL .
|
||||||
|
'```' . PHP_EOL .
|
||||||
|
'[Download](/data/blog/Befunge/Euler_Problem-' . $num_padded . '.b93)' . PHP_EOL .
|
||||||
|
'' . PHP_EOL .
|
||||||
|
$this->Explanation . PHP_EOL .
|
||||||
|
'' . PHP_EOL .
|
||||||
|
'**Interpreter steps:** `' . number_format($this->SolutionSteps, 0, null, ',') . '` ' . PHP_EOL .
|
||||||
|
'**Execution time** ([BefunExec](/programs/view/BefunGen)): `' . number_format($this->SolutionTime, 0, null, ',') . '` ms' . (($this->SolutionTime < 1000) ? (' ') : (' *(= ' . MsHelper::formatMilliseconds($this->SolutionTime) . ')* ')) . PHP_EOL .
|
||||||
|
'**Program size:** `' . $this->SolutionWidth . 'x' . $this->SolutionHeight . '` ' . PHP_EOL .
|
||||||
|
'**Solution:** `' . number_format($this->SolutionValue, 0, null, ',') . '` ';
|
||||||
|
}
|
||||||
|
}
|
@ -37,7 +37,6 @@ class HighscoreEntries extends CActiveRecord
|
|||||||
array('PLAYER, IP', 'length', 'max'=>41),
|
array('PLAYER, IP', 'length', 'max'=>41),
|
||||||
array('CHECKSUM', 'length', 'max'=>32),
|
array('CHECKSUM', 'length', 'max'=>32),
|
||||||
// The following rule is used by search().
|
// The following rule is used by search().
|
||||||
// @todo Please remove those attributes that should not be searched.
|
|
||||||
array('GAME_ID, POINTS, PLAYER, PLAYERID, CHECKSUM, TIMESTAMP, IP', 'safe', 'on'=>'search'),
|
array('GAME_ID, POINTS, PLAYER, PLAYERID, CHECKSUM, TIMESTAMP, IP', 'safe', 'on'=>'search'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -81,8 +81,6 @@ class HighscoreGames extends CActiveRecord
|
|||||||
*/
|
*/
|
||||||
public function search()
|
public function search()
|
||||||
{
|
{
|
||||||
// @todo Please modify the following code to remove attributes that should not be searched.
|
|
||||||
|
|
||||||
$criteria=new CDbCriteria;
|
$criteria=new CDbCriteria;
|
||||||
|
|
||||||
$criteria->compare('ID',$this->ID);
|
$criteria->compare('ID',$this->ID);
|
||||||
|
@ -30,6 +30,8 @@
|
|||||||
|
|
||||||
<?php echo $form->textAreaControlGroup($model,'Content',array('rows'=>30,'span'=>8)); ?>
|
<?php echo $form->textAreaControlGroup($model,'Content',array('rows'=>30,'span'=>8)); ?>
|
||||||
|
|
||||||
|
<?php echo $form->textFieldControlGroup($model,'ControllerID',array('span'=>8)); ?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if ($model->isNewRecord)
|
if ($model->isNewRecord)
|
||||||
echo $form->textFieldControlGroup($model,'Visible',array('span'=>5, 'value' => '1'));
|
echo $form->textFieldControlGroup($model,'Visible',array('span'=>5, 'value' => '1'));
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
<?php echo $form->textAreaControlGroup($model,'Content',array('rows'=>6,'span'=>8)); ?>
|
<?php echo $form->textAreaControlGroup($model,'Content',array('rows'=>6,'span'=>8)); ?>
|
||||||
|
|
||||||
|
<?php echo $form->textFieldControlGroup($model,'ControllerID',array('span'=>5)); ?>
|
||||||
|
|
||||||
<?php echo $form->textFieldControlGroup($model,'Visible',array('span'=>5)); ?>
|
<?php echo $form->textFieldControlGroup($model,'Visible',array('span'=>5)); ?>
|
||||||
|
|
||||||
<?php echo $form->textFieldControlGroup($model,'Enabled',array('span'=>5)); ?>
|
<?php echo $form->textFieldControlGroup($model,'Enabled',array('span'=>5)); ?>
|
||||||
|
@ -21,6 +21,11 @@
|
|||||||
<?php echo CHtml::encode($data->Content); ?>
|
<?php echo CHtml::encode($data->Content); ?>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
<b><?php echo CHtml::encode($data->getAttributeLabel('ControllerID')); ?>:</b>
|
||||||
|
<?php echo CHtml::encode($data->ControllerID); ?>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
|
||||||
<b><?php echo CHtml::encode($data->getAttributeLabel('Visible')); ?>:</b>
|
<b><?php echo CHtml::encode($data->getAttributeLabel('Visible')); ?>:</b>
|
||||||
<?php echo CHtml::encode($data->Visible); ?>
|
<?php echo CHtml::encode($data->Visible); ?>
|
||||||
<br />
|
<br />
|
||||||
|
168
www/protected/views/blogpost/view_ProjectEulerBefunge.php
Normal file
168
www/protected/views/blogpost/view_ProjectEulerBefunge.php
Normal file
@ -0,0 +1,168 @@
|
|||||||
|
<?php
|
||||||
|
/* @var $this BlogPostController */
|
||||||
|
/* @var $model BlogPost */
|
||||||
|
/* @var $problems EulerProblem[] */
|
||||||
|
/* @var $currproblemID int */
|
||||||
|
/* @var $currproblem EulerProblem */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$this->pageTitle = 'Blogpost: ' . $model->Title . ' - ' . Yii::app()->name;
|
||||||
|
|
||||||
|
if ($currproblemID < 0)
|
||||||
|
{
|
||||||
|
$this->breadcrumbs = array(
|
||||||
|
'Blog' => ['/blog'],
|
||||||
|
$model->Title,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->breadcrumbs = array(
|
||||||
|
'Blog' => ['/blog'],
|
||||||
|
$model->Title => [$model->getLink()],
|
||||||
|
'Problem_' . str_pad($problems[$currproblemID]->Problemnumber, 3, '0', STR_PAD_LEFT),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
array_push($this->css_files, "/css/blogpost_ProjectEulerBefunge_style.css");
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
|
||||||
|
<?php echo MsHtml::pageHeader("Blog", "My personal programming blog"); ?>
|
||||||
|
|
||||||
|
<?php if ($currproblemID < 0): ?>
|
||||||
|
<div class="blogOwner well markdownOwner" style="position: relative;">
|
||||||
|
<a href="https://github.com/Mikescher/Project-Euler_Befunge"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>
|
||||||
|
|
||||||
|
<h1><?php echo $model->Title ?></h1>
|
||||||
|
|
||||||
|
<p><a href="https://projecteuler.net/problems"><img src="http://projecteuler.net/profile/Mikescher.png" /></a></p>
|
||||||
|
|
||||||
|
<p>A lot of you probably know <a href="https://projecteuler.net/">Project Euler</a>.<br />
|
||||||
|
For those who don't here a short explanation: Project Euler is a collection of mathematical/programming problems.
|
||||||
|
Most problems consist of finding a single number and are solved by writing a program in the programming language of your choice.</p>
|
||||||
|
<p>Most people solve these by using normal languages like C, Java, Phyton, Haskell etc.
|
||||||
|
But you can also go a step further and try solving it with a little bit more exotic languages.</p>
|
||||||
|
<p>So here are my solutions written in <a href="http://esolangs.org/wiki/Befunge">Befunge</a></p>
|
||||||
|
<blockquote>
|
||||||
|
<p><strong>Note:</strong><br />
|
||||||
|
Similar to most Befunge content on this site I only used the Befunge-93 instruction-set but ignored the 80x25 size restriction.
|
||||||
|
<em>(Even so most programs here don't get this big.)</em></p>
|
||||||
|
</blockquote>
|
||||||
|
|
||||||
|
<table class="PEB_tableProblems items table table-striped table-bordered table-condensed">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Number</th>
|
||||||
|
<th>Title</th>
|
||||||
|
<th>Time</th>
|
||||||
|
<th>Size</th>
|
||||||
|
<th>Solution (hover to reveal)</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
for($i = 0; $i < count($problems); $i++)
|
||||||
|
{
|
||||||
|
$problem = $problems[$i];
|
||||||
|
|
||||||
|
echo '<tr class="PEB_tablerowProblems">' . "\r\n";
|
||||||
|
|
||||||
|
echo '<td class="PEB_tablecellProblems PEB_TC_Number">' . $problem->Problemnumber . "</td>\r\n";
|
||||||
|
echo '<td class="PEB_tablecellProblems PEB_TC_Title"><a href="?problem=' . $problems[$i]->Problemnumber . '">' . $problem->Problemtitle . "</a></td>\r\n";
|
||||||
|
echo '<td class="PEB_tablecellProblems"><div class="PEB_TC_Time PEB_TC_Timelevel_' . $problem->getTimeScore() . '">' . MsHelper::formatMilliseconds($problem->SolutionTime) . "</div></td>\r\n";
|
||||||
|
|
||||||
|
if ($problem->isBefunge93())
|
||||||
|
echo '<td class="PEB_tablecellProblems">' . $problem->SolutionWidth . 'x' . $problem->SolutionHeight . '<div class="PEB_TC_Size_93">Bef-93</div>' . "</td>\r\n";
|
||||||
|
else
|
||||||
|
echo '<td class="PEB_tablecellProblems">' . $problem->SolutionWidth . 'x' . $problem->SolutionHeight . '<div class="PEB_TC_Size_98">Bef-98</div>' . "</td>\r\n";
|
||||||
|
|
||||||
|
echo '<td class="PEB_tablecellProblems PEB_TC_Value">' . number_format($problem->SolutionValue, 0, null, ',') . "</td>\r\n";
|
||||||
|
|
||||||
|
echo "</tr>\r\n";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<?php endif ?>
|
||||||
|
|
||||||
|
<div class="blogOwner well markdownOwner" style="position: relative;">
|
||||||
|
<?php
|
||||||
|
if ($currproblemID >= 0)
|
||||||
|
{
|
||||||
|
echo '<a href="https://github.com/Mikescher/Project-Euler_Befunge"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>';
|
||||||
|
|
||||||
|
echo "<h1>$model->Title</h1>";
|
||||||
|
|
||||||
|
echo ParsedownHelper::parse($currproblem->generateMarkdown());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo "<h2>Problems:</h2>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$pagination = array();
|
||||||
|
|
||||||
|
for ($i = 0; $i < ceil(count($problems)/20)*20; $i++)
|
||||||
|
{
|
||||||
|
if ($i < count($problems))
|
||||||
|
array_push($pagination,
|
||||||
|
[
|
||||||
|
'label' => str_pad($problems[$i]->Problemnumber, 3, '0', STR_PAD_LEFT),
|
||||||
|
'url' => '?problem=' . $problems[$i]->Problemnumber,
|
||||||
|
'disabled' => false,
|
||||||
|
'active' => $currproblemID == $i,
|
||||||
|
]);
|
||||||
|
else
|
||||||
|
array_push($pagination,
|
||||||
|
[
|
||||||
|
'label' => str_pad($i+1, 3, '0', STR_PAD_LEFT),
|
||||||
|
'url' => '#',
|
||||||
|
'disabled' => true,
|
||||||
|
'active' => false,
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ((($i+1) % 20 == 0))
|
||||||
|
{
|
||||||
|
echo TbHtml::pagination($pagination, ['align' => TbHtml::PAGINATION_ALIGN_CENTER]);
|
||||||
|
$pagination = array();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo TbHtml::pagination($pagination, ['align' => TbHtml::PAGINATION_ALIGN_CENTER]);
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="blogFooter">
|
||||||
|
<div class="blogFooterLeft">
|
||||||
|
<?php echo $model->Title; ?>
|
||||||
|
</div>
|
||||||
|
<div class="blogFooterRight">
|
||||||
|
<?php echo $model->getDateTime()->format('d.m.Y'); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="disqus_owner">
|
||||||
|
<?php
|
||||||
|
$this->widget(
|
||||||
|
'ext.YiiDisqusWidget.YiiDisqusWidget',
|
||||||
|
[
|
||||||
|
'shortname' => 'mikescher-de',
|
||||||
|
'identifier' => 'blog/view/' + $model->ID,
|
||||||
|
'title' => $model->Title,
|
||||||
|
'url' => $model->getAbsoluteLink(),
|
||||||
|
'category_id' => '3253401', // = blog/view
|
||||||
|
]
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
57
www/protected/views/eulerProblem/_form.php
Normal file
57
www/protected/views/eulerProblem/_form.php
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
/* @var $this EulerProblemController */
|
||||||
|
/* @var $model EulerProblem */
|
||||||
|
/* @var $form TbActiveForm */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="form">
|
||||||
|
|
||||||
|
<?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm', array(
|
||||||
|
'id'=>'euler-problem-form',
|
||||||
|
// Please note: When you enable ajax validation, make sure the corresponding
|
||||||
|
// controller action is handling ajax validation correctly.
|
||||||
|
// There is a call to performAjaxValidation() commented in generated controller code.
|
||||||
|
// See class documentation of CActiveForm for details on this.
|
||||||
|
'enableAjaxValidation'=>false,
|
||||||
|
)); ?>
|
||||||
|
|
||||||
|
<p class="help-block">Fields with <span class="required">*</span> are required.</p>
|
||||||
|
|
||||||
|
<?php echo $form->errorSummary($model); ?>
|
||||||
|
|
||||||
|
<?php echo $form->textFieldControlGroup($model,'Problemnumber',array('span'=>8)); ?>
|
||||||
|
|
||||||
|
<?php echo $form->textFieldControlGroup($model,'Problemtitle',array('span'=>5,'maxlength'=>50)); ?>
|
||||||
|
|
||||||
|
<?php echo $form->textAreaControlGroup($model,'Problemdescription',array('rows'=>6,'span'=>8)); ?>
|
||||||
|
|
||||||
|
<?php echo $form->textAreaControlGroup($model,'Code',array('rows'=>6,'span'=>8)); ?>
|
||||||
|
|
||||||
|
<?php echo $form->textAreaControlGroup($model,'Explanation',array('rows'=>6,'span'=>8)); ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if ($model->isNewRecord)
|
||||||
|
echo $form->textFieldControlGroup($model,'AbbreviatedCode',array('span'=>5, 'value' => '0'));
|
||||||
|
else
|
||||||
|
echo $form->textFieldControlGroup($model,'AbbreviatedCode',array('span'=>5));
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php echo $form->textFieldControlGroup($model,'SolutionSteps',array('span'=>5,'maxlength'=>20)); ?>
|
||||||
|
|
||||||
|
<?php echo $form->textFieldControlGroup($model,'SolutionTime',array('span'=>5,'maxlength'=>20)); ?>
|
||||||
|
|
||||||
|
<?php echo $form->textFieldControlGroup($model,'SolutionWidth',array('span'=>5)); ?>
|
||||||
|
<?php echo $form->textFieldControlGroup($model,'SolutionHeight',array('span'=>5)); ?>
|
||||||
|
|
||||||
|
<?php echo $form->textFieldControlGroup($model,'SolutionValue',array('span'=>5,'maxlength'=>20)); ?>
|
||||||
|
|
||||||
|
<div class="form-actions">
|
||||||
|
<?php echo TbHtml::submitButton($model->isNewRecord ? 'Create' : 'Save',array(
|
||||||
|
'color'=>TbHtml::BUTTON_COLOR_PRIMARY,
|
||||||
|
'size'=>TbHtml::BUTTON_SIZE_LARGE,
|
||||||
|
)); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php $this->endWidget(); ?>
|
||||||
|
|
||||||
|
</div><!-- form -->
|
41
www/protected/views/eulerProblem/_search.php
Normal file
41
www/protected/views/eulerProblem/_search.php
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
/* @var $this EulerProblemController */
|
||||||
|
/* @var $model EulerProblem */
|
||||||
|
/* @var $form CActiveForm */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="wide form">
|
||||||
|
|
||||||
|
<?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm', array(
|
||||||
|
'action'=>Yii::app()->createUrl($this->route),
|
||||||
|
'method'=>'get',
|
||||||
|
)); ?>
|
||||||
|
|
||||||
|
<?php echo $form->textFieldControlGroup($model,'Problemnumber',array('span'=>5)); ?>
|
||||||
|
|
||||||
|
<?php echo $form->textFieldControlGroup($model,'Problemtitle',array('span'=>5,'maxlength'=>50)); ?>
|
||||||
|
|
||||||
|
<?php echo $form->textAreaControlGroup($model,'Problemdescription',array('rows'=>6,'span'=>8)); ?>
|
||||||
|
|
||||||
|
<?php echo $form->textAreaControlGroup($model,'Code',array('rows'=>6,'span'=>8)); ?>
|
||||||
|
|
||||||
|
<?php echo $form->textAreaControlGroup($model,'Explanation',array('rows'=>6,'span'=>8)); ?>
|
||||||
|
|
||||||
|
<?php echo $form->textFieldControlGroup($model,'AbbreviatedCode',array('span'=>5)); ?>
|
||||||
|
|
||||||
|
<?php echo $form->textFieldControlGroup($model,'SolutionSteps',array('span'=>5,'maxlength'=>20)); ?>
|
||||||
|
|
||||||
|
<?php echo $form->textFieldControlGroup($model,'SolutionTime',array('span'=>5,'maxlength'=>20)); ?>
|
||||||
|
|
||||||
|
<?php echo $form->textFieldControlGroup($model,'SolutionWidth',array('span'=>5)); ?>
|
||||||
|
<?php echo $form->textFieldControlGroup($model,'SolutionHeight',array('span'=>5)); ?>
|
||||||
|
|
||||||
|
<?php echo $form->textFieldControlGroup($model,'SolutionValue',array('span'=>5,'maxlength'=>20)); ?>
|
||||||
|
|
||||||
|
<div class="form-actions">
|
||||||
|
<?php echo TbHtml::submitButton('Search', array('color' => TbHtml::BUTTON_COLOR_PRIMARY,));?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php $this->endWidget(); ?>
|
||||||
|
|
||||||
|
</div><!-- search-form -->
|
55
www/protected/views/eulerProblem/_view.php
Normal file
55
www/protected/views/eulerProblem/_view.php
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
/* @var $this EulerProblemController */
|
||||||
|
/* @var $data EulerProblem */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="view">
|
||||||
|
|
||||||
|
<b><?php echo CHtml::encode($data->getAttributeLabel('Problemnumber')); ?>:</b>
|
||||||
|
<?php echo CHtml::link(CHtml::encode($data->Problemnumber),array('view','id'=>$data->Problemnumber)); ?>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<b><?php echo CHtml::encode($data->getAttributeLabel('Problemtitle')); ?>:</b>
|
||||||
|
<?php echo CHtml::link(CHtml::encode($data->Problemtitle)); ?>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<b><?php echo CHtml::encode($data->getAttributeLabel('Problemdescription')); ?>:</b>
|
||||||
|
<?php echo CHtml::encode($data->Problemdescription); ?>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<b><?php echo CHtml::encode($data->getAttributeLabel('Code')); ?>:</b>
|
||||||
|
<?php echo CHtml::encode($data->Code); ?>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<b><?php echo CHtml::encode($data->getAttributeLabel('Explanation')); ?>:</b>
|
||||||
|
<?php echo CHtml::encode($data->Explanation); ?>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<b><?php echo CHtml::encode($data->getAttributeLabel('AbbreviatedCode')); ?>:</b>
|
||||||
|
<?php echo CHtml::encode($data->AbbreviatedCode); ?>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<b><?php echo CHtml::encode($data->getAttributeLabel('SolutionSteps')); ?>:</b>
|
||||||
|
<?php echo CHtml::encode($data->SolutionSteps); ?>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<b><?php echo CHtml::encode($data->getAttributeLabel('SolutionWidth')); ?>:</b>
|
||||||
|
<?php echo CHtml::encode($data->SolutionTime); ?>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<b><?php echo CHtml::encode($data->getAttributeLabel('SolutionHeight')); ?>:</b>
|
||||||
|
<?php echo CHtml::encode($data->SolutionTime); ?>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<b><?php echo CHtml::encode($data->getAttributeLabel('SolutionTime')); ?>:</b>
|
||||||
|
<?php echo CHtml::encode($data->SolutionTime); ?>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<?php /*
|
||||||
|
<b><?php echo CHtml::encode($data->getAttributeLabel('SolutionValue')); ?>:</b>
|
||||||
|
<?php echo CHtml::encode($data->SolutionValue); ?>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
*/ ?>
|
||||||
|
|
||||||
|
</div>
|
64
www/protected/views/eulerProblem/admin.php
Normal file
64
www/protected/views/eulerProblem/admin.php
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
/* @var $this EulerProblemController */
|
||||||
|
/* @var $model EulerProblem */
|
||||||
|
|
||||||
|
|
||||||
|
$this->breadcrumbs=array(
|
||||||
|
'Euler Problems'=>array('index'),
|
||||||
|
'Manage',
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->menu=array(
|
||||||
|
array('label'=>'List EulerProblem', 'url'=>array('index')),
|
||||||
|
array('label'=>'Create EulerProblem', 'url'=>array('create')),
|
||||||
|
);
|
||||||
|
|
||||||
|
Yii::app()->clientScript->registerScript('search', "
|
||||||
|
$('.search-button').click(function(){
|
||||||
|
$('.search-form').toggle();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
$('.search-form form').submit(function(){
|
||||||
|
$('#euler-problem-grid').yiiGridView('update', {
|
||||||
|
data: $(this).serialize()
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
");
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h1>Manage Euler Problems</h1>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
You may optionally enter a comparison operator (<b><</b>, <b><=</b>, <b>></b>, <b>>=</b>, <b>
|
||||||
|
<></b>
|
||||||
|
or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<?php echo CHtml::link('Advanced Search','#',array('class'=>'search-button btn')); ?>
|
||||||
|
<div class="search-form" style="display:none">
|
||||||
|
<?php $this->renderPartial('_search',array(
|
||||||
|
'model'=>$model,
|
||||||
|
)); ?>
|
||||||
|
</div><!-- search-form -->
|
||||||
|
|
||||||
|
<?php $this->widget('bootstrap.widgets.TbGridView',array(
|
||||||
|
'id'=>'euler-problem-grid',
|
||||||
|
'dataProvider'=>$model->search(),
|
||||||
|
'filter'=>$model,
|
||||||
|
'columns'=>array(
|
||||||
|
'Problemnumber',
|
||||||
|
'Problemdescription',
|
||||||
|
'Code',
|
||||||
|
'Explanation',
|
||||||
|
'AbbreviatedCode',
|
||||||
|
'SolutionSteps',
|
||||||
|
/*
|
||||||
|
'SolutionTime',
|
||||||
|
'SolutionValue',
|
||||||
|
*/
|
||||||
|
array(
|
||||||
|
'class'=>'bootstrap.widgets.TbButtonColumn',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)); ?>
|
20
www/protected/views/eulerProblem/create.php
Normal file
20
www/protected/views/eulerProblem/create.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
/* @var $this EulerProblemController */
|
||||||
|
/* @var $model EulerProblem */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$this->breadcrumbs=array(
|
||||||
|
'Euler Problems'=>array('index'),
|
||||||
|
'Create',
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->menu=array(
|
||||||
|
array('label'=>'List EulerProblem', 'url'=>array('index')),
|
||||||
|
array('label'=>'Manage EulerProblem', 'url'=>array('admin')),
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h1>Create EulerProblem</h1>
|
||||||
|
|
||||||
|
<?php $this->renderPartial('_form', array('model'=>$model)); ?>
|
35
www/protected/views/eulerProblem/index.php
Normal file
35
www/protected/views/eulerProblem/index.php
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
/* @var $this EulerProblemController */
|
||||||
|
/* @var $dataProvider CActiveDataProvider */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$this->breadcrumbs=array(
|
||||||
|
'Euler Problems',
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->menu=array(
|
||||||
|
array('label'=>'Create EulerProblem','url'=>array('create')),
|
||||||
|
array('label'=>'Manage EulerProblem','url'=>array('admin')),
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h1>Euler Problems</h1>
|
||||||
|
|
||||||
|
<?php $this->widget('bootstrap.widgets.TbGridView',array(
|
||||||
|
'type'=>'striped bordered condensed',
|
||||||
|
|
||||||
|
'dataProvider'=>$dataProvider,
|
||||||
|
|
||||||
|
'columns'=>array(
|
||||||
|
'Problemnumber',
|
||||||
|
'Problemtitle',
|
||||||
|
'Problemdescription',
|
||||||
|
'AbbreviatedCode',
|
||||||
|
'SolutionWidth',
|
||||||
|
'SolutionHeight',
|
||||||
|
'SolutionSteps',
|
||||||
|
'SolutionTime',
|
||||||
|
'SolutionValue',
|
||||||
|
),
|
||||||
|
)); ?>
|
23
www/protected/views/eulerProblem/update.php
Normal file
23
www/protected/views/eulerProblem/update.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
/* @var $this EulerProblemController */
|
||||||
|
/* @var $model EulerProblem */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$this->breadcrumbs=array(
|
||||||
|
'Euler Problems'=>array('index'),
|
||||||
|
'#' . $model->Problemnumber=>array('view','id'=>$model->Problemnumber),
|
||||||
|
'Update',
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->menu=array(
|
||||||
|
array('label'=>'List EulerProblem', 'url'=>array('index')),
|
||||||
|
array('label'=>'Create EulerProblem', 'url'=>array('create')),
|
||||||
|
array('label'=>'View EulerProblem', 'url'=>array('view', 'id'=>$model->Problemnumber)),
|
||||||
|
array('label'=>'Manage EulerProblem', 'url'=>array('admin')),
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h1>Update EulerProblem <?php echo $model->Problemnumber; ?></h1>
|
||||||
|
|
||||||
|
<?php $this->renderPartial('_form', array('model'=>$model)); ?>
|
38
www/protected/views/eulerProblem/view.php
Normal file
38
www/protected/views/eulerProblem/view.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
/* @var $this EulerProblemController */
|
||||||
|
/* @var $model EulerProblem */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$this->breadcrumbs=array(
|
||||||
|
'Euler Problems'=>array('index'),
|
||||||
|
'#' . $model->Problemnumber,
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->menu=array(
|
||||||
|
array('label'=>'List EulerProblem', 'url'=>array('index')),
|
||||||
|
array('label'=>'Create EulerProblem', 'url'=>array('create')),
|
||||||
|
array('label'=>'Update EulerProblem', 'url'=>array('update', 'id'=>$model->Problemnumber)),
|
||||||
|
array('label'=>'Delete EulerProblem', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->Problemnumber),'confirm'=>'Are you sure you want to delete this item?')),
|
||||||
|
array('label'=>'Manage EulerProblem', 'url'=>array('admin')),
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h1>View EulerProblem #<?php echo $model->Problemnumber; ?></h1>
|
||||||
|
|
||||||
|
<?php $this->widget('zii.widgets.CDetailView',array(
|
||||||
|
'htmlOptions' => array(
|
||||||
|
'class' => 'table table-striped table-condensed table-hover',
|
||||||
|
),
|
||||||
|
'data'=>$model,
|
||||||
|
'attributes'=>array(
|
||||||
|
'Problemnumber',
|
||||||
|
'Problemdescription',
|
||||||
|
'Code',
|
||||||
|
'Explanation',
|
||||||
|
'AbbreviatedCode',
|
||||||
|
'SolutionSteps',
|
||||||
|
'SolutionTime',
|
||||||
|
'SolutionValue',
|
||||||
|
),
|
||||||
|
)); ?>
|
@ -19,9 +19,13 @@
|
|||||||
<link rel="icon" type="image/png" href="/images/favicon.png"/>
|
<link rel="icon" type="image/png" href="/images/favicon.png"/>
|
||||||
|
|
||||||
<?php Yii::app()->bootstrap->register(); ?>
|
<?php Yii::app()->bootstrap->register(); ?>
|
||||||
<link rel="stylesheet" type="text/css" href="/css/styles.css"/>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/css/prism.css"/>
|
<?php
|
||||||
<link rel="stylesheet" type="text/css" href="/css/lightbox.css"/>
|
foreach ($this->css_files as $file)
|
||||||
|
{
|
||||||
|
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$file\"/>\r\n";
|
||||||
|
}
|
||||||
|
?>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<!--if lt IE 7]>
|
<!--if lt IE 7]>
|
||||||
|
@ -48,7 +48,6 @@ $this->breadcrumbs =
|
|||||||
|
|
||||||
echo MsHtml::stackedTabs(
|
echo MsHtml::stackedTabs(
|
||||||
[
|
[
|
||||||
['label' => 'Show', 'url' => '/programupdates'],
|
|
||||||
['label' => 'Manage', 'url' => '/programupdates/admin'],
|
['label' => 'Manage', 'url' => '/programupdates/admin'],
|
||||||
['label' => 'Create', 'url' => '/programupdates/create'],
|
['label' => 'Create', 'url' => '/programupdates/create'],
|
||||||
]
|
]
|
||||||
@ -69,6 +68,59 @@ $this->breadcrumbs =
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="span3">
|
||||||
|
<?php
|
||||||
|
echo MsHtml::lead('EulerProblems');
|
||||||
|
|
||||||
|
echo MsHtml::stackedTabs(
|
||||||
|
[
|
||||||
|
['label' => 'Manage', 'url' => '/eulerproblem/admin'],
|
||||||
|
['label' => 'Create', 'url' => '/eulerproblem/create'],
|
||||||
|
]
|
||||||
|
); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="span3" style="visibility: hidden">
|
||||||
|
<?php
|
||||||
|
echo MsHtml::lead('xxx');
|
||||||
|
|
||||||
|
echo MsHtml::stackedTabs(
|
||||||
|
[
|
||||||
|
['label' => 'Show', 'url' => '/xxx'],
|
||||||
|
['label' => 'Manage', 'url' => '/xxx/admin'],
|
||||||
|
['label' => 'Create', 'url' => '/xxx/create'],
|
||||||
|
]
|
||||||
|
); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="span3" style="visibility: hidden">
|
||||||
|
<?php
|
||||||
|
echo MsHtml::lead('xxx');
|
||||||
|
|
||||||
|
echo MsHtml::stackedTabs(
|
||||||
|
[
|
||||||
|
['label' => 'Show', 'url' => '/xxx'],
|
||||||
|
['label' => 'Manage', 'url' => '/xxx/admin'],
|
||||||
|
['label' => 'Create', 'url' => '/xxx/create'],
|
||||||
|
]
|
||||||
|
); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="span3" style="visibility: hidden">
|
||||||
|
<?php
|
||||||
|
echo MsHtml::lead('xxx');
|
||||||
|
|
||||||
|
echo MsHtml::stackedTabs(
|
||||||
|
[
|
||||||
|
['label' => 'Show', 'url' => '/xxx'],
|
||||||
|
['label' => 'Manage', 'url' => '/xxx/admin'],
|
||||||
|
['label' => 'Create', 'url' => '/xxx/create'],
|
||||||
|
]
|
||||||
|
); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="well well-small">
|
<div class="well well-small">
|
||||||
<?php
|
<?php
|
||||||
$egh = $egh = (new ExtendedGitGraph('Mikescher'))->loadFinishedData();
|
$egh = $egh = (new ExtendedGitGraph('Mikescher'))->loadFinishedData();
|
||||||
|
@ -23,9 +23,18 @@ $this->selectedNav = 'prog';
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
if (empty($category))
|
if (empty($category))
|
||||||
|
{
|
||||||
echo MsHtml::pageHeader("Programs", "Games and Tools, developed by me");
|
echo MsHtml::pageHeader("Programs", "Games and Tools, developed by me");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
echo MsHtml::pageHeader("Programs", '"' . $category . '"');
|
echo MsHtml::pageHeader("Programs", '"' . $category . '"');
|
||||||
|
|
||||||
|
$this->breadcrumbs = array(
|
||||||
|
'Programs' => '/programs',
|
||||||
|
$category
|
||||||
|
);
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
|
@ -11,6 +11,9 @@ $this->breadcrumbs = array(
|
|||||||
'Programs' => array('index'),
|
'Programs' => array('index'),
|
||||||
$model->Name,
|
$model->Name,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
array_push($this->css_files, "/css/lightbox.css");
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
@ -112,7 +115,7 @@ if (!$model->visible && Yii::app()->user->name != 'admin') {
|
|||||||
'color' => TbHtml::BUTTON_COLOR_PRIMARY,
|
'color' => TbHtml::BUTTON_COLOR_PRIMARY,
|
||||||
'size' => TbHtml::BUTTON_SIZE_DEFAULT,
|
'size' => TbHtml::BUTTON_SIZE_DEFAULT,
|
||||||
'Content' => 'nofollow',
|
'Content' => 'nofollow',
|
||||||
'url' => $model->getDownloadLink(), //TODO-MS Add Download link
|
'url' => $model->getDownloadLink(),
|
||||||
]);
|
]);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@ -156,7 +159,7 @@ if (!$model->visible && Yii::app()->user->name != 'admin') {
|
|||||||
'block' => true,
|
'block' => true,
|
||||||
'color' => TbHtml::BUTTON_COLOR_SUCCESS,
|
'color' => TbHtml::BUTTON_COLOR_SUCCESS,
|
||||||
'size' => TbHtml::BUTTON_SIZE_DEFAULT,
|
'size' => TbHtml::BUTTON_SIZE_DEFAULT,
|
||||||
'url' => '/Highscores/list?gameid=' . $model->highscore_gid, //TODO-MS Add Highscore link
|
'url' => '/Highscores/list?gameid=' . $model->highscore_gid,
|
||||||
]);
|
]);
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user