Пример #1
0
	<div class="row">
		<?php 
echo $form->label($model, 'title');
?>
		<?php 
echo $form->textField($model, 'title', array('size' => 60, 'maxlength' => 500));
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'autor_id');
?>
		<?php 
echo $form->dropDownList($model, 'id', Books::selectObjData(Autor::model()->findAll(), 'book_id', 'autor_name_id'), array('empty' => '--выберите автора--'));
?>
	</div>


	<div class="row">
		<?php 
echo $form->label($model, 'publisher_id');
?>
        <?php 
echo $form->dropDownList($model, 'publisher_id', CHtml::listData(Publisher::model()->findAll(), 'id', 'publisher_name'), array('empty' => '--выберите издательство--'));
?>


	</div>
Пример #2
0
<h1>Редактировать книги</h1>


<?php 
echo CHtml::link('Расширенный поиск', '#', array('class' => 'search-button'));
?>
<div class="search-form" style="display:none">
<?php 
$this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->

<?php 
/*echo CHtml::dropDownList('publisher', '',
  CHtml::listData(Publisher::model()->findAll(), 'id', 'publisher_name'),
  array('empty' => 'All'));*/
$this->widget('zii.widgets.grid.CGridView', array('id' => 'books-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('title', array('name' => 'publisher.publisher_name', 'filter' => CHtml::dropDownList('Books[publisher_id]', $model->publisher_id, CHtml::listData(Publisher::model()->findAll(), 'id', 'publisher_name'), array('empty' => 'All'))), array('header' => 'Авторы', 'value' => 'Books::extractObjData($data->autor)', 'filter' => CHtml::dropDownList('Books[id]', $model->id, Books::selectObjData(Autor::model()->findAll(), 'book_id', 'autor_name_id'), array('empty' => 'All')), 'type' => 'raw'), array('name' => 'category.title', 'filter' => CHtml::dropDownList('Books[rubric_id]', $model->rubric_id, CHtml::listData(Category::model()->findAll(), 'id', 'title'), array('empty' => 'All'))), array('header' => 'Фото', 'value' => 'Books::photo($data->id)', 'type' => 'raw', 'htmlOptions' => array('width' => '110px', 'text-align' => 'center')), array('class' => 'CButtonColumn', 'template' => '{update}{delete}'))));
?>

<script>
    function slide(count, id, numPhoto){
        $('#icon_'+id+'_'+numPhoto).hide();
        if (numPhoto < count)
            numPhoto++;
        else
            numPhoto = 1;
        $('#icon_'+id+'_'+numPhoto).show();
    }
</script>