Inheritance: extends CI_Controller
Example #1
0
 public function run()
 {
     Eloquent::unguard();
     DB::table('clinics')->delete();
     Clinic::create(['name' => 'Apollo', 'x_coord' => '12.45', 'y_coord' => '54.23', 'address' => 'Delhi', 'email' => 'apollo', 'description' => 'apollo']);
     Clinic::create(['name' => 'Fortis', 'x_coord' => '56.45', 'y_coord' => '32.23', 'address' => 'Noida', 'email' => 'fortis', 'description' => 'fortis']);
 }
 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/users/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->activated = 1;
         $user->save();
         $doctorUser = Sentry::getUserProvider()->findByLogin($user->email);
         $doctorsyGroup = Sentry::getGroupProvider()->findByName('Receptionist');
         $doctorUser->addGroup($doctorsyGroup);
         $Receptionist = new UserReceptionist();
         $Receptionist->user_id = $user->id;
         $Receptionist->clinic_id = Clinic::getClinicId();
         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);
         }
         $Receptionist->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/users/')->withFlash_message("Guardado Exitosamente");
         } else {
             return Redirect::to('/clinic/users/create')->withErrors("Error")->withInput();
         }
     }
 }
Example #3
0
 public function search()
 {
     $q = Input::get('q');
     $doctors = Doctor::where('name', 'like', '%' . $q . '%')->get();
     $result = [];
     foreach ($doctors as $doctor) {
         array_push($result, $doctor);
     }
     $clinics = Clinic::with('doctors.contacts', 'doctors.specializations')->where('name', 'like', $q . '%')->orWhere('address', 'like', $q . '%')->get();
     foreach ($clinics as $clinic) {
         foreach ($clinic->doctors as $doctor) {
             $flag = false;
             foreach ($result as $d) {
                 if ($d->id == $doctor->id) {
                     $flag = true;
                     break;
                 }
             }
             if ($flag == false) {
                 array_push($result, $doctor);
             }
         }
     }
     $specializations = Specialization::with('doctors.contacts', 'doctors.specializations')->where('detail', 'like', $q . '%')->get();
     foreach ($specializations as $specialization) {
         foreach ($specialization->doctors as $doctor) {
             $flag = false;
             foreach ($result as $d) {
                 if ($d->id == $doctor->id) {
                     $flag = true;
                     break;
                 }
             }
             if ($flag == false) {
                 array_push($result, $doctor);
             }
         }
     }
     return Response::data($result);
 }
 public function getAgendas()
 {
     if (Payment::VeryPayment() == false) {
         return View::make('clinic.payment.renews-payment');
     }
     $user = Sentry::getUser();
     $clinic = Clinic::where('user_id', $user->id)->first();
     $doctors = Doctor::where('clinic_id', $clinic->id)->get();
     return View::make('clinic.Agendas.agenda', ['doctors' => $doctors]);
 }
 public function edit($id)
 {
     if (Payment::VeryPayment() == false) {
         return View::make('clinic.payment.renews-payment');
     }
     $user = Sentry::getUser();
     $clinic = Clinic::where('user_id', $user->id)->first();
     $doctor = Doctor::where('clinic_id', $clinic->id)->where('id', $id)->first();
     $agenda = Agenda::where('doctor_id', $doctor->id)->first();
     $esps = explode(',', $doctor->specialty_id);
     $espok = '';
     $array = array();
     foreach ($esps as $esp) {
         $very = Specialty::where('id', $esp)->first();
         if ($very) {
             $array[] = array('value' => $very->id, 'text' => $very->name_es);
         }
     }
     $profile = Profile::where('user_id', $doctor->user_id)->first();
     return View::make('clinic.doctors.edit', ['agenda' => $agenda, 'doctor' => $doctor, 'profile' => $profile, 'specialty' => $array]);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('users')->truncate();
     DB::table('patients')->truncate();
     DB::table('doctors')->truncate();
     DB::table('clinics')->truncate();
     Sentry::getUserProvider()->create(array('email' => '*****@*****.**', 'password' => '123', 'username' => 'diego10', 'first_name' => 'Diego', 'last_name' => 'Serras', 'activated' => 1));
     $c1 = Sentry::getUserProvider()->create(array('email' => '*****@*****.**', 'password' => '123', 'username' => 'jose10', 'first_name' => 'Jose', 'last_name' => 'Gonzalez', 'activated' => 1));
     $c1_ = new Clinic();
     $c1_->user_id = $c1->id;
     $c1_->name = "Clinica Medica Raul Ortega";
     $c1_->save();
     $c2 = Sentry::getUserProvider()->create(array('email' => '*****@*****.**', 'password' => '123', 'username' => 'alber10', 'first_name' => 'Alberto', 'last_name' => 'Perdomo', 'activated' => 1));
     $c2_ = new Clinic();
     $c2_->user_id = $c2->id;
     $c2_->name = "Clinica Medica Jose Pineda";
     $c2_->save();
     $d1 = Sentry::getUserProvider()->create(array('email' => '*****@*****.**', 'password' => '123', 'username' => 'martha10', 'first_name' => 'Martha', 'last_name' => 'Mendoza', 'activated' => 1));
     $d1_ = new Doctor();
     $d1_->user_id = $d1->id;
     $d1_->clinic_id = $c2_->id;
     $d1_->save();
     $d2 = Sentry::getUserProvider()->create(array('email' => '*****@*****.**', 'password' => '123', 'username' => 'jairo10', 'first_name' => 'Jairo', 'last_name' => 'Flores', 'activated' => 1));
     $d2_ = new Doctor();
     $d2_->user_id = $d2->id;
     $d2_->clinic_id = $c2_->id;
     $d2_->save();
     $d3 = Sentry::getUserProvider()->create(array('email' => '*****@*****.**', 'password' => '123', 'username' => 'gabriela10', 'first_name' => 'Gabriela', 'last_name' => 'del Cid', 'activated' => 1));
     $d3_ = new Doctor();
     $d3_->user_id = $d3->id;
     $d3_->clinic_id = $c2_->id;
     $d3_->save();
     $d4 = Sentry::getUserProvider()->create(array('email' => '*****@*****.**', 'password' => '123', 'username' => 'keiry10', 'first_name' => 'Keiry', 'last_name' => 'Rivas', 'activated' => 1));
     $d4_ = new Doctor();
     $d4_->user_id = $d4->id;
     $d4_->save();
     $d5 = Sentry::getUserProvider()->create(array('email' => '*****@*****.**', 'password' => '123', 'username' => 'mabel10', 'first_name' => 'Mabel', 'last_name' => 'Mendoza', 'activated' => 1));
     $d5_ = new Doctor();
     $d5_->user_id = $d5->id;
     $d5_->save();
     $p1 = Sentry::getUserProvider()->create(array('email' => '*****@*****.**', 'password' => '123', 'username' => 'John10', 'first_name' => 'Jonh', 'last_name' => 'Smith', 'activated' => 1));
     $p1_ = new Patient();
     $p1_->user_id = $p1->id;
     $p1_->save();
     $p2 = Sentry::getUserProvider()->create(array('email' => '*****@*****.**', 'password' => '123', 'username' => 'Orlando10', 'first_name' => 'Orlando', 'last_name' => 'Arias', 'activated' => 1));
     $p2_ = new Patient();
     $p2_->user_id = $p2->id;
     $p2_->main = $p1_->id;
     $p2_->relationship = 'son';
     $p2_->save();
     $p3 = Sentry::getUserProvider()->create(array('email' => '*****@*****.**', 'password' => '123', 'username' => 'Alejandra10', 'first_name' => 'Alejandra', 'last_name' => 'Cerna', 'activated' => 1));
     $p3_ = new Patient();
     $p3_->user_id = $p3->id;
     $p3_->main = $p1_->id;
     $p3_->relationship = 'daughter';
     $p3_->save();
     $p4 = Sentry::getUserProvider()->create(array('email' => '*****@*****.**', 'password' => '123', 'username' => 'Maria10', 'first_name' => 'Maria', 'last_name' => 'Polio', 'activated' => 1));
     $p4_ = new Patient();
     $p4_->user_id = $p4->id;
     $p3_->main = $p1_->id;
     $p3_->relationship = 'wife';
     $p4_->save();
     $p5 = Sentry::getUserProvider()->create(array('email' => '*****@*****.**', 'password' => '123', 'username' => 'Rodrigo10', 'first_name' => 'Rodrigo', 'last_name' => 'Jandres', 'activated' => 1));
     $p5_ = new Patient();
     $p5_->user_id = $p5->id;
     $p5_->save();
 }
 public function run()
 {
     Clinic::where('id', 1)->delete();
     Clinic::create(['id' => '1', 'name' => 'EMR Clinic', 'address' => 'DHA Lahore']);
 }
Example #8
0
 public function index()
 {
     $clinics = Clinic::all();
     return Response::data($clinics);
 }
Example #9
0
 /**
  * Remove the specified resource from storage.
  * DELETE /clinics/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Clinic::destroy($id);
     return Redirect::route('clinics.index');
 }
Example #10
0
 public static function getClinicId()
 {
     $user = Sentry::getUser();
     $clinic = Clinic::where('user_id', $user->id)->first();
     return $clinic->id;
 }
Example #11
0
 /**
  * Draw page text
  */
 public function DrawText()
 {
     global $objLogin;
     $objGallery = new GalleryAlbums();
     $objContactUs = ContactUs::Instance();
     $replace_needles = 1;
     $module_page = false;
     if (!count($this->page)) {
         return false;
     }
     // dont show this page if it was expired
     if (!$objLogin->IsLoggedInAsAdmin() && $this->page['finish_publishing'] != '0000-00-00' && date('Y-m-d') > $this->page['finish_publishing']) {
         draw_important_message(_PAGE_EXPIRED);
         return false;
     }
     if ($this->page['content_type'] == 'article' && isset($this->page['page_text'])) {
         $page_text = decode_text($this->page['page_text'], false);
         echo '<div class="pages_contents">';
         if (preg_match('/{module:gallery}/i', $page_text)) {
             $module_page = true;
             $page_text = @preg_replace('/{module:gallery}/i', $objGallery->DrawGallery(false), $page_text, 1);
         }
         if (preg_match_all('/{module:album=(.*?)}/i', $page_text, $matches)) {
             $module_page = true;
             if (is_array($matches[1])) {
                 foreach ($matches[1] as $key => $val) {
                     if (strtolower($val) != 'code') {
                         $val = @preg_replace('/[^A-Za-z0-9:]/i', '', $val);
                         $page_text = @preg_replace('/{module:album=' . $val . '}/i', $objGallery->DrawAlbum($val, false), $page_text, 1);
                     }
                 }
             }
         }
         if (self::$PROJECT == 'MedicalAppointment') {
             if (preg_match('/{module:about_us}/i', $page_text)) {
                 $module_page = true;
                 $page_text = @preg_replace('/{module:about_us}/i', Clinic::DrawAboutUs(false), $page_text, 1);
             }
         }
         if (self::$PROJECT == 'HotelSite') {
             if (preg_match('/{module:about_us}/i', $page_text)) {
                 $module_page = true;
                 $page_text = @preg_replace('/{module:about_us}/i', Hotels::DrawAboutUs(false), $page_text, 1);
             }
             if (preg_match('/{module:rooms}/i', $page_text)) {
                 $module_page = true;
                 $page_text = @preg_replace('/{module:rooms}/i', Rooms::DrawRoomsInfo(false), $page_text, 1);
             }
             if (preg_match('/{module:testimonials}/i', $page_text)) {
                 $module_page = true;
                 $page_text = @preg_replace('/{module:testimonials}/i', Testimonials::DrawTestimonails(false), $page_text, 1);
             }
         }
         if (preg_match('/{module:contact_us}/i', $page_text)) {
             $module_page = true;
             $page_text = @preg_replace('/{module:contact_us}/i', $objContactUs->DrawContactUsForm(false), $page_text, 1);
         }
         if (preg_match('/{module:faq}/i', $page_text)) {
             $module_page = true;
             $page_text = @preg_replace('/{module:faq}/i', FaqCategories::DrawFaqList(false), $page_text, 1);
         }
         if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
             $page_text = stripslashes($page_text);
         }
         if ($this->page['is_home']) {
             if (self::$PROJECT == 'HotelSite') {
                 Campaigns::DrawCampaignBanner('standard');
                 Campaigns::DrawCampaignBanner('global');
             }
         }
         //echo $page_text;
         //echo "<hr>";
         // draw all needed blocks for Home page
         if ($this->page['is_home']) {
             if (self::$PROJECT == 'BusinessDirectory') {
                 if (ModulesSettings::Get('listings', 'show_categories_home_block') == 'yes') {
                     Categories::DrawHomePageBlock();
                 }
             } else {
                 if (self::$PROJECT == 'ShoppingCart') {
                     if (ModulesSettings::Get('products_catalog', 'is_active') == 'yes') {
                         Campaigns::DrawCampaignBanner();
                         if (ModulesSettings::Get('products_catalog', 'show_featured_block') == 'home page') {
                             Products::DrawFeaturedBlock('home');
                         }
                         if (ModulesSettings::Get('products_catalog', 'show_new_products_block') == 'home page') {
                             Products::DrawNewProductsBlock();
                         }
                         Categories::DrawHomePageBlock();
                     }
                 }
             }
         }
         // draw comments form
         if (!$this->page['is_home'] && !$module_page) {
             if (Modules::IsModuleInstalled('comments')) {
                 if (ModulesSettings::Get('comments', 'comments_allow') == 'yes' && $this->page['comments_allowed']) {
                     $objComments = new Comments();
                     $objComments->DrawArticleComments($this->page['id']);
                 }
             }
         }
         echo '</div>';
     } else {
         if ($this->page['content_type'] == 'link' && isset($this->page['link_url'])) {
             $link_url = decode_text($this->page['link_url']);
             echo '<div class="pages_contents">';
             echo '<a href="' . $link_url . '">' . $link_url . '</a>';
             echo '</div>';
         }
     }
 }
Example #12
0
loadLib('payment');
loadLib('clinic');
//loadJS('payment.js','payment');
//loadCSS('payment.css','payment');
switch (getVar('task')) {
    case 'add_payment':
        //check if the user has rights to add a payment
        if (current_user_can('add_payment')) {
            Payment::addPayment(getVar('patient_id'), getVar('clinic'), getVar('practitioner_id'), getVar('description'), getVar('amount'));
            error_log("Adding the payment", 0);
            setResponse('Payment Registered... !!');
        }
        break;
    case 'get_clinics':
        //get the clinics to use in the payment
        echo $clinics = json_encode(Clinic::getClinics());
        break;
    case 'get_fees':
        echo $fees = json_encode(Payment::getFees());
        break;
    case 'get_users':
        echo $users = json_encode(get_users('role=practitioner'));
        break;
}
switch (getView()) {
    case 'list':
        //get all the payments from the clinics
        $payments = Payment::getAllPayments();
        //set the backLink
        //$backLink = "index.php?com=patient&view=patient&patient_id=" . $patient_id;
        include 'views/list.php';