/** * Store a newly created resource in storage. * * @return Response */ public function store(ApplicationRequest $request) { $data = $request->all(); if (isset($data['OralExamInvitationId']) && $data['OralExamInvitationId'] == '') { unset($data['OralExamInvitationId']); } $application = new Application(); $application->fromArray($data); $application->save(); flash()->success("ADDED"); session(['attribute' => \Lang::get('general.APPLICATION')]); return redirect($this->main_page); }
function createFeedback(FeedbackRequest $request) { // Double check to make sure the current user is authorized to do this... $this->authorize('create-feedback'); $input = $request->all(); // Check application ID $application = Application::find($input['application_id']); // Check regarding ID / type, Note, nothing to be done for 'general' feedback if ($input['regarding_type'] == 'question') { $regarding = Question::find($input['regarding_id']); } elseif ($input['regarding_type'] == 'document') { // todo } // Create new feedback $feedback = new Feedback(); $feedback->application_id = $application->id; $feedback->regarding_type = $input['regarding_type']; if (isset($regarding) && $regarding->exists) { $feedback->regarding_id = $regarding->id; } // Set the current judge ID for a record of who requested this feedback $feedback->user_id = Auth::user()->id; $feedback->save(); $feedback->update($input); // Notify applicant of new feedback requested event(new FeedbackChanged($feedback, ['status' => 'created'])); $request->session()->flash('success', 'Your feedback has been requested.'); return redirect('/applications/' . $application->id . '/review'); }
/** * Store a newly created resource in storage. * * @return Response */ public function postStore(Request $request) { $input = $request->all(); // return ($input['Administrative']); DB::beginTransaction(); $apps = Application::create($input['REGISTRANT']); $input['Administrative']['registrant_id'] = $apps->id; $input['Technical']['registrant_id'] = $apps->id; if ($request->hasFile("image1")) { $destinationPath = 'uploads/a/'; $fileName = time() . "-" . $request->file('image1')->getClientOriginalName(); $request->file('image1')->move($destinationPath, $fileName); $input['Administrative']['image'] = $fileName; } if ($request->hasFile('image2')) { $destinationPath = 'uploads/t/'; $fileName = time() . "-" . $request->file('image2')->getClientOriginalName(); $request->file('image2')->move($destinationPath, $fileName); $input['Technical']['image'] = $fileName; } return 1; Administrative::create($input['Administrative']); Technical::create($input['Technical']); DB::commit(); return redirect()->back()->withSuccess('Application Submitted Successfully'); }
public function getDeleteApplication($id) { DB::beginTransaction(); Application::where('id', $id)->delete(); Administrative::where('registrant_id', $id)->delete(); Technical::where('registrant_id', $id)->delete(); DB::commit(); }
public function getHackersWithRating() { $hackers = []; foreach (Application::where("team_id", $this->id)->get() as $app) { $hacker = User::with('application', 'application.ratings', 'application.school')->find($app->user_id); $hacker['application']['ratinginfo'] = $hacker->application->ratingInfo(); $hackers[] = $hacker; } return $hackers; }
public function home() { if ($this->auth->check()) { if (in_array($this->auth->user()->role, ['judge', 'observer'])) { $applications = Application::whereIn('status', ['submitted', 'review'])->get(); } else { $applications = $this->auth->user()->applications; } return view('pages/dashboard', compact('applications')); } else { return view('pages/home'); } }
public function getApplication() { $application = Application::with('school', 'team', 'ratings', 'notes')->firstOrCreate(['user_id' => $this->id]); if (!$application->team_id) { //assign them to a team of 1 in lieu of no team $team = new Team(); $team->code = md5(Carbon::now() . getenv("APP_KEY")); $team->save(); $application->team_id = $team->id; } $application->save(); $application->teaminfo = $application->team; $application->schoolinfo = $application->school; return $application; }
/** * Update the user's application form. * * @param ApplicationRequest $request * @return \Illuminate\Http\RedirectResponse */ public function update(ApplicationRequest $request) { if ($request->has('id')) { $application = Application::where('id', $request->has('id'))->first(); if ($application->status != 'PENDING') { return redirect()->back()->with(['notice' => Lang::get('user.application_stop_edit')]); } if ($application->user_id == Auth::user()->id) { $this->repository->update($request->all()); return redirect()->route('user.account')->with(['notice' => Lang::get('user.application_updated')]); } return redirect()->back()->with(['notice' => Lang::get('user.application_cannot_edit')]); } return redirect()->back()->with(['notice' => Lang::get('user.application_cannot_edit')]); }
public function updateAnswer(AnswerRequest $request, Answer $answer) { $input = $request->all(); $application = Application::find($input['application_id']); if ($answer->user->id != Auth::user()->id) { $request->session()->flash('error', 'Only the person who created an application may answer questions for it.'); return redirect('/login'); } if ($answer->application->status != 'new') { $request->session()->flash('error', 'Your application has been submitted, you may no longer make changes.'); return redirect('/applications/' . $application->id . '/review'); } $answer->update($input); // Check if a file needs to be uploaded if ($answer->question->type == 'file') { // Save uploaded file $upload = Document::handleUpload($request); // Save new document Document::createDocument($application, $upload, $answer); } $request->session()->flash('success', 'Your answer has been saved.'); return redirect('/applications/' . $answer->application->id); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { Application::find($id)->delete(); return redirect('applications'); }
/** * Update an application form. * * @param array $attributes * @return mixed */ public function update($attributes = array()) { Application::where('id', $attributes['id'])->first()->update($attributes); }
public function getMentorsPrint(Request $request) { $applications = Application::where('status', "accepted")->orderBy('name')->get(); $mentors = Mentor::orderBy('name')->get(); return view('print.mentors', compact('applications', 'mentors')); }
/** * Filter the query by a related \App\Models\Application object * * @param \App\Models\Application|ObjectCollection $application The related object(s) to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @throws \Propel\Runtime\Exception\PropelException * * @return ChildApplicationRequestQuery The current query, for fluid interface */ public function filterByApplication($application, $comparison = null) { if ($application instanceof \App\Models\Application) { return $this->addUsingAlias(ApplicationRequestTableMap::COL_APPLICATION_ID, $application->getId(), $comparison); } elseif ($application instanceof ObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this->addUsingAlias(ApplicationRequestTableMap::COL_APPLICATION_ID, $application->toKeyValue('PrimaryKey', 'Id'), $comparison); } else { throw new PropelException('filterByApplication() only accepts arguments of type \\App\\Models\\Application or Collection'); } }
/** * Filter the query by a related \App\Models\Application object * * @param \App\Models\Application|ObjectCollection $application the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildSubjectQuery The current query, for fluid interface */ public function filterByApplication($application, $comparison = null) { if ($application instanceof \App\Models\Application) { return $this->addUsingAlias(SubjectTableMap::COL_ID, $application->getSubjectId(), $comparison); } elseif ($application instanceof ObjectCollection) { return $this->useApplicationQuery()->filterByPrimaryKeys($application->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByApplication() only accepts arguments of type \\App\\Models\\Application or Collection'); } }
/** * @return \yii\db\ActiveQuery */ public function getApplication() { return $this->hasOne(Application::className(), ['id' => 'idApplication']); }
public function getApplication($id) { $user = Auth::user(); if (!Auth::user()->hasRole('exec')) { //TODO middleware perhaps? return; } $app = Application::with('user', 'school', 'team', 'notes.user')->find($id); $app->resumeURL = GeneralController::resumeUrl($app->user->id, 'get'); $app->myrating = ApplicationRating::where('application_id', $id)->where('user_id', $user->id)->first(); $app->github_summary = $app->getGithubSummary(); return $app; }
/** * @param ChildApplication $application The ChildApplication object to add. */ protected function doAddApplication(ChildApplication $application) { $this->collApplications[] = $application; $application->setSchoolYear($this); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $person = Address::find($id); $applications_version = array(); $applications = Application::lists('name', 'id'); foreach ($applications as $id => $application) { $versions = Version::where('application_id', $id)->orderBy('id', 'desc')->get(); foreach ($versions as $id => $version) { $applications_version = array($version->id => $application . ' - ' . $version->name) + $applications_version; } } return view('persons.edit', array('person' => $person, 'applications_version' => $applications_version)); }
/** * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). */ public function clear() { if (null !== $this->aApplication) { $this->aApplication->removeApplicationRequest($this); } $this->id = null; $this->application_id = null; $this->description = null; $this->response = null; $this->created_at = null; $this->updated_at = null; $this->alreadyInSave = false; $this->clearAllReferences(); $this->resetModified(); $this->setNew(true); $this->setDeleted(false); }
public function leaveCurrentTeam() { $app = self::getApplication()['application']; $old_team_id = $app->team_id; $app->team_id = null; $app->save(); if (Application::where("team_id", $old_team_id)->get()->count() == 0) { //we don't want empty teams Team::find($old_team_id)->delete(); } return ['ok']; }
function denyApplication(Application $application, Request $request) { // Check if current user has permission $this->authorize('approve-application'); $application->status = 'rejected'; $application->judge_status = 'finalized'; $application->save(); // Send notification to judges and applicant event(new ApplicationChanged($application)); $request->session()->flash('success', 'This application has been denied.'); return redirect('/applications'); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $version = Version::find($id); $applications = Application::lists('name', 'id'); return view('versions.edit', array('version' => $version, 'applications' => $applications)); }
/** * Exclude object from result * * @param ChildApplication $application Object to remove from the list of results * * @return $this|ChildApplicationQuery The current query, for fluid interface */ public function prune($application = null) { if ($application) { $this->addUsingAlias(ApplicationTableMap::COL_ID, $application->getId(), Criteria::NOT_EQUAL); } return $this; }
/** * Display a listing of the resource. * * @return Response */ public function index(Request $request) { $storage_path = storage_path(); $sms_request = $request->all(); $phone_number = $sms_request['sender']; $description = json_encode($sms_request); $student = StudentQuery::retrieveByPhoneNumber($phone_number); if (is_null($student)) { $msg_text = 'Niste registrovani. Kontaktirajte administratora PMF-a.'; //$this->sendSms($phone_number, $msg_text, $description); exit; } if ($sms_request['sms_prefix'] !== 'PRIJAVA_ISPITA') { $msg_text = "Nepostojeca komanda! Za prijavu ispita poslati: ‘PRIJAVA_ISPITA <šifra_predmeta> <ispitni_rok>'"; $this->sendSms($phone_number, $msg_text, $description); exit; } $fullsms = explode(" ", $sms_request['fullsms']); $subject_code = isset($fullsms[1]) ? $fullsms[1] : null; $period_name = isset($fullsms[2]) ? $fullsms[2] : null; if (!isset($subject_code) && !isset($period_name)) { $msg_text = 'Doslo je do greske, proverite unete podatke.'; $this->sendSms($phone_number, $msg_text, $description); exit; } $subject = SubjectQuery::retrieveByCode($subject_code); if (is_null($subject)) { $msg_text = 'Nepostojeca šifra predmeta.'; $this->sendSms($phone_number, $msg_text, $description); exit; } $period = $this->getPeriodIdByName($period_name); if (is_null($period)) { $msg_text = 'Ispitni rok ne postoji'; $this->sendSms($phone_number, $msg_text, $description); exit; } $school_year_id = $this->getSchoolYearIdByDate(); $periodSchoolYear = PeriodSchoolYearQuery::create()->findPk([$period->getId(), $school_year_id]); if (is_null($periodSchoolYear)) { $msg_text = 'Ispitni rok ne postoji'; $this->sendSms($phone_number, $msg_text, $description); exit; } $studyProgram = StudyProgramQuery::create()->findPk([$subject->getId(), $student->getCourseId()]); if (is_null($studyProgram)) { $msg_text = 'Ovaj predmet nije u vašem studijskom programu.'; $this->sendSms($phone_number, $msg_text, $description); exit; } $msg_text = $this->allowedToApply($student->getId(), $subject, $period->getId(), $school_year_id); if ($msg_text !== null) { $this->sendSms($phone_number, $msg_text, $description); exit; } $application = new Application(); $application->setStudentId($student->getId()); $application->setSubjectId($subject->getId()); $application->setPeriodId(8); $application->setSchoolYearId(8); $application->setApplicationDate(date('Y-m-d')); $application->save(); $msg_text = 'Uspesno ste prijavili ispit.'; $this->sendSms($phone_number, $msg_text, $description, $application->getId()); exit; }
/** * @param ChildApplication $application The ChildApplication object to add. */ protected function doAddApplication(ChildApplication $application) { $this->collApplications[] = $application; $application->setStudent($this); }
public function recalcScores(Request $request) { $this->authorize('recalculate-scores'); $applications = Application::whereIn('status', ['submitted', 'review'])->get(); foreach ($applications as $application) { Score::calculateTotals($application); } $request->session()->flash('success', 'Scores Recalculated.'); return redirect('applications/'); }
/** * @return \yii\db\ActiveQuery */ public function getApplications() { return $this->hasMany(Application::className(), ['idCompany' => 'idUser']); }
/** * 撤销选课申请 * @author FuRongxin * @date 2016-02-23 * @version 2.0 * @param string $kcxh 12位课程序号 * @return \Illuminate\Http\Response 选课申请列表 */ public function destroy($kcxh) { $app = Application::whereXh(Auth::user()->xh)->whereNd(session('year'))->whereXq(session('term'))->whereKcxh($kcxh)->firstOrFail(); $app->delete(); return back()->withStatus('撤销课程申请成功'); }