<div class="row"> <?php echo $form->labelEx($model, 'autoprolonged'); ?> <?php echo $form->dropDownList($model, 'autoprolonged', Contracts::model()->itemAlias('autoprolonged')); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'template_id'); ?> <?php echo $form->dropDownList($model, 'template_id', CHtml::listData(ContractsTmpl::model()->findAll(), 'id', 'name')); ?> </div> <div class="row"> <?php echo CHtml::label(' ', 'wysiwig'); ?> <?php echo CHtml::button('Обновить окно редактора', array('type' => 'button', 'class' => 'button', 'id' => 'wysiwyg')); echo "<span id='ajax_mess'></span>"; ?> </div> <div class="row">
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = ContractsTmpl::model()->findByPk((int) $id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
/** * выбрать шаблон для подстановки * @param <type> $contract_tmpl * @return <type> */ public function get_contract_tmpl($contract_tmpl) { return ContractsTmpl::model()->findByPk($contract_tmpl); }
<?php $this->breadcrumbs = array('Договора' => array('index'), 'Управление'); $this->menu = array(array('label' => 'Шаблоны договоров', 'url' => array('contractsTmpl/admin'))); Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('contracts-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n"); ?> <h1>Управление договорами</h1> <?php $this->widget('application.extensions.yii-flash.Flash', array('keys' => array('success', 'error', 'notice'), 'htmlOptions' => array('class' => 'flash'))); ?> <!-- flashes --> <p> Можно использовать (<b><</b>, <b><=</b>, <b>></b>, <b>>=</b>, <b><></b> или <b>=</b>). </p> <?php echo CHtml::link('Advanced Search', '#', array('class' => 'search-button')); ?> <div class="search-form" style="display:none"> <?php $this->renderPartial('_search', array('model' => $model)); ?> </div><!-- search-form --> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'contracts-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('id', 'name', 'num', array('name' => 'client_id', 'value' => '$data->client->name', 'filter' => CHtml::listData(Clients::model()->findAll(array('order' => 'name')), 'id', 'name')), 'sum', 'date', 'duedate', array('name' => 'template_id', 'value' => '$data->tmpl->name', 'filter' => CHtml::listData(ContractsTmpl::model()->findAll(), 'id', 'name')), array('name' => 'is_sign', 'value' => 'Contracts::model()->itemAlias("is_sign",$data->is_sign)'), 'note', array('class' => 'MyButtonColumn'))));