本文整理汇总了PHP中app\modules\user\models\User::getGenderArray方法的典型用法代码示例。如果您正苦于以下问题:PHP User::getGenderArray方法的具体用法?PHP User::getGenderArray怎么用?PHP User::getGenderArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\modules\user\models\User
的用法示例。
在下文中一共展示了User::getGenderArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
?>
<?php
echo $form->field($model, 'first_name')->textInput(['maxlength' => 255]);
?>
<?php
echo $form->field($model, 'patronymic')->textInput(['maxlength' => 255]);
?>
<?php
echo $form->field($model, 'alias')->textInput(['maxlength' => 255]);
?>
<?php
echo $form->field($model, 'gender')->dropDownList(User::getGenderArray(), ['prompt' => Yii::t('app', 'Select from list')]);
?>
<?php
echo $form->field($model, 'marital')->dropDownList(User::getMaritalArray(), ['prompt' => Yii::t('app', 'Select from list')]);
?>
<?php
echo $form->field($model, 'birthday')->widget(DatePicker::classname(), ['language' => 'ru', 'dateFormat' => 'dd.MM.yyyy']);
?>
<?php
echo $form->field($model, 'workday')->widget(DatePicker::classname(), ['language' => 'ru', 'dateFormat' => 'dd.MM.yyyy']);
?>
示例2:
<?php
use app\components\helpers\Phone;
use app\modules\user\models\User;
use yii\helpers\Html;
use yii\widgets\DetailView;
echo DetailView::widget(['model' => $model, 'attributes' => ['birthday:date', ['attribute' => 'age', 'format' => 'raw', 'value' => $model->getAge()], 'alias', ['attribute' => 'gender', 'value' => User::getGenderArray()[$model->gender]], ['attribute' => 'marital', 'value' => User::getMaritalArray()[$model->marital]], ['attribute' => 'phone_private', 'format' => 'raw', 'value' => Html::a(Phone::getFormatView($model->phone_private), 'tel:' . $model->phone_private)], ['attribute' => 'phone_home', 'format' => 'raw', 'value' => Html::a(Phone::getFormatView($model->phone_home), 'tel:' . $model->phone_home)], 'email_private:email', 'passport', 'address_home']]);