예제 #1
0
 public function getDefaultParams()
 {
     $params = [];
     // add first project
     if (array_keys(Project::getProjectsList())) {
         $params['TodoSearch']['project_id'] = array_keys(Project::getProjectsList())[0];
     }
     return $params;
 }
예제 #2
0
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model deka6pb\simpleTodo\models\Todo */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="todo-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'project_id')->dropDownList(Project::getProjectsList(), ['prompt' => '']);
?>

    <?php 
echo $form->field($model, 'user_id')->dropDownList(ArrayHelper::map(User::find()->all(), 'id', 'username'), ['prompt' => '']);
?>

    <?php 
echo $form->field($model, 'text')->textarea(['rows' => 6]);
?>

    <?php 
echo $form->field($model, 'type')->dropDownList(Todo::getTypeAliases(), ['prompt' => '']);
?>

    <?php 
예제 #3
0
?>
<div class="todo-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
//echo $this->render('_search', ['model' => $searchModel]);
?>

    <div id="w0-filters">
        <div class="form-group field-todo-project_id required">
            <label class="control-label" for="todo-project_id">Projects</label>
            <?php 
echo Html::dropDownList('TodoSearch[project_id]', 'id', Project::getProjectsList(), ['id' => "ajax-select-project_id", 'class' => 'form-control']);
?>
        </div>
    </div>

    <p>
        <?php 
echo Html::a('Create Todo', ['create'], ['class' => 'btn btn-success']);
?>
    </p>
    <?php 
Pjax::begin(['id' => 'todoList', 'timeout' => false, 'enablePushState' => false]);
?>
    <?php 
echo $this->render('_grid', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
?>