public function actionIndex()
    {
        $model = new DatabaseForm;
        
        // Assign previously set credentials
        if (Cii::get(Yii::app()->session['dsn']) != "")
            $model->attributes = Yii::app()->session['dsn'];
        
        // If a post request was sent
        if (Cii::get($_POST, 'DatabaseForm'))
        {
            $model->attributes = $_POST['DatabaseForm'];
            
            if ($model->validateConnection())
            {
                Yii::app()->session['dsn'] = $model->attributes;
                $this->redirect($this->createUrl('/migrate'));
            }
            else
            {
                Yii::app()->user->setFlash('error', Yii::t('Install.main', '{{warning}} {{error}}', array(
                    '{{warning}}' => CHtml::tag('strong', array(), Yii::t('Install.main', 'Warning!')),
                    '{{error}}' => $model->getError('dsn')
                )));
            }
        }

        $this->render('index', array('model'=>$model));
    }
public function actionIndex()
    {
        $model = new DatabaseForm;
        
        // Assign previously set credentials
        if (Cii::get(Yii::app()->session['dsn']) != "")
            $model->attributes = Yii::app()->session['dsn'];
        
        // If a post request was sent
        if (Cii::get($_POST, 'DatabaseForm'))
        {
            $model->attributes = $_POST['DatabaseForm'];
            
            if ($model->validateConnection())
            {
                Yii::app()->session['dsn'] = $model->attributes;
                $this->redirect($this->createUrl('/migrate'));
            }
            else
            {
                Yii::app()->user->setFlash('error', Yii::t('Install.main', '{{warning}} {{error}}', array(
                    '{{warning}}' => CHtml::tag('strong', array(), Yii::t('Install.main', 'Warning!')),
                    '{{error}}' => $model->getError('dsn')
                )));
            }
        }

        $this->render('index', array('model'=>$model));
    }
public function actionIndex ( ) { $ model = new DatabaseForm ; // Assign previously set credentials if ( Cii :: get ( Yii :: app ( ) -> session [ 'dsn' ] ) != "" ) $ model -> attributes = Yii :: app ( ) -> session [ 'dsn' ] ; // If a post request was sent if ( Cii :: get ( $ _POST , 'DatabaseForm' ) ) { $ model -> attributes = $ _POST [ 'DatabaseForm' ] ; if ( $ model -> validateConnection ( ) ) { Yii :: app ( ) -> session [ 'dsn' ] = $ model -> attributes ; $ this -> redirect ( $ this -> createUrl ( '/migrate' ) ) ; } else { Yii :: app ( ) -> user -> setFlash ( 'error' , Yii :: t ( 'Install.main' , '{{warning}} {{error}}' , array ( '{{warning}}' => CHtml :: tag ( 'strong' , array ( ) , Yii :: t ( 'Install.main' , 'Warning!' ) ) , '{{error}}' => $ model -> getError ( 'dsn' ) ) ) ) ; } } $ this -> render ( 'index' , array ( 'model' => $ model ) ) ; }
Initial action the user arrives to.
Handles setting up the database connection
Initial action the user arrives to . Handles setting up the database connection