public function actionIndex($id, $limit = 2)
 {
     $model = Todo::find()->limit($limit)->with('idcities0')->all();
     if (!\Yii::$app->request->getIsAjax()) {
         return $this->render('index', ['model' => $model, 'limit' => $limit]);
     } else {
         return $this->renderAjax('_form', ['model' => $model, 'limit' => $limit]);
     }
 }
示例#2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Todo::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['idtodo' => $this->idtodo, 'idcities' => $this->idcities, 'iduser' => $this->iduser, 'cdate' => $this->cdate, 'mdate' => $this->mdate]);
     $query->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'image', $this->image]);
     return $dataProvider;
 }
 public function actionIndex($id)
 {
     $text = new Comments();
     $model = Todo::find()->where(['idtodo' => $id])->one();
     $provider = new ActiveDataProvider(['query' => Comments::find()->with('iduser0')]);
     function replyComments($idcomments)
     {
         $data = Comments::find()->with('iduser0')->where(['parent' => $idcomments])->all();
         foreach ($data as $val) {
             echo "<u>" . $val['iduser0']['username'] . "</u> replied<br/>" . "<b>" . $val['description'] . "</b><br/>";
         }
     }
     return $this->render('index', ['model' => $model, 'text' => $text, 'dataprovider' => $provider]);
 }
 /**
  * Displays a single Functionality model.
  * @param integer $id
  * @return mixed
  */
 public function actionView($id)
 {
     $model = $this->findModel($id);
     if (Yii::$app->user->can('viewProject', ['project' => $model->project], false)) {
         $todo = new Todo();
         $todo->creator_id = Yii::$app->user->id;
         $todo->updater_id = Yii::$app->user->id;
         $todo->deleted = false;
         $todo->functionality_id = $id;
         if ($todo->load(Yii::$app->request->post()) && $todo->save(false)) {
             \Yii::$app->getSession()->setFlash('success', Yii::t('todo', 'Todo saved'));
             $todo = new Todo();
             $todo->creator_id = Yii::$app->user->id;
             $todo->updater_id = Yii::$app->user->id;
             $todo->deleted = false;
             $todo->functionality_id = $id;
         }
         $dataProvider = new ActiveDataProvider(['query' => Todo::find()->andWhere(['or', ['functionality_id' => $id]])]);
         return $this->render('view', ['model' => $model, 'dataProvider' => $dataProvider, 'todo' => $todo]);
     }
     throw new NotFoundHttpException('The requested page does not exist.');
 }
 /**
  * Updates an existing File model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     if (!Yii::$app->user->can('editFile', ['file' => $model])) {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->file_id]);
     } else {
         return $this->render('update', ['model' => $model, 'projects' => Project::find()->all(), 'todos' => Todo::find()->all()]);
     }
 }
示例#6
0
<div class="file-form">

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

    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'description')->textInput();
?>

    <?php 
echo $form->field($model, 'todo_id')->dropdownList(ArrayHelper::map(Todo::find()->all(), 'todo_id', 'name'));
?>

    <?php 
echo $form->field($model, 'project_id')->dropdownList(ArrayHelper::map(Project::find()->all(), 'project_id', 'description'));
?>

    <?php 
echo $form->field($model, 'deleted')->checkBox();
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('common', 'Create') : Yii::t('common', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>
 /**
  * Lists all Todo models.
  * @return mixed
  */
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => Todo::find()->with('creator', 'updater', 'functionality')]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }
 public function getTodoAmount()
 {
     return Todo::find('deleted = false')->andWhere('functionality_id = ' . $this->functionality_id)->count();
 }