예제 #1
0
$form = ActiveForm::begin(['id' => 'create-role-form', 'options' => ['class' => 'form-horizontal', 'data-toggle' => 'validator', 'role' => 'form'], 'fieldConfig' => ['template' => "{label}\n<div class=\"col-lg-3\">{input}</div>\n<div class=\"col-lg-8\">{error}</div>", 'labelOptions' => ['class' => 'col-lg-1 control-label']]]);
?>
							<div class="form-group">
				                <label>Role name</label>
				                <input type="text" class="form-control" placeholder="" name="role" required = "required">
				           	</div>
							<!-- <?php 
echo Html::input("text", "role", null, ["placeholder" => "role name", "required" => "required"]);
?>
 -->
							<div class="form-group">
                				<label>Module and it's access rule</label><br>
								<table>
								<?php 
$module = Module::find()->all();
$hakAkses = HakAkses::find()->all();
$i = 0;
foreach ($module as $key => $value) {
    echo "<tr>";
    echo "<td>";
    echo Html::checkbox("module[{$i}][name]", false, ["label" => $value["name"], "value" => $value["id"]]);
    echo "</td>";
    echo "<td>";
    foreach ($hakAkses as $key2 => $value2) {
        echo Html::checkbox("module[{$i}][role][]", false, ["label" => $value2["name"], "value" => $value2["id"]]);
    }
    echo "</td>";
    echo "</tr>";
    $i++;
}
?>
예제 #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getHakAkses()
 {
     return $this->hasOne(HakAkses::className(), ['id' => 'hak_akses']);
 }