Пример #1
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 coresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aAgenda !== null) {
             if ($this->aAgenda->isModified() || $this->aAgenda->isNew()) {
                 $affectedRows += $this->aAgenda->save($con);
             }
             $this->setAgenda($this->aAgenda);
         }
         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;
 }
Пример #2
0
 public function actionCadastrar()
 {
     if ($this->request->isPostRequest) {
         $cadastrarAgenda = new Agenda();
         $cadastrarAgenda->agenda = $this->request->getPost('agenda');
         $cadastrarAgenda->save();
     }
 }
Пример #3
0
 public function actionAgendaMaker()
 {
     date_default_timezone_set("Asia/Manila");
     $activity = new Activity();
     $activity->act_desc = 'Viewed Agenda List';
     $activity->act_datetime = date('Y-m-d G:i:s');
     $activity->act_by = User::model()->findByPK(Yii::app()->user->name)->emp_id;
     $activity->save();
     $model = new Agenda('search');
     if (isset($_POST['Agenda'])) {
         $model->attributes = $_POST['Agenda'];
         $model->session_time = date('H:i:s', strtotime($model->session_time));
         $model->confirmation = 0;
         if ($model->save()) {
             $this->redirect(array('/reportsOthers/viewAgenda', 'id' => $model->agenda_id));
         }
     }
     $this->render('agendaMaker', array('model' => $model));
 }
Пример #4
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Agenda();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Agenda'])) {
         $model->attributes = $_POST['Agenda'];
         if ($model->save()) {
             date_default_timezone_set("Asia/Manila");
         }
         $activity = new Activity();
         $activity->act_desc = 'Added Another Agenda';
         $activity->act_datetime = date('Y-m-d G:i:s');
         $activity->act_by = User::model()->findByPK(Yii::app()->user->name)->emp_id;
         $activity->save();
         $this->redirect(array('view', 'id' => $model->agenda_id));
     }
     $this->render('create', array('model' => $model));
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $data = Input::all();
     $proveedor = 1;
     $agenda = new Agenda();
     $agenda->nombre_completo = $data['nombre_completo'];
     $agenda->profesion = $data['profesion'];
     $agenda->telefono = $data['telefono'];
     $agenda->celular = $data['celular'];
     $agenda->extension = $data['extension'];
     $agenda->correo = $data['correo'];
     $agenda->ruc = $data['ruc'];
     $agenda->detalle = $data['detalle'];
     if (empty($data['proveedor'])) {
         $proveedor = 0;
     }
     $agenda->proveedor = $proveedor;
     $agenda->save();
     return Redirect::route('datos.agenda.index');
 }
Пример #6
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     // is current user has the required privilege ?
     if (!Yii::app()->user->checkAccess('agenda_create')) {
         throw new CHttpException(403, 'You are not authorized to perform this action.');
     }
     if ($this->isDivisionAdmin()) {
         $model = new Agenda();
         // Uncomment the following line if AJAX validation is needed
         // $this->performAjaxValidation($model);
         if (isset($_POST['Agenda'])) {
             $model->attributes = $_POST['Agenda'];
             if ($model->save()) {
                 $this->redirect(array('view', 'id' => $model->id));
             }
         }
         $this->render('create', array('model' => $model));
     } else {
         $this->render('notAdmin');
     }
 }
 public function generarAgenda($id, $fecha)
 {
     $errores = false;
     $agendas_general = 0;
     $dow = array('Domingo' => 0, 'Lunes' => 1, 'Martes' => 2, 'Miercoles' => 3, 'Jueves' => 4, 'Viernes' => 5, 'Sabado' => 6);
     $coe = $this->modelo->find($id);
     $fecha_ini = $fecha;
     $especialidad = $coe->especialidad;
     $odontologo = $coe->odontologo;
     $centro = $coe->centro;
     $lapso = 1;
     $fecha_fin = date("Y-m-d", strtotime("+" . $lapso . " days", strtotime($fecha_ini)));
     $agendas = array();
     if ($coe->habilitado != 1) {
         return json_encode(array('error' => true, 'listado' => "El centro-odontologo-especialidad no está habilitado"));
     }
     while (strtotime($fecha_ini) <= strtotime($fecha_fin)) {
         $f = new Feriado();
         if ($f->esFeriado($fecha_ini)) {
             //	echo "Feriado".$fecha_ini;
             $fecha_ini = date("Y-m-d", strtotime("+1 day", strtotime($fecha_ini)));
             continue;
         } elseif ($dow[$coe->dia_semana] != date('w', strtotime($fecha_ini))) {
             $fecha_ini = date("Y-m-d", strtotime("+1 day", strtotime($fecha_ini)));
             continue;
         } elseif ($coe->existeAgenda($fecha_ini)) {
             $fecha_ini = date("Y-m-d", strtotime("+1 day", strtotime($fecha_ini)));
             continue;
             //} elseif ($coe->odontologo()->existeAusencia($fecha_ini) > 0){
         } elseif ($odontologo->existeAusencia($fecha_ini) > 0) {
             $fecha_ini = date("Y-m-d", strtotime("+1 day", strtotime($fecha_ini)));
             continue;
         } else {
             $agenda = new Agenda();
             $agenda->centro_odontologo_especialidad_id = $coe->id;
             $agenda->fecha = $fecha_ini;
             $agenda->odontologo_efector_id = $odontologo->id;
             $agenda->habilitado_turnos = 1;
             $agenda->created_at = date("Y-m-d H:i:s");
             $agenda->updated_at = date("Y-m-d H:i:s");
             $agendas[] = $agenda;
         }
         $fecha_ini = date("Y-m-d", strtotime("+1 day", strtotime($fecha_ini)));
     }
     $err_agenda = true;
     $agendas_general += count($agendas);
     if (count($agendas)) {
         $err_agenda = $agenda->save();
     }
     if (!$err_agenda) {
         $errores = true;
     }
     if ($agendas_general == 0) {
         return json_encode(array('error' => true, 'listado' => "No hay agendas para generar"));
     }
     $t = $this->generarTurnos($agenda->id);
     if (!$t) {
         $errores = true;
     }
     if ($errores) {
         return json_encode(array('error' => true, 'listado' => "Se produjeron errores al generar las agendas"));
     } else {
         return json_encode(array('error' => false, 'listado' => "Se generaron las agendas"));
     }
 }
 public function store()
 {
     $data = array("first_name" => Input::get("first_name"), "last_name" => Input::get("last_name"), "email" => Input::get("email"), "username" => Input::get("username"), "phone" => Input::get("phone"), "picture" => Input::file("picture"), "password" => Input::get("password"), "password_confirmation" => Input::get("password_confirmation"));
     $rules = array("first_name" => 'required|min:1|max:255', "last_name" => 'required|min:1|max:100', "email" => 'required|email|unique:users', "username" => 'required|min:5|unique:users', "phone" => 'required|min:1|max:100', "picture" => 'mimes:jpeg,gif,png', 'password' => 'confirmed|min:6');
     $messages = array('required' => 'El campo :attribute es obligatorio.', 'min' => 'El campo :attribute no puede tener menos de :min carácteres.', 'email' => 'El campo :attribute debe ser un email válido.', 'max' => 'El campo :attribute no puede tener más de :max carácteres.', 'numeric' => 'El campo :attribute debe contener solo numeros', 'mimes' => 'El formato de la imagen logo debe ser jpg, git, png', 'unique' => 'El :attribute ingresado ya esta siendo usaddo por otro usuario.', 'confirmed' => 'La confirmación del :attribute no coincide');
     $validation = Validator::make(Input::all(), $rules, $messages);
     //si la validación falla redirigimos al formulario de registro con los errores
     //y con los campos que nos habia llenado el usuario
     if ($validation->fails()) {
         return Redirect::to('/clinic/doctors/create')->withErrors($validation)->withInput();
     } else {
         $user = new User();
         $user->first_name = Input::get("first_name");
         $user->last_name = Input::get("last_name");
         $user->email = Input::get("email");
         $user->username = Input::get("username");
         $user->password = Input::get("password");
         $user->save();
         $doctorUser = Sentry::getUserProvider()->findByLogin($user->email);
         $doctorsyGroup = Sentry::getGroupProvider()->findByName('Doctors');
         $doctorUser->addGroup($doctorsyGroup);
         $doctor = new Doctor();
         $doctor->user_id = $user->id;
         $doctor->clinic_id = Clinic::getClinicId();
         $doctor->specialty_id = Input::get("specialty_id");
         if (Input::file('picture') != NULL) {
             //agrega imagen de logo
             $file_logo = Input::file('picture');
             $ext = Input::file('picture')->getClientOriginalExtension();
             $nameIMG = date('YmdHis');
             $logo = $nameIMG . '.' . $ext;
             $logo = 'assets/doctor/images/profile_pic/profile_' . $logo;
             $file_logo->move("assets/doctor/images/profile_pic/", $logo);
             $doctor->picture = $logo;
         }
         $doctor->save();
         $clinic = Clinic::find(Clinic::getClinicId());
         $address_id = $clinic->address_id;
         $agenda = new Agenda();
         $agenda->doctor_id = $doctor->id;
         $agenda->name = "Agenda " . Input::get("first_name") . ' ' . Input::get("last_name");
         $agenda->description = 'Nuevo';
         $agenda->save();
         $busines = new Business();
         $busines->doctor_id = $doctor->id;
         $busines->agenda_id = $agenda->id;
         $busines->addresses_id = $address_id;
         $busines->name = 'Local # ';
         $busines->save();
         if (!$logo) {
             $logo = "";
         }
         $profile = new Profile();
         $profile->user_id = $user->id;
         $profile->lang = Input::get("lang");
         $profile->phone = Input::get("phone");
         $profile->picture = $logo;
         $profile->save();
         if ($profile) {
             return Redirect::to('/clinic/doctors/')->withFlash_message("Guardado Exitosamente");
         } else {
             return Redirect::to('/clinic/doctors/create')->withErrors("Error")->withInput();
         }
     }
 }
Пример #9
0
 public function actareunion_add2($codcampeonato, $id)
 {
     $users = DB::table('tagenda')->count();
     $users++;
     //$users1 = DB::table('treunion')->count();
     $users1 = substr($id, 3, strlen($id));
     $codagenda = "AGE" . $users1 . $users;
     $input = Input::all();
     $rules = array('tema' => 'required');
     $validator = Validator::make($input, $rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator);
     } else {
         $category = new Agenda();
         $category->codAgenda = $codagenda;
         $category->tema = Input::get('tema');
         $category->codReunion = $id;
         $category->save();
         return Redirect::to('campeonato/detail/' . $codcampeonato . '/abriracta/' . $id);
     }
 }
Пример #10
0
 public function actionChoosePIC($id, $action)
 {
     // is current user has the required privilege ?
     if (!Yii::app()->user->checkAccess('request_choosePIC')) {
         throw new CHttpException(403, 'You are not authorized to perform this action.');
     }
     $model = $this->loadModel($id);
     if (isset($_POST['PICForm'])) {
         $submitted = $_POST['PICForm'];
         $agenda = new Agenda();
         $agenda->topik = $model->topik;
         $agenda->deskripsi = $model->deskripsi;
         $agenda->jenis_rapat = $model->jenis_rapat;
         $agenda->PIC = $submitted['PIC'];
         if ($agenda->save()) {
             $this->redirect(array('index'));
         }
     }
     $picForm = new PICForm();
     $this->render('view', array('model' => $model, 'action' => $action, 'picForm' => $picForm));
 }