예제 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Status::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, 'weight' => $this->weight, 'closed' => $this->closed]);
     $query->andFilterWhere(['like', 'title', $this->title]);
     return $dataProvider;
 }
예제 #2
0
 /**
  * Finds the Status model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return \app\modules\settings\models\Status the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Status::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
예제 #3
0
파일: _search.php 프로젝트: sapozhkov/goal
    <? $form = ActiveForm::begin([
        'action' => ['index'],
        'method' => 'get',
    ]) ?>

    <div class="row">
        <div class="col-sm-4">
            <?php 
echo $form->field($model, 'title');
?>
        </div>

        <div class="col-sm-4">
        <?
            $statusList = ArrayHelper::map(
                Status::find()->orderBy('weight')->asArray()->all(),
                'id',
                'title'
            );
            echo $form->field($model, 'status_id')->dropDownList([''=>''] + $statusList+[
                    Status::OPENED => \Yii::t('type', '<< Opened >>'),
                    Status::CLOSED => \Yii::t('type', '<< Closed >>'),
                ]);
        ?>
        </div>

        <div class="col-sm-4">
        <?
            $priorityList = ArrayHelper::map(
                Priority::find()->orderBy('weight')->asArray()->all(),
                'id',
예제 #4
0
파일: Goal.php 프로젝트: sapozhkov/goal
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getStatus()
 {
     return $this->hasOne(Status::className(), ['id' => 'status_id']);
 }
예제 #5
0
파일: log_data.php 프로젝트: sapozhkov/goal
$rows = [];
if ($data) {
    foreach ($data as $fieldName => $fieldData) {
        if ($goalModel->hasAttribute($fieldName)) {
            $fieldLabel = $goalModel->getAttributeLabel($fieldName);
            switch ($fieldName) {
                case 'percent':
                case 'title':
                    $rows[] = sprintf('<strong>%s</strong>: "%s" -> "%s"', $fieldLabel, Html::encode($fieldData[0]), Html::encode($fieldData[1]));
                    break;
                case 'to_be_done_at':
                    $rows[] = sprintf('<strong>%s</strong>: "%s" -> "%s"', $fieldLabel, \Yii::$app->formatter->asDate($fieldData[0]), \Yii::$app->formatter->asDate($fieldData[1]));
                    break;
                case 'status_id':
                    $oldStatus = Status::findOne($fieldData[0]);
                    $newStatus = Status::findOne($fieldData[1]);
                    $rows[] = sprintf('<strong>%s</strong>: "%s" -> "%s"', $fieldLabel, $oldStatus ? Html::encode($oldStatus->title) : $notFound, $newStatus ? Html::encode($newStatus->title) : $notFound);
                    break;
                case 'priority_id':
                    $oldPriority = Priority::findOne($fieldData[0]);
                    $newPriority = Priority::findOne($fieldData[1]);
                    $rows[] = sprintf('<strong>%s</strong>: "%s" -> "%s"', $fieldLabel, $oldPriority ? Html::encode($oldPriority->title) : $notFound, $newPriority ? Html::encode($newPriority->title) : $notFound);
                    break;
                case 'type_id':
                    $oldType = Type::findOne($fieldData[0]);
                    $newType = Type::findOne($fieldData[1]);
                    $rows[] = sprintf('<strong>%s</strong>: "%s" -> "%s"', $fieldLabel, $oldType ? Html::encode($oldType->title) : $notFound, $newType ? Html::encode($newType->title) : $notFound);
                    break;
                case 'description':
                case 'smart_specific':
                case 'smart_measurable':