Permalink
Browse files

Backend. Список задач

  • Loading branch information...
sabian committed Dec 14, 2015
1 parent 6330d8a commit f4d2019ff395c625857935a615bb2d2c1815926d
Showing with 74 additions and 1 deletion.
  1. +1 −1 TodoModule.php
  2. +22 −0 controllers/TodoBackendController.php
  3. +19 −0 models/Todo.php
  4. +32 −0 views/todoBackend/index.php
@@ -2,7 +2,7 @@
/**
* ToDo module
*
* @package yupe.modules.payler
* @package yupe.modules.todo
* @author Oleg Filimonov <olegsabian@gmail.com>
* @license BSD http://ru.wikipedia.org/wiki/%D0%9B%D0%B8%D1%86%D0%B5%D0%BD%D0%B7%D0%B8%D1%8F_BSD
* @version 0.1
@@ -0,0 +1,22 @@
<?php
use yupe\components\controllers\BackController;
/**
* Class TodoBackendController
*/
class TodoBackendController extends BackController
{
public function actionIndex()
{
$model = new Todo('search');
$query = Yii::app()->getRequest()->getQuery('Todo');
$model->unsetAttributes();
if ($query) {
$model->setAttributes($query);
}
$this->render('index', ['model' => $model]);
}
}
@@ -28,6 +28,7 @@ public function rules()
['description', 'required'],
['description', 'length', 'max' => 255],
['status, sort', 'numerical', 'integerOnly' => true],
['description, sort', 'safe', 'on' => 'search'],
];
}
@@ -42,4 +43,22 @@ public function attributeLabels()
'sort' => 'Сортировка',
];
}
/**
* @return CActiveDataProvider
*/
public function search()
{
$criteria = new CDbCriteria;
$criteria->compare('description', $this->description, true);
$criteria->compare('status', $this->status);
return new CActiveDataProvider(get_class($this), [
'criteria' => $criteria,
'sort' => [
'defaultOrder' => 'sort'
]
]);
}
}
@@ -0,0 +1,32 @@
<?php
/**
* @var $this TodoBackendController
* @var $model Todo
*/
$this->pageTitle = 'ToDo - Список';
$this->breadcrumbs = [ $this->pageTitle ];
?>
<div class="page-header">
<h1><?= $this->pageTitle ?></h1>
</div>
<?php $this->widget('yupe\widgets\CustomGridView', [
'id' => 'todo-grid',
'type' => 'condensed',
'dataProvider' => $model->search(),
'filter' => $model,
'columns' => [
'id',
'description',
'status',
[
'class' => 'yupe\widgets\CustomButtonColumn',
'template' => '{update} {delete}'
],
],
]
); ?>

0 comments on commit f4d2019

Please sign in to comment.