/** * Returns the next examination number for the given school year. * * @param SchoolYear $school_year A school year. * @return integer The next examation number. */ public static function getNextExaminationNumberFor(SchoolYear $school_year) { $c = new Criteria(); $c->add(self::SCHOOL_YEAR_ID, $school_year->getId()); $c->addDescendingOrderByColumn(self::EXAMINATION_NUMBER); $obj = self::doSelectOne($c); return $obj->getExaminationNumber() + 1; }
public static function countNotClosedExaminationSubjectsFor(SchoolYear $school_year, PropelPDO $con = null) { $con = is_null($con) ? Propel::getConnection() : $con; $c = new Criteria(); $c->add(ExaminationPeer::SCHOOL_YEAR_ID, $school_year->getId()); $c->addJoin(ExaminationSubjectPeer::EXAMINATION_ID, ExaminationPeer::ID); $c->add(ExaminationSubjectPeer::IS_CLOSED, false); return ExaminationSubjectPeer::doCount($c, $con); }
public static function countExaminationRepprovedWithoutSubjects(SchoolYear $school_year, $type, PropelPDO $con = null) { $con = is_null($con) ? Propel::getConnection() : $con; $c = new Criteria(); $c->add(ExaminationRepprovedPeer::SCHOOL_YEAR_ID, $school_year->getId()); $c->addJoin(ExaminationRepprovedSubjectPeer::EXAMINATION_REPPROVED_ID, ExaminationRepprovedPeer::ID, Criteria::RIGHT_JOIN); $c->add(ExaminationRepprovedSubjectPeer::ID, null, Criteria::ISNULL); return ExaminationRepprovedPeer::doCount($c, $con); }
public static function retrieveComissionsForSchoolYearCriteria(SchoolYear $school_year) { $c = new Criteria(); $c->add(CareerSchoolYearPeer::SCHOOL_YEAR_ID, $school_year->getId()); $c->addJoin(CareerSchoolYearPeer::ID, CareerSubjectSchoolYearPeer::CAREER_SCHOOL_YEAR_ID); $c->addJoin(CourseSubjectPeer::CAREER_SUBJECT_SCHOOL_YEAR_ID, CareerSubjectSchoolYearPeer::ID); $c->addJoin(CourseSubjectPeer::COURSE_ID, CoursePeer::ID); $c->add(CoursePeer::DIVISION_ID, null, Criteria::ISNULL); return $c; }
/** * Execute the console command. * * @return mixed */ public function handle() { $users = User::where('type', 'ecole')->get(); foreach ($users as $user) { $sc = SchoolYear::where('user_id', $user->id)->where('current', 1)->first(); if ($sc) { if ($sc->type == 'Semis' && $sc->endch2 < Carbon::now()->toDateString() || $sc->type == 'Trim' && $sc->endch3 < Carbon::now()->toDateString()) { foreach ($user->families as $famille) { $f = Family::where('email_responsable', $famille->email_responsable)->where('school_year_id', $sc->id)->first(); if ($f) { $f->email_responsable = $sc->ann_scol . $f->email_responsable; $f->cin = $sc->cin . $f->cin; $f->save(); $fu = User::where('type', 'famille')->where('email', substr($f->email_responsable, 9))->first(); if ($fu) { $fu->email = $sc->ann_scol . $fu->email; $fu->save(); } } } $sc->current = 0; $sc->save(); $ynow = Carbon::now()->year; $ynext = Carbon::now()->year + 1; $yes = SchoolYear::where('user_id', $user->id)->where('ann_scol', $ynow . '-' . $ynext)->first(); if ($yes) { $yes->current = 1; $yes->save(); } } } } }
/** * Execute the console command. * * @return mixed */ public function handle() { $users = User::where('type', 'ecole')->get(); foreach ($users as $user) { $sc = SchoolYear::where('user_id', $user->id)->where('current', 1)->first(); if ($sc) { if ($sc->type == 'Semis' && $sc->endch2 < Carbon::now()->toDateString() || $sc->type == 'Trim' && $sc->endch3 < Carbon::now()->toDateString()) { $sc->current = 0; $sc->save(); $ynow = Carbon::now()->year; $ynext = Carbon::now()->year + 1; $yes = SchoolYear::where('user_id', $user->id)->where('ann_scol', $ynow . '-' . $ynext)->first(); if ($yes) { $yes->current = 1; $yes->save(); } } } } }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. */ public function loadModel() { if ($this->_model === null) { if (isset($_GET['id'])) { $this->_model = SchoolYear::model()->findbyPk($_GET['id']); } if ($this->_model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } } return $this->_model; }
?> <?php echo $form->checkbox($model, 'minimum'); ?> <?php echo $form->error($model, 'minimum'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'school_year_id'); ?> <?php echo $form->dropDownList($model, 'school_year_id', CHtml::listData(SchoolYear::model()->findAll(), 'id', 'description')); ?> <?php echo $form->error($model, 'school_year_id'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'note'); ?> <?php echo $form->textField($model, 'note', array('size' => 60, 'maxlength' => 256)); ?> <?php echo $form->error($model, 'note');
<?php header('refresh: 3; url = ../index.php'); //header('Location: ../index.php'); session_start(); require_once "../libraries/classes/config.php"; require_once "../libraries/classes/clsSchoolYear.php"; require_once "../libraries/classes/clsCandidate.php"; require_once "../libraries/classes/clsPosition.php"; require_once "../libraries/classes/clsVoter.php"; $studentID = $_SESSION["studentID"]; $programID = $_SESSION["programID"]; $voter = new Voter(); $schoolYear = new SchoolYear(); $currentSY = $schoolYear->getCurrentSchoolYear(); $candidate = new Candidate(); $ssgCandidate = $candidate->getSSGCandidates(); $programCandidate = $candidate->getProgramCandidates($programID); $position = new Position(); $ssgPosition = $position->getPosition(1); $programPosition = $position->getPosition(2); $ctr = 0; /*This line displays list of voted candidates from the SSG executive positions*/ //echo "-----------------------------------------------SSG Executive-----------------------------------------------<br>"; for ($pos_y = 0; $pos_y < count($position->getPosition(1)); $pos_y++) { if (isset($_POST[$ssgPosition[$pos_y]["posID"]])) { for ($cand_x = 0; $cand_x < count($candidate->getSSGCandidates()); $cand_x++) { if ($_POST[$ssgPosition[$pos_y]["posID"]] == $ssgCandidate[$cand_x]["candID"]) { /* echo $ssgPosition[$pos_y]["posName"].": "; echo $ssgCandidate[$cand_x]["lname"].", ".$ssgCandidate[$cand_x]["fname"];
/** * This method returns all the divisions of the SchoolYear passed fot the student given * * @param Student $student * @param SchoolYear $school_year * @return <array> Division */ public static function retrieveStudentSchoolYearDivisions($school_year, $student) { $criteria = new Criteria(); $criteria->add(CareerSchoolYearPeer::SCHOOL_YEAR_ID, $school_year->getId()); $criteria->addJoin(self::CAREER_SCHOOL_YEAR_ID, CareerSchoolYearPeer::ID); $criteria->addJoin(self::ID, DivisionStudentPeer::DIVISION_ID); $criteria->add(DivisionStudentPeer::STUDENT_ID, $student->getId()); $criteria->addAscendingOrderByColumn(self::YEAR); return self::doSelect($criteria); }
/** * Execute the console command. * * @return mixed */ public function handle() { if (Carbon::now()->toDateString() == Carbon::now()->startOfMonth()->toDateString()) { $users = User::where('type', 'ecole')->get(); foreach ($users as $user) { $sc = SchoolYear::where('user_id', $user->id)->where('current', 1)->first(); if ($sc->type == 'Semis' && Carbon::now()->between($sc->startch1, $sc->endch2)) { foreach ($user->children as $child) { foreach ($child->bills as $bill) { $getChild = Bill::where('child_id', $bill->child_id)->where('reduction', 1)->where('school_year_id', $sc->id)->orderBy('id', 'desc')->where('nbrMois', 1)->first(); if ($getChild) { $facture = new Bill(); $facture->start = $getChild->end->toDateString(); $facture->end = $getChild->end->addMonth()->toDateString(); $facture->status = 0; $facture->user_id = $getChild->user_id; $facture->nbrMois = $getChild->nbrMois; $facture->reductionPrix = $getChild->reductionPrix; $facture->school_year_id = $getChild->school_year_id; $facture->reduction = 1; $enfant = Child::where('user_id', $getChild->user_id)->where('id', $getChild->child_id)->first(); $taman = ''; if ($getChild->reduction == 1) { if ($enfant->transport == 1) { foreach ($enfant->levels as $level) { $getPriceOfLevel = PriceBill::where('niveau', $level->id)->where('user_id', $getChild->user_id)->first(); $taman = $getPriceOfLevel->prix; } $facture->somme = $taman - $getChild->reductionPrix + Transport::where('user_id', $getChild->user_id)->first()->somme; } elseif ($enfant->transport == 0) { foreach ($enfant->levels as $level) { $getPriceOfLevel = PriceBill::where('niveau', $level->id)->where('user_id', $getChild->user_id)->first(); $taman = $getPriceOfLevel->prix; } $facture->somme = $taman - $getChild->reductionPrix; } } $facture->child_id = $getChild->child_id; $facture->f_id = $getChild->f_id; $facture->save(); break; } } } } elseif ($sc->type == 'Trim' && Carbon::now()->between($sc->startch1, $sc->endch3)) { foreach ($user->children as $child) { foreach ($child->bills as $bill) { $getChild = Bill::where('child_id', $bill->child_id)->where('reduction', 1)->where('school_year_id', $sc->id)->where('nbrMois', 1)->orderBy('id', 'desc')->first(); if ($getChild) { $facture = new Bill(); $facture->start = $getChild->end->toDateString(); $facture->end = $getChild->end->addMonth()->toDateString(); $facture->status = 0; $facture->user_id = $getChild->user_id; $facture->nbrMois = $getChild->nbrMois; $facture->reductionPrix = $getChild->reductionPrix; $facture->school_year_id = $getChild->school_year_id; $facture->reduction = 1; $enfant = Child::where('user_id', $getChild->user_id)->where('id', $getChild->child_id)->first(); $taman = ''; if ($getChild->reduction == 1) { if ($enfant->transport == 1) { foreach ($enfant->levels as $level) { $getPriceOfLevel = PriceBill::where('niveau', $level->id)->where('user_id', $getChild->user_id)->first(); $taman = $getPriceOfLevel->prix; } $facture->somme = $taman - $getChild->reductionPrix + Transport::where('user_id', $getChild->user_id)->first()->somme; } elseif ($enfant->transport == 0) { foreach ($enfant->levels as $level) { $getPriceOfLevel = PriceBill::where('niveau', $level->id)->where('user_id', $getChild->user_id)->first(); $taman = $getPriceOfLevel->prix; } $facture->somme = $taman - $getChild->reductionPrix; } } $facture->child_id = $getChild->child_id; $facture->f_id = $getChild->f_id; $facture->save(); break; } } } } } } }
/** * Returns the next examination number for the given school year. * * @param SchoolYear $school_year A school year. * @return integer The next examation number. */ public static function getNextExaminationNumberFor(SchoolYear $school_year) { $c = new Criteria(); $c->add(self::SCHOOL_YEAR_ID, $school_year->getId()); return self::doCount($c) + 1; }
/** * Execute the console command. * * @return mixed */ public function handle() { $users = User::where('type', 'ecole')->get(); foreach ($users as $user) { $sc = SchoolYear::where('user_id', $user->id)->where('current', 1)->first(); if ($sc->type == 'Semis' && Carbon::now()->between($sc->startch1, $sc->endch2)) { foreach ($user->children as $child) { foreach ($child->bills as $bill) { $getChild = Bill::where('child_id', $bill->child_id)->where('reduction', 0)->where('school_year_id', $sc->id)->where('nbrMois', 3)->orderBy('id', 'desc')->first(); if ($getChild) { // give us from the end of bill to 3 months ahead $fromStartToNbrMois = $getChild->end->addMonths($getChild->nbrMois); if ($fromStartToNbrMois <= $sc->endch2) { if (Carbon::now() >= $getChild->end) { $facture = new Bill(); $facture->start = $getChild->end->toDateString(); $facture->end = $getChild->end->addMonths($getChild->nbrMois)->toDateString(); $facture->status = 0; $facture->user_id = $getChild->user_id; $facture->nbrMois = $getChild->nbrMois; $facture->reductionPrix = null; $facture->school_year_id = $getChild->school_year_id; $facture->reduction = 0; $enfant = Child::where('user_id', $getChild->user_id)->where('id', $getChild->child_id)->first(); $taman = ''; if ($getChild->reduction == 0) { if ($enfant->transport == 1) { foreach ($enfant->levels as $level) { $getPriceOfLevel = PriceBill::where('niveau', $level->id)->where('user_id', $getChild->user_id)->first(); $taman = $getPriceOfLevel->prix; } $TotalOnMonths = $taman * $getChild->nbrMois; $total_transport = Transport::where('user_id', $getChild->user_id)->first()->somme * $getChild->nbrMois; $prix_finale = $TotalOnMonths + $total_transport; $facture->somme = $prix_finale; } elseif ($enfant->transport == 0) { foreach ($enfant->levels as $level) { $getPriceOfLevel = PriceBill::where('niveau', $level->id)->where('user_id', $getChild->user_id)->first(); $taman = $getPriceOfLevel->prix; } $prix_finale = $taman * $getChild->nbrMois; $facture->somme = $prix_finale; } } $facture->child_id = $getChild->child_id; $facture->f_id = $getChild->f_id; $facture->save(); break; } } elseif ($fromStartToNbrMois > $sc->endch2) { $last_bill = Bill::where('child_id', $getChild->child_id)->where('reduction', 0)->where('school_year_id', $sc->id)->where('nbrMois', 1)->orderBy('id', 'desc')->first(); if (!$last_bill && Carbon::now() > $getChild->end) { $facture = new Bill(); $facture->start = $getChild->end->toDateString(); $facture->end = $getChild->end->addMonths(1)->toDateString(); $facture->status = 0; $facture->user_id = $getChild->user_id; $facture->nbrMois = 1; $facture->reductionPrix = null; $facture->school_year_id = $getChild->school_year_id; $facture->reduction = 0; $enfant = Child::where('user_id', $getChild->user_id)->where('id', $getChild->child_id)->first(); $taman = ''; if ($getChild->reduction == 0) { if ($enfant->transport == 1) { foreach ($enfant->levels as $level) { $getPriceOfLevel = PriceBill::where('niveau', $level->id)->where('user_id', $getChild->user_id)->first(); $taman = $getPriceOfLevel->prix; } $TotalOnMonths = $taman * 1; $total_transport = Transport::where('user_id', $getChild->user_id)->first()->somme * 1; $prix_finale = $TotalOnMonths + $total_transport; $facture->somme = $prix_finale; } elseif ($enfant->transport == 0) { foreach ($enfant->levels as $level) { $getPriceOfLevel = PriceBill::where('niveau', $level->id)->where('user_id', $getChild->user_id)->first(); $taman = $getPriceOfLevel->prix; } $prix_finale = $taman * 1; $facture->somme = $prix_finale; } } $facture->child_id = $getChild->child_id; $facture->f_id = $getChild->f_id; $facture->save(); break; } } } } } } elseif ($sc->type == 'Trim' && Carbon::now()->between($sc->startch1, $sc->endch3)) { foreach ($user->children as $child) { foreach ($child->bills as $bill) { $getChild = Bill::where('child_id', $bill->child_id)->where('reduction', 0)->where('school_year_id', $sc->id)->where('nbrMois', 3)->orderBy('id', 'desc')->first(); if ($getChild) { // give is from the end of bill to 3 months ahead $fromStartToNbrMois = $getChild->end->addMonths($getChild->nbrMois); if ($fromStartToNbrMois <= $sc->endch3) { if (Carbon::now() >= $getChild->end) { $facture = new Bill(); $facture->start = $getChild->end->toDateString(); $facture->end = $getChild->end->addMonths($getChild->nbrMois)->toDateString(); $facture->status = 0; $facture->user_id = $getChild->user_id; $facture->nbrMois = $getChild->nbrMois; $facture->reductionPrix = null; $facture->school_year_id = $getChild->school_year_id; $facture->reduction = 0; $enfant = Child::where('user_id', $getChild->user_id)->where('id', $getChild->child_id)->first(); $taman = ''; if ($getChild->reduction == 0) { if ($enfant->transport == 1) { foreach ($enfant->levels as $level) { $getPriceOfLevel = PriceBill::where('niveau', $level->id)->where('user_id', $getChild->user_id)->first(); $taman = $getPriceOfLevel->prix; } $TotalOnMonths = $taman * $getChild->nbrMois; $total_transport = Transport::where('user_id', $getChild->user_id)->first()->somme * $getChild->nbrMois; $prix_finale = $TotalOnMonths + $total_transport; $facture->somme = $prix_finale; } elseif ($enfant->transport == 0) { foreach ($enfant->levels as $level) { $getPriceOfLevel = PriceBill::where('niveau', $level->id)->where('user_id', $getChild->user_id)->first(); $taman = $getPriceOfLevel->prix; } $prix_finale = $taman * $getChild->nbrMois; $facture->somme = $prix_finale; } } $facture->child_id = $getChild->child_id; $facture->f_id = $getChild->f_id; $facture->save(); break; } } elseif ($fromStartToNbrMois >= $sc->endch3) { $last_bill = Bill::where('child_id', $getChild->child_id)->where('reduction', 0)->where('school_year_id', $sc->id)->where('nbrMois', 1)->orderBy('id', 'desc')->first(); if (!$last_bill && Carbon::now() > $getChild->end) { $facture = new Bill(); $facture->start = $getChild->end->toDateString(); $facture->end = $getChild->end->addMonths(1)->toDateString(); $facture->status = 0; $facture->user_id = $getChild->user_id; $facture->nbrMois = 1; $facture->reductionPrix = null; $facture->school_year_id = $getChild->school_year_id; $facture->reduction = 0; $enfant = Child::where('user_id', $getChild->user_id)->where('id', $getChild->child_id)->first(); $taman = ''; if ($getChild->reduction == 0) { if ($enfant->transport == 1) { foreach ($enfant->levels as $level) { $getPriceOfLevel = PriceBill::where('niveau', $level->id)->where('user_id', $getChild->user_id)->first(); $taman = $getPriceOfLevel->prix; } $TotalOnMonths = $taman * 1; $total_transport = Transport::where('user_id', $getChild->user_id)->first()->somme * 1; $prix_finale = $TotalOnMonths + $total_transport; $facture->somme = $prix_finale; } elseif ($enfant->transport == 0) { foreach ($enfant->levels as $level) { $getPriceOfLevel = PriceBill::where('niveau', $level->id)->where('user_id', $getChild->user_id)->first(); $taman = $getPriceOfLevel->prix; } $prix_finale = $taman * 1; $facture->somme = $prix_finale; } } $facture->child_id = $getChild->child_id; $facture->f_id = $getChild->f_id; $facture->save(); break; } } } } } } } }
/** * Returns the number of disapproved for the given school year. * * @param SchoolYear $school_year * @return integer the disapproved count */ public function countDisapprovedForSchoolYear(SchoolYear $school_year, PropelPDO $con = null) { $con = is_null($con) ? Propel::getConnection() : $con; $c = new Criteria(); $c->addJoin(StudentDisapprovedCourseSubjectPeer::COURSE_SUBJECT_STUDENT_ID, CourseSubjectStudentPeer::ID); $c->add(CourseSubjectStudentPeer::STUDENT_ID, $this->getId()); $previous_ids = array_map(create_function('$c', 'return $c->getId();'), CourseSubjectStudentPeer::doSelect($c)); $c = new Criteria(); $c->add(CourseSubjectStudentPeer::STUDENT_ID, $this->getId()); $c->add(CoursePeer::SCHOOL_YEAR_ID, $school_year->getId()); $c->addJoin(CoursePeer::ID, CourseSubjectPeer::COURSE_ID); $c->addJoin(CourseSubjectStudentPeer::COURSE_SUBJECT_ID, CourseSubjectPeer::ID); $c->addJoin(CourseSubjectStudentPeer::ID, StudentDisapprovedCourseSubjectPeer::COURSE_SUBJECT_STUDENT_ID); $c->add(StudentDisapprovedCourseSubjectPeer::STUDENT_APPROVED_CAREER_SUBJECT_ID, null, Criteria::ISNULL); $c->add(StudentDisapprovedCourseSubjectPeer::COURSE_SUBJECT_STUDENT_ID, $previous_ids, Criteria::NOT_IN); return StudentDisapprovedCourseSubjectPeer::doCount($c, $con); }
<?php $form = $this->beginWidget('CActiveForm', array('id' => 'class-session-form', 'enableAjaxValidation' => false)); ?> <p class="note">Fields with <span class="required">*</span> are required.</p> <?php echo $form->errorSummary($model); ?> <div class="row"> <?php echo $form->labelEx($model, 'school_year_id'); ?> <?php echo $form->dropDownList($model, 'school_year_id', CHtml::listData(SchoolYear::model()->findAll(array('order' => 'start_date DESC')), 'id', 'description')); ?> <?php echo $form->error($model, 'school_year_id'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'description'); ?> <?php echo $form->textField($model, 'description', array('size' => 60, 'maxlength' => 128)); ?>