Пример #1
0
 public function deleteColegio($id)
 {
     $model = Colegio::findOne($id);
     $model->eliminado = 1;
     if ($model->save()) {
         return true;
     } else {
         return false;
     }
 }
Пример #2
0
use yii\helpers\ArrayHelper;
use app\models\Colegio;
use kartik\select2\Select2;
/* @var $this yii\web\View */
/* @var $model app\models\Llave */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="llave-form">

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

        <?php 
echo $form->field($model, 'id_colegio')->widget(Select2::classname(), ['data' => ArrayHelper::map(Colegio::find()->all(), 'id', 'nombre'), 'language' => 'en', 'options' => ['placeholder' => 'Colegio ...'], 'pluginOptions' => ['allowClear' => true]]);
?>



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

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Generar Llave' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
Пример #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdColegio()
 {
     return $this->hasOne(Colegio::className(), ['id' => 'id_colegio']);
 }
Пример #4
0
 /**
  * Finds the Colegio model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Colegio the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Colegio::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }