public function actionCreate($id, $esNuevo = false, $save = 0)
 {
     if (!(bool) $esNuevo) {
         if ($id != 0) {
             $modelold = Docente::Model()->findByPk($id);
         } else {
             $modelold = new Docente();
         }
         $model = new DocenteEspejo();
         $this->layout = 'main_box';
         $existeEspejo = DocenteEspejo::model()->findByAttributes(array('iddocente' => $id));
         if (!isset($existeEspejo) || $id == 0) {
             Controller::scriptBasico();
             if (isset($_POST['DocenteEspejo'])) {
                 $model->setAttributes($_POST['DocenteEspejo']);
                 if ($id == 0) {
                     $model->iddocente = 0;
                 }
                 if ($model->save()) {
                     if (Yii::app()->getRequest()->getIsAjaxRequest()) {
                         Yii::app()->end();
                     } else {
                         $this->redirect(array('update', 'id' => $model->iddocenteEspejo, 'idupdate' => $model->iddocenteEspejo, 'save' => 1));
                     }
                 }
             }
             $this->render('create', array('model' => $model, 'modelold' => $modelold, 'save' => $save));
         } else {
             $this->redirect('index.php?r=docenteEspejo/update&idupdate=' . $existeEspejo->iddocenteEspejo . '&id=' . $id);
         }
     } else {
         $this->redirect('index.php?r=docenteEspejo/update&idupdate=' . $id . '&id=0');
     }
 }