Example #1
0
 public function actionIndex()
 {
     $model = new ExportForm();
     $modelClass = get_class($model);
     $this->performAjaxValidation($model);
     if (isset($_POST[$modelClass])) {
         //HU::dump($_POST);exit;
         $model->setAttributes($_POST[$modelClass], false);
         $valid = true;
         foreach ($_POST[$modelClass] as $i => $item) {
             if (isset($_POST[$modelClass][$i]) && is_array($_POST[$modelClass][$i])) {
                 $model->checkAttributes[] = $item['checkAttributes'];
                 $model->newObjectParameters[] = $item['newObjectParameters'];
                 $model->objectParameters[] = $item['objectParameters'];
             }
             $valid = $model->validate() && $valid;
         }
         if ($model->validate() && $valid) {
             $sqlDump = $model->getDump();
             echo $sqlDump;
             Yii::app()->end();
         } else {
             HU::dump($model->errors);
             exit;
         }
     }
     $objects = DaObject::model()->findAll(array('condition' => 'table_name IS NOT NULL', 'order' => 'name ASC'));
     $this->render('index', array('model' => $model, 'objects' => $objects));
 }