1
0

Renamed SiteController -> MSMainController

This commit is contained in:
2014-06-04 09:33:24 +02:00
parent f9cf82ea9e
commit 5b2a5bec36
15 changed files with 270 additions and 276 deletions

View File

@@ -3,21 +3,23 @@
* Controller is the customized base controller class.
* All controller classes for this application should extend from this base class.
*/
class Controller extends CController
class MSController extends CController
{
/**
* @var string the default layout for the controller view. Defaults to '//layouts/main',
* meaning using a single column layout. See 'protected/views/layouts/main.php'.
*/
public $layout='//layouts/main';
/**
* @var array context menu items. This property will be assigned to {@link CMenu::items}.
*/
public $menu=array();
/**
* @var array the breadcrumbs of the current page. The value of this property will
* be assigned to {@link CBreadcrumbs::links}. Please refer to {@link CBreadcrumbs::links}
* for more details on how to specify this property.
*/
public $breadcrumbs=array();
/**
* @var string the currently active Element in the Navbar
*/
public $selectedNav = '';
}

1
www/protected/config/env/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*.secret.php

View File

@@ -17,7 +17,7 @@ return [
'errorHandler' =>
[
'errorAction' => 'site/debugerror',
'errorAction' => 'msmain/debugerror',
],
],

View File

@@ -4,20 +4,21 @@ return [
'components' =>
[
'db' =>
[
'connectionString' => 'mysql:host=rdbms.strato.de;dbname=DB451718',
'username' => 'U451718',
'password' => '?<?<?.?>?>?>', //TODO Change me and move me to extra file
'enableProfiling' => false,
'enableParamLogging' => false,
'charset' => 'utf8',
'emulatePrepare' => true, // needed by some MySQL installations
'schemaCachingDuration' => 3600, // Performance with AR's
],
ArrayX::merge(
[
'connectionString' => 'mysql:host=rdbms.strato.de;dbname=DB451718',
'enableProfiling' => false,
'enableParamLogging' => false,
'charset' => 'utf8',
'emulatePrepare' => true, // needed by some MySQL installations
'schemaCachingDuration' => 3600, // Performance with AR's
],
require_once('database-access.secret.php') // DB Username & PW
),
'errorHandler' =>
[
'errorAction' => 'site/error',
'errorAction' => 'msmain/error',
],
],

View File

@@ -69,9 +69,9 @@ return ArrayX::merge(
'downloads/downloads.php' => 'programs/index', // Compatibility
'downloads/<id>' => 'programs/view', // Compatibility
'' => 'site/index',
'' => 'msmain/index',
'<action:\w+>' => 'site/<action>',
'<action:\w+>' => 'msmain/<action>',
],
],
@@ -87,6 +87,11 @@ return ArrayX::merge(
],
],
],
'db' =>
[
'tablePrefix' => 'ms4_',
],
],
// application-level parameters that can be accessed

View File

@@ -1,9 +1,7 @@
<?php
class SiteController extends Controller
class MSMainController extends MSController
{
public $selectedNav = '';
public function actionIndex()
{
$data = array();

View File

@@ -1,12 +1,10 @@
<?php
class ProgramsController extends Controller
class ProgramsController extends MSController
{
public $layout='//layouts/column2';
public $selectedNav = '';
/**
* @return array action filters
*/

View File

@@ -32,7 +32,7 @@ class Program extends CActiveRecord
*/
public function tableName()
{
return 'Programme';
return '{{programs}}';
}
/**
@@ -49,7 +49,7 @@ class Program extends CActiveRecord
array('update_identifier', 'length', 'max'=>28),
array('programming_lang', 'length', 'max'=>16),
// The following rule is used by search().
// @todo Please remove those attributes that should not be searched.
// @TODO-MS Please remove those attributes that should not be searched.
array('ID, Name, Thumbnailname, Downloads, Kategorie, Sterne, enabled, visible, Language, programming_lang, Description, add_date, download_url, viewable_code, sourceforge_url, homepage_url, github_url, uses_absCanv, update_identifier, highscore_gid', 'safe', 'on'=>'search'),
);
}
@@ -156,12 +156,13 @@ class Program extends CActiveRecord
/**
* @return string
* @throws CHttpException
*/
public function getImagePath() {
if (file_exists('images/programs/thumbnails/' . $this->Name . '.png'))
return '/images/programs/thumbnails/' . $this->Name . '.png';
else if (file_exists('images/programs/thumbnails/' . $this->Name . '.jpg'))
return '/images/programs/thumbnails/' . $this->Name . '.jpg'; //TODO REM ME - never use jpg
return '/images/programs/thumbnails/' . $this->Name . '.jpg'; //TODO-MS REM ME - never use jpg
else throw new CHttpException(500, "Could not find Program Thumbnail '" . $this->Name . "'");
}

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 {{Programs}}");
$command->execute(); // a non-query SQL statement execution
// or execute an SQL query and fetch the result set
$reader=$command->query();