Example #1
0
      <?php 
echo $form->textField($model, 'server_password', array('size' => 60, 'maxlength' => 64));
?>
      <?php 
echo $form->error($model, 'server_password');
?>
    </div>
  </div>

  <div class="control-group">
    <?php 
echo $form->labelEx($model, 'group_id', array('class' => 'control-label'));
?>
    <div class="controls">
      <?php 
echo $form->dropDownList($model, 'group_id', CHtml::listData(SBGroup::model()->findAll(array('order' => 't.name')), 'id', 'name'), array('empty' => '- ' . Yii::t('sourcebans', 'None') . ' -'));
?>
      <?php 
echo $form->error($model, 'group_id');
?>
    </div>
  </div>

  <div class="control-group">
    <?php 
echo $form->label($model, 'server_groups.name', array('class' => 'control-label'));
?>
    <div class="controls">
<?php 
$server_groups = CHtml::listData($model->server_groups, 'id', 'id');
foreach (SBServerGroup::model()->findAll(array('order' => 't.name')) as $server_group) {
Example #2
0
 /**
  * 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 $id the ID of the model to be loaded
  * @param string $type the type of the model to be loaded
  * @return SBGroup|SBServerGroup the loaded model
  * @throws CHttpException
  */
 public function loadModel($id, $type)
 {
     if ($type == 'web') {
         $model = SBGroup::model()->findByPk($id);
     } else {
         $model = SBServerGroup::model()->findByPk($id);
     }
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }