예제 #1
0
$options = [];
$options['checkNameUrl'] = Url::to(['/student/check-name']);
$options['getClassesUrl'] = Url::to(['/class/create-student-hand-anchors']);
$this->registerJs("var options = " . JSON::encode($options) . ";", $this::POS_HEAD, 'my-options');
$this->registerJsFile('/js/student-create.js', ['\\app\\assets\\AppAsset']);
$this->title = 'Create Student';
$this->params['breadcrumbs'][] = ['label' => 'Students', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="student-create">
   <h1><?php 
echo Html::encode($this->title);
?>
</h1>
   <?php 
$form = ActiveForm::begin();
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 3, 'attributes' => ['gender' => ['type' => Form::INPUT_DROPDOWN_LIST, 'options' => [], 'items' => ['M' => 'Male', 'F' => 'Female']], 'fname' => ['type' => Form::INPUT_TEXT, 'options' => []], 'lname' => ['type' => Form::INPUT_TEXT, 'options' => []], 'dob' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\datecontrol\\DateControl', 'options' => ['widgetClass' => '\\yii\\widgets\\MaskedInput', 'options' => ['mask' => '99/99/9999']], 'hint' => 'Use mm/dd/yyyy format'], 'bestPhone' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\yii\\widgets\\MaskedInput', 'options' => ['mask' => '(999) 999 9999', 'value' => '', 'name' => 'StudentPhone[number]']], 'belt_size' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => Student::getGiSizeMap()], 'division_id' => ['type' => Form::INPUT_DROPDOWN_LIST, 'options' => [], 'items' => [null => ''] + Division::getMap()], 'handAnchor' => ['type' => Form::INPUT_DROPDOWN_LIST, 'options' => ['value' => 0, 'name' => 'Affiliation[hand_anchor_id]'], 'items' => [null => '']]]]);
?>
   <div class="form-group">
      <!--input type="hidden" name="action" id="action" value="" /-->
      <?php 
echo Html::submitButton('Save and Exit', ['class' => 'btn btn-success', 'icon' => 'floppy-disk']);
?>
      <?php 
echo Html::submitButton('Save and Add Another', ['name' => 'then-add', 'class' => 'btn btn-success', 'icon' => 'floppy-disk']);
?>
      <?php 
echo Html::a('Cancel', Url::to(['/student']), ['class' => 'btn btn-primary', 'icon' => 'remove']);
?>
   </div>
</div>
예제 #2
0
$this->registerCssFile('/css/student-index.css', ['\\app\\assets\\AppAsset']);
$this->title = 'Students';
$this->params['breadcrumbs'][] = $this->title;
$columns = [['class' => 'yii\\grid\\SerialColumn'], ['class' => ToggleColumn::className(), 'attribute' => 'active', 'filter' => ['1' => 'Y', '0' => 'N', '' => 'All'], 'headerOptions' => ['style' => 'width:20px'], 'contentOptions' => ['class' => 'text-center']], ['attribute' => 'gender', 'class' => EditableColumn::className(), 'url' => 'editable', 'contentOptions' => ['class' => 'text-center', 'nowrap' => true], 'headerOptions' => ['class' => 'text-center', 'style' => 'width:20px'], 'type' => 'select', 'filter' => ['M' => 'M', 'F' => 'F', '' => 'All'], 'editableOptions' => ['showbuttons' => false, 'mode' => 'inline', 'source' => '[{"M": "M"}, {"F": "F"}]', 'value' => function ($model) {
    return $model->gender;
}]], ['attribute' => 'fname', 'contentOptions' => ['nowrap' => true], 'class' => EditableColumn::className(), 'url' => 'editable', 'editableOptions' => ['mode' => 'inline']], ['attribute' => 'lname', 'contentOptions' => ['nowrap' => true], 'class' => EditableColumn::className(), 'url' => 'editable', 'editableOptions' => ['mode' => 'inline']], ['value' => 'division.name', 'header' => 'Div', 'attribute' => 'division_id', 'headerOptions' => ['class' => 'text-center', 'style' => 'width:20px'], 'contentOptions' => ['class' => 'text-center'], 'filter' => Division::getMap() + ['' => 'All'], 'class' => EditableColumn::className(), 'url' => 'editable', 'type' => 'select', 'editableOptions' => ['showbuttons' => false, 'value' => function ($model) {
    return $model->division_id;
}, 'source' => Json::encode(Division::getMap()), 'mode' => 'inline']], ['value' => 'handAnchor.name', 'attribute' => 'handAnchorId', 'header' => 'Anchor', 'headerOptions' => ['class' => 'text-center'], 'contentOptions' => ['nowrap' => true], 'class' => EditableColumn::className(), 'url' => 'editable', 'type' => 'select', 'editableOptions' => ['showbuttons' => false, 'mode' => 'inline', 'value' => function ($model) {
    return $model->affiliation->hand_anchor_id;
}, 'source' => function ($model) {
    return Url::to(['/student/available-classes', 'id' => $model->id, 'type' => 'hand']);
}]], ['value' => 'dobAndAge', 'attribute' => 'dob', 'header' => 'DoB & Age', 'contentOptions' => ['nowrap' => true, 'style' => 'width:100px'], 'class' => EditableColumn::className(), 'url' => 'editable', 'type' => 'combodate', 'editableOptions' => ['value' => function ($model) {
    return $model->dob;
}, 'format' => 'YYYY-MM-DD', 'viewformat' => 'M/D', 'template' => 'M / D / YYYY']], ['attribute' => 'belt_size', 'headerOptions' => ['style' => 'width:20px'], 'contentOptions' => ['class' => 'text-center'], 'class' => EditableColumn::className(), 'filter' => Student::getGiSizeMap() + ['' => 'All'], 'url' => 'editable', 'type' => 'select', 'editableOptions' => ['mode' => 'inline', 'showbuttons' => false, 'value' => function ($model) {
    return $model->belt_size;
}, 'source' => Json::encode(Student::getGiSizeMap())]], ['attribute' => 'bestPhoneNumber', 'contentOptions' => ['nowrap' => true], 'class' => EditableColumn::className(), 'url' => 'editable', 'editableOptions' => ['mode' => 'inline']], ['attribute' => 'sparAuth', 'value' => 'sparAuthJson', 'contentOptions' => ['class' => 'text-center'], 'headerOptions' => ['style' => 'width:20px'], 'class' => EditableColumn::className(), 'url' => 'editable', 'type' => 'checklist', 'editableOptions' => ['value' => function ($model) {
    return $model->sparAuthJson;
}, 'display' => new JsExpression("function(value, sourceData)\n         {  \n            var icon = 'remove';\n            //console.log(value, sourceData);\n            if(value instanceof Array && value[0] !== '')\n            {\n               \$.each(value, function(i, v)\n               {\n                  if (v.toLowerCase() === 'a')\n                  {\n                     icon = 'ok';\n                     return false;\n                  }\n                  else\n                  {\n                     icon = 'tasks';\n                  }\n               });\n            }\n            \$(this).html('<span class=\"glyphicon glyphicon-' + icon + '\"></span>');\n        }"), 'mode' => 'pop', 'source' => Json::encode(Student::getSparAuthList())]], ['attribute' => 'rank.name', 'contentOptions' => ['nowrap' => true]], ['attribute' => 'grappleAuth', 'value' => 'grappleAuthJson', 'contentOptions' => ['class' => 'text-center'], 'headerOptions' => ['style' => 'width:20px'], 'class' => EditableColumn::className(), 'url' => 'editable', 'type' => 'checklist', 'editableOptions' => ['value' => function ($model) {
    return $model->grappleAuthJson;
}, 'display' => new JsExpression("function(value, sourceData)\n            {\n               var icon = 'remove';\n               //console.log(value, sourceData);\n               if(value instanceof Array && value[0] !== '')\n               {\n                  \$.each(value, function(i, v)\n                  {\n                     if (v.toLowerCase() === 'a')\n                     {\n                        icon = 'ok';\n                        return false;\n                     }\n                     else\n                     {\n                     console.log(v);\n                        icon = 'tasks';\n                     }\n                  });\n               }\n               \$(this).html('<span class=\"glyphicon glyphicon-' + icon + '\"></span>');\n            }"), 'mode' => 'pop', 'source' => Json::encode(Student::getGrappleAuthList())]], ['class' => 'yii\\grid\\ActionColumn', 'contentOptions' => ['nowrap' => true], 'template' => '{view} {update}' . (Yii::$app->user->can('deleteStudent') ? ' {delete}' : '')]];
?>
<div class="student-index">

   <h1><?php 
echo Html::encode($this->title);
?>
</h1>

   <?php 
//echo $this->render('_search', ['model' => $searchModel]);
?>
예제 #3
0
?>
</td>
         <td/>
         
         <td><?php 
echo $form->field($model, 'fname')->textInput(['maxlength' => 45]);
?>
</td>
         <td><?php 
echo $form->field($model, 'lname')->textInput(['maxlength' => 45]);
?>
</td>
      </tr>
      <tr>
         <td colspan="2"><?php 
echo $form->field($model, 'belt_size')->dropDownList(Student::getGiSizeMap());
?>
</td>
         <td colspan="2"><?php 
echo $form->field($model, 'division_id')->dropDownList(Division::getMap());
?>
</td>
      </tr>
      <tr>
         <td colspan="2"><?php 
echo $form->field($model->affiliation, 'hand_anchor_id')->dropDownList(ArrayHelper::map($model->handAnchors, 'id', 'fullName'));
?>
</td>
         <td colspan="2"><?php 
echo $form->field($model->affiliation, 'weapon_anchor_id')->dropDownList(ArrayHelper::map([null] + $model->weaponAnchors, 'id', 'fullName'));
?>