Пример #1
0
 protected function findModel($id)
 {
     if (($model = BasicProfile::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Пример #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getBasicProfiles()
 {
     return $this->hasMany(BasicProfile::className(), ['country_id' => 'id']);
 }
Пример #3
0
use yii\bootstrap\Modal;
use yii\helpers\Url;
use yii\helpers\ArrayHelper;
$this->title = 'Basic Profile';
?>

<div class="row">
    <div class="col-sm-12">

        <h2>Basic Profile</h2>

        <hr>
        
        <section>
            <?php 
if (!BasicProfile::find()->count()) {
    ?>
                <?php 
    echo Html::button('Create Profile', ['value' => Url::to('/create'), 'class' => 'btn btn-success', 'id' => 'modal-button-create']);
    ?>
            <?php 
} else {
    ?>
                <?php 
    Pjax::begin(['id' => 'profile-content']);
    ?>
   
                <div>
                    <p><b><?php 
    echo $profile->getAttributeLabel('firts_name');
    ?>
Пример #4
0
echo $form->field($model, 'last_name')->textarea(['maxlength' => true]);
?>

<?php 
echo $form->field($model, 'gender')->dropdownList([$model::GENDER_FEMALE => 'Female', $model::GENDER_MALE => 'Male'], ['prompt' => 'Select gender']);
?>

<?php 
echo $form->field($model, 'country_id')->dropdownList(BasicProfile::getCountryList(), ['prompt' => 'Select Country', 'onchange' => '$.post("/city-list?id=' . '"+$(this).val(), function (data) { 
                $("select#country-cities-list").html(data);
                $("#country-cities-list").prop("disabled", false);
            });']);
?>

<?php 
echo $form->field($model, 'city_id')->dropdownList(BasicProfile::getCityList(), ['id' => 'country-cities-list', 'disabled' => true, 'prompt' => 'Select City']);
?>

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

<?php 
echo $form->field($model, 'timezone_id')->dropdownList(ArrayHelper::map(Timezone::find()->all(), 'id', 'name'), ['prompt' => 'Select Timezone']);
?>

<?php 
echo $form->field($model, 'date_of_birth')->widget(DatePicker::className(), ['inline' => true, 'template' => '<div class="well well-sm" style="background-color: #fff; width:250px">{input}</div>', 'clientOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd']]);
?>