コード例 #1
0
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index(Route $route)
 {
     //echo $route->getActionName();
     //	 exit();
     $upcomingexhibitionevents = ExhibitionEvent::where('start_time', '>', date("Y-m-d H:i:s"))->take(4)->get();
     $currentlyexhibitionevents = ExhibitionEvent::where('start_time', '<', date("Y-m-d H:i:s"))->where('end_time', '>', date("Y-m-d H:i:s"))->take(4)->get();
     $tracklogins = Tracklogin::where('user_id', '=', Auth::User()->id)->orderBy('created_at', 'desc')->take(2)->get();
     $systemtracks = Systemtrack::where('user_id', '=', Auth::User()->id)->orderBy('created_at', 'desc')->take(5)->get();
     if (Auth::User()->type == 'company') {
         $user = User::find(Auth::User()->id);
         $company = Company::where('user_id', $user->id)->get();
         $company = $company[0];
         $companyId = $company->id;
         $exhibitors = Exhibitor::where('company_id', $companyId)->get();
         //$booths=array();
         $events = array();
         $i = 0;
         foreach ($exhibitors as $exhibitor) {
             $booths = Booth::where('exhibitor_id', $exhibitor->id)->get();
             foreach ($booths as $booth) {
                 $events[$i] = $booth->exhibition_event_id;
                 $i++;
             }
         }
         $events = array_unique($events);
         //var_dump($events); exit();
         $i = 0;
         $exhibitionevents = array();
         foreach ($events as $event) {
             $exhibitionevents[$i] = ExhibitionEvent::find($event);
             $i++;
         }
         // var_dump($exhibitionevents[0]); exit();
         $upcomingcompanyevents = array();
         $currentlycompanyevents = array();
         $finishedcompanyevents = array();
         $i = 0;
         foreach ($exhibitionevents as $exhibitionevent) {
             if ($exhibitionevent->start_time > date("Y-m-d H:i:s")) {
                 $upcomingcompanyevents[$i] = $exhibitionevent;
                 $i++;
             } elseif ($exhibitionevent->start_time < date("Y-m-d H:i:s") && $exhibitionevent->end_time > date("Y-m-d H:i:s")) {
                 $currentlycompanyevents[$i] = $exhibitionevent;
                 $i++;
             } else {
                 $finishedcompanyevents[$i] = $exhibitionevent;
                 $i++;
             }
         }
     }
     return view('home', compact('upcomingexhibitionevents', 'currentlyexhibitionevents', 'tracklogins', 'systemtracks', 'upcomingcompanyevents', 'currentlycompanyevents', 'finishedcompanyevents'));
 }
コード例 #2
0
ファイル: HomeController.php プロジェクト: raniafathy/wavexpo
 /**
  * function run by server every certain time for logout
  */
 public function outFromSystem()
 {
     $now = new DateTime(date("Y-m-d H:i:s"));
     $userid = Tracklogin::select('userid')->first();
     $userId = $userid->userid;
     $sessiontime = Tracklogin::select('sessiontime')->get()->first();
     $date2 = $sessiontime->sessiontime;
     $date3 = new DateTime($date2);
     $diff1 = $date3->diff($now);
     $test = $diff1->s;
     if ($diff1->s > 2) {
         //Checking event_id key exist in session.
         $maxID = DB::table('systemtracks')->max('id');
         $eventid = Systemtrack::where('id', $maxID)->pluck('eventid');
         $leave_at = Systemtrack::where('id', $maxID)->pluck('leave_at');
         if ($eventid != 0 && $leave_at == NULL) {
             $systemeventid = Systemtrack::where('id', $maxID)->pluck('systemeventid');
             $systemtrack = Systemtrack::find($systemeventid);
             $systemtrack->leave_at = date("Y-m-d H:i:s");
             $systemtrack->save();
         }
         //Checking booth_id key exist in session.
         $maxID = DB::table('systemtracks')->max('id');
         $boothid = Systemtrack::where('id', $maxID)->pluck('boothid');
         $leave_at = Systemtrack::where('id', $maxID)->pluck('leave_at');
         if ($boothid != 0 && $leave_at == Null) {
             $systemboothid = Systemtrack::where('id', $maxID)->pluck('systemboothid');
             $systemtrack = Systemtrack::find($systemboothid);
             $systemtrack->leave_at = date("Y-m-d H:i:s");
             $systemtrack->save();
         }
         $maxLogin = DB::table('tracklogins')->where('user_id', $userId)->max('login_at');
         DB::table('tracklogins')->where('user_id', $userId)->where('login_at', $maxLogin)->update(['logout_at' => $now]);
         //Auth::logout();
     }
 }
コード例 #3
0
 public function boothsreport()
 {
     $exhibitionevents = ExhibitionEvent::all();
     $booths = Booth::all();
     $i = 0;
     foreach ($booths as $booth) {
         $data = $booth->name;
         //$allvisitors[$i]=Systemtrack::where('do','LIKE', "%$data%")->count();
         $allvisitors[$i] = Systemtrack::where('type', 'booth')->where('type_id', $booth->id)->count();
         $uniquevisit[$i] = Systemtrack::where('type', 'booth')->where('type_id', $booth->id)->distinct('user_id')->count('user_id');
         $i++;
     }
     return view('AdminCP.reports.booths.boothreport', compact('exhibitionevents', 'booths', 'allvisitors', 'uniquevisit'));
 }
コード例 #4
0
 public function ajaxSearchForBoothTrack()
 {
     //if(Request::ajax){
     $boothId = Request::get('optValue');
     //echo $boothId;
     $booth = Booth::find($boothId);
     //}
     // $exhibitionevents=ExhibitionEvent::all();
     // $users=User::all();
     // $booths=Booth::all();
     $systemtracks = Systemtrack::where('type', 'booth')->get();
     //$systemtracks=Systemtrack::where('type','booth')->get();
     $systemtrack_users = DB::table('systemtracks')->where('systemtracks.type', 'booth')->join('users', 'users.id', '=', 'systemtracks.user_id')->get();
     //	echo json_encode(array("value" => $booth, "value2" => $systemtracks));
     return view('AdminCP.reports.systemtracks.ajaxbooth', compact('booth', 'systemtracks', 'systemtrack_users'));
 }
コード例 #5
0
 public function eventsreport()
 {
     $exhibitionevents = ExhibitionEvent::all();
     $booths = array();
     $i = 0;
     foreach ($exhibitionevents as $exhibitionevent) {
         $booths[$i] = Booth::where('exhibition_event_id', $exhibitionevent->id)->count();
         $data = $exhibitionevent->name;
         // $allvisitors[$i]=Systemtrack::where('do','LIKE', "%$data%")->count();
         $allvisitors[$i] = Systemtrack::where('type', 'exhibitionevent')->where('type_id', $exhibitionevent->id)->count();
         $uniquevisit[$i] = Systemtrack::where('type', 'exhibitionevent')->where('type_id', $exhibitionevent->id)->distinct('user_id')->count('user_id');
         $i++;
     }
     //var_dump($uniquevisit); exit();
     return view('AdminCP.reports.exhibitionevents.eventreport', compact('exhibitionevents', 'booths', 'allvisitors', 'uniquevisit'));
 }
コード例 #6
0
 public function booth()
 {
     if (!$this->adminAuth()) {
         return view('errors.404');
     }
     $exhibitionevents = ExhibitionEvent::all();
     $users = User::all();
     $booths = Booth::all();
     $systemtracks = Systemtrack::where('type', 'booth')->get();
     $systemtrack_users = DB::table('systemtracks')->where('systemtracks.type', 'booth')->join('users', 'users.id', '=', 'systemtracks.user_id')->get();
     return view('AdminCP.reports.systemtracks.booth', compact('booths', 'systemtracks', 'users', 'exhibitionevents', 'systemtrack_users'));
 }