Пример #1
0
$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]);
?>

   <p>
Пример #2
0
?>
</td>
         <td colspan="2"><?php 
echo $form->field($model->affiliation, 'weapon_anchor_id')->dropDownList(ArrayHelper::map([null] + $model->weaponAnchors, 'id', 'fullName'));
?>
</td>
      </tr>
      <tr>
         <td colspan="4"><?php 
echo $form->field($model, 'email')->textInput(['maxlength' => 254]);
?>
</td>
      </tr>
      <tr>
         <td td colspan="4"><?php 
echo $form->field($model, 'sparAuth')->checkBoxList(Student::getSparAuthList(true), ['inline' => true]);
?>
</td>
      </tr>
      <tr>
         <td td colspan="4"><?php 
echo $form->field($model, 'grappleAuth')->checkboxList(Student::getGrappleAuthList(true), ['inline' => true]);
?>
</td>
      </tr>
      <tr>
         <td colspan="4"><?php 
echo $form->field($model, 'notes')->textarea(['rows' => 6]);
?>
</td>
      </tr>