public function store()
 {
     $medico = new Medico();
     $medico->codmedico = Input::get('codmedico');
     $medico->Nombre = Input::get('nombre');
     $medico->Apellido = Input::get('apellido');
     $medico->Email = Input::get('email');
     $medico->Telefono = Input::get('telefono');
     $medico->codEspecialidad = "E1";
     $medico->save();
     return Redirect::to('medico');
 }
示例#2
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Medico();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Medico'])) {
         $model->attributes = $_POST['Medico'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
示例#3
0
 /**
  * Performs the work of inserting or updating the row in the database.
  *
  * If the object is new, it inserts it; otherwise an update is performed.
  * All related objects are also updated in this method.
  *
  * @param PropelPDO $con
  * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
  * @throws PropelException
  * @see        save()
  */
 protected function doSave(PropelPDO $con)
 {
     $affectedRows = 0;
     // initialize var to track total num of affected rows
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         // We call the save method on the following object(s) if they
         // were passed to this object by their corresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aMedico !== null) {
             if ($this->aMedico->isModified() || $this->aMedico->isNew()) {
                 $affectedRows += $this->aMedico->save($con);
             }
             $this->setMedico($this->aMedico);
         }
         if ($this->aPaciente !== null) {
             if ($this->aPaciente->isModified() || $this->aPaciente->isNew()) {
                 $affectedRows += $this->aPaciente->save($con);
             }
             $this->setPaciente($this->aPaciente);
         }
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
             } else {
                 $this->doUpdate($con);
             }
             $affectedRows += 1;
             $this->resetModified();
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
示例#4
0
 /**
  * Performs the work of inserting or updating the row in the database.
  *
  * If the object is new, it inserts it; otherwise an update is performed.
  * All related objects are also updated in this method.
  *
  * @param PropelPDO $con
  * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
  * @throws PropelException
  * @see        save()
  */
 protected function doSave(PropelPDO $con)
 {
     $affectedRows = 0;
     // initialize var to track total num of affected rows
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         // We call the save method on the following object(s) if they
         // were passed to this object by their corresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aConsultorio !== null) {
             if ($this->aConsultorio->isModified() || $this->aConsultorio->isNew()) {
                 $affectedRows += $this->aConsultorio->save($con);
             }
             $this->setConsultorio($this->aConsultorio);
         }
         if ($this->aMedico !== null) {
             if ($this->aMedico->isModified() || $this->aMedico->isNew()) {
                 $affectedRows += $this->aMedico->save($con);
             }
             $this->setMedico($this->aMedico);
         }
         if ($this->aPaciente !== null) {
             if ($this->aPaciente->isModified() || $this->aPaciente->isNew()) {
                 $affectedRows += $this->aPaciente->save($con);
             }
             $this->setPaciente($this->aPaciente);
         }
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
             } else {
                 $this->doUpdate($con);
             }
             $affectedRows += 1;
             $this->resetModified();
         }
         if ($this->cargoconsultasScheduledForDeletion !== null) {
             if (!$this->cargoconsultasScheduledForDeletion->isEmpty()) {
                 CargoconsultaQuery::create()->filterByPrimaryKeys($this->cargoconsultasScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->cargoconsultasScheduledForDeletion = null;
             }
         }
         if ($this->collCargoconsultas !== null) {
             foreach ($this->collCargoconsultas as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->consultaanticiposScheduledForDeletion !== null) {
             if (!$this->consultaanticiposScheduledForDeletion->isEmpty()) {
                 ConsultaanticipoQuery::create()->filterByPrimaryKeys($this->consultaanticiposScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->consultaanticiposScheduledForDeletion = null;
             }
         }
         if ($this->collConsultaanticipos !== null) {
             foreach ($this->collConsultaanticipos as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->facturasScheduledForDeletion !== null) {
             if (!$this->facturasScheduledForDeletion->isEmpty()) {
                 FacturaQuery::create()->filterByPrimaryKeys($this->facturasScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->facturasScheduledForDeletion = null;
             }
         }
         if ($this->collFacturas !== null) {
             foreach ($this->collFacturas as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $foto = Input::file('foto');
     $medico = Medico::find($id);
     $data = Input::all();
     if (!is_null($foto)) {
         $extension = $foto->getClientOriginalExtension();
         $name_foto = 'm_' . $id . '.' . $extension;
         $medico->foto = $name_foto;
         File::delete('./imgs/' . $name_foto);
         $foto->move("imgs", $name_foto);
     }
     if (is_null($medico)) {
         $medico = new Medico();
     }
     $medico->cedula = $data['cedula'];
     $medico->primer_nombre = $data['primer_nombre'];
     $medico->segundo_nombre = $data['segundo_nombre'];
     $medico->apellido_paterno = $data['apellido_paterno'];
     $medico->apellido_materno = $data['apellido_materno'];
     $medico->sexo = $data['sexo'];
     $medico->id_especialidades_medicas = $data['id_especialidades_medicas'];
     $medico->celular = $data['celular'];
     $medico->telefono = $data['telefono'];
     $medico->email = $data['email'];
     $medico->extension = $data['extension'];
     $medico->id_nivel = $data['id_nivel'];
     $medico->id_ubicacion = $data['id_ubicacion'];
     $medico->observacion = $data['observaciones'];
     $medico->save();
     return Redirect::route('datos.medicos.index');
 }