Beispiel #1
0
 public static function createOrg($opts)
 {
     $organization = \Organization::saveRecord(null, array("name" => $opts['user']->name));
     $centre = new \Centre(array("user_id" => $opts['user']->id, "organization_id" => $organization->id, "type" => "clinic", "department" => json_encode(RequestMethods::post("department", array("Clinic"))), "phone" => RequestMethods::post("org_phone", ""), "location_id" => $opts['location']->id));
     $centre->save();
     $member = new \Member(array("user_id" => $opts['user']->id, "centre_id" => $centre->id, "organization_id" => $organization->id, "designation" => "admin", "image" => "", "live" => 1));
     $member->save();
     return $organization;
 }
Beispiel #2
0
 public function getCentreUnits()
 {
     $getCentreUnits = array();
     if ($this->getCentre()) {
         $centre = new Centre($this->getCentre());
         $getCentreUnits = $centre->getUnits();
     }
     return $getCentreUnits;
 }
 /**
  * Crea un nou grup
  */
 public function nouGrup()
 {
     if (Input::has('nom')) {
         $grup = new Grup();
         $nom = Input::get('nom');
         $nom = strip_tags($nom);
         $nom = trim($nom);
         $descripcio = Input::get('descripcio');
         $descripcio = strip_tags($descripcio);
         $descripcio = trim($descripcio);
         $aula = Input::get('aula');
         $aula = strip_tags($aula);
         $aula = trim($aula);
         $centre = Input::get('centre');
         $validator = Validator::make(array('nombre' => $nom, 'descripción' => $descripcio, 'aula' => $aula, 'centro' => $centre), array('nombre' => array('required', 'max:60'), 'descripción' => array('max:255'), 'aula' => array('max:25'), 'centro' => array('max:150')));
         if ($validator->fails()) {
             return Redirect::route('grup.nou')->withErrors($validator);
         }
         $grup->nom_grup = $nom;
         $grup->descripcio_grup = $descripcio;
         $grup->aula = $aula;
         $grup->centre_nom_centre = $centre;
         $grup->curs_nom_curs = '2013-2014';
         $slug = $nom . uniqid();
         $grup->slug_grup = $slug;
         $emaillog = Auth::user()->email_estudiant;
         $grup->estudiant_email_estudiant = $emaillog;
         $grup->save();
         try {
             $estudiant = Estudiant::findOrFail($emaillog);
         } catch (ModelNotFoundException $e) {
             return Redirect::route('grups.meus');
         }
         $estudiant->matricularEstudiant($slug);
         return Redirect::route('assignatures.nou', array('slug' => $slug));
     } else {
         $centres = Centre::all();
         $this->layout->title = 'Workshome - Nuevo grupo';
         $this->layout->description = 'Crear nuevo grupo';
         $this->layout->content = View::make('grups/nou', array('centres' => $centres));
     }
 }
Beispiel #4
0
<meta name="google-site-verification" content="z5nWBQFi1Hh6OMcFON3qsqWvVXXpL-sucwg71j_hymM" />
<title>Dhamma-Reise</title>
<?php 
include 'layout_inc/css.inc.php';
?>
</head>
<body>
 
<div id="container">
<?php 
include 'layout_inc/title.inc.php';
?>

<?php 
// Deciding whether request comes with Centre's identifier
$centre = new Centre();
$centreIdent = $_GET['centreIdent'];
if ($centreIdent == null) {
    unset($_SESSION['centreIdent']);
} else {
    $_SESSION['centreIdent'] = $centreIdent;
}
if ($centreIdent != null) {
    $oneCentre = $centre->getCentreByStrIdent($centreIdent);
    // if centre id has been set echo one table
    if ($oneCentre == null) {
        echo "<strong>Achtung: </strong>Kein Zentrum mit diesem Namen gefunden. \n\t\tBitte wenden Sie sich an ";
        include './layout_inc/email_obfuscator.inc.php';
    } else {
        include './layout_inc/centre-table.inc.php';
    }
Beispiel #5
0
 /**
  * @before _secure
  */
 public function book()
 {
     $this->noview();
     $session = Registry::get("session");
     $configuration = Registry::get("configuration");
     $imojo = $configuration->parse("configuration/payment");
     $intoSeconds = function ($value) {
         $pieces = explode(":", $value);
         return 3600 * $pieces[0] + 60 * $pieces[1];
     };
     if (RequestMethods::get("action") == "pickupLocation") {
         $session->set('Appt\\Book:$location', RequestMethods::get("location_id"));
         echo "Success";
         return;
     }
     if (RequestMethods::post("action") != "checkout" || !$session->get('Appt\\Book:$location')) {
         $this->redirect("/404");
     }
     $charge = base64_decode(RequestMethods::post("tp"));
     $services = RequestMethods::post("service");
     $centre = RequestMethods::post("centre");
     $carts = RequestMethods::post("cart");
     $order = new Order(array("user_id" => $this->user->id, "type" => "appointment", "amount" => $charge, "mode" => "instamojo", "ref_id" => ""));
     $order->save();
     foreach ($services as $service) {
         $i = 0;
         $c = Centre::first(array("id = ?" => $centre[$i]), array("organization_id"));
         $appointment = new Appointment(array("patient_id" => RequestMethods::post("user_id", $this->user->id), "user_id" => $this->user->id, "order_id" => $order->id, "centre_id" => $centre[$i], "service_id" => $service, "location_id" => $session->get('Appt\\Book:$location'), "organization_id" => $c->organization_id, "start" => strftime("%Y-%m-%d %H:%M:%S", strtotime(RequestMethods::post("start")) + $intoSeconds(RequestMethods::post("startTime"))), "end" => strftime("%Y-%m-%d %H:%M:%S", strtotime(RequestMethods::post("start")) + $intoSeconds(RequestMethods::post("endTime"))), "allDay" => 0));
         $appointment->save();
         $i++;
     }
     $session->erase('Appt\\Book:$location');
     $curl = new Curl();
     $curl->setHeader('X-Api-Key', $imojo->payment->instamojo->key);
     $curl->setHeader('X-Auth-Token', $imojo->payment->instamojo->auth);
     $curl->post('https://www.instamojo.com/api/1.1/payment-requests/', array("purpose" => "Appointment", "amount" => $charge, "buyer_name" => $this->user->name, "email" => $this->user->email, "phone" => $this->user->phone, "redirect_url" => "http://healthlitmus.com/appointments/success", "allow_repeated_payments" => false));
     if (!isset($_COOKIE["fixedappointments"])) {
         setcookie("fixedappointments", 1, time() + 3600 * 24);
     } else {
         setcookie("fixedappointments", $_COOKIE["fixedappointments"] + 1, time() + 3600 * 24);
     }
     $payment = $curl->response;
     if ($payment->success == "true") {
         foreach ($carts as $cart) {
             $cart = Cart::first(array("id = ?" => $cart));
             $cart->delete();
         }
         $session->erase('User\\Cart:$cart')->erase('User\\Cart:$total');
         $instamojo = new Instamojo(array("user_id" => $this->user->id, "payment_request_id" => $payment->payment_request->id, "amount" => $payment->payment_request->amount, "purpose" => "order", "purpose_id" => $order->id, "status" => $payment->payment_request->status, "longurl" => $payment->payment_request->longurl, "live" => 1));
         $instamojo->save();
         $this->redirect($instamojo->longurl);
     }
 }
Beispiel #6
0
    echo "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>";
    echo "{$_SESSION['info']}";
    echo "</div>";
    unset($_SESSION['info']);
}
if (isset($user) && is_null($page)) {
    $centre = new Centre($user->getCentre());
    if (!$centre->infolock && $user->isLocalAdmin() && !$trial->checkComplete('siteinfo', $centre)) {
        echo "<div class=\"alert alert-warning\">";
        echo "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>";
        echo "Please go to Admin → Edit Site Information and complete the one-time hospital information form there.";
        echo "</div>";
    }
}
if (isset($user) && is_null($page)) {
    $centre = new Centre($user->getCentre());
    if ($centre->isLocked()) {
        echo "<div class=\"alert alert-info\">";
        echo "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>";
        echo "Your centre is not currently opened for data entry.";
        echo "</div>";
    }
}
if ($include) {
    $include = basename($include);
    // Should be unneccesary, but you never know!
    require "./includes/{$include}.php";
} else {
    echo $trial->getWelcome();
    if ($trial->randomisationOffline()) {
        echo "<h4>Apologies, but randomisation is currently paused, it should be resumed soon.</h4>";
Beispiel #7
0
 /**
  * Get the language the record is written in
  * @return string Two-letter language code, returns 'en' if none set
  */
 public function getLanguage()
 {
     if ($this->getCentre()) {
         $centre = new Centre($this->getCentre());
         return $centre->getLanguage();
     } else {
         return 'en';
     }
 }
Beispiel #8
0
    ?>
  <p>Hier k&ouml;nnen Sie Kontakt<?php 
    if ($offers) {
        ?>
 zum Anbieter einer Fahrt aufnehmen.<?php 
    } else {
        ?>
 zu einem Mitfahrer aufnehmen.<?php 
    }
    ?>
 Ihre Daten werden per E-Mail &uuml;bertragen und der Empf&auml;nger kann sich dann mit Ihnen in Verbindung setzen.<br />
  Die mit einem Sternchen gekennzeichneten Felder sind Pflichtfelder. </p>
        
  <div class="box">      
		<?php 
    $centre = new Centre();
    $centreName = $centre->getNameById($_GET['centreId']);
    $events = new Event();
    $eventInfo = $events->getEventById($_GET['eventId']);
    $transfer = new Transfer();
    $transferInfo = $transfer->getTransferById($transferId);
    if ($offers) {
        ?>
		<form action="contact.php?eventId=<?php 
        echo $_GET['eventId'];
        ?>
&centreId=<?php 
        echo $_GET['centreId'];
        ?>
&mode=offer&transferId=<?php 
        echo $_GET['transferId'];
 public function test()
 {
     $output = '<table>';
     foreach (Centre::all() as $centre) {
         $output .= '<tr><td>' . $centre->name . '</td><td>' . $centre->address . '</td><td>' . $centre->city->name . '</td><td>' . $centre->city->state->name . '</td><td>' . $centre->pincode . '</td></tr>';
     }
     $output .= '</table>';
     return $output;
     return PDF::loadView('admin.certi')->stream('certi_final.pdf');
     //        return View::make('admin.centrecerti');
     //        $pdf = PDF::loadView('admin.centrecerti');
     //        return $pdf->stream('certi.pdf');
     $out = '<table>';
     $out .= '<tr><td>Name</td><td>Address</td><td>City</td><td>Pincode</td></tr>';
     $count = 0;
     foreach (Centre::orderBy('city_id')->get() as $centre) {
         $out .= '<tr><td>' . $centre->name . '</td><td>' . $centre->address . '</td><td>' . $centre->city->name . '</td><td>' . $centre->pincode . '</td></tr>';
     }
     //        foreach (DB::table('results_2015')->where('rank','<','51')->where('kv',1)->get() as $user)
     //        {
     //            if(User::where('roll',$user->roll)->count()) {
     //                $users = User::where('roll',$user->roll)->first();
     //                if($users->status == 3 || $users->status == 5) {
     ////                    dd($users);
     //                    $out .= '<tr><td>'.$user->rank.'</td><td>'.$user->roll.'</td><td>'.$user->mobile.'</td><td>'.$users->name1.'</td><td>'.$users->name2.'</td><td>'.$user->path.'</td><td></td><td></td><td></td><td></td><td></td><td></td><td>'.$users->squad.'</td></tr>';
     //                }
     //                else {
     //                    try {
     //                        $out .= '<tr><td>'.$user->rank.'</td><td>'.$user->roll.'</td><td>'.$user->mobile.'</td><td>'.$users->name1.'</td><td>'.$users->name2.'</td><td>'.$users->school->name.'</td><td>'.$users->city->name.'</td><td>'.$users->school->address.'</td><td>'.$users->school->pincode.'</td><td>'.$users->school->contact.'</td><td>'.$users->contact1.'</td><td>'.$users->contact2.'</td><td>'.$users->squad.'</td></tr>';
     //                    }catch (Exception $e) {
     //                        return var_dump($users);
     //                    }
     //                }
     ////                $count++;
     //            }
     //        }
     //        return $count;
     return $out . '</table>';
     $pdf = PDF::loadView('admin.certi');
     return $pdf->stream('certi.pdf');
     $det = '<table>';
     foreach (City::orderBy('state_id')->get() as $city) {
         $count = User::whereCityId($city->id)->count();
         if ($count) {
             $det .= '<tr><td>' . $city->name . '</td><td>' . $city->state->name . '</td><td>' . $count . '</td></tr>';
         }
     }
     $det .= '</table>';
     return $det;
     //        $list = '<table>';
     //        foreach(DB::table('results_2015')->where('rank','<','27')->where('kv','!=',1)->where('roll','LIKE',"H%")->get() as $res)
     //        {
     //            $user = User::whereRoll($res->roll)->first();
     //            if(!$user) {
     //                $name1 = 'User1';
     //                $name2 = 'User2';
     //            }
     //            else {
     //                $name1 = $user->name1;
     //                $name2 = $user->name2;
     //            }
     //            $list .= '<tr><td>'.$res->rank.'</td><td>'.$res->roll.'</td><td>'.$name1.'</td><td>'.$name2.'</td><td>'.$res->mobile.'</td><td>'.$res->path.'</td></tr>';
     //        }
     //        $list .= '</table>';
     //        return $list;
     //        $rolls = array('HE53600040','HE53600004','HE53600027','HE53600022','HE53600023','HE53600002','HE53600005','HE53600003','HE53600006','HE53600034','HE53600033','HE53600037','HE53600001','HE53600039','HE53600038','HE53600018','HE53600011','HE53600010','HE53600009','HE53600008','HE53600007','HE53600025','HE53600026','HE53600020','HE53600019','HE53600016','HE53600017','HE53600015','HE53600014','HE53600013','HE53600012');
     //        $list = '';
     //        foreach($rolls as $roll)
     //        {
     //            $old = User::whereRoll($roll)->first();
     //            $user = $old->replicate();
     //            $user->squad = 'JUNIOR';
     //            $lastroll = User::withTrashed()->where('roll', 'LIKE', "%JE5360%")->count();
     //            $roll = 'JE5360'.str_pad(strval($lastroll + 1), 4, "0", STR_PAD_LEFT);
     //            $user->roll = $roll;
     //            $user->comments = 'Change squad';
     //            $user->push();
     //            $list .= $old->roll.'  '.$user->roll.'<br>';
     //        }
     //        return $list;
     $user = User::whereRoll('HE52530018')->first();
     return $user->roll . '<br>' . Crypt::decrypt($user->result_pass) . '<br>' . $user->name1 . '<br>' . $user->name2;
     foreach (User::where('city_id', 21)->where('paid', 1)->get() as $user) {
         $password = str_random(6);
         $school = $user->school;
         $user->password = Hash::make($password);
         $user->save();
         if ($user->email1 !== "") {
             Queue::push(function ($job) use($user, $password, $school) {
                 Mail::send('emails.offline', array('user' => $user, 'school' => $school, 'password' => $password, 'name' => $user->name1), function ($message) use($user) {
                     $message->to($user->email1, $user->name1)->subject('Technothlon Registration Details');
                 });
                 $job->delete;
             });
         }
         if ($user->email1 !== "") {
             Queue::push(function ($job) use($user, $password, $school) {
                 Mail::send('emails.offline', array('user' => $user, 'school' => $school, 'password' => $password, 'name' => $user->name2), function ($message) use($user) {
                     $message->to($user->email2, $user->name2)->subject('Technothlon Registration Details');
                 });
                 $job->delete;
             });
         }
     }
     return View::make('emails.kvroll');
     return $pdf = PDF::loadView('technopedia.onlineadmitcard')->stream('admit-cards/users/' . Auth::user()->get()->roll . '.pdf');
     return View::make('technopedia.onlineadmitcard');
     $schools = '';
     foreach (Centre::all() as $centre) {
         $count = User::where('centre_id', $centre->id)->count();
         $schools .= $count . ' ' . ($centre->strength - $centre->left) . ' ' . $centre->id;
     }
     return $schools;
     foreach (School::where('verified', 2)->get() as $school) {
         $junior = User::where('school_id', $school->id)->where('squad', 'JUNIOR')->count();
         $hauts = User::where('school_id', $school->id)->where('squad', 'HAUTS')->count();
         $schools .= $school->name . '<br>' . $school->address . '<br>' . $school->city->name . ' Pin: ' . $school->pincode . '<br>' . $school->city->state->name . '<br>Ph.: ' . $school->contact . '<br>Junior:' . $junior . ' Hauts: ' . $hauts . '<br><br>';
     }
     return $schools;
     //        return View::make('admin.test');
 }
Beispiel #10
0
 public function details($title, $id = '')
 {
     $organization = Organization::first(array("id = ?" => $id));
     $this->seo(array("title" => $organization->name, "keywords" => $organization->name, "description" => substr(strip_tags($organization->details), 0, 150), "view" => $this->getLayoutView()));
     $view = $this->getActionView();
     $centre = Centre::first(array("organization_id = ?" => $id), array("*"), "created", "desc");
     $services = Service::all(array("centre_id = ?" => $centre->id), array("property", "property_id", "charge"));
     $location = Location::first(array("id = ?" => $centre->location_id), array("street", "area_id", "city_id"));
     $area = Area::first(array("id = ?" => $location->area_id), array("name"));
     $city = City::first(array("id = ?" => $location->city_id), array("name"));
     $view->set("centre", $centre);
     $view->set("area", $area);
     $view->set("city", $city);
     $view->set("location", $location);
     $view->set("services", $services);
     $view->set("organization", $organization);
 }
 public function attendance($centre)
 {
     try {
         $centre = Crypt::decrypt($centre);
         $centre = Centre::find($centre);
     } catch (Exception $e) {
         return View::make('layouts.error');
     }
     Excel::create($centre->name, function ($excel) use($centre) {
         $excel->setTitle('Attendance Sheet');
         $excel->setCreator('Technothlon')->setCompany('Technothlon');
         $excel->setDescription('Attendance Sheet for ' . $centre->name);
         $excel->sheet('Offline', function ($sheet) use($centre) {
             $sheet->appendRow(array('Name 1', 'Name 2', 'School', 'Roll'));
             $users = array();
             foreach (User::where('centre_id', $centre->id)->wherePaid(1)->orderBy('school_id')->get() as $user) {
                 $users[] = array($user->name1, $user->name2, $user->school->name, $user->roll);
             }
             $sheet->rows($users);
         });
         $excel->sheet('Online', function ($sheet) use($centre) {
             $sheet->appendRow(array('Name 1', 'Name 2', 'School', 'Roll'));
             $users = array();
             foreach (User::where('centre_id', $centre->id)->wherePaid(0)->orderBy('school_id')->get() as $user) {
                 $users[] = array($user->name1, $user->name2, $user->school->name, $user->roll);
             }
             $sheet->rows($users);
         });
     })->export('xlsx');
 }
Beispiel #12
0
 /**
  * Retorna tots els centres de la BBDD
  */
 public static function showCentres()
 {
     return Centre::all();
 }
Beispiel #13
0
 /**
  * @before _secure, _vendor
  */
 public function download()
 {
     $this->noview();
     $tests = Test::all(array("live = ?" => true), array("title"));
     $centres = Centre::all(array("organization_id = ?" => $this->organization->id), array("location_id"));
     $locations = array();
     foreach ($centres as $centre) {
         $loc = Location::first(array("id = ?" => $centre->location_id), array("city"));
         array_push($locations, $loc->city);
     }
     header('Content-Type: text/csv; charset=utf-8');
     header('Content-Disposition: attachment; filename=medicaltests.csv');
     // create a file pointer connected to the output stream
     $output = fopen('php://output', 'w');
     $first = array("Medical Test");
     $locations = array_unique($locations);
     foreach ($locations as $location) {
         array_push($first, "Price at " . $location);
     }
     fputcsv($output, $first);
     foreach ($tests as $test) {
         $data = array();
         array_push($data, $test->title);
         foreach ($locations as $location) {
             array_push($data, "");
         }
         fputcsv($output, $data);
     }
 }
 public function centrechanged()
 {
     $user = User::find(Auth::user()->get()->id);
     $city = Input::get('city');
     $user->centre_city = $city * 10;
     if (Centre::where('city_id', $city)->where('online', 'YES')->where('left', '>', 0)->count() > 0) {
         $centre = Centre::where('city_id', $city)->where('online', 'YES')->where('left', '>', 0)->first();
         $user->centre_id = $centre->id;
     }
     $user->save();
     return View::make('layouts.centrechanged')->with('user', $user);
 }
Beispiel #15
0
if ($trial->user->isRegional()) {
    if ($trial->record->getCentre() != $trial->user->getCentre()) {
        $_SESSION['error'] = 'You are not authorised to edit records for other centres.';
        $complete = false;
        header("Location:index.php");
        exit;
    } else {
        if (isset($_POST['core-centre_id']) && $_POST['core-centre_id'] != $trial->user->getCentre()) {
            $_SESSION['error'] = 'You are not authorised to change records to other centres.';
            $complete = false;
            header("Location:index.php");
            exit;
        }
    }
}
$centre = new Centre($trial->record->getCentre());
if ($centre->isLocked() && !$trial->user->isCentralAdmin()) {
    $_SESSION['error'] = 'This centre is locked for data entry.';
    $complete = false;
    header("Location:index.php");
    exit;
}
if ($page == 'signpt') {
    if (isset($_SESSION['returnTo'])) {
        $return = "index.php?page={$_SESSION['returnTo']}";
    } else {
        $return = "index.php";
    }
    $presigned = $trial->record->isPreSigned();
    $signed = $trial->record->isSigned();
    // To detect if there's a change in signed status
Beispiel #16
0
 /**
  * @before _secure, _vendor, _admin
  */
 public function payments()
 {
     $this->seo(array("title" => "Vendor Profile", "view" => $this->getLayoutView()));
     $view = $this->getActionView();
     $where["organization_id = ?"] = $this->organization->id;
     $period = RequestMethods::get("period", "total");
     switch ($period) {
         case 'year':
             $year = strftime("%Y-%m-%d", strtotime('-1 year'));
             $where["created > ?"] = $year;
             break;
         case 'week':
             $week = strftime("%Y-%m-%d", strtotime('-1 year'));
             $where["created > ?"] = $week;
             break;
         case 'day':
             $day = strftime("%Y-%m-%d", strtotime('-1 day'));
             $where["created > ?"] = $day;
             break;
     }
     $centres = Centre::all(array("organization_id = ?" => $this->organization->id), array("id", "location_id"));
     $revenue = 0;
     $cash = 0;
     $online = 0;
     $appointments = Appointment::all($where);
     foreach ($appointments as $a) {
         $order = Order::first(array("id = ?" => $a->order_id), array("amount"));
         $revenue += $order->amount;
         switch ($order->mode) {
             case 'cash':
                 $cash += $order->amount;
                 break;
             default:
                 $online += $order->amount;
                 break;
         }
     }
     if (RequestMethods::get("action") == "invoice") {
         $this->paymentsInvoice($this->organization, $appointments, $revenue, $cash, $online, "show");
     }
     $view->set("appointments", $appointments);
     $view->set("period", $period);
     $view->set("revenue", $revenue);
     $view->set("cash", $cash);
     $view->set("online", $online);
     $view->set("centres", $centres);
 }
Beispiel #17
0
        $form->addErrors($_SESSION['inputErr']);
        unset($_SESSION['inputErr']);
    }
    if ($page === 'core' && !$user->isRoot()) {
        $form->makeReadOnly();
    }
    if ($trial->record->isSigned() || $trial->record->isPreSigned()) {
        $form->disableForm();
    }
}
$form->addClass('crf');
$form->addInput('hidden', 'page', $trial->getPage());
$form->addInput('hidden', 'link_id', $link_id);
$_SESSION['csrfToken'] = $token = base64_encode(openssl_random_pseudo_bytes(32));
$form->addInput('hidden', 'csrfToken', $token);
$centre = new Centre($trial->record->getCentre());
if ($centre->isLocked() && !$trial->user->isCentralAdmin()) {
    $form->disableForm();
}
if ($centre->getID() !== $user->getCentre() && !$trial->user->isCentralAdmin()) {
    $form->disableForm();
}
if ($page !== 'audit') {
    echo $form->writeHTML();
}
if ($trial->getSubPage()) {
    echo "</div>";
}
echo "</div>";
echo "</div>";
echo "</div>";
Beispiel #18
0
             }
         }
         header('Pragma: public');
         header('Expires: -1');
         header('Content-Transfer-Encoding: binary');
         header('Content-Type: application/vnd.ms-excel');
         header('Content-Disposition: attachment;filename="eCRFData.csv"');
         header('Cache-Control: max-age=0');
         // output the file
         echo $output;
         exit;
     }
     break;
 case 'locksite':
     if (isset($_POST['lockSite'])) {
         $centre = new Centre($user->getCentre());
         $centre->lockSite();
         $_SESSION['message'] = "You have locked your site for data entry, you may now download your data from Admin->Download your data";
     }
     break;
 case 'certs':
     addIncludePath('/addons/tfpdf');
     addIncludePath('/addons/fpdi');
     // Check first for if the confirmation code is being issued
     $certificate = "lead";
     $name = $user->forename . ' ' . $user->surname;
     // map FPDF to tFPDF so FPDF_TPL can extend it
     class FPDF extends tFPDF
     {
         protected $_tplIdx;
     }
Beispiel #19
0
<?php

$sql = "SELECT v.id as vid, d.option_text as centre_name, a.link_id, c.trialid, v.active, CONCAT(user.forename,' ',user.surname) as full_name, privilege.option_text as privilege_name FROM violation v \nLEFT JOIN violationlink a ON v.id = a.violation_id \nLEFT JOIN link b ON a.link_id = b.id \nLEFT JOIN core c ON b.core_id = c.id\nLEFT JOIN centre d ON c.centre_id = d.id\nLEFT JOIN violationAudit ON v.id = violationAudit.table_id\nLEFT JOIN user on violationAudit.user_id = user.id\nLEFT JOIN privilege ON user.privilege_id = privilege.option_value\nWHERE v.active = 1\nAND violationAudit.field='violationdesc'";
if ($user->isCentralAdmin()) {
    $sql .= " GROUP BY a.link_id ORDER BY active";
    $result = DB::query($sql);
} elseif ($user->isRegionalAdmin()) {
    $sql .= " AND country_id = ?";
    $sql .= " GROUP BY a.link_id";
    $centre = new Centre($user->getCentre());
    $pA = array('i', $centre->get('country_id'));
    $result = DB::query($sql, $pA);
} else {
    $sql .= " AND centre_id = ?";
    $sql .= " GROUP BY a.link_id";
    $pA = array('i', $user->getCentre());
    $result = DB::query($sql, $pA);
}
if ($result->getRows()) {
    echo "<div class=\"container well\" style=\"background-color:#FFFFFF;\">";
    echo "<h3>Protocol deviations</h3>";
    if ($user->isCentralAdmin()) {
        echo "<h5>If you wish to remove a protocol deviation form then please select and click 'Delete' - the form will be stored for audit purposes.</h5>";
        echo "<form action=\"process.php\" method=\"POST\">";
    }
    echo '<table class="table table-striped table-bordered table-hover dataTable"><thead>';
    echo '<tr><th scope="col">Centre</th><th scope="col">' . Config::get('idName') . '</th><th scope="col">Deviation</th>';
    echo '<th scope="col">Description</th><th scope="col">Reported time</th><th scope="col">Reported by</th>';
    if ($user->isCentralAdmin()) {
        echo '<th>Select</th>';
    }
Beispiel #20
0
 /**
  * @before _secure, _vendor
  */
 public function create()
 {
     $this->seo(array("title" => "Create runner", "view" => $this->getLayoutView()));
     $view = $this->getActionView();
     $msg = "";
     $centres = Centre::all(array("organization_id = ?" => $this->organization->id), array("id", "location_id"));
     $upload = function ($key) {
         if (isset($_FILES["image"]["name"][$key])) {
             $file = $_FILES["image"];
             $path = APP_PATH . "/public/assets/uploads/images/";
             $extension = pathinfo($file["name"][$key], PATHINFO_EXTENSION);
             if (!preg_match("/^(jpe?g|gif|png|bmp)\$/", $extension)) {
                 return false;
             }
             $filename = uniqid() . ".{$extension}";
             if (move_uploaded_file($file["tmp_name"][$key], $path . $filename)) {
                 return $filename;
             } else {
                 return FALSE;
             }
         } else {
             return false;
         }
     };
     if (RequestMethods::post("phone")) {
         $phone = RequestMethods::post("phone");
         $name = RequestMethods::post("name");
         $centre_id = RequestMethods::post("centre_id");
         foreach ($phone as $key => $value) {
             if (!empty($value)) {
                 $exist = User::first(array("phone = ?" => $phone[$key]), array("id"));
                 $img = $upload($key);
                 if (!$img) {
                     $msg = 'Not a vaild image';
                 } else {
                     if ($exist) {
                         $msg = 'Phone number already exists';
                     }
                 }
                 if (!$exist && $img) {
                     $user = new User(array("name" => $name[$key], "email" => "", "phone" => $phone[$key], "password" => sha1(rand(100000, 9999999)), "gender" => $gender[$key], "birthday" => "", "live" => true));
                     $user->save();
                     foreach ($centre_id[$key] as $k => $v) {
                         $runner = new Member(array("user_id" => $user->id, "organization_id" => $this->organization->id, "centre_id" => $v, "designation" => "runner", "image" => $img, "live" => true));
                         $runner->save();
                     }
                     $msg = "Runner Created Successfully";
                 } else {
                     $msg .= ", Not all were added";
                 }
             }
         }
         $view->set("message", $msg);
     }
     $locations = array();
     foreach ($centres as $c) {
         $l = Location::first(array("id = ?" => $c->location_id), array("area_id"));
         $a = Area::first(array("id = ?" => $l->area_id), array("name", "id"));
         $data = array("id" => $c->id, "name" => $a->name);
         $data = ArrayMethods::toObject($data);
         $locations[$c->id] = $data;
     }
     $view->set("centres", $locations);
 }
Beispiel #21
0
<?php

$showSearch = true;
if (isset($_POST['centreSelect']) && is_numeric($_POST['centreSelect'])) {
    $centreEdit = new Centre($_POST['centreSelect']);
    if ($centreEdit->get('name') && ($centreEdit->getCountry() == $user->getCountry() || $user->isCentralAdmin())) {
        $showSearch = false;
        echo "<h4>Edit the centre below</h4>";
        $form = new HTMLForm('process.php', 'post');
        $fields = $trial->getFormFields($page);
        $form->processFields($fields, $centreEdit);
        if ($user->isCentralAdmin()) {
            $sql = "SELECT units.number, units.name FROM units WHERE number IN ( SELECT number FROM formFields\n                    LEFT JOIN units ON units.number=formFields.fieldname\n                    GROUP BY units.number )\n                    GROUP BY units.number\n                    HAVING count(units.number)>1";
            $numbers = DB::cleanQuery($sql);
            if ($numbers->getRows()) {
                $defUnits = $centreEdit->getUnits();
                foreach ($numbers->rows as $row) {
                    $input = $form->addInput('select', "units[{$row->number}]");
                    $input->addLabel("Units for {$row->name}");
                    $sql = "SELECT id, unit FROM units\n                WHERE number = ?\n                ORDER BY unitorder";
                    $pA = array('s', $row->number);
                    $units = DB::cleanQuery($sql, $pA);
                    $options = array();
                    foreach ($units->rows as $unitRow) {
                        $options[$unitRow->id] = $unitRow->unit;
                    }
                    $input->addOption($options, true);
                    if (isset($defUnits[$row->number])) {
                        $input->addValue($defUnits[$row->number]['units_id']);
                    }
                    $input->setMand();
Beispiel #22
0
 /**
  * @before _secure, _vendor
  */
 public function settings()
 {
     $this->seo(array("title" => "Settings", "view" => $this->getLayoutView()));
     $view = $this->getActionView();
     $centre = Centre::first(array("id = ?" => $this->member->centre_id));
     $location = Location::first(array("id = ?" => $centre->location_id));
     $area = Area::first(array("id = ?" => $location->area_id));
     if (RequestMethods::post("action") == "settings") {
         $phone = RequestMethods::post("phone");
         $user = $this->user;
         $message = null;
         if ($phone != $user->phone) {
             $exist = User::first(array("phone = ?" => $phone));
             if ($exist) {
                 $message = "Phone number already exists";
             } else {
                 $user->phone = $phone;
             }
         }
         $user->name = RequestMethods::post("name");
         $user->save();
         $this->setUser($user);
         $location = \Location::saveRecord($user, $location);
         $phone = RequestMethods::post("cphone");
         if ($centre->phone != $phone) {
             $exist = Centre::first(array("phone = ?" => $phone));
             if ($exist) {
                 $message = "Landline already exists!!";
             } else {
                 $centre->phone = $phone;
                 $centre->save();
             }
         }
         if (!$message) {
             $message = "Info updated!!";
         }
         $view->set("message", $message);
     }
     if (RequestMethods::post("action") == "operations") {
         $operations = RequestMethods::post("operations");
         foreach ($operations as $key => $value) {
             $operation = Operation::first(array("centre_id = ?" => $id, "area_id = ?" => $value));
             if (!$operation) {
                 $operation = new Operation(array("user_id" => $this->user->id, "centre_id" => $id, "organization_id" => $this->organization->id, "area_id" => $value, "live" => 1));
                 $operation->save();
             }
         }
     }
     $ops = Operation::all(array("centre_id = ?" => $id), array("area_id"));
     $opa = array();
     foreach ($ops as $o) {
         $opa[] = $o->area_id;
     }
     $view->set("centre", $centre);
     $view->set("area", $area);
     $view->set("location", $location);
     $view->set("opa", $opa);
 }
Beispiel #23
0
function write_search_table($type, $acc = false, $active = false, $centre = NULL)
{
    $user = $_SESSION['user'];
    $pA = array();
    // Central admin and above allowed to see whole dataset, local users just local // WHen this is moved, remember to fix it!
    switch ($type) {
        case 'yourcrfs':
            $caption = "Your CRFs";
            $sql = "SELECT link.id AS link_id, \n\t\t\t\t\tcentre.name AS name, \n\t\t\t\t\tcore.trialid AS trialid, \n\t\t\t\t\tlink.signed AS signed,\n                    link.presigned AS presigned,\n                    link.lastmod AS lastmod\n\t\t\t\tFROM link \n\t\t\t\t\tINNER JOIN core ON link.core_id = core.id \n\t\t\t\t\tINNER JOIN centre ON core.centre_id = centre.id \n                WHERE firstuser = ?";
            $pA = array('i', $user->getID());
            $result = DB::query($sql, $pA);
            break;
        case 'sitecrfs':
            $caption = "All CRFs entered by your site";
            $sql = "SELECT link.id AS link_id, \n\t\t\t\t\tcentre.name AS name, \n\t\t\t\t\tcore.trialid AS trialid, \n\t\t\t\t\tlink.signed AS signed,\n                    link.presigned AS presigned,\n                    link.lastmod AS lastmod,\n\t\t\t\t\tcentre.id AS centre_id,\n\t\t\t\t\tMIN( DATE(coreAudit.time) ) AS time_entered\n\t\t\t\tFROM link \n\t\t\t\t\tINNER JOIN core ON link.core_id = core.id \n\t\t\t\t\tINNER JOIN centre ON core.centre_id = centre.id\n\t\t\t\t\tLEFT JOIN coreAudit ON coreAudit.table_id = core.id\n                WHERE centre.id = ? AND core.studygroup IS NOT NULL AND link.discontinue_id IS NULL\n                GROUP BY link.id";
            $pA = array('i', $user->getCentre());
            $result = DB::query($sql, $pA);
            break;
        case 'siteunsigncrfs':
            $caption = "Completed CRFs for you to sign";
            $none = 'There are no unflagged CRFs for you to sign';
            $sql = "SELECT link.id AS link_id, \n\t\t\t\t\tcentre.name AS name, \n\t\t\t\t\tcore.trialid AS trialid, \n\t\t\t\t\tlink.signed AS signed,\n                    link.presigned AS presigned,\n                    link.lastmod AS lastmod,\n                    link.comment AS comment\n\t\t\t\tFROM link \n\t\t\t\t\tINNER JOIN core ON link.core_id = core.id \n\t\t\t\t\tINNER JOIN centre ON core.centre_id = centre.id \n                    LEFT JOIN flag ON link.id = flag.link_id \n                WHERE centre.id = ? \n                    AND presigned = 1 \n                    AND signed = 0\n                    AND ( link.comment IS NULL OR link.comment = '' ) \n                    AND flag.id IS NULL";
            $pA = array('i', $user->getCentre());
            $result = DB::query($sql, $pA);
            break;
        case 'siteflaggedcrfs':
            $caption = "Completed CRFs that have been flagged as requiring checking before signing";
            $none = 'There are no flagged CRFs for you to sign';
            $sql = "SELECT link.id AS link_id, \n\t\t\t\t\tcentre.name AS name, \n\t\t\t\t\tcore.trialid AS trialid, \n\t\t\t\t\tlink.signed AS signed,\n                    link.presigned AS presigned,\n                    link.lastmod AS lastmod,\n                    link.comment AS comment\n\t\t\t\tFROM link \n\t\t\t\t\tINNER JOIN core ON link.core_id = core.id \n\t\t\t\t\tINNER JOIN centre ON core.centre_id = centre.id \n                    LEFT JOIN flag ON link.id = flag.link_id \n                WHERE centre.id = ? \n                    AND presigned = 1 \n                    AND signed = 0\n                    AND (( link.comment IS NOT NULL AND link.comment != '' ) \n                    OR flag.id IS NOT NULL )\n                GROUP BY link.id";
            $pA = array('i', $user->getCentre());
            $result = DB::query($sql, $pA);
            break;
        case 'signedandflagged':
            $caption = "Signed CRFs that are flagged as having incomplete data";
            $none = 'There are no signed and flagged CRFs';
            $sql = "SELECT link.id AS link_id, \n\t\t\t\t\tcentre.name AS name, \n\t\t\t\t\tcore.trialid AS trialid, \n\t\t\t\t\tlink.signed AS signed,\n                    link.presigned AS presigned,\n                    link.lastmod AS lastmod,\n                    link.comment AS comment\n\t\t\t\tFROM link \n\t\t\t\t\tINNER JOIN core ON link.core_id = core.id \n\t\t\t\t\tINNER JOIN centre ON core.centre_id = centre.id \n                    LEFT JOIN flag ON link.id = flag.link_id \n                WHERE signed = 1\n                    AND ignored = 0\n                    AND (( link.comment IS NOT NULL AND link.comment != '' ) \n                    OR flag.id IS NOT NULL )";
            if ($user->isRegional()) {
                $sql .= " AND centre.id = ?";
            }
            $sql .= " GROUP BY link.id";
            if ($user->isRegional()) {
                $pA = array('i', $user->getCentre());
                $result = DB::query($sql, $pA);
            } else {
                $result = DB::query($sql);
            }
            break;
        case 'incompletecrfs':
            $caption = "Incomplete CRFs from your site";
            $none = 'There are no incomplete CRFs from your site';
            $sql = "SELECT link.id AS link_id, \n\t\t\t\t\tcentre.name AS name, \n\t\t\t\t\tcore.trialid AS trialid, \n\t\t\t\t\tlink.signed AS signed,\n                    link.presigned AS presigned,\n                    link.lastmod AS lastmod\n\t\t\t\tFROM link \n\t\t\t\t\tINNER JOIN core ON link.core_id = core.id \n\t\t\t\t\tINNER JOIN centre ON core.centre_id = centre.id \n                WHERE centre.id = ? AND \n                    presigned = 0";
            $pA = array('i', $user->getCentre());
            $result = DB::query($sql, $pA);
            break;
        case 'countrycrfs':
            if (!($user->isCentralAdmin() || $user->isRegionalAdmin())) {
                exit('Please select another option');
            }
            $caption = "All CRFs from your country";
            $sql = "SELECT link.id AS link_id, \n\t\t\t\t\tcentre.name AS name, \n\t\t\t\t\tcore.trialid AS trialid, \n\t\t\t\t\tlink.signed AS signed,\n                    link.presigned AS presigned,\n                    link.lastmod AS lastmod,\n                    country.name AS country,\n\t\t\t\t\tcentre.id AS centre_id,\n\t\t\t\t\tMIN( DATE(coreAudit.time) ) AS time_entered\n\t\t\t\tFROM link \n\t\t\t\t\tINNER JOIN core ON link.core_id = core.id \n\t\t\t\t\tINNER JOIN centre ON core.centre_id = centre.id\n                    INNER JOIN country ON centre.country_id = country.id\n                    LEFT JOIN coreAudit ON coreAudit.table_id = core.id\n\t\t\t\tWHERE country.id = ?  AND core.studygroup IS NOT NULL AND link.discontinue_id IS NULL\n\t\t\t\tGROUP BY link.id";
            $centre = new Centre($user->getCentre());
            $pA = array('i', $centre->get('country_id'));
            $result = DB::query($sql, $pA);
            break;
        case 'all':
            if (!$user->isCentralAdmin()) {
                exit('Please select another option');
            }
            $caption = "All CRFs";
            if ($centre) {
                $caption .= " from centre {$centre}";
            }
            $sql = "SELECT link.id AS link_id, \n\t\t\t\t\tcentre.name AS name, \n\t\t\t\t\tcore.trialid AS trialid, \n\t\t\t\t\tlink.signed AS signed,\n                    link.presigned AS presigned,\n                    link.lastmod AS lastmod,\n                    country.name AS country,\n\t\t\t\t\tcentre.id AS centre_id,\n\t\t\t\t\tMIN( coreAudit.time ) AS time_entered\n\t\t\t\tFROM link \n\t\t\t\t\tINNER JOIN core ON link.core_id = core.id \n\t\t\t\t\tINNER JOIN centre ON core.centre_id = centre.id\n                    INNER JOIN country ON centre.country_id = country.id\n                    LEFT JOIN coreAudit ON coreAudit.table_id = core.id ";
            if ($centre) {
                $sql .= "WHERE centre.id = ? AND link.discontinue_id IS NULL ";
                $sql .= "GROUP BY link.id";
                $pA = array('i', $centre);
                $result = DB::query($sql, $pA);
            } else {
                $sql .= "WHERE link.discontinue_id IS NULL GROUP BY link.id";
                $result = DB::query($sql);
            }
            break;
    }
    if ($type == 'recent') {
        $sql = "SELECT link.id AS link_id, \n\t\t\t\t\tcentre.name AS name, \n\t\t\t\t\tcore.trialid AS trialid, \n\t\t\t\t\tlink.signed AS signed,\n                    link.presigned AS presigned\n\t\t\t\tFROM link \n\t\t\t\t\tINNER JOIN core ON link.core_id = core.id \n\t\t\t\t\tINNER JOIN centre ON core.centre_id = centre.id ";
        switch ($user->getPrivilege()) {
            case 10:
                $sql .= "WHERE centre_id=" . DB::clean($user->getCentre()) . " ";
                break;
            case 15:
                $sql .= "WHERE centre_id=" . DB::clean($user->getCentre()) . " AND signed = 0 ";
                break;
        }
        $sql .= "ORDER BY lastmod DESC, centre_id \n\t\t\t\t\t\tLIMIT 0, 10";
        $caption = 'Recently entered patients';
    } elseif ($type == 'unsigned') {
        $sql = "SELECT *, link.id AS link_id FROM link INNER JOIN core ON link.core_id = core.id INNER JOIN centre ON core.centre_id = centre.id WHERE centre_id=" . DB::clean($user->getCentre()) . " AND signed = 0 ORDER BY lastmod DESC, centre_id";
        $caption = 'Incomplete CRFs from your site (max 10)';
        $none = 'No incomplete CRFs found';
    } elseif ($type == 'signedsite') {
        $sql = "SELECT *, link.id AS link_id FROM link INNER JOIN core ON link.core_id = core.id INNER JOIN centre ON core.centre_id = centre.id WHERE centre_id=" . DB::clean($user->getCentre()) . " AND signed = 1 ORDER BY lastmod DESC, centre_id";
        $caption = 'Unflagged CRFs for you to sign (max 10)';
        $none = 'No unflagged CRFs for you to sign found';
    } elseif ($type == 'unsigneduser') {
        $sql = "SELECT *, link.id AS link_id FROM link INNER JOIN core ON link.core_id = core.id INNER JOIN centre ON core.centre_id = centre.id WHERE centre_id=" . DB::clean($user->getCentre()) . " AND signed = 0 AND firstuser = "******" ORDER BY lastmod DESC, centre.id";
        $caption = 'Your incomplete CRFs (max 10)';
        $none = 'No incomplete CRFs of yours found';
    } elseif ($type == 'flagged') {
        $sql = "SELECT *, link.id AS link_id, COUNT( flag.id ) AS name FROM flag LEFT JOIN link ON flag.link_id = link.id INNER JOIN core ON core.id = link.core_id WHERE core.centre_id = " . DB::clean($user->getCentre()) . " AND signed = 1 GROUP BY link.id ORDER BY lastmod DESC";
        $caption = 'Flagged CRFs from your site (max 10)';
        $none = 'No flagged CRFs for you to sign found';
    }
    //    $result = DB::query( $sql );
    if ($result->getRows()) {
        echo "<div class=\"container well\" style=\"background-color:#FFFFFF;\">";
        if ($acc) {
            echo "<div class=\"accordion-group\">";
            echo "<div class=\"accordion-heading\">";
            if ($active) {
                $class = 'active';
                $collapse = 'in';
            } else {
                $collapse = $class = '';
            }
            echo "<a class=\"accordion-toggle {$class}\" data-toggle=\"collapse\" data-parent=\"#{$acc}\" href=\"#{$type}\">";
            echo $caption;
            echo "</a>";
            echo "</div>\n";
            echo "<div id=\"{$type}\" class=\"accordion-body collapse {$collapse}\">";
            echo "<div class=\"accordion-inner\">";
        } else {
            echo "<h3>{$caption}</h3>";
        }
        echo "<p>Click on any heading to sort by that field.</p>";
        echo '<form class="nomand" action="process.php" method="post">';
        ob_start();
        echo '<table id="searchTable';
        if ($type == 'all') {
            echo "All";
        }
        echo '" class="table table-striped table-bordered table-hover"><thead><tr><th scope="col">' . Config::get('idName') . '</th><th scope="col">Centre</th>';
        if ($type == 'all') {
            echo '<th scope="col">Country</th>';
        }
        echo '<th scope="col">Date Entered</th><th scope="col">Completed?</th><th scope="col">Signed?</th><th scope="col">Action</th><th scope="col">Last modified</th></tr></thead>';
        echo "<tbody>\n";
        for ($i = 0; $i < $result->num_rows; $i++) {
            echo '<tr class="clickable"><td>', HTML::clean($result->rows[$i]->trialid), '</td><td>', HTML::clean($result->rows[$i]->name), '</td>';
            if ($type == 'all') {
                echo "<td>{$result->rows[$i]->country}</td>";
            }
            echo "<td>{$result->rows[$i]->time_entered}</td>";
            echo '<td>';
            echo $result->rows[$i]->presigned == 1 ? 'Yes' : 'No';
            echo '</td><td >';
            echo $result->rows[$i]->signed == 1 ? 'Yes' : 'No';
            echo '</td><td class="clickable">';
            $link_id = HTML::clean($result->rows[$i]->link_id);
            echo '<input class="radio" type="radio" name="searchpt-link_id" value="', $link_id, '" />';
            echo '&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp';
            echo '<select class="action-', $link_id, '" name="searchpt-action" disabled>';
            echo '<option>No action</option>';
            if (!$result->rows[$i]->signed) {
                if ($user->isCentralAdmin() || $user->getCentre() == $result->rows[$i]->centre_id) {
                    echo '<option value="data">Enter data</option>';
                    echo '<option value="ae">Record an adverse event</option>';
                    echo '<option value="withdraw">Withdraw a patient</option>';
                    echo '<option value="violation">Record a protocol deviation</option>';
                } elseif ($user->isRegionalAdmin()) {
                    echo '<option value="data">View record</option>';
                }
            } else {
                echo '<option value="data">View record</option>';
                if ($user->canUnsign() && ($user->isCentralAdmin() || $user->getCentre() == $result->rows[$i]->centre_id)) {
                    echo '<option value="unsign">Unsign and edit record</option>';
                }
            }
            echo '</select>';
            echo '</td><td>';
            echo HTML::clean($result->rows[$i]->lastmod);
            echo '</td></tr>';
            echo "\n";
        }
        echo '</tbody></table><p>';
        echo "<input type=\"hidden\" name=\"page\" value=\"searchpt\">";
        if ($type == 'siteunsigncrfs') {
            echo "<input type=\"hidden\" name=\"sign\" value =\"1\">";
        }
        $_SESSION['csrfToken'] = $token = base64_encode(openssl_random_pseudo_bytes(32));
        echo "<input type=\"hidden\" name=\"csrfToken\" value=\"{$token}\"/>";
        echo "<div class=\"form-actions\">\n            <button type=\"submit\" class=\"btn btn-primary\">Select</button>\n            </div>";
        ob_end_flush();
        echo '</form>';
        if ($acc) {
            echo "</div>\n";
            echo "</div>\n";
            echo "</div>\n";
        }
        echo "</div>";
    } else {
        if (isset($none)) {
            echo "<h3>{$none}</h3>";
        } else {
            echo "<h3>No records found.</h3>";
        }
    }
}