public function configure() { $student_id = $this->getOption('student_id'); $this->student = StudentPeer::retrieveByPK($student_id); $this->career_school_year_id = $this->getOption('career_school_year_id'); $this->course_subject_id = $this->getOption('course_subject_id'); $this->division_id = $this->getOption('division_id'); $sf_formatter_attendance_week = new sfWidgetFormSchemaFormatterAttendanceWeek($this->getWidgetSchema()); $this->getWidgetSchema()->addFormFormatter("AttendanceWeek", $sf_formatter_attendance_week); $this->getWidgetSchema()->setFormFormatterName('AttendanceWeek'); $day = $this->getOption('day'); $this->widgetSchema->setNameFormat('attendance_' . $student_id . '][%s]'); #student $this->setWidget("student_id", new sfWidgetFormInputHidden()); $this->setValidator("student_id", new sfValidatorPropelChoice(array("model" => "Student", "required" => true))); $this->setWidget("student", new mtWidgetFormPlain(array('object' => $this->student))); for ($i = 0; $i <= 6; $i++) { $day_i = date('Y-m-d', strtotime($day . '-' . $i . 'day a go')); $student_attendance = StudentAttendancePeer::retrieveOrCreateByDateAndStudent($day_i, $this->student, $this->getOption('course_subject_id')); if ($student_attendance) { $this->setDefault("value_" . $i, $student_attendance->getAbsenceTypeId()); } $this->setWidget("value_" . $i, $this->getAttendanceWidget()); $this->getWidget("value_" . $i, $this->getAttendanceWidget())->setAttribute('class', 'attendance_week_input'); $this->setValidator("value_" . $i, $this->getAttendanceValidator()); } $this->setDefault("student_id", $student_id); $this->disableCSRFProtection(); $this->course_subject = CourseSubjectPeer::retrieveByPK($this->course_subject_id); $period = CareerSchoolYearPeriodPeer::retrieveByPK($this->course_subject->getCourse()->getCurrentPeriod()); $this->setWidget('period', new mtWidgetFormPartial(array('module' => 'student_attendance', 'partial' => 'totalAbsences', 'form' => $this, 'parameters' => array('career_school_year_id' => $this->career_school_year_id, 'period' => $period, 'course_subject_id' => $this->course_subject_id, 'student' => $this->student)))); $this->getWidgetSchema()->moveField('period', sfWidgetFormSchema::LAST); }
function validate($validator, $values) { $student_ids = $values['division_student_list']; $result = true; $msg = 'No se pudieron hacer las inscripciones por que surgieron algunos errores.'; $msg .= '<ul>'; if (!is_null($student_ids)) { foreach ($student_ids as $student_id) { $student = StudentPeer::retrieveByPk($student_id); if ($student->isRegistered() && !is_null($student->isRegisteredInCareer($this->getObject()->getCareer()))) { foreach ($this->getObject()->getCourses() as $course) { if (!$student->hasApprovedCorrelativesForCourse($course)) { $result = false; $msg .= '<li>El alumno ' . $student . ' no puede cursar: ' . $course . ' por que no tiene las correlativas necesarias. </li>'; } } } else { $result = false; $msg .= '<li>El alumno ' . $student . ' no se encuentra inscripto en la carrera o en el año lectivo. </li>'; } } $msg .= '</ul>'; if (!$result) { throw new sfValidatorError($validator, $msg); } } return $values; }
public static function doSelectByStudent(Criteria $criteria, $con = null) { $usertype = sfContext::getInstance()->getUser()->getAttribute('usertype', 'common', 'bo'); $student = null; $student_id = null; if ($usertype == 'student') { $student_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo'); $student = StudentPeer::retrieveByPK($student_id); } if ($student == null) { $student_id = sfContext::getInstance()->getRequest()->getParameter('student_id'); $student = StudentPeer::retrieveByPK($student_id); } $criteria->add(StudentPeer::CURRICULUM_ID, $student->getCurriculumId()); $criteria->addJoin(StudentPeer::CURRICULUM_ID, CurriculumPeer::ID); $criteria->addJoin(CurriculumPeer::DEPARTMENT_ID, DepartmentPeer::ID); $tmp_depts = DepartmentPeer::doSelect($criteria); $depts = array(); foreach ($tmp_depts as $key => $val) { $pi = $val->getParentalIndex(); $prefix = ''; for ($i = 0; $i < $val->level - 1; $i++) { $prefix .= ParamsPeer::retrieveByCode('tree_node_mark')->getValue(); } $val->setdescription($prefix . $val->getDescription()); $val->setCode($prefix . $val->getCode()); $depts[$pi] = $val; } ksort($depts); $result = array(); foreach ($depts as $r) { $result[] = $r; } return $result; }
public function executeGeneralInformation() { $this->current_school_year = SchoolYearPeer::retrieveCurrent(); $this->amount_sy_students = $this->current_school_year->countSchoolYearStudents(); $this->amount_teachers = TeacherPeer::doCount(new Criteria()); $this->amount_students = StudentPeer::doCount(new Criteria()); }
public function getStudent() { $c = new Criteria(); $c->add(StudentPeer::ID, $this->getPayer()); $student = StudentPeer::doSelectOne($c); return $student; }
public function save($con = null) { if (!$this->isValid()) { throw $this->getErrorSchema(); } if (is_null($con)) { $con = Propel::getConnection(CareerStudentPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } try { $con->beginTransaction(); $values = $this->getValues(); $career = CareerPeer::retrieveByPK($values["career_id"]); $orientation = OrientationPeer::retrieveByPK($values["orientation_id"]); $sub_orientation = SubOrientationPeer::retrieveByPK($values["sub_orientation_id"]); $start_year = $values["start_year"]; unset($values["career_id"]); unset($values["orientation_id"]); unset($values["sub_orientation_id"]); unset($values["start_year"]); foreach ($values as $student_id) { $student = StudentPeer::retrieveByPk($student_id, $con); if (!$student->isRegisteredToCareer($career, $con)) { $student->registerToCareer($career, $orientation, $sub_orientation, $start_year, $con); } } $con->commit(); } catch (Exception $e) { $con->rollBack(); throw $e; } }
/** * This method check if all the student_attendance_ids are for the same student. * * @param <array> $student_attendance_ids * @return boolean */ public static function areAllFromSameStudent($student_attendance_ids) { $c = new Criteria(); $c->add(self::ID, $student_attendance_ids, Criteria::IN); $c->addJoin(self::STUDENT_ID, StudentPeer::ID); return StudentPeer::doCount($c) == 1; }
public function save($con = null) { if (!$this->isValid()) { throw $this->getErrorSchema(); } if (is_null($con)) { $con = Propel::getConnection(); } try { $con->beginTransaction(); $values = $this->getValues(); $school_year = SchoolYearPeer::retrieveByPK($values["school_year_id"]); $shift = ShiftPeer::retrieveByPK($values["shift_id"]); unset($values["school_year_id"]); unset($values["shift_id"]); foreach ($values as $student_id) { $student = StudentPeer::retrieveByPk($student_id); if (!$student->getIsRegistered($school_year)) { $student->registerToSchoolYear($school_year, $shift, $con); } } $con->commit(); } catch (Exception $e) { $con->rollBack(); throw $e; } }
public function canBeDeleted(PropelPDO $con = null) { $criteria = new Criteria(); $criteria->add(TutorPeer::OCCUPATION_ID, $this->getId()); $criteria2 = new Criteria(); $criteria2->add(StudentPeer::OCCUPATION_ID, $this->getId()); return !(StudentPeer::doCount($criteria2) || TutorPeer::doCount($criteria)); }
public function executeListByStudent() { $student_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo'); $student = StudentPeer::retrieveByPK($student_id); $this->student = $student; $this->forward404Unless($student); $c = new Criteria(); $c->add(AcademicCalendarPeer::ID, $student->getAcademicCalendar()->getChildRecurs(), Criteria::IN); $c->add(AcademicCalendarPeer::DEPARTMENT_ID, $student->getAcademicCalendar()->getDepartment()->getChildRecurs(), Criteria::IN); $c->addJoin(AccalActivityPeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID); $c->addDescendingOrderByColumn(AccalActivityPeer::ID); $this->sort($c); if ($this->getRequest()->hasParameter('filters')) { $filters = $this->getRequestParameter('filters'); if ($filters == 'clear') { $this->filters = null; } else { $defined_filter = false; foreach ($filters as $f) { if (is_array($f)) { if (strlen($f['from']) > 0 || strlen($f['to']) > 0) { $defined_filter = true; break; } } else { if ($f != null && $f != '') { $defined_filter = true; break; } } } if ($defined_filter) { $this->filters = $filters; $this->filter($c, $this->getRequestParameter('filters')); } } } $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'accal_activity')); $this->getUser()->setAttribute('max_per_page', $rpp, 'accal_activity'); $pager = new sfPropelPager('AccalActivity', $rpp); $pager->setCriteria($c); $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'accal_activity')); $this->getUser()->setAttribute('page', $page, 'accal_activity'); $pager->setPage($page); $pager->init(); $this->pager = $pager; $actions = array(array('name' => 'filter', 'color' => 'white')); $filter_string = ""; if ($this->filters) { foreach ($this->filters as $key => $val) { $filter_string .= "&filters[{$key}]={$val}"; } $filter_string = preg_replace('/^&/', '', $filter_string); } $this->actions = $actions; $actions2 = array(array('name' => '<span>Tahun Ajaran 2011/2012</span>', 'url' => 'accal_activity/listByStudent', 'color' => 'sun', 'type' => 'direct')); $this->actions2 = $actions2; }
public static function retrieveByStudentId($student_id) { $c = new Criteria(); $student = StudentPeer::retrieveByPK($student_id); $scsy = StudentCareerSchoolYearPeer::retrieveCareerSchoolYearForStudentAndYear($student, SchoolYearPeer::retrieveCurrent()); $c->add(self::STUDENT_CAREER_SCHOOL_YEAR_ID, $scsy[0]->getId()); $c->add(self::IS_DELETED, true, Criteria::EQUAL); return self::doSelectOne($c); }
public static function doSelectByStudentAll() { $student = StudentPeer::retrieveByPK(sfContext::getInstance()->getRequest()->getParameter('student_id')); if (!$student) { return array(); } $c = new Criteria(); $c->add(VStudentCoursePeer::STUDENT_ID, $student->getId()); return VStudentCoursePeer::doSelect($c); }
public function executeIndex() { $lekarSms = new lekarSms(); $students = StudentPeer::retrieveByPK('1'); echo '<pre>'; print_r($students); echo '</pre>'; var_dump($students->getCode()); //sfLoader::loadHelpers(array('myHelper')); }
public static function retrieveByCode($member_code, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $criteria = new Criteria(StudentPeer::DATABASE_NAME); $criteria->add(StudentPeer::CODE, $member_code); $v = StudentPeer::doSelect($criteria, $con); return !empty($v) > 0 ? $v[0] : null; }
public static function getAvailableStudentsForExaminationRepprovedSubject(ExaminationRepprovedSubject $examination_repproved_subject) { if ($examination_repproved_subject->getExaminationRepproved()->getExaminationType() == ExaminationRepprovedType::FREE_GRADUATED) { $c = self::getFreeGraduatedStudentsCriteria($examination_repproved_subject); } else { $c = self::getAvailableForExaminationRepprovedSubjectCriteria($examination_repproved_subject); } $c->addJoin(CourseSubjectStudentPeer::STUDENT_ID, StudentPeer::ID, Criteria::INNER_JOIN); return StudentPeer::doSelect($c); }
public static function doCountStudentsForCareerSchoolYearAndYear($career_school_year, $year, $criteria = null) { $criteria = is_null($criteria) ? new Criteria() : $criteria; $criteria->addJoin(self::STUDENT_ID, StudentPeer::ID); $criteria->addJoin(StudentCareerSchoolYearPeer::STUDENT_ID, StudentPeer::ID); $criteria->add(StudentCareerSchoolYearPeer::CAREER_SCHOOL_YEAR_ID, $career_school_year->getId()); //$criteria->add(StudentCareerSchoolYearPeer::YEAR, $year); $criteria->add(DivisionPeer::YEAR, $year); $criteria->setDistinct(); return StudentPeer::doCount($criteria); }
/** * This method returns the students related with this examinationRepprovedSubject * * @return array Students[] */ public function getStudents() { $c = new Criteria(); $c->add(StudentExaminationRepprovedSubjectPeer::EXAMINATION_REPPROVED_SUBJECT_ID, $this->getId()); $c->addJoin(StudentExaminationRepprovedSubjectPeer::STUDENT_REPPROVED_COURSE_SUBJECT_ID, StudentRepprovedCourseSubjectPeer::ID); $c->addJoin(StudentRepprovedCourseSubjectPeer::COURSE_SUBJECT_STUDENT_ID, CourseSubjectStudentPeer::ID); $c->addJoin(CourseSubjectStudentPeer::STUDENT_ID, StudentPeer::ID); $c->addJoin(StudentPeer::PERSON_ID, PersonPeer::ID); $c->addAscendingOrderByColumn(PersonPeer::LASTNAME); return StudentPeer::doSelect($c); }
public function doSave($con = null) { parent::doSave($con); $student = StudentPeer::retrieveByPk($this->getValue('student_id')); $career_school_year_period = CareerSchoolYearPeriodPeer::retrieveByPk($this->getValue('career_school_year_period_id')); $student_career_school_year = StudentCareerSchoolYearPeer::getCurrentForStudentAndCareerSchoolYear($student, $career_school_year_period->getCareerSchoolYear()); $course_subject = CourseSubjectPeer::retrieveByPk($this->getValue('course_subject_id')); $student_free = StudentFreePeer::retrieveByStudentCareerSchoolYearCareerSchoolYearPeriodAndCourse($student_career_school_year, $career_school_year_period, $course_subject); $student_free->setIsFree(false); $student_free->save($con); }
/** * Redefines preExecute because this action CANT BE RISED WITHOUT A REFERENCE * */ public function preExecute() { if (!$this->getUser()->getReferenceFor('student')) { $this->getUser()->setFlash('warning', 'Debe seleccionar un estudiante para poder administrar las sanciones.'); $this->redirect('@student'); } $this->student = StudentPeer::retrieveByPK($this->getUser()->getReferenceFor('student')); if (is_null($this->student)) { $this->getUser()->setFlash('warning', 'Debe seleccionar un estudiante para poder administrar las sanciones.'); $this->redirect('@student'); } parent::preExecute(); }
public function sendSmsAttendance($student_code, $type, $time) { $connection = Propel::getConnection(); $query = "\n\t\t\tselect id as student_id from student where replace(code, '.', '') = '{$student_code}';\n\t\t"; $statement = $connection->prepareStatement($query); $resultset = $statement->executeQuery(); $resultset->next(); $studentId = $resultset->getInt('student_id'); $student = StudentPeer::retrieveByPK($studentId); $senderId = $this->getSenderId($student->getClassGroup()->getDepartmentId()); $prefix = $senderId->getText(); $date = date('j-M-Y', $time); $hour = date('H:i', $time); $recipients = array(array('type' => 'student', 'value' => $student->getId())); if ($type == 'attend') { $subject = 'Attend SMS ' . $student->getName() . ' - ' . $student->getClassGroup()->getName(); $message = $prefix . ' Alhamdulillah, Ananda ' . $student->getName() . ' telah hadir di sekolah pada tgl ' . $date . ' pkl ' . $hour; } else { if ($type == 'return') { $subject = 'Return SMS ' . $student->getName() . ' - ' . $student->getClassGroup()->getName(); $message = $prefix . 'Ananda ' . $student->getName() . ' tlh selesai kbm di sekolah pd ' . $date . ' pkl ' . $hour; $message .= '. Silahkan dijemput'; } else { return; } } $log = new SmsLog(); //$log->setCreatorUserId($employeeId); $log->setCreatorType('system'); $log->setSubject($subject); $log->setRecipient($this->jsonwrapper->json_encode($recipients)); $log->setMessage($message); $log->setSenderId($senderId->getId()); $log->setCreated(date('Y-m-d H:i:s')); $log->setSmsLong(1); $log->setSmsCount(1); $sendAt = date('Y-m-d H:i:s'); $log->setSendAt('now'); $log->save(); $recNumber = $student->getStudentDetail()->getCellphone(); $rec = new SmsLogRecipient(); $rec->setLogId($log->getId()); $rec->setRecipientId($student->getId()); $rec->setRecipientType('student'); $rec->setRecipientNumber($recNumber); $rec->setStatus('pending'); $rec->setLog(0); $rec->save(); /* Saving to gammu Database */ $save = $this->smsConn->send($rec->getId(), 1, 2, 3, $recNumber, $log->getMessage(), $log->getCreated(), $log->getSendAt()); }
/** * redefines preExecute because this action CANT BE RISED WITHOUT A REFERENCE * */ public function preExecute() { if (!$this->getUser()->getReferenceFor('student') && is_null($this->getUser()->getAttribute('student_id'))) { $this->getUser()->setFlash('warning', 'Debe seleccionar un alumno para poder administrar sus reincorporaciones.'); $this->redirect('@student'); } $this->student = StudentPeer::retrieveByPK($this->getUser()->getReferenceFor('student')); if (is_null($this->student)) { $this->student = StudentPeer::retrieveByPK($this->getUser()->getAttribute('student_id')); } if (is_null($this->student)) { $this->getUser()->setFlash('warning', 'Debe seleccionar un alumno para poder administrar sus reincorporaciones.'); $this->redirect('@student'); } parent::preExecute(); }
/** * This method joins the teacher indicated with the corresponing students. * * @return $criteria */ public static function joinWithStudents(Criteria $c, $user_id) { $c1 = new Criteria(); $c1->add(PersonPeer::USER_ID, $user_id); $c1->addJoin(PersonPeer::ID, TeacherPeer::PERSON_ID); $c1->addJoin(CourseSubjectTeacherPeer::TEACHER_ID, TeacherPeer::ID); $c1->addJoin(CourseSubjectTeacherPeer::COURSE_SUBJECT_ID, CourseSubjectPeer::ID); $c1->addJoin(CourseSubjectPeer::ID, CourseSubjectStudentPeer::COURSE_SUBJECT_ID); $c1->addJoin(CourseSubjectStudentPeer::STUDENT_ID, StudentPeer::ID); $c1->clearSelectColumns(); $c1->addSelectColumn(StudentPeer::ID); $c1->setDistinct(); $stmt = StudentPeer::doSelectStmt($c1); $student_ids = $stmt->fetchAll(PDO::FETCH_COLUMN); $c->add(StudentPeer::ID, $student_ids, Criteria::IN); }
public function executeUpdateEquivalence(sfWebRequest $request) { $parametrs = $request->getPostParameters(); $this->career_school_year = CareerSchoolYearPeer::retrieveByPK($parametrs['career_school_year_id']); $this->career = $this->career_school_year->getCareer(); $this->career_subject_school_years = array(); $this->years = array(); $this->forms = array(); for ($y = 1; $y <= $this->career->getQuantityYears(); $y++) { $this->years[] = $y; $this->career_subject_school_years[$y] = $this->career->getCareerSubjectsForYear($y, true); } unset($parametrs['_save']); unset($parametrs['career_school_year_id']); $valid = true; foreach ($parametrs as $parameter) { $career_subject_id = $parameter['career_subject_id']; $student_id = $parameter['student_id']; $school_year_id = $parameter['school_year']; $career_subject = CareerSubjectPeer::retrieveByPK($career_subject_id); $student = StudentPeer::retrieveByPK($student_id); $student_approved_career_subject = StudentApprovedCareerSubjectPeer::retrieveOrCreateByCareerSubjectAndStudent($career_subject->getId(), $student->getId()); $student_approved_career_subject->setSchoolYearId($school_year_id); $parameter['career_subject_id'] = $student_approved_career_subject->getCareerSubjectId(); $this->form = new EquivalenceForm($student_approved_career_subject); $this->form->setCareerSubjectAndStudent($career_subject, $student); if (isset($parameter['mark']) && $parameter['mark'] != "") { $this->form->bind($parameter); if ($this->form->isValid()) { $this->form->save(); } else { $valid = false; } } $this->form = new EquivalenceForm($student_approved_career_subject); $this->form->setCareerSubjectAndStudent($career_subject, $student); $this->forms[$career_subject->getId()] = $this->form; $parameter['career_subject_id'] = $career_subject_id; } if ($valid) { $this->getUser()->setFlash('notice', 'subjects are updated correctly'); } else { $this->setProcessFormErrorFlash(); } $this->module = $this->getModuleName(); $this->setTemplate('makeUpEquivalence'); }
protected function buildCriteria() { if (is_null($this->filters)) { $this->filters = $this->configuration->getFilterForm($this->getFilters()); } $criteria = $this->filters->buildCriteria($this->getFilters()); $event = $this->dispatcher->filter(new sfEvent($this, 'admin.build_criteria'), $criteria); $criteria = $event->getReturnValue(); $deserter_students = StudentPeer::getDeserterStudents(); $ids = array(); foreach ($deserter_students as $student) { $ids[] = $student->getId(); } $criteria->add(StudentPeer::ID, $ids, Criteria::IN); $total_criteria_desertores = count(StudentPeer::doSelect($criteria)); $total_alumnos = count(StudentPeer::doSelect(new Criteria())); $this->getUser()->setAttribute('students_count', $total_criteria_desertores); $this->getUser()->setAttribute('students_percentaje', $total_criteria_desertores * 100 / $total_alumnos); return $criteria; }
public function configure() { $student_id = $this->getOption('student_id'); $this->student = StudentPeer::retrieveByPK($student_id); $this->career_school_year_id = $this->getOption('career_school_year_id'); $this->course_subject_id = $this->getOption('course_subject_id'); $this->division_id = $this->getOption('division_id'); $sf_formatter_attendance_week = new sfWidgetFormSchemaFormatterAttendanceWeek($this->getWidgetSchema()); $this->getWidgetSchema()->addFormFormatter("AttendanceWeek", $sf_formatter_attendance_week); $this->getWidgetSchema()->setFormFormatterName('AttendanceWeek'); $day = $this->getOption('day'); $this->widgetSchema->setNameFormat('attendance_' . $student_id . '][%s]'); #student $this->setWidget("student_id", new sfWidgetFormInputHidden()); $this->setValidator("student_id", new sfValidatorPropelChoice(array("model" => "Student", "required" => true))); $this->setWidget("student", new mtWidgetFormPlain(array('object' => $this->student))); $sf_user = sfContext::getInstance()->getUser(); if ($sf_user->isPreceptor()) { $limit = SchoolBehaviourFactory::getInstance()->getDaysForMultipleAttendanceForm(); } else { $limit = BaseSchoolBehaviour::DAYS_FOR_MULTIPLE_ATTENDANCE_FORM; } for ($i = 0; $i <= $limit; $i++) { $day_i = date('Y-m-d', strtotime($day . '-' . $i . 'day ago')); $student_attendance = StudentAttendancePeer::retrieveOrCreateByDateAndStudent($day_i, $this->student, $this->getOption('course_subject_id')); if ($student_attendance) { $this->setDefault("value_" . $i, $student_attendance->getAbsenceTypeId()); } $this->setWidget("value_" . $i, $this->getAttendanceWidget()); #$this->getWidget('value_'.$i)->setLabel($day_i); $this->setValidator("value_" . $i, $this->getAttendanceValidator()); } #sumarle 7 dias al dia antes de mandarlo a la funcion // $total_absenses = $this->student->getAmountStudentAttendanceUntilDay( strtotime($day . '+ 7 day a go')); // $this->setWidget("total", new mtWidgetFormPartial(array('module'=>'student_attendance','partial'=>'total_absens','form'=>$this,'parameters'=>array('total'=>$total_absenses )) )); $this->setDefault("student_id", $student_id); $this->disableCSRFProtection(); $this->setWidget('period', new mtWidgetFormPartial(array('module' => 'student_attendance', 'partial' => 'totalAbsences', 'form' => $this, 'parameters' => array('career_school_year_id' => $this->career_school_year_id, 'course_subject_id' => null, 'student' => $this->student, 'day' => $day)))); $this->getWidgetSchema()->moveField('period', sfWidgetFormSchema::LAST); }
public static function doSelectByStudentCurriculum(Criteria $criteria, $con = null) { $usertype = sfContext::getInstance()->getUser()->getAttribute('usertype', 'common', 'bo'); $student = null; $student_id = null; if ($usertype == 'student') { $student_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo'); $student = StudentPeer::retrieveByPK($student_id); } if ($student == null) { $student_id = sfContext::getInstance()->getRequest()->getParameter('student_id'); $student = StudentPeer::retrieveByPK($student_id); } $curr = $student->getCurriculum(); $cgs = array(); foreach ($curr->getAcademicCalendars() as $accal) { foreach ($accal->getClassGroup()->getChildRecurs() as $cg) { array_push($cgs, $cg); } } $criteria->add(VClassGroupPeer::ID, $cgs, Criteria::IN); $tmp_depts = VClassGroupPeer::doSelect($criteria); $depts = array(); foreach ($tmp_depts as $key => $val) { $pi = $val->getParentalIndex(); $prefix = ''; for ($i = 0; $i < $val->level - 1; $i++) { $prefix .= ParamsPeer::retrieveByCode('tree_node_mark')->getValue(); } $val->setName($prefix . $val->getName()); $val->setCode($prefix . $val->getCode()); $depts[$pi] = $val; } ksort($depts); $result = array(); foreach ($depts as $r) { $result[] = $r; } return $result; }
protected function execute($arguments = array(), $options = array()) { // initialize the database connection $databaseManager = new sfDatabaseManager($this->configuration); $connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection(); // add your code here $this->createContextInstance(); $i = 0; $students = StudentPeer::doSelect(new Criteria()); $career_school_year = CareerSchoolYearPeer::retrieveByPK(4); foreach ($students as $student) { $this->logSection("Evaluando student ID = ", $student->getId()); $career_student = $student->getCareerStudent(); if ($career_student == null) { $this->logSection("ceando CarrerStudent", $student->getId()); $career_student = new CareerStudent(); $career_student->setStudent($student); $career_student->setCareerId(1); $career_student->setStartYear(1); $career_student->setFileNumber($student->getGlobalFileNumber()); $career_student->save($connection); #$career_student->createStudentsCareerSubjectAlloweds(1, $connection); $this->logSection("Fin creacion careerStudent", $career_student->getId()); } $student_career_school_year = StudentCareerSchoolYearPeer::getCurrentForStudentAndCareerSchoolYear($student, $career_school_year); if ($student_career_school_year == null) { $i++; $this->logSection("Creando studentCareerSchoolYear", $student->getId()); $student_career_school_year = new StudentCareerSchoolYear(); $student_career_school_year->setCareerSchoolYear($career_school_year); $student_career_school_year->setStudent($student); $student_career_school_year->setYear($student->getCareerStudent()->getStartYear()); $student_career_school_year->save($connection); $this->logSection("Fin creacion studentCareerSchoolYear", $career_student->getId()); $this->logSection("Guardando", $student); echo $i; } } }
$i = 0; foreach ($pager->getResults() as $payment_history) { ++$i; ?> "<?php echo $i + ($pager->getPage() - 1) * $pager->getMaxPerPage(); ?> ",<?php if (!$byStudent) { ?> "<?php $payer = null; if ($payment_history->getPaymentJournal()->getPayerType() == PaymentJournal::PAYER_TYPE_APPLICANT) { $payer = TestApplicantPeer::retrieveByPK($payment_history->getPaymentJournal()->getPayer()); } elseif ($payment_history->getPaymentJournal()->getPayerType() == PaymentJournal::PAYER_TYPE_STUDENT) { $payer = StudentPeer::retrieveByPK($payment_history->getPaymentJournal()->getPayer()); } echo strlen($payment_history->getPaymentJournal()->getPayer() && $payer != null) > 0 ? $payer->tostring() : 'n/a'; ?> ",<?php } ?> "<?php echo $payment_history->getPaymentJournal()->getAcademicCost() ? $payment_history->getPaymentJournal()->getAcademicCost()->getAcademicCostComponent() ? $payment_history->getPaymentJournal()->getAcademicCost()->getAcademicCostComponent()->toString() : '-' : '-'; ?> ","<?php echo $payment_history->getPaymentJournal()->getAcademicProcess() ? $payment_history->getPaymentJournal()->getAcademicProcess()->toString() : '-'; ?> ","<?php echo $payment_history->getPaymentJournal()->getAcademicCost()->getAcademicCalendar()->getCurriculum()->getDepartment() ? $payment_history->getPaymentJournal()->getAcademicCost()->getAcademicCalendar()->getCurriculum()->getDepartment()->toString() : '-'; ?>
public function executeSaveScore() { $student_id = $this->getRequestParameter('student_id'); $student = StudentPeer::retrieveByPK($student_id); $this->forward404Unless($student); $academic_calendar_id = $this->getRequestParameter('academic_calendar_id'); $academic_calendar = AcademicCalendarPeer::retrieveByPK($academic_calendar_id); $this->forward404Unless($academic_calendar); $counseling_id = $this->getRequestParameter('counseling_id'); $counseling = CounselingPeer::retrieveByPK($counseling_id); $this->forward404Unless($counseling); $student_accal_id = $this->getRequestParameter('student_accal_id'); $student_accal = StudentAccalPeer::retrieveByPK($student_accal_id); $this->forward404Unless($student_accal); $scores = $this->getRequestParameter('score'); foreach ($scores as $k => $score) { if ($score != null) { $cb = new Criteria(); $cb->add(CounselingRaportPeer::STUDENT_ACCAL_ID, $student_accal->getId()); $cb->add(CounselingRaportPeer::COUNSELING_SPEC_ID, $k); $raport = CounselingRaportPeer::doSelectOne($cb); if ($raport == null) { $raport = new CounselingRaport(); } $raport->setStudentAccalId($student_accal->getId()); $raport->setCounselingSpecId($k); $raport->setGrade($score); $raport->save(); } else { $cb = new Criteria(); $cb->add(CounselingRaportPeer::STUDENT_ACCAL_ID, $student_accal->getId()); $cb->add(CounselingRaportPeer::COUNSELING_SPEC_ID, $k); $raport = CounselingRaportPeer::doSelectOne($cb); if ($raport != null) { $raport->delete(); } } } return $this->redirect('counseling_raport/listCounselingScore?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId()); }
public function executePrintFinal() { $this->tanggalCetak = $this->getRequestParameter('time'); $counseling_id = $this->getRequestParameter('counseling_id'); $counseling = CounselingPeer::retrieveByPK($counseling_id); if (!$counseling) { if (SF_ENVIRONMENT == 'dev') { echo 'Counseling Not Found'; } die; } $this->counseling = $counseling; $this->waliKelas = $counseling->toStringEmployee(); $this->academic_calendar = AcademicCalendarPeer::retrieveByPK($this->getRequestParameter('accal_id')); if (!$this->academic_calendar) { if (SF_ENVIRONMENT == 'dev') { echo 'Academic Calendar Not Found'; } die; } $this->department = $this->academic_calendar->getDepartment(); $this->departmentDetail = $this->department->getThisDepartmentDetail(); $time = $this->getRequestParameter('time'); $time2 = $this->getRequestParameter('time2'); $tgl = $this->getRequestParameter('tgl_cetak'); /* Get Student */ $student_id = $this->getRequestParameter('student_id'); $this->student = StudentPeer::retrieveByPK($student_id); if (!$this->student) { if (SF_ENVIRONMENT == 'dev') { echo 'Student Not Found'; } die; } /* Get StudentAccal */ $this->studentAccal = StudentAccalPeer::getStudentByAccal($this->academic_calendar->getId(), $this->student->getId()); if (!$this->studentAccal) { if (SF_ENVIRONMENT == 'dev') { echo 'Student Accal Not Found'; } die; } /* Get Score Rule */ $this->scoreRule = nilaiRapor::getScoreRuleAkhir($this->academic_calendar->getId(), $counseling->getClassGroup()->getClassTypeId()); if (!$this->scoreRule) { if (SF_ENVIRONMENT == 'dev') { echo 'AccalId => ' . $this->academic_calendar->getId() . '<br />'; echo 'getClassTypeId => ' . $counseling->getClassGroup()->getClassTypeId() . '<br />'; echo 'Score Rule Not Found'; } die; } $this->scoreRuleSubject = nilaiRapor::getScoreRuleSubject($this->scoreRule->getId()); $this->orientation = 'portrait'; $this->papersize = 'a4'; if (SF_ENVIRONMENT != 'dev') { $this->setViewClass('sfDomPDF'); } }