/** * 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; }
/** * Declares an association between this object and a ChildApplication object. * * @param ChildApplication $v * @return $this|\App\Models\ApplicationRequest The current object (for fluent API support) * @throws PropelException */ public function setApplication(ChildApplication $v = null) { if ($v === null) { $this->setApplicationId(NULL); } else { $this->setApplicationId($v->getId()); } $this->aApplication = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the ChildApplication object, it will not be re-added. if ($v !== null) { $v->addApplicationRequest($this); } return $this; }
/** * 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'); } }