/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Project::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'status' => $this->status, 'created' => $this->created, 'responsible_user' => $this->responsible_user]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'description', $this->description]); return $dataProvider; }
public static function getProjectArr() { $model = new Project(); $listData = ArrayHelper::map($model->find()->all(), 'id', 'name'); return $listData; }
public function bct_getParent() { return Project::getTaskModel($this->taskID); // Task::find()->where(['id'=>$this->taskID,])->one(); }
/** * Deletes an existing Tasks model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param integer $id * @return mixed */ public function actionTaskdelete($id) { $task = Project::getTaskModel($id); $projectid = $task->projectID; $task->delete(); return $this->redirect(['tasklist', 'projectid' => $projectid]); }
public function getProjectName() { return Project::getProjectName($this->projectID); }
//use yii\jui\DatePicker; use cubiclab\project\models\Project; use cubiclab\project\models\Task; /* @var $this yii\web\View */ /* @var $model app\modules\cubicProject\models\Tasks */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="tasks-form"> <?php $form = ActiveForm::begin(); ?> <?php $prjArr = Project::getProjectArr(); echo $form->field($model, 'projectID')->dropDownList($prjArr); ?> <?php echo $form->field($model, 'name')->textInput(['maxlength' => true]); ?> <?php // $stArr = TaskStatus::getTaskStatusArr(); // array_unshift($stArr, ''); // echo $form->field($model, 'status')->dropDownList($stArr); ?> <?php echo $form->field($model, 'status')->textInput(); ?>