public function loadModel($id) { $model = Ls::model()->findByPk($id); if (!$model) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
/** * @param string $type gs|ls * @param int $id * * @throws Exception * * @return void */ private function init($type, $id) { if ($type == 'gs') { $dependency = new CDbCacheDependency("SELECT COUNT(0), MAX(UNIX_TIMESTAMP(updated_at)) FROM {{gs}} WHERE status = :status AND id = :id"); $dependency->params = array('status' => ActiveRecord::STATUS_ON, 'id' => $id); $dependency->reuseDependentData = TRUE; $this->_config = Gs::model()->cache(3600 * 24, $dependency)->opened()->findByPk($id); } elseif ($type == 'ls') { $dependency = new CDbCacheDependency("SELECT COUNT(0), MAX(UNIX_TIMESTAMP(updated_at)) FROM {{ls}} WHERE status = :status AND id = :id"); $dependency->params = array('status' => ActiveRecord::STATUS_ON, 'id' => $id); $dependency->reuseDependentData = TRUE; $this->_config = Ls::model()->cache(3600 * 24, $dependency)->opened()->findByPk($id); } if (!$this->_config) { Yii::log('Настройки в БД для ' . $type . ' с ID ' . $id . ' не найдены', CLogger::LEVEL_ERROR, 'Lineage::init'); throw new Exception('Настройки в БД для ' . $type . ' с ID ' . $id . ' не найдены'); } }
echo $form->textField($model, 'user_id', array('class' => 'form-control input-sm')); ?> </td> <td><?php echo $form->textField($model, 'login', array('class' => 'form-control input-sm')); ?> </td> <td><?php echo $form->textField($model, 'email', array('class' => 'form-control input-sm')); ?> </td> <td></td> <td></td> <td></td> <td><?php echo $form->dropDownList($model, 'ls_id', Chtml::listData(Ls::model()->not_deleted()->findAll(), 'id', 'name'), array('class' => 'form-control input-sm', 'empty' => Yii::t('backend', 'Выбрать'))); ?> </td> <td></td> <td> <button type="submit" class="btn btn-primary glyphicon glyphicon-search" title="<?php echo Yii::t('backend', 'Искать'); ?> " rel="tooltip"></button> <?php echo HTML::link('', array('/backend/' . $this->getId() . '/index'), array('class' => 'btn btn-default glyphicon glyphicon-ban-circle', 'title' => Yii::t('backend', 'Сбросить'), 'rel' => 'tooltip')); ?> </td> </tr> <?php if ($data = $dataProvider->getData()) {
echo $form->labelEx($model, 'port', array('class' => 'col-lg-3 control-label')); ?> <div class="col-lg-9"> <?php echo $form->textField($model, 'port', array('placeholder' => $model->getAttributeLabel('port'), 'class' => 'form-control')); ?> </div> </div> <div class="form-group"> <?php echo $form->labelEx($model, 'login_id', array('class' => 'col-lg-3 control-label')); ?> <div class="col-lg-9"> <?php echo $form->dropDownList($model, 'login_id', CHtml::listData(Ls::model()->findAll(), 'id', 'name'), array('class' => 'form-control')); ?> </div> </div> <div class="form-group"> <?php echo $form->labelEx($model, 'version', array('class' => 'col-lg-3 control-label')); ?> <div class="col-lg-9"> <?php echo $form->dropDownList($model, 'version', app()->params['server_versions'], array('class' => 'form-control')); ?> </div> </div>