示例#1
0
 private function loadProjects()
 {
     $html = [];
     foreach ($this->modelData['projectList'] as $aKey => $projectData) {
         $selected = '';
         if ($projectData['projectDefault'] == 1) {
             $selected = 'selected="selected"';
         }
         $html[] = '<option value="' . $projectData['projectID'] . '" ' . $selected . '>' . \App\Tool::removeSchemeFromURL($projectData['projectURL']) . '</option>';
     }
     $this->viewData['projectList'] = implode("\n", $html);
 }
示例#2
0
 public function generateList()
 {
     $html = [];
     foreach ($this->modelData['projects'] as $projectID => $projectData) {
         $html[] = '<tr class="p' . $projectData['projectID'] . '">';
         $html[] = '<td>' . \App\Tool::removeSchemeFromURL($projectData['projectURL']) . '</td>';
         $html[] = '<td>' . \App\Tool::removeSchemeFromURL($projectData['projectCompetition']) . '</td>';
         $html[] = '<td>' . $projectData['projectsKeywordCount'] . '</td>';
         $html[] = '<td>' . $projectData['projectAdded'] . '</td>';
         $html[] = '<td><a href="/projects/edit/' . $projectData['projectID'] . '/"><i class="fa fa-edit projectEdit"></i></a></td>';
         $html[] = '<td><i data-pid="' . $projectData['projectID'] . '" class="fa fa-remove projectRemove"></i></td>';
         $html[] = '</tr>';
     }
     $this->viewData['projectsTable'] = implode("\n", $html);
 }
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create(Request $request)
 {
     $data = Tool::removeSpace($request->all());
     $validator = Validator::make($data, ["hora_prueba" => "required|valid_time", "duración_prueba" => "required|valid_minute"]);
     $toArray = $validator->errors()->toArray();
     if ($validator->fails()) {
         return redirect()->back()->withInput()->withErrors($validator->errors());
     }
     $chedumalTrial = Settings::where('field', '=', 'Schedumal_trial')->first();
     $durationTrial = Settings::where('field', '=', 'Duration_trial')->first();
     if ($chedumalTrial->value != $data['hora_prueba']) {
         DB::table('rb_settings')->where('field', 'Schedumal_trial')->update(['value' => $data['hora_prueba']]);
     }
     if ($durationTrial->value != $data['duración_prueba']) {
         DB::table('rb_settings')->where('field', 'Duration_trial')->update(['value' => $data['duración_prueba']]);
     }
     return $this->index();
 }
 public function getProjectList()
 {
     $html = [];
     $currentParentCounter = 0;
     foreach ($this->projectArray as $pArrayKey => $projectData) {
         if ($projectData['projectURL'] != $projectData['parentURL']) {
             $html[] = '<li>';
             $html[] = '<a href="/projects/select/' . $projectData['projectID'] . '/"><i class="fa fa-caret-right"></i> <strong>' . \App\Tool::removeSchemeFromURL($projectData['parentURL']) . '</strong> <i class="fa fa-caret-right"></i> ' . \App\Tool::removeSchemeFromURL($projectData['projectURL']) . '</a>';
             $html[] = '</li>';
         } else {
             if ($currentParentCounter > 0) {
                 $html[] = '<li class="divider"></li>';
             }
             $html[] = '<li>';
             $html[] = '<a href="/projects/select/' . $projectData['projectID'] . '/"><i class="fa fa-caret-right"></i> <strong>' . \App\Tool::removeSchemeFromURL($projectData['projectURL']) . '</strong></a>';
             $html[] = '</li>';
             $currentParentCounter++;
         }
     }
     return implode("\n", $html);
 }
 public function getCurrentProjectName()
 {
     return \App\Tool::removeSchemeFromURL($this->currentProjectArray['projectURL']);
 }
示例#6
0
 public function loadProjectData()
 {
     $this->viewData['projectData'] = $this->modelData['projectData'];
     $this->viewData['projectData']['currentProjectURL'] = \App\Tool::removeSchemeFromURL($this->viewData['projectData']['currentProjectURL']);
 }
示例#7
0
 public function update(Request $request, $id)
 {
     $input = $request->all();
     $project = Publish::find($id);
     $project->update(['user_id' => Auth::user()->id, 'category_id' => $input['category_id'], 'title' => $input['title'], 'desc' => $input['desc'], 'content' => $input['content'], 'url' => $input['url']]);
     if (isset($input['background_image'])) {
         $file = base_path() . '/public/assets/images/projects/' . $project->id . '/cover.jpg';
         $img = Image::make($input['background_image']);
         $img->save($file);
     }
     $project->cover->update(['name' => $input['background_image_name']]);
     $tools = explode('_', $input['tags']);
     $project->tools->each(function ($item, $key) {
         $item->tool->delete();
         $item->delete();
     });
     if ($tools[0] != '') {
         foreach ($tools as $tool) {
             $tool = Tool::create(['term' => $tool]);
             PublishTool::create(['publish_id' => $project->id, 'tool_id' => $tool->id]);
         }
     }
     return redirect()->route('projects');
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit(Request $request)
 {
     $data = Tool::removeSpace($request->all());
     return Challenge::find($data['id']);
 }
 public function createUser(Request $request)
 {
     $data = Tool::removeSpace($request->all());
     if ($request->id) {
         $validator = Validator::make($data, ["Rol" => "required", "Nombre" => "required|alpha_space", "Apellido_paterno" => "required|alpha", "Apellido_materno" => "required|alpha", "Password" => "required"]);
         $validatorTwo = Validator::make($data['varia'], ["Escenario 1" => "required", "Reto 1" => "required", "Escenario 2" => "required", "Reto 2" => "required"]);
     } else {
         $validator = Validator::make($data, ["Rol" => "required", "Nombre" => "required|alpha_space", "Apellido_paterno" => "required|alpha", "Apellido_materno" => "required|alpha", "Usuario" => "required|unique:rb_users,username", "Password" => "required"]);
         $validatorTwo = Validator::make($data['varia'], ["Escenario 1" => "required", "Reto 1" => "required", "Escenario 2" => "required", "Reto 2" => "required"]);
     }
     $error = $validator->errors()->toArray();
     $error += $validatorTwo->errors()->toArray();
     if ($validator->fails() || $validatorTwo->fails()) {
         return response()->json(['success' => false, 'errors' => $error]);
     } else {
         DB::beginTransaction();
         try {
             if ($request->id) {
                 $user = User::find($request->id);
                 $user->name = $data['Nombre'];
                 $user->last_name = $data['Apellido_paterno'];
                 $user->last_name_m = $data['Apellido_materno'];
                 $user->password = bcrypt($data['Password']);
                 $user->password_two = base64_encode($data['Password']);
                 $user->save();
                 $stage = RelationUseSta::where('user_id', '=', $request->id)->first();
                 $stage->challenge_id_1 = $data['varia']['Reto 1'];
                 $stage->challenge_id_2 = $data['varia']['Reto 2'];
                 $stage->stage_id_1 = $data['varia']['Escenario 1'];
                 $stage->stage_id_2 = $data['varia']['Escenario 2'];
                 $stage->save();
             } else {
                 $user = User::create(['role_id' => $data['Rol'], 'name' => $data['Nombre'], 'last_name' => $data['Apellido_paterno'], 'last_name_m' => $data['Apellido_materno'], 'username' => $data['Usuario'], 'password' => bcrypt($data['Password']), 'password_two' => base64_encode($data['Password'])]);
                 RelationUseSta::create(['user_id' => $user->id, 'challenge_id_1' => $data['varia']['Reto 1'], 'challenge_id_2' => $data['varia']['Reto 2'], 'stage_id_1' => $data['varia']['Escenario 1'], 'stage_id_2' => $data['varia']['Escenario 2']]);
             }
         } catch (\Exception $e) {
             DB::rollback();
         }
         DB::commit();
         return response()->json(['success' => true, 'errors' => $error]);
     }
 }
 public function taekFirm(Request $request)
 {
     //dd($request->all());
     $data2 = Tool::removeSpace($request->all());
     $validator = Validator::make($data2, ["firma_equipo_uno" => "required|integer", "firma_equipo_dos" => "required|integer"]);
     //dd($request->team_id_1.'   -----  '.$request->firma_equipo_uno);
     $data1 = $this->evalFirmsTeam($request->team_id_1, $request->firma_equipo_uno);
     $data2 = $this->evalFirmsTeam($request->team_id_2, $request->firma_equipo_dos);
     //dd($data1.'  ----------  '.$data2);
     $toArray = $validator->errors()->toArray();
     if ($validator->fails()) {
         return response()->json(['success' => false, 'errors' => $toArray]);
     } else {
         if ($data1 != true) {
             return response()->json(['success' => false, 'errors' => [0 => 'El campo firma equipo uno no coincide']]);
         } else {
             if ($data2 != true) {
                 return response()->json(['success' => false, 'errors' => [0 => 'El campo firma equipo dos no coincide']]);
             } else {
                 Taekwondo::create(['team_id_win' => $request->win, 'team_id_1' => $request->team_id_1, 'score_team_1' => $request->score_equipo_1, 'drop_team_1' => $request->caidas_equipo_1, 'firm_team_1' => $request->firma_equipo_uno, 'team_id_2' => $request->team_id_2, 'score_team_2' => $request->score_equipo_2, 'drop_team_2' => $request->caidas_equipo_2, 'firm_team_2' => $request->firma_equipo_dos]);
             }
         }
     }
 }
 public function update(Request $request)
 {
     $data = Tool::removeSpace($request->all());
     if ($data['id']) {
     } else {
         $ins = new Institution();
         $ins->name = $data['nombre'];
         $ins->user_id = 1;
         if (isset($data['Tipo'][0])) {
             $r = $this->returnType($data['Tipo'][0]);
             $ins->{$r} = true;
         }
         if (isset($data['Tipo'][1])) {
             $r = $this->returnType($data['Tipo'][1]);
             $ins->{$r} = true;
         }
         if (isset($data['Tipo'][2])) {
             $r = $this->returnType($data['Tipo'][2]);
             $ins->{$r} = true;
         }
         $ins->country_id = $data['País'];
         $ins->state_id = $data['Estado'];
         $ins->city_id = $data['Ciudad'];
         $ins->save();
         $country = [];
         $country += ['' => '-- Selecciona Pais --'];
         $country += Country::lists('name', 'id')->toArray();
         $insti = $this->pagination();
         return view('institutions.index', compact('insti', 'country'));
     }
 }