1
0

Fixed Filesystem Uppercase (for *-nix systems)

This commit is contained in:
Mike Schwörer 2014-09-29 17:00:22 +02:00
parent 58eb50f0ad
commit da7583392c
11 changed files with 504 additions and 2 deletions

View File

@ -100,7 +100,7 @@ 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', '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

View File

@ -1,6 +1,6 @@
<?php <?php
class EulerProblemController extends MSController class EulerproblemController extends MSController
{ {
public $layout='//layouts/column2'; public $layout='//layouts/column2';

View 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();
}
}
}

View 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 -->

View 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 -->

View 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>

View 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>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>
&lt;&gt;</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',
),
),
)); ?>

View 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)); ?>

View 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',
),
)); ?>

View 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)); ?>

View 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',
),
)); ?>