コード例 #1
0
ファイル: admin.php プロジェクト: travis83bui/yii2-blog
	</tr>
	<?php 
if (count($models) > 0) {
    foreach ($models as $model) {
        ?>
	<tr>
		<td><?php 
        echo $model->id;
        ?>
</td>
		<td><?php 
        echo Html::a(Html::encode($model->title), $model->url);
        ?>
</td>
		<td><?php 
        echo Lookup::item("PostStatus", $model->status);
        ?>
</td>
		<td><?php 
        echo date("Y/m/d", $model->create_time);
        ?>
</td>
		<td>
			<?php 
        echo Html::a(NULL, array("update", "id" => $model->id), array('class' => 'icon icon-edit'));
        ?>
 |
			<?php 
        echo Html::a(NULL, array("delete", "id" => $model->id), array('class' => 'delete icon icon-trash'));
        ?>
		<td>
コード例 #2
0
ファイル: _form.php プロジェクト: travis83bui/yii2-blog
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\blog\models\Lookup;
?>

<?php 
$form = ActiveForm::begin(array('options' => array('class' => 'form-horizontal'), 'fieldConfig' => array('inputOptions' => array('class' => 'input-xlarge'))));
?>

	<?php 
echo $form->field($model, 'title')->textInput(array('size' => 80, 'maxlength' => 128));
?>
	<?php 
echo $form->field($model, 'content')->textArea(array('rows' => 10, 'cols' => 70));
?>
	<?php 
echo $form->field($model, 'tags')->textInput(array('size' => 50));
?>
	<?php 
echo $form->field($model, 'status')->dropDownList(Lookup::items('PostStatus'));
?>

	<div class="form-actions">
		<?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Save', null, null, array('class' => 'btn btn-primary'));
?>
	</div>

<?php 
ActiveForm::end();