Пример #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Canton::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_cant' => $this->id_cant, 'id_prov' => $this->id_prov]);
     $query->andFilterWhere(['like', 'nom_cant', $this->nom_cant])->andFilterWhere(['like', 'desc_cant', $this->desc_cant]);
     return $dataProvider;
 }
Пример #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdCant()
 {
     return $this->hasOne(Canton::className(), ['id_cant' => 'id_cant']);
 }
Пример #3
0
 /**
  * Finds the Canton model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Canton the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Canton::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Пример #4
0
use yii\widgets\ActiveForm;
use app\models\Canton;
use yii\helpers\ArrayHelper;
?>

<p>Seleccione Número de toma y Cantón del que desea revisar los Porcentajes de los Indicadores </p>
<?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'num_tom')->dropDownList(array('prompt' => '--select--', '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5));
?>

  <?php 
echo $form->field($model, 'canton')->dropDownList(ArrayHelper::map(Canton::find()->all(), 'id_cant', 'nom_cant'));
?>
 

 

    <div class="form-group">
        <?php 
echo Html::submitButton('Buscar', ['class' => 'btn btn-primary']);
?>
    </div>

<?php 
ActiveForm::end();
?>
Пример #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCantons()
 {
     return $this->hasMany(Canton::className(), ['province_id' => 'id']);
 }
Пример #6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCanton()
 {
     return $this->hasOne(Canton::className(), ['id' => 'canton_id']);
 }