/** * Auto generated seed file * * @return void */ public function run() { \DB::table('virus_tracker')->delete(); $uids = DB::table('virus_users')->lists('id'); $faker = Faker\Factory::create(); foreach (range(1, 20) as $id) { $hundredDaysAgo = new DateTime(date('Y-m-d h:i:s', strtotime('-100 days'))); $randDays = $faker->unique()->numberBetween(0, 103); Scans::create(['mac_addr' => $faker->macAddress(), 'scan_date' => $hundredDaysAgo->modify("+{$randDays} days"), 'notes' => $faker->realText(200), 'troj_mal' => $faker->numberBetween(10, 200), 'pups' => $faker->numberBetween(10, 200), 'cpu_desc' => $faker->realText(200), 'scanned_by' => $faker->randomElement(array('Alice', 'Asok')), 'room_number' => $faker->randomLetter() . '-' . $faker->randomNumber(3), 'uid' => $faker->randomElement($uids)]); } }
public function updateMostRecentScan() { //finds the most recent scan $mostRecentScan = Scans::where('uid', '=', $this->id)->orderBy('scan_date', 'desc')->first(); //if there isn't a scan, then the most recent scan doesn't exist if (is_null($mostRecentScan)) { $this->last_scanned = '0000-00-00'; } else { $this->last_scanned = $mostRecentScan->scan_date; } //save the user $this->save(); }
public function dashboard() { $practice = DB::table('practiceinfo')->where('practice_id', '=', Session::get('practice_id'))->first(); $user_id = Session::get('user_id'); $result = User::find($user_id); $practice_id = Session::get('practice_id'); $fax_query = Received::where('practice_id', '=', $practice_id)->count(); $displayname = $result->displayname; $from = $displayname . ' (' . $user_id . ')'; $data['header'] = $this->mobile_header_build(Session::get('displayname')); if (Session::get('group_id') == '2') { $data1['number_messages'] = Messaging::where('mailbox', '=', $user_id)->count(); $data1['number_documents'] = Scans::where('practice_id', '=', $practice_id)->count() + $fax_query; $data1['number_appts'] = $this->getNumberAppts($user_id); $query1 = DB::table('t_messages')->join('demographics', 't_messages.pid', '=', 'demographics.pid')->where('t_messages.t_messages_from', '=', $from)->where('t_messages.t_messages_signed', '=', 'No')->count(); $query2 = DB::table('encounters')->join('demographics', 'encounters.pid', '=', 'demographics.pid')->where('encounters.encounter_provider', '=', $displayname)->where('encounters.encounter_signed', '=', 'No')->count(); $data1['number_drafts'] = $query1 + $query2; $data1['number_reminders'] = DB::table('alerts')->join('demographics', 'alerts.pid', '=', 'demographics.pid')->where('alerts.alert_provider', '=', $user_id)->where('alerts.alert_date_complete', '=', '0000-00-00 00:00:00')->where('alerts.alert_reason_not_complete', '=', '')->where(function ($query_array) { $query_array->where('alerts.alert', '=', 'Laboratory results pending')->orWhere('alerts.alert', '=', 'Radiology results pending')->orWhere('alerts.alert', '=', 'Cardiopulmonary results pending')->orWhere('alerts.alert', '=', 'Referral pending')->orWhere('alerts.alert', '=', 'Reminder')->orWhere('alerts.alert', '=', 'REMINDER'); })->count(); $data1['number_bills'] = Encounters::where('bill_submitted', '=', 'No')->where('user_id', '=', $user_id)->count(); $data1['number_tests'] = Tests::whereNull('pid')->where('practice_id', '=', $practice_id)->count(); } $data['content'] = View::make('mobile.home_content', $data1)->render(); $data['form'] = ''; $left_panel_array = array(array('Schedule', 'mobile_schedule'), array('Inbox', 'mobile_inbox')); if (Session::get('group_id') != '100') { $left_panel_array[] = array('Drafts', 'mobile_drafts'); $left_panel_array[] = array('Alerts', 'mobile_alerts'); if (Session::get('patient_centric') == 'n') { $left_panel_array[] = array('Scans', 'mobile_scan'); if ($practice->fax_type != "") { $left_panel_array[] = array('Faxes', 'mobile_fax'); } } } $data['left_panel'] = $this->mobile_menu_build($left_panel_array, "left_panel_list", 'mobile_click_home'); $data['right_panel'] = ''; $this->layout->style = HTML::style('css/mobile.css'); $this->layout->style .= HTML::style('css/toastr.min.css'); $this->layout->script = $this->js_assets('base', true); $this->layout->content = View::make('mobile.home', $data); }
case "running": case "finished": $scans = $scn->get_all_scans($type); break; default: $scans = $scn->get_all_scans("pending"); break; } // Assigning PHP 5 to a template variable so that I can prevent displaying // the cancel scan if the user is not running php 5 $tpl->assign(array('scans' => $scans, 'type' => $type)); $tpl->display('admin_scans_list.tpl'); break; case "x_count_scans": require_once _ABSPATH . '/lib/Scans.php'; $_scn = new Scans(); $not_running = 0; $pending = 0; $running = 0; $finished = 0; $all = 0; $not_running = $_scn->count_not_running_scans(); $pending = $_scn->count_pending_scans(); $running = $_scn->count_running_scans(); $finished = $_scn->count_finished_scans(); $all = $not_running + $pending + $running + $finished; echo "pass::{$not_running};{$pending};{$running};{$finished};{$all};admin"; break; case "show_scans_view": $type = import_var('type', 'P'); $tpl->assign('type', $type);
public function postDeletescan() { $row = Scans::find(Input::get('scans_id')); unlink($row->filePath); DB::table('scans')->where('scans_id', '=', Input::get('scans_id'))->delete(); $this->audit('Delete'); echo 'Document deleted!'; }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = Scans::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function view_scan($id) { $result = Scans::find($id); $file_path = $result->filePath; return Response::download($file_path); }
public function destroy($id) { try { //get the scan to be deleted $deleteScan = Scans::find($id); //get the scan user for this scan $deleteScanUser = $deleteScan->getScansUserById(); //delete the scan $deleteScan->delete(); //update the totals and most recent scan for the user $deleteScanUser->updateTotal(); $deleteScanUser->updateMostRecentScan(); //Destroy must return the object that was destroyed for backbone to not throw an error. return $deleteScan->toJson(); } catch (Exception $e) { return json_encode('{"error":{"text":' . $e->getMessage() . '}}'); } }