web part of Bashgid
This commit is contained in:
1 parent
4ef60e1aa0
commit
5c5238c85f
155 files changed
+7956
No files matched your search
@@ -0,0 +1,180 @@
|
||||
<?php
|
||||
|
||||
class AlbumArticleRelationController extends Controller {
|
||||
|
||||
/**
|
||||
* @var string the default layout for the views. Defaults to '//layouts/column2', meaning
|
||||
* using two-column layout. See 'protected/views/layouts/column2.php'.
|
||||
*/
|
||||
public $layout = '//layouts/column2';
|
||||
|
||||
/**
|
||||
* @return array action filters
|
||||
*/
|
||||
public function filters()
|
||||
{
|
||||
return array(
|
||||
'accessControl', // perform access control for CRUD operations
|
||||
'postOnly + delete', // we only allow deletion via POST request
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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('allow',
|
||||
'actions' => array('json'),
|
||||
'users' => array('*'),
|
||||
),
|
||||
array('deny', // deny all users
|
||||
'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 AlbumArticleRelation;
|
||||
|
||||
// Uncomment the following line if AJAX validation is needed
|
||||
// $this->performAjaxValidation($model);
|
||||
|
||||
if (isset($_POST['AlbumArticleRelation']))
|
||||
{
|
||||
$model->attributes = $_POST['AlbumArticleRelation'];
|
||||
if ($model->save())
|
||||
$this->redirect(array('view', 'id' => $model->id));
|
||||
}
|
||||
|
||||
$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['AlbumArticleRelation']))
|
||||
{
|
||||
$model->attributes = $_POST['AlbumArticleRelation'];
|
||||
if ($model->save())
|
||||
$this->redirect(array('view', 'id' => $model->id));
|
||||
}
|
||||
|
||||
$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)
|
||||
{
|
||||
$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'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all models.
|
||||
*/
|
||||
public function actionIndex()
|
||||
{
|
||||
$dataProvider = new CActiveDataProvider('AlbumArticleRelation');
|
||||
$this->render('index', array(
|
||||
'dataProvider' => $dataProvider,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Manages all models.
|
||||
*/
|
||||
public function actionAdmin()
|
||||
{
|
||||
$model = new AlbumArticleRelation('search');
|
||||
$model->unsetAttributes(); // clear any default values
|
||||
if (isset($_GET['AlbumArticleRelation']))
|
||||
$model->attributes = $_GET['AlbumArticleRelation'];
|
||||
|
||||
$this->render('admin', array(
|
||||
'model' => $model,
|
||||
));
|
||||
}
|
||||
|
||||
public function actionJson()
|
||||
{
|
||||
$dataArray = AlbumArticleRelation::model()->findAll();
|
||||
|
||||
$this->layout = false;
|
||||
header('Content-type: application/json');
|
||||
echo CJavaScript::jsonEncode($dataArray);
|
||||
Yii::app()->end();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 AlbumArticleRelation the loaded model
|
||||
* @throws CHttpException
|
||||
*/
|
||||
public function loadModel($id)
|
||||
{
|
||||
$model = AlbumArticleRelation::model()->findByPk($id);
|
||||
if ($model === null)
|
||||
throw new CHttpException(404, 'The requested page does not exist.');
|
||||
return $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs the AJAX validation.
|
||||
* @param AlbumArticleRelation $model the model to be validated
|
||||
*/
|
||||
protected function performAjaxValidation($model)
|
||||
{
|
||||
if (isset($_POST['ajax']) && $_POST['ajax'] === 'album-article-relation-form')
|
||||
{
|
||||
echo CActiveForm::validate($model);
|
||||
Yii::app()->end();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
<?php
|
||||
|
||||
class AlbumController extends Controller {
|
||||
|
||||
/**
|
||||
* @var string the default layout for the views. Defaults to '//layouts/column2', meaning
|
||||
* using two-column layout. See 'protected/views/layouts/column2.php'.
|
||||
*/
|
||||
public $layout = '//layouts/column2';
|
||||
|
||||
/**
|
||||
* @return array action filters
|
||||
*/
|
||||
public function filters()
|
||||
{
|
||||
return array(
|
||||
'accessControl', // perform access control for CRUD operations
|
||||
'postOnly + delete', // we only allow deletion via POST request
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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('allow',
|
||||
'actions' => array('json'),
|
||||
'users' => array('*'),
|
||||
),
|
||||
array('deny', // deny all users
|
||||
'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 Album;
|
||||
|
||||
// Uncomment the following line if AJAX validation is needed
|
||||
// $this->performAjaxValidation($model);
|
||||
|
||||
if (isset($_POST['Album']))
|
||||
{
|
||||
$model->attributes = $_POST['Album'];
|
||||
if ($model->save())
|
||||
$this->redirect(array('view', 'id' => $model->id));
|
||||
}
|
||||
|
||||
$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['Album']))
|
||||
{
|
||||
$model->attributes = $_POST['Album'];
|
||||
if ($model->save())
|
||||
$this->redirect(array('view', 'id' => $model->id));
|
||||
}
|
||||
|
||||
$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)
|
||||
{
|
||||
$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'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all models.
|
||||
*/
|
||||
public function actionIndex()
|
||||
{
|
||||
$dataProvider = new CActiveDataProvider('Album');
|
||||
$this->render('index', array(
|
||||
'dataProvider' => $dataProvider,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Manages all models.
|
||||
*/
|
||||
public function actionAdmin()
|
||||
{
|
||||
$model = new Album('search');
|
||||
$model->unsetAttributes(); // clear any default values
|
||||
if (isset($_GET['Album']))
|
||||
$model->attributes = $_GET['Album'];
|
||||
|
||||
$this->render('admin', array(
|
||||
'model' => $model,
|
||||
));
|
||||
}
|
||||
|
||||
public function actionJson()
|
||||
{
|
||||
$dataArray = Album::model()->findAll();
|
||||
|
||||
$this->layout = false;
|
||||
header('Content-type: application/json');
|
||||
echo CJavaScript::jsonEncode($dataArray);
|
||||
Yii::app()->end();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 Album the loaded model
|
||||
* @throws CHttpException
|
||||
*/
|
||||
public function loadModel($id)
|
||||
{
|
||||
$model = Album::model()->findByPk($id);
|
||||
if ($model === null)
|
||||
throw new CHttpException(404, 'The requested page does not exist.');
|
||||
return $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs the AJAX validation.
|
||||
* @param Album $model the model to be validated
|
||||
*/
|
||||
protected function performAjaxValidation($model)
|
||||
{
|
||||
if (isset($_POST['ajax']) && $_POST['ajax'] === 'album-form')
|
||||
{
|
||||
echo CActiveForm::validate($model);
|
||||
Yii::app()->end();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
<?php
|
||||
|
||||
class ArticleController extends Controller {
|
||||
|
||||
/**
|
||||
* @var string the default layout for the views. Defaults to '//layouts/column2', meaning
|
||||
* using two-column layout. See 'protected/views/layouts/column2.php'.
|
||||
*/
|
||||
public $layout = '//layouts/column2';
|
||||
|
||||
/**
|
||||
* @return array action filters
|
||||
*/
|
||||
public function filters()
|
||||
{
|
||||
return array(
|
||||
'accessControl', // perform access control for CRUD operations
|
||||
'postOnly + delete', // we only allow deletion via POST request
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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('allow',
|
||||
'actions' => array('json'),
|
||||
'users' => array('*'),
|
||||
),
|
||||
array('deny', // deny all users
|
||||
'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 Article;
|
||||
|
||||
$model->geoLat = 0;
|
||||
$model->geoLon = 0;
|
||||
|
||||
// Uncomment the following line if AJAX validation is needed
|
||||
// $this->performAjaxValidation($model);
|
||||
|
||||
if (isset($_POST['Article']))
|
||||
{
|
||||
$model->attributes = $_POST['Article'];
|
||||
date_default_timezone_set("UTC");
|
||||
$model->dateTime = date('Y-m-d H:i:s');
|
||||
if ($model->save())
|
||||
$this->redirect(array('view', 'id' => $model->id));
|
||||
}
|
||||
|
||||
$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['Article']))
|
||||
{
|
||||
$model->attributes = $_POST['Article'];
|
||||
if ($model->save())
|
||||
$this->redirect(array('view', 'id' => $model->id));
|
||||
}
|
||||
|
||||
$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)
|
||||
{
|
||||
$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'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all models.
|
||||
*/
|
||||
public function actionIndex()
|
||||
{
|
||||
$dataProvider = new CActiveDataProvider('Article');
|
||||
$this->render('index', array(
|
||||
'dataProvider' => $dataProvider,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Manages all models.
|
||||
*/
|
||||
public function actionAdmin()
|
||||
{
|
||||
$model = new Article('search');
|
||||
$model->unsetAttributes(); // clear any default values
|
||||
if (isset($_GET['Article']))
|
||||
$model->attributes = $_GET['Article'];
|
||||
|
||||
$this->render('admin', array(
|
||||
'model' => $model,
|
||||
));
|
||||
}
|
||||
|
||||
public function actionJson()
|
||||
{
|
||||
$dataArray = Article::model()->findAll();
|
||||
|
||||
$this->layout = false;
|
||||
header('Content-type: application/json');
|
||||
echo CJavaScript::jsonEncode($dataArray);
|
||||
Yii::app()->end();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 Article the loaded model
|
||||
* @throws CHttpException
|
||||
*/
|
||||
public function loadModel($id)
|
||||
{
|
||||
$model = Article::model()->findByPk($id);
|
||||
if ($model === null)
|
||||
throw new CHttpException(404, 'The requested page does not exist.');
|
||||
return $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs the AJAX validation.
|
||||
* @param Article $model the model to be validated
|
||||
*/
|
||||
protected function performAjaxValidation($model)
|
||||
{
|
||||
if (isset($_POST['ajax']) && $_POST['ajax'] === 'article-form')
|
||||
{
|
||||
echo CActiveForm::validate($model);
|
||||
Yii::app()->end();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
<?php
|
||||
|
||||
class ArticleJournalRelationController extends Controller {
|
||||
|
||||
/**
|
||||
* @var string the default layout for the views. Defaults to '//layouts/column2', meaning
|
||||
* using two-column layout. See 'protected/views/layouts/column2.php'.
|
||||
*/
|
||||
public $layout = '//layouts/column2';
|
||||
|
||||
/**
|
||||
* @return array action filters
|
||||
*/
|
||||
public function filters()
|
||||
{
|
||||
return array(
|
||||
'accessControl', // perform access control for CRUD operations
|
||||
'postOnly + delete', // we only allow deletion via POST request
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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('allow',
|
||||
'actions' => array('json'),
|
||||
'users' => array('*'),
|
||||
),
|
||||
array('deny', // deny all users
|
||||
'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 ArticleJournalRelation;
|
||||
|
||||
// Uncomment the following line if AJAX validation is needed
|
||||
// $this->performAjaxValidation($model);
|
||||
|
||||
if (isset($_POST['ArticleJournalRelation']))
|
||||
{
|
||||
$model->attributes = $_POST['ArticleJournalRelation'];
|
||||
if ($model->save())
|
||||
$this->redirect(array('view', 'id' => $model->id));
|
||||
}
|
||||
|
||||
$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['ArticleJournalRelation']))
|
||||
{
|
||||
$model->attributes = $_POST['ArticleJournalRelation'];
|
||||
if ($model->save())
|
||||
$this->redirect(array('view', 'id' => $model->id));
|
||||
}
|
||||
|
||||
$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)
|
||||
{
|
||||
$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'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all models.
|
||||
*/
|
||||
public function actionIndex()
|
||||
{
|
||||
$dataProvider = new CActiveDataProvider('ArticleJournalRelation');
|
||||
$this->render('index', array(
|
||||
'dataProvider' => $dataProvider,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Manages all models.
|
||||
*/
|
||||
public function actionAdmin()
|
||||
{
|
||||
$model = new ArticleJournalRelation('search');
|
||||
$model->unsetAttributes(); // clear any default values
|
||||
if (isset($_GET['ArticleJournalRelation']))
|
||||
$model->attributes = $_GET['ArticleJournalRelation'];
|
||||
|
||||
$this->render('admin', array(
|
||||
'model' => $model,
|
||||
));
|
||||
}
|
||||
|
||||
public function actionJson()
|
||||
{
|
||||
$dataArray = ArticleJournalRelation::model()->findAll();
|
||||
|
||||
$this->layout = false;
|
||||
header('Content-type: application/json');
|
||||
echo CJavaScript::jsonEncode($dataArray);
|
||||
Yii::app()->end();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ArticleJournalRelation the loaded model
|
||||
* @throws CHttpException
|
||||
*/
|
||||
public function loadModel($id)
|
||||
{
|
||||
$model = ArticleJournalRelation::model()->findByPk($id);
|
||||
if ($model === null)
|
||||
throw new CHttpException(404, 'The requested page does not exist.');
|
||||
return $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs the AJAX validation.
|
||||
* @param ArticleJournalRelation $model the model to be validated
|
||||
*/
|
||||
protected function performAjaxValidation($model)
|
||||
{
|
||||
if (isset($_POST['ajax']) && $_POST['ajax'] === 'article-journal-relation-form')
|
||||
{
|
||||
echo CActiveForm::validate($model);
|
||||
Yii::app()->end();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
<?php
|
||||
|
||||
class ChannelArticleRelationController extends Controller {
|
||||
|
||||
/**
|
||||
* @var string the default layout for the views. Defaults to '//layouts/column2', meaning
|
||||
* using two-column layout. See 'protected/views/layouts/column2.php'.
|
||||
*/
|
||||
public $layout = '//layouts/column2';
|
||||
|
||||
/**
|
||||
* @return array action filters
|
||||
*/
|
||||
public function filters()
|
||||
{
|
||||
return array(
|
||||
'accessControl', // perform access control for CRUD operations
|
||||
'postOnly + delete', // we only allow deletion via POST request
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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('allow',
|
||||
'actions' => array('json'),
|
||||
'users' => array('*'),
|
||||
),
|
||||
array('deny', // deny all users
|
||||
'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 ChannelArticleRelation;
|
||||
|
||||
// Uncomment the following line if AJAX validation is needed
|
||||
// $this->performAjaxValidation($model);
|
||||
|
||||
if (isset($_POST['ChannelArticleRelation']))
|
||||
{
|
||||
$model->attributes = $_POST['ChannelArticleRelation'];
|
||||
if ($model->save())
|
||||
$this->redirect(array('view', 'id' => $model->id));
|
||||
}
|
||||
|
||||
$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['ChannelArticleRelation']))
|
||||
{
|
||||
$model->attributes = $_POST['ChannelArticleRelation'];
|
||||
if ($model->save())
|
||||
$this->redirect(array('view', 'id' => $model->id));
|
||||
}
|
||||
|
||||
$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)
|
||||
{
|
||||
$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'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all models.
|
||||
*/
|
||||
public function actionIndex()
|
||||
{
|
||||
$dataProvider = new CActiveDataProvider('ChannelArticleRelation');
|
||||
$this->render('index', array(
|
||||
'dataProvider' => $dataProvider,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Manages all models.
|
||||
*/
|
||||
public function actionAdmin()
|
||||
{
|
||||
$model = new ChannelArticleRelation('search');
|
||||
$model->unsetAttributes(); // clear any default values
|
||||
if (isset($_GET['ChannelArticleRelation']))
|
||||
$model->attributes = $_GET['ChannelArticleRelation'];
|
||||
|
||||
$this->render('admin', array(
|
||||
'model' => $model,
|
||||
));
|
||||
}
|
||||
|
||||
public function actionJson()
|
||||
{
|
||||
$dataArray = ChannelArticleRelation::model()->findAll();
|
||||
|
||||
$this->layout = false;
|
||||
header('Content-type: application/json');
|
||||
echo CJavaScript::jsonEncode($dataArray);
|
||||
Yii::app()->end();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ChannelArticleRelation the loaded model
|
||||
* @throws CHttpException
|
||||
*/
|
||||
public function loadModel($id)
|
||||
{
|
||||
$model = ChannelArticleRelation::model()->findByPk($id);
|
||||
if ($model === null)
|
||||
throw new CHttpException(404, 'The requested page does not exist.');
|
||||
return $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs the AJAX validation.
|
||||
* @param ChannelArticleRelation $model the model to be validated
|
||||
*/
|
||||
protected function performAjaxValidation($model)
|
||||
{
|
||||
if (isset($_POST['ajax']) && $_POST['ajax'] === 'channel-article-relation-form')
|
||||
{
|
||||
echo CActiveForm::validate($model);
|
||||
Yii::app()->end();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
<?php
|
||||
|
||||
class ChannelController extends Controller {
|
||||
|
||||
/**
|
||||
* @var string the default layout for the views. Defaults to '//layouts/column2', meaning
|
||||
* using two-column layout. See 'protected/views/layouts/column2.php'.
|
||||
*/
|
||||
public $layout = '//layouts/column2';
|
||||
|
||||
/**
|
||||
* @return array action filters
|
||||
*/
|
||||
public function filters()
|
||||
{
|
||||
return array(
|
||||
'accessControl', // perform access control for CRUD operations
|
||||
'postOnly + delete', // we only allow deletion via POST request
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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('allow',
|
||||
'actions' => array('json'),
|
||||
'users' => array('*'),
|
||||
),
|
||||
array('deny', // deny all users
|
||||
'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 Channel;
|
||||
|
||||
// Uncomment the following line if AJAX validation is needed
|
||||
// $this->performAjaxValidation($model);
|
||||
|
||||
if (isset($_POST['Channel']))
|
||||
{
|
||||
$model->attributes = $_POST['Channel'];
|
||||
if ($model->save())
|
||||
$this->redirect(array('view', 'id' => $model->id));
|
||||
}
|
||||
|
||||
$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['Channel']))
|
||||
{
|
||||
$model->attributes = $_POST['Channel'];
|
||||
if ($model->save())
|
||||
$this->redirect(array('view', 'id' => $model->id));
|
||||
}
|
||||
|
||||
$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)
|
||||
{
|
||||
$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'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all models.
|
||||
*/
|
||||
public function actionIndex()
|
||||
{
|
||||
$dataProvider = new CActiveDataProvider('Channel');
|
||||
$this->render('index', array(
|
||||
'dataProvider' => $dataProvider,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Manages all models.
|
||||
*/
|
||||
public function actionAdmin()
|
||||
{
|
||||
$model = new Channel('search');
|
||||
$model->unsetAttributes(); // clear any default values
|
||||
if (isset($_GET['Channel']))
|
||||
$model->attributes = $_GET['Channel'];
|
||||
|
||||
$this->render('admin', array(
|
||||
'model' => $model,
|
||||
));
|
||||
}
|
||||
|
||||
public function actionJson()
|
||||
{
|
||||
$dataArray = Channel::model()->findAll();
|
||||
|
||||
$this->layout = false;
|
||||
header('Content-type: application/json');
|
||||
echo CJavaScript::jsonEncode($dataArray);
|
||||
Yii::app()->end();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 Channel the loaded model
|
||||
* @throws CHttpException
|
||||
*/
|
||||
public function loadModel($id)
|
||||
{
|
||||
$model = Channel::model()->findByPk($id);
|
||||
if ($model === null)
|
||||
throw new CHttpException(404, 'The requested page does not exist.');
|
||||
return $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs the AJAX validation.
|
||||
* @param Channel $model the model to be validated
|
||||
*/
|
||||
protected function performAjaxValidation($model)
|
||||
{
|
||||
if (isset($_POST['ajax']) && $_POST['ajax'] === 'channel-form')
|
||||
{
|
||||
echo CActiveForm::validate($model);
|
||||
Yii::app()->end();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
<?php
|
||||
|
||||
class JournalController extends Controller {
|
||||
|
||||
/**
|
||||
* @var string the default layout for the views. Defaults to '//layouts/column2', meaning
|
||||
* using two-column layout. See 'protected/views/layouts/column2.php'.
|
||||
*/
|
||||
public $layout = '//layouts/column2';
|
||||
|
||||
/**
|
||||
* @return array action filters
|
||||
*/
|
||||
public function filters()
|
||||
{
|
||||
return array(
|
||||
'accessControl', // perform access control for CRUD operations
|
||||
'postOnly + delete', // we only allow deletion via POST request
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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('allow',
|
||||
'actions' => array('json'),
|
||||
'users' => array('*'),
|
||||
),
|
||||
array('deny', // deny all users
|
||||
'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 Journal;
|
||||
|
||||
// Uncomment the following line if AJAX validation is needed
|
||||
// $this->performAjaxValidation($model);
|
||||
|
||||
if (isset($_POST['Journal']))
|
||||
{
|
||||
$model->attributes = $_POST['Journal'];
|
||||
if ($model->save())
|
||||
$this->redirect(array('view', 'id' => $model->id));
|
||||
}
|
||||
|
||||
$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['Journal']))
|
||||
{
|
||||
$model->attributes = $_POST['Journal'];
|
||||
if ($model->save())
|
||||
$this->redirect(array('view', 'id' => $model->id));
|
||||
}
|
||||
|
||||
$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)
|
||||
{
|
||||
$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'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all models.
|
||||
*/
|
||||
public function actionIndex()
|
||||
{
|
||||
$dataProvider = new CActiveDataProvider('Journal');
|
||||
$this->render('index', array(
|
||||
'dataProvider' => $dataProvider,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Manages all models.
|
||||
*/
|
||||
public function actionAdmin()
|
||||
{
|
||||
$model = new Journal('search');
|
||||
$model->unsetAttributes(); // clear any default values
|
||||
if (isset($_GET['Journal']))
|
||||
$model->attributes = $_GET['Journal'];
|
||||
|
||||
$this->render('admin', array(
|
||||
'model' => $model,
|
||||
));
|
||||
}
|
||||
|
||||
public function actionJson()
|
||||
{
|
||||
$dataArray = Journal::model()->findAll();
|
||||
|
||||
$this->layout = false;
|
||||
header('Content-type: application/json');
|
||||
echo CJavaScript::jsonEncode($dataArray);
|
||||
Yii::app()->end();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 Journal the loaded model
|
||||
* @throws CHttpException
|
||||
*/
|
||||
public function loadModel($id)
|
||||
{
|
||||
$model = Journal::model()->findByPk($id);
|
||||
if ($model === null)
|
||||
throw new CHttpException(404, 'The requested page does not exist.');
|
||||
return $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs the AJAX validation.
|
||||
* @param Journal $model the model to be validated
|
||||
*/
|
||||
protected function performAjaxValidation($model)
|
||||
{
|
||||
if (isset($_POST['ajax']) && $_POST['ajax'] === 'journal-form')
|
||||
{
|
||||
echo CActiveForm::validate($model);
|
||||
Yii::app()->end();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
<?php
|
||||
|
||||
class PhotoAlbumRelationController extends Controller {
|
||||
|
||||
/**
|
||||
* @var string the default layout for the views. Defaults to '//layouts/column2', meaning
|
||||
* using two-column layout. See 'protected/views/layouts/column2.php'.
|
||||
*/
|
||||
public $layout = '//layouts/column2';
|
||||
|
||||
/**
|
||||
* @return array action filters
|
||||
*/
|
||||
public function filters()
|
||||
{
|
||||
return array(
|
||||
'accessControl', // perform access control for CRUD operations
|
||||
'postOnly + delete', // we only allow deletion via POST request
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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('allow',
|
||||
'actions' => array('json'),
|
||||
'users' => array('*'),
|
||||
),
|
||||
array('deny', // deny all users
|
||||
'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 PhotoAlbumRelation;
|
||||
|
||||
// Uncomment the following line if AJAX validation is needed
|
||||
// $this->performAjaxValidation($model);
|
||||
|
||||
if (isset($_POST['PhotoAlbumRelation']))
|
||||
{
|
||||
$model->attributes = $_POST['PhotoAlbumRelation'];
|
||||
if ($model->save())
|
||||
$this->redirect(array('view', 'id' => $model->id));
|
||||
}
|
||||
|
||||
$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['PhotoAlbumRelation']))
|
||||
{
|
||||
$model->attributes = $_POST['PhotoAlbumRelation'];
|
||||
if ($model->save())
|
||||
$this->redirect(array('view', 'id' => $model->id));
|
||||
}
|
||||
|
||||
$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)
|
||||
{
|
||||
$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'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all models.
|
||||
*/
|
||||
public function actionIndex()
|
||||
{
|
||||
$dataProvider = new CActiveDataProvider('PhotoAlbumRelation');
|
||||
$this->render('index', array(
|
||||
'dataProvider' => $dataProvider,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Manages all models.
|
||||
*/
|
||||
public function actionAdmin()
|
||||
{
|
||||
$model = new PhotoAlbumRelation('search');
|
||||
$model->unsetAttributes(); // clear any default values
|
||||
if (isset($_GET['PhotoAlbumRelation']))
|
||||
$model->attributes = $_GET['PhotoAlbumRelation'];
|
||||
|
||||
$this->render('admin', array(
|
||||
'model' => $model,
|
||||
));
|
||||
}
|
||||
|
||||
public function actionJson()
|
||||
{
|
||||
$dataArray = PhotoAlbumRelation::model()->findAll();
|
||||
|
||||
$this->layout = false;
|
||||
header('Content-type: application/json');
|
||||
echo CJavaScript::jsonEncode($dataArray);
|
||||
Yii::app()->end();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 PhotoAlbumRelation the loaded model
|
||||
* @throws CHttpException
|
||||
*/
|
||||
public function loadModel($id)
|
||||
{
|
||||
$model = PhotoAlbumRelation::model()->findByPk($id);
|
||||
if ($model === null)
|
||||
throw new CHttpException(404, 'The requested page does not exist.');
|
||||
return $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs the AJAX validation.
|
||||
* @param PhotoAlbumRelation $model the model to be validated
|
||||
*/
|
||||
protected function performAjaxValidation($model)
|
||||
{
|
||||
if (isset($_POST['ajax']) && $_POST['ajax'] === 'photo-album-relation-form')
|
||||
{
|
||||
echo CActiveForm::validate($model);
|
||||
Yii::app()->end();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
<?php
|
||||
|
||||
class PhotoController extends Controller {
|
||||
|
||||
/**
|
||||
* @var string the default layout for the views. Defaults to '//layouts/column2', meaning
|
||||
* using two-column layout. See 'protected/views/layouts/column2.php'.
|
||||
*/
|
||||
public $layout = '//layouts/column2';
|
||||
|
||||
/**
|
||||
* @return array action filters
|
||||
*/
|
||||
public function filters()
|
||||
{
|
||||
return array(
|
||||
'accessControl', // perform access control for CRUD operations
|
||||
'postOnly + delete', // we only allow deletion via POST request
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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('allow',
|
||||
'actions' => array('json'),
|
||||
'users' => array('*'),
|
||||
),
|
||||
array('deny', // deny all users
|
||||
'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 Photo;
|
||||
|
||||
$model->geoLat = 0;
|
||||
$model->geoLon = 0;
|
||||
|
||||
// Uncomment the following line if AJAX validation is needed
|
||||
// $this->performAjaxValidation($model);
|
||||
|
||||
if (isset($_POST['Photo']))
|
||||
{
|
||||
$model->attributes = $_POST['Photo'];
|
||||
|
||||
$model->imageHash = md5_file($model->imageUrl);
|
||||
|
||||
if ($model->save())
|
||||
$this->redirect(array('view', 'id' => $model->id));
|
||||
}
|
||||
|
||||
$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['Photo']))
|
||||
{
|
||||
$model->attributes = $_POST['Photo'];
|
||||
if ($model->save())
|
||||
$this->redirect(array('view', 'id' => $model->id));
|
||||
}
|
||||
|
||||
$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)
|
||||
{
|
||||
$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'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all models.
|
||||
*/
|
||||
public function actionIndex()
|
||||
{
|
||||
$dataProvider = new CActiveDataProvider('Photo');
|
||||
$this->render('index', array(
|
||||
'dataProvider' => $dataProvider,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Manages all models.
|
||||
*/
|
||||
public function actionAdmin()
|
||||
{
|
||||
$model = new Photo('search');
|
||||
$model->unsetAttributes(); // clear any default values
|
||||
if (isset($_GET['Photo']))
|
||||
$model->attributes = $_GET['Photo'];
|
||||
|
||||
$this->render('admin', array(
|
||||
'model' => $model,
|
||||
));
|
||||
}
|
||||
|
||||
public function actionJson()
|
||||
{
|
||||
$dataArray = Photo::model()->findAll();
|
||||
|
||||
$this->layout = false;
|
||||
header('Content-type: application/json');
|
||||
echo CJavaScript::jsonEncode($dataArray);
|
||||
Yii::app()->end();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 Photo the loaded model
|
||||
* @throws CHttpException
|
||||
*/
|
||||
public function loadModel($id)
|
||||
{
|
||||
$model = Photo::model()->findByPk($id);
|
||||
if ($model === null)
|
||||
throw new CHttpException(404, 'The requested page does not exist.');
|
||||
return $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs the AJAX validation.
|
||||
* @param Photo $model the model to be validated
|
||||
*/
|
||||
protected function performAjaxValidation($model)
|
||||
{
|
||||
if (isset($_POST['ajax']) && $_POST['ajax'] === 'photo-form')
|
||||
{
|
||||
echo CActiveForm::validate($model);
|
||||
Yii::app()->end();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
|
||||
class SiteController extends Controller
|
||||
{
|
||||
/**
|
||||
* Declares class-based actions.
|
||||
*/
|
||||
public function actions()
|
||||
{
|
||||
return array(
|
||||
// captcha action renders the CAPTCHA image displayed on the contact page
|
||||
'captcha'=>array(
|
||||
'class'=>'CCaptchaAction',
|
||||
'backColor'=>0xFFFFFF,
|
||||
),
|
||||
// page action renders "static" pages stored under 'protected/views/site/pages'
|
||||
// They can be accessed via: index.php?r=site/page&view=FileName
|
||||
'page'=>array(
|
||||
'class'=>'CViewAction',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the default 'index' action that is invoked
|
||||
* when an action is not explicitly requested by users.
|
||||
*/
|
||||
public function actionIndex()
|
||||
{
|
||||
// renders the view file 'protected/views/site/index.php'
|
||||
// using the default layout 'protected/views/layouts/main.php'
|
||||
$this->render('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the action to handle external exceptions.
|
||||
*/
|
||||
public function actionError()
|
||||
{
|
||||
if($error=Yii::app()->errorHandler->error)
|
||||
{
|
||||
if(Yii::app()->request->isAjaxRequest)
|
||||
echo $error['message'];
|
||||
else
|
||||
$this->render('error', $error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the contact page
|
||||
*/
|
||||
public function actionContact()
|
||||
{
|
||||
$model=new ContactForm;
|
||||
if(isset($_POST['ContactForm']))
|
||||
{
|
||||
$model->attributes=$_POST['ContactForm'];
|
||||
if($model->validate())
|
||||
{
|
||||
$name='=?UTF-8?B?'.base64_encode($model->name).'?=';
|
||||
$subject='=?UTF-8?B?'.base64_encode($model->subject).'?=';
|
||||
$headers="From: $name <{$model->email}>\r\n".
|
||||
"Reply-To: {$model->email}\r\n".
|
||||
"MIME-Version: 1.0\r\n".
|
||||
"Content-Type: text/plain; charset=UTF-8";
|
||||
|
||||
mail(Yii::app()->params['adminEmail'],$subject,$model->body,$headers);
|
||||
Yii::app()->user->setFlash('contact','Thank you for contacting us. We will respond to you as soon as possible.');
|
||||
$this->refresh();
|
||||
}
|
||||
}
|
||||
$this->render('contact',array('model'=>$model));
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the login page
|
||||
*/
|
||||
public function actionLogin()
|
||||
{
|
||||
$model=new LoginForm;
|
||||
|
||||
// if it is ajax validation request
|
||||
if(isset($_POST['ajax']) && $_POST['ajax']==='login-form')
|
||||
{
|
||||
echo CActiveForm::validate($model);
|
||||
Yii::app()->end();
|
||||
}
|
||||
|
||||
// collect user input data
|
||||
if(isset($_POST['LoginForm']))
|
||||
{
|
||||
$model->attributes=$_POST['LoginForm'];
|
||||
// validate user input and redirect to the previous page if valid
|
||||
if($model->validate() && $model->login())
|
||||
$this->redirect(Yii::app()->user->returnUrl);
|
||||
}
|
||||
// display the login form
|
||||
$this->render('login',array('model'=>$model));
|
||||
}
|
||||
|
||||
|
||||
public function actionRegister()
|
||||
{
|
||||
$model = new User('register');
|
||||
|
||||
if (isset($_POST['User']))
|
||||
{
|
||||
$model->attributes = $_POST['User'];
|
||||
if ($model->validate())
|
||||
{
|
||||
|
||||
$oldPassword = $model->password;
|
||||
$model->password = $this->better_crypt($model->password);
|
||||
|
||||
|
||||
date_default_timezone_set("UTC");
|
||||
$model->date = date('Y-m-d H:i:s');
|
||||
|
||||
if ($model->save())
|
||||
{
|
||||
|
||||
//$this->redirect(Yii::app()->user->returnUrl);
|
||||
$this->redirect(array("site/login"));
|
||||
|
||||
return;
|
||||
}
|
||||
$model->password = $oldPassword;
|
||||
}
|
||||
}
|
||||
$this->render('register', array('model' => $model));
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs out the current user and redirect to homepage.
|
||||
*/
|
||||
public function actionLogout()
|
||||
{
|
||||
Yii::app()->user->logout();
|
||||
$this->redirect(Yii::app()->homeUrl);
|
||||
}
|
||||
|
||||
private function better_crypt($input)
|
||||
{
|
||||
$salt = "";
|
||||
$salt_chars = array_merge(range('A', 'Z'), range('a', 'z'), range(0, 9));
|
||||
for ($i = 0; $i < 22; $i++)
|
||||
{
|
||||
$salt .= $salt_chars[array_rand($salt_chars)];
|
||||
}
|
||||
return crypt($input, '$2y$10$' . $salt);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
<?php
|
||||
|
||||
class VideoChannelRelationController extends Controller {
|
||||
|
||||
/**
|
||||
* @var string the default layout for the views. Defaults to '//layouts/column2', meaning
|
||||
* using two-column layout. See 'protected/views/layouts/column2.php'.
|
||||
*/
|
||||
public $layout = '//layouts/column2';
|
||||
|
||||
/**
|
||||
* @return array action filters
|
||||
*/
|
||||
public function filters()
|
||||
{
|
||||
return array(
|
||||
'accessControl', // perform access control for CRUD operations
|
||||
'postOnly + delete', // we only allow deletion via POST request
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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('allow',
|
||||
'actions' => array('json'),
|
||||
'users' => array('*'),
|
||||
),
|
||||
array('deny', // deny all users
|
||||
'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 VideoChannelRelation;
|
||||
|
||||
// Uncomment the following line if AJAX validation is needed
|
||||
// $this->performAjaxValidation($model);
|
||||
|
||||
if (isset($_POST['VideoChannelRelation']))
|
||||
{
|
||||
$model->attributes = $_POST['VideoChannelRelation'];
|
||||
if ($model->save())
|
||||
$this->redirect(array('view', 'id' => $model->id));
|
||||
}
|
||||
|
||||
$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['VideoChannelRelation']))
|
||||
{
|
||||
$model->attributes = $_POST['VideoChannelRelation'];
|
||||
if ($model->save())
|
||||
$this->redirect(array('view', 'id' => $model->id));
|
||||
}
|
||||
|
||||
$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)
|
||||
{
|
||||
$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'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all models.
|
||||
*/
|
||||
public function actionIndex()
|
||||
{
|
||||
$dataProvider = new CActiveDataProvider('VideoChannelRelation');
|
||||
$this->render('index', array(
|
||||
'dataProvider' => $dataProvider,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Manages all models.
|
||||
*/
|
||||
public function actionAdmin()
|
||||
{
|
||||
$model = new VideoChannelRelation('search');
|
||||
$model->unsetAttributes(); // clear any default values
|
||||
if (isset($_GET['VideoChannelRelation']))
|
||||
$model->attributes = $_GET['VideoChannelRelation'];
|
||||
|
||||
$this->render('admin', array(
|
||||
'model' => $model,
|
||||
));
|
||||
}
|
||||
|
||||
public function actionJson()
|
||||
{
|
||||
$dataArray = VideoChannelRelation::model()->findAll();
|
||||
|
||||
$this->layout = false;
|
||||
header('Content-type: application/json');
|
||||
echo CJavaScript::jsonEncode($dataArray);
|
||||
Yii::app()->end();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 VideoChannelRelation the loaded model
|
||||
* @throws CHttpException
|
||||
*/
|
||||
public function loadModel($id)
|
||||
{
|
||||
$model = VideoChannelRelation::model()->findByPk($id);
|
||||
if ($model === null)
|
||||
throw new CHttpException(404, 'The requested page does not exist.');
|
||||
return $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs the AJAX validation.
|
||||
* @param VideoChannelRelation $model the model to be validated
|
||||
*/
|
||||
protected function performAjaxValidation($model)
|
||||
{
|
||||
if (isset($_POST['ajax']) && $_POST['ajax'] === 'video-channel-relation-form')
|
||||
{
|
||||
echo CActiveForm::validate($model);
|
||||
Yii::app()->end();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
<?php
|
||||
|
||||
class VideoController extends Controller {
|
||||
|
||||
/**
|
||||
* @var string the default layout for the views. Defaults to '//layouts/column2', meaning
|
||||
* using two-column layout. See 'protected/views/layouts/column2.php'.
|
||||
*/
|
||||
public $layout = '//layouts/column2';
|
||||
|
||||
/**
|
||||
* @return array action filters
|
||||
*/
|
||||
public function filters()
|
||||
{
|
||||
return array(
|
||||
'accessControl', // perform access control for CRUD operations
|
||||
'postOnly + delete', // we only allow deletion via POST request
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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('allow',
|
||||
'actions' => array('json'),
|
||||
'users' => array('*'),
|
||||
),
|
||||
array('deny', // deny all users
|
||||
'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 Video;
|
||||
|
||||
// Uncomment the following line if AJAX validation is needed
|
||||
// $this->performAjaxValidation($model);
|
||||
|
||||
if (isset($_POST['Video']))
|
||||
{
|
||||
$model->attributes = $_POST['Video'];
|
||||
|
||||
$model->previewImageHash = md5_file($model->previewImageUrl);
|
||||
|
||||
if ($model->save())
|
||||
$this->redirect(array('view', 'id' => $model->id));
|
||||
}
|
||||
|
||||
$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['Video']))
|
||||
{
|
||||
$model->attributes = $_POST['Video'];
|
||||
if ($model->save())
|
||||
$this->redirect(array('view', 'id' => $model->id));
|
||||
}
|
||||
|
||||
$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)
|
||||
{
|
||||
$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'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all models.
|
||||
*/
|
||||
public function actionIndex()
|
||||
{
|
||||
$dataProvider = new CActiveDataProvider('Video');
|
||||
$this->render('index', array(
|
||||
'dataProvider' => $dataProvider,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Manages all models.
|
||||
*/
|
||||
public function actionAdmin()
|
||||
{
|
||||
$model = new Video('search');
|
||||
$model->unsetAttributes(); // clear any default values
|
||||
if (isset($_GET['Video']))
|
||||
$model->attributes = $_GET['Video'];
|
||||
|
||||
$this->render('admin', array(
|
||||
'model' => $model,
|
||||
));
|
||||
}
|
||||
|
||||
public function actionJson()
|
||||
{
|
||||
$dataArray = Video::model()->findAll();
|
||||
|
||||
$this->layout = false;
|
||||
header('Content-type: application/json');
|
||||
echo CJavaScript::jsonEncode($dataArray);
|
||||
Yii::app()->end();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 Video the loaded model
|
||||
* @throws CHttpException
|
||||
*/
|
||||
public function loadModel($id)
|
||||
{
|
||||
$model = Video::model()->findByPk($id);
|
||||
if ($model === null)
|
||||
throw new CHttpException(404, 'The requested page does not exist.');
|
||||
return $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs the AJAX validation.
|
||||
* @param Video $model the model to be validated
|
||||
*/
|
||||
protected function performAjaxValidation($model)
|
||||
{
|
||||
if (isset($_POST['ajax']) && $_POST['ajax'] === 'video-form')
|
||||
{
|
||||
echo CActiveForm::validate($model);
|
||||
Yii::app()->end();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user