1
0

Renamed "Programme" to "Programs"/"Program"

This commit is contained in:
2014-05-28 11:02:52 +02:00
parent fa36f26f2e
commit 98fb0f1cec
19 changed files with 263 additions and 312 deletions

View File

@@ -1,6 +1,6 @@
<?php
class ProgrammeHelper {
class ProgramHelper {
public static function GetHighlightedProgList($doDelimiter)
{
@@ -10,7 +10,7 @@ class ProgrammeHelper {
$criteria->order = "add_date DESC";
$criteria->condition = "visible=1 AND enabled=1";
$criteria->limit = 3;
foreach (Programme::model()->findAll($criteria) as $row) {
foreach (Program::model()->findAll($criteria) as $row) {
$dropDownModels[] = $row;
}
@@ -23,7 +23,7 @@ class ProgrammeHelper {
$criteria->order = "add_date DESC";
$criteria->limit = 8;
$criteria->condition = "Sterne=4 AND visible=1 AND enabled=1";
foreach (Programme::model()->findAll($criteria) as $row) {
foreach (Program::model()->findAll($criteria) as $row) {
$dropDownModels[] = $row;
}
@@ -37,7 +37,7 @@ class ProgrammeHelper {
$criteria->condition = "DATEDIFF(CURDATE(), add_date) <= 14 AND visible=1 AND enabled=1";
$criteria->limit = 1;
return Programme::model()->find($criteria);
return Program::model()->find($criteria);
}
public static function GetDailyProg()
@@ -67,7 +67,7 @@ class ProgrammeHelper {
if (is_null($row))
$progDropDown[] = TbHtml::menuDivider();
else
$progDropDown[] = array('label' => $row->attributes['Name'], 'url' => '/programme/' . $row->attributes['Name']);
$progDropDown[] = array('label' => $row->attributes['Name'], 'url' => '/programs/' . $row->attributes['Name']);
}
return $progDropDown;
}

View File

@@ -64,9 +64,9 @@ return ArrayX::merge(
'showScriptName' => false,
'rules' =>
[
'Programme/' => 'Programme/index',
'downloads/<action:\w+>' => 'programme/<action>', // Compatibility
'downloads/downloads.php' => 'programme/index', // Compatibility
'programs/' => 'programs/index',
'downloads/<action:\w+>' => 'programs/<action>', // Compatibility
'downloads/downloads.php' => 'programs/index', // Compatibility
'' => 'site/index',

View File

@@ -1,6 +1,6 @@
<?php
class ProgrammeController extends Controller
class ProgramsController extends Controller
{
public $layout='//layouts/column2';
@@ -61,13 +61,13 @@ class ProgrammeController extends Controller
*/
public function actionCreate()
{
$model=new Programme;
$model=new Program();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Programme'])) {
$model->attributes=$_POST['Programme'];
if (isset($_POST['Program'])) {
$model->attributes=$_POST['Program'];
if ($model->save()) {
$this->redirect(array('view','id'=>$model->ID));
}
@@ -90,8 +90,8 @@ class ProgrammeController extends Controller
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Programme'])) {
$model->attributes=$_POST['Programme'];
if (isset($_POST['Program'])) {
$model->attributes=$_POST['Program'];
if ($model->save()) {
$this->redirect(array('view','id'=>$model->ID));
}
@@ -138,10 +138,10 @@ class ProgrammeController extends Controller
*/
public function actionAdmin()
{
$model=new Programme('search');
$model=new Program('search');
$model->unsetAttributes(); // clear any default values
if (isset($_GET['Programme'])) {
$model->attributes=$_GET['Programme'];
if (isset($_GET['Program'])) {
$model->attributes=$_GET['Program'];
}
$this->render('admin',array(
@@ -153,12 +153,12 @@ class ProgrammeController extends Controller
* 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 Programme the loaded model
* @return Program the loaded model
* @throws CHttpException
*/
public function loadModel($id)
{
$model=Programme::model()->findByPk($id);
$model=Program::model()->findByPk($id);
if ($model===null) {
throw new CHttpException(404,'The requested page does not exist.');
}
@@ -167,11 +167,11 @@ class ProgrammeController extends Controller
/**
* Performs the AJAX validation.
* @param Programme $model the model to be validated
* @param Program $model the model to be validated
*/
protected function performAjaxValidation($model)
{
if (isset($_POST['ajax']) && $_POST['ajax']==='programme-form') {
if (isset($_POST['ajax']) && $_POST['ajax']==='program-form') {
echo CActiveForm::validate($model);
Yii::app()->end();
}

View File

@@ -8,7 +8,7 @@ class SiteController extends Controller
{
$data = array();
$data['program'] = ProgrammeHelper::GetDailyProg();
$data['program'] = ProgramHelper::GetDailyProg();
$this->render('index', $data);
}

View File

@@ -1,9 +1,9 @@
<?php
/**
* This is the model class for table "programme".
* This is the model class for table "program".
*
* The followings are the available columns in table 'programme':
* The followings are the available columns in table 'program':
* @property integer $ID
* @property string $Name
* @property double $Downloads
@@ -23,14 +23,14 @@
* @property string $update_identifier
* @property integer $highscore_gid
*/
class Programme extends CActiveRecord
class Program extends CActiveRecord
{
/**
* @return string the associated database table name
*/
public function tableName()
{
return 'programme';
return 'Programme';
}
/**
@@ -136,7 +136,7 @@ class Programme extends CActiveRecord
* 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 Programme the static model class
* @return Program the static model class
*/
public static function model($className=__CLASS__)
{

View File

@@ -44,8 +44,8 @@
[
['label' => 'Home', 'url' => '/', 'active' => ($this->selectedNav === 'index')],
['label' => 'Blog', 'url' => '#', 'active' => ($this->selectedNav === 'blog')],
['label' => 'Programme', 'url' => '/programme/', 'active' => ($this->selectedNav === 'prog')],
['label' => '', 'items' => ProgrammeHelper::GetProgDropDownList(), 'htmlOptions' => ['class' => 'dropdown-append']],
['label' => 'Programs', 'url' => '/programs/', 'active' => ($this->selectedNav === 'prog')],
['label' => '', 'items' => ProgramHelper::GetProgDropDownList(), 'htmlOptions' => ['class' => 'dropdown-append']],
['label' => 'About', 'url' => '/about', 'active' => ($this->selectedNav === 'about')],
['label' => '[[Log "'.Yii::app()->user->name.'" out]]', 'url' => '/logout', 'visible' => !Yii::app()->user->isGuest]
],

View File

@@ -1,20 +0,0 @@
<?php
/* @var $this ProgrammeController */
/* @var $model Programme */
?>
<?php
$this->breadcrumbs=array(
'Programme'=>array('index'),
'Create',
);
$this->menu=array(
array('label'=>'List Programme', 'url'=>array('index')),
array('label'=>'Manage Programme', 'url'=>array('admin')),
);
?>
<h1>Create Programme</h1>
<?php $this->renderPartial('_form', array('model'=>$model)); ?>

View File

@@ -1,23 +0,0 @@
<?php
/* @var $this ProgrammeController */
/* @var $model Programme */
?>
<?php
$this->breadcrumbs=array(
'Programme'=>array('index'),
$model->Name=>array('view','id'=>$model->ID),
'Update',
);
$this->menu=array(
array('label'=>'List Programme', 'url'=>array('index')),
array('label'=>'Create Programme', 'url'=>array('create')),
array('label'=>'View Programme', 'url'=>array('view', 'id'=>$model->ID)),
array('label'=>'Manage Programme', 'url'=>array('admin')),
);
?>
<h1>Update Programme <?php echo $model->ID; ?></h1>
<?php $this->renderPartial('_form', array('model'=>$model)); ?>

View File

@@ -1,13 +1,13 @@
<?php
/* @var $this ProgrammeController */
/* @var $model Programme */
/* @var $this ProgramController */
/* @var $model Program */
/* @var $form TbActiveForm */
?>
<div class="form">
<?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm', array(
'id'=>'programme-form',
'id'=>'program-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.

View File

@@ -1,6 +1,6 @@
<?php
/* @var $this ProgrammeController */
/* @var $model Programme */
/* @var $this ProgramController */
/* @var $model Program */
/* @var $form CActiveForm */
?>

View File

@@ -1,6 +1,6 @@
<?php
/* @var $this ProgrammeController */
/* @var $data Programme */
/* @var $this ProgramController */
/* @var $data Program */
?>
<div class="view">

View File

@@ -1,16 +1,16 @@
<?php
/* @var $this ProgrammeController */
/* @var $model Programme */
/* @var $this ProgramController */
/* @var $model Program */
$this->breadcrumbs=array(
'Programme'=>array('index'),
'Programs'=>array('index'),
'Manage',
);
$this->menu=array(
array('label'=>'List Programme', 'url'=>array('index')),
array('label'=>'Create Programme', 'url'=>array('create')),
array('label'=>'List Program', 'url'=>array('index')),
array('label'=>'Create Program', 'url'=>array('create')),
);
Yii::app()->clientScript->registerScript('search', "
@@ -19,7 +19,7 @@ $('.search-button').click(function(){
return false;
});
$('.search-form form').submit(function(){
$('#programme-grid').yiiGridView('update', {
$('#program-grid').yiiGridView('update', {
data: $(this).serialize()
});
return false;
@@ -30,7 +30,7 @@ $('.search-form form').submit(function(){
?>
<h1>Manage Programmes</h1>
<h1>Manage Program</h1>
<p>
You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>
@@ -47,7 +47,7 @@ or <b>=</b>) at the beginning of each of your search values to specify how the c
<br><br>
<?php $this->widget('bootstrap.widgets.TbGridView',array(
'type' => TbHtml::GRID_TYPE_BORDERED,
'id'=>'programme-grid',
'id'=>'program-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(

View File

@@ -0,0 +1,20 @@
<?php
/* @var $this ProgramController */
/* @var $model Program */
?>
<?php
$this->breadcrumbs=array(
'Programs'=>array('index'),
'Create',
);
$this->menu=array(
array('label'=>'List Program', 'url'=>array('index')),
array('label'=>'Manage Program', 'url'=>array('admin')),
);
?>
<h1>Create Program</h1>
<?php $this->renderPartial('_form', array('model'=>$model)); ?>

View File

@@ -1,16 +1,16 @@
<?php
/* @var $this ProgrammeController */
/* @var $this ProgramController */
/* @var $dataProvider CActiveDataProvider */
?>
<?php
$this->breadcrumbs = array(
'Programme',
'Programs',
);
$this->menu = array(
array('label' => 'Create Programme', 'url' => array('create')),
array('label' => 'Manage Programme', 'url' => array('admin')),
array('label' => 'Create Program', 'url' => array('create')),
array('label' => 'Manage Program', 'url' => array('admin')),
);
?>
@@ -21,7 +21,7 @@ $this->menu = array(
<br>
<?php
foreach (Programme::model()->findAll() as $record) {
foreach (Program::model()->findAll() as $record) {
echo "<div class='well'>";
echo nl2br(print_r($record->attributes, true));
echo "</div>";

View File

@@ -0,0 +1,23 @@
<?php
/* @var $this ProgramController */
/* @var $model Program */
?>
<?php
$this->breadcrumbs=array(
'Programs'=>array('index'),
$model->Name=>array('view','id'=>$model->ID),
'Update',
);
$this->menu=array(
array('label'=>'List Program', 'url'=>array('index')),
array('label'=>'Create Program', 'url'=>array('create')),
array('label'=>'View Program', 'url'=>array('view', 'id'=>$model->ID)),
array('label'=>'Manage Program', 'url'=>array('admin')),
);
?>
<h1>Update Program <?php echo $model->ID; ?></h1>
<?php $this->renderPartial('_form', array('model'=>$model)); ?>

View File

@@ -1,24 +1,24 @@
<?php
/* @var $this ProgrammeController */
/* @var $model Programme */
/* @var $this ProgramController */
/* @var $model Program */
?>
<?php
$this->breadcrumbs=array(
'Programme'=>array('index'),
'Programs'=>array('index'),
$model->Name,
);
$this->menu=array(
array('label'=>'List Programme', 'url'=>array('index')),
array('label'=>'Create Programme', 'url'=>array('create')),
array('label'=>'Update Programme', 'url'=>array('update', 'id'=>$model->ID)),
array('label'=>'Delete Programme', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->ID),'confirm'=>'Are you sure you want to delete this item?')),
array('label'=>'Manage Programme', 'url'=>array('admin')),
array('label'=>'List Program', 'url'=>array('index')),
array('label'=>'Create Program', 'url'=>array('create')),
array('label'=>'Update Program', 'url'=>array('update', 'id'=>$model->ID)),
array('label'=>'Delete Program', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->ID),'confirm'=>'Are you sure you want to delete this item?')),
array('label'=>'Manage Program', 'url'=>array('admin')),
);
?>
<h1>View Programme #<?php echo $model->ID; ?></h1>
<h1>View Program #<?php echo $model->ID; ?></h1>
<?php $this->widget('zii.widgets.CDetailView',array(
'htmlOptions' => array(

View File

@@ -22,9 +22,9 @@ $this->selectedNav = 'about';
<div class="well cstm-well-light">
<p>Welcome to my private homepage.</p>
<p>My name is Mike Schwörer, and this is my homepage - here i upload programs i write in my free time and sometimes i even write a blog entry. </p>
<p>My name is Mike Schwörer, and this is my homepage - here i upload program i write in my free time and sometimes i even write a blog entry. </p>
<p>If you want you can look <?php echo TbHtml::link('here', '#'); // TODO Add Link ?> at the things I programmed </p>
<p>If you want you can look <?php echo TbHtml::link('here', '/programs'); ?> at the things I programd </p>
</div>
<div class="well cstm-well-light">

View File

@@ -40,7 +40,7 @@ $this->selectedNav = 'index';
<?php
$connection = Yii::app()->db;
$command=$connection->createCommand("SELECT * FROM programme");
$command=$connection->createCommand("SELECT * FROM Programme");
$command->execute(); // a non-query SQL statement execution
// or execute an SQL query and fetch the result set
$reader=$command->query();