Пример #1
0
 public function postAddset(Request $request)
 {
     $this->validate($request, ['setid' => 'integer']);
     $setid = $request->input('setid');
     $set = new Set();
     if (!empty($setid)) {
         $set = Set::find($setid);
     }
     $set->name = $request->input('setname');
     $set->drivertype = 0;
     if ($request->input('drivertype') == 1) {
         $set->drivertype = 1;
     }
     $set->datatype = $request->input('datatype');
     $set->save();
     $ids = explode(',', $request->input('requests'));
     Runner::where("setid", "=", $setid)->where("state", "=", "static")->delete();
     for ($i = 1; $i < count($ids) - 1; $i++) {
         $runner = new Runner();
         $runner->setid = $set->id;
         $runner->requestid = $ids[$i];
         $runner->state = "static";
         $runner->checkid = 1;
         $runner->checkstate = 0;
         $runner->save();
     }
     return view("work.autotest.set.showset")->withSet($set);
 }
Пример #2
0
 public function delete($ques, $resp, $args)
 {
     $runner_id = $args['runner'];
     if (Runner::destroy($runner_id)) {
         $this->flash->addMessage('success', 'User removed.');
         return $resp->withRedirect('/runner');
     }
     $this->flash->addMessage('error', 'We were unable to delete this entry.');
     return $resp->withRedirect('/runner/' . $runner_id);
 }
Пример #3
0
 public function getLogs(Request $request)
 {
     $type = $request->input('type');
     $id = $request->input('id');
     $content = "";
     if ($type == "debug") {
         $content = file_get_contents("/data1/www/autotest/logs/debug.log");
     } else {
         if ($type == "error") {
             $content = file_get_contents("/data1/www/autotest/logs/error.log");
         } else {
             if ($type == "info") {
                 $content = file_get_contents("/data1/www/autotest/logs/info.log");
             }
         }
     }
     foreach (Runner::where("setid", "=", $id)->where("state", "=", "static")->get() as $runner) {
         $runner->state = "wait";
         $runner->save();
     }
     return $content;
 }
Пример #4
0
 public function export(Request $request, $race_id)
 {
     $race = Race::find($race_id);
     if ($request->has('format')) {
         $runners = Runner::where([['race_id', $race_id], ['status', 1]])->get();
         $csv = Writer::createFromFileObject(new \SplTempFileObject());
         if ($request->get('format') == 'excel_win') {
             $csv->setDelimiter(';');
             $csv->setOutputBOM(Writer::BOM_UTF8);
         }
         $csv->insertOne(\Schema::getColumnListing('runners'));
         foreach ($runners as $runner) {
             $csv->insertOne($runner->toArray());
         }
         $csv->output($race->prefix . '_runners.csv');
         die;
     }
     return view('admin.export');
 }
Пример #5
0
 public function elite($id)
 {
     $runner = Runner::find($id);
     $bib = $runner->bib;
     $runner->bib = $runner->event->generateElite();
     $runner->comment = $runner->comment . ' |BIB:' . $bib . '| ';
     $runner->save();
     return redirect('admin/runner/' . $runner->id);
 }
Пример #6
0
 public function pdf($prefix, $encrypted_runner_id)
 {
     $runner_id = Crypt::decrypt($encrypted_runner_id);
     $runner = Runner::find($runner_id);
     if (is_null($runner)) {
         return redirect($prefix . '/error');
     }
     $payment = $runner->payment;
     if ($payment->id == 1) {
         $transaction = Transaction::find($runner->ticket);
         $code = Code::makeDummy();
     } else {
         $code = Code::where('code', $runner->ticket)->first();
         $transaction = Transaction::makeDummy();
     }
     $pdf = PDF::loadView('enroll.docs.manifest', ['runner' => $runner, 'transaction' => $transaction, 'code' => $code])->setPaper('a4')->setOrientation('portrait');
     return $pdf->stream('manifest.pdf');
 }