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; } }
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 doSelectOrdered(Criteria $criteria, $con = null) { $sc_id = sfContext::getInstance()->getRequest()->getParameter('student_course_id'); $sc = StudentCoursePeer::retrieveByPk($sc_id); $stu_id = sfContext::getInstance()->getRequest()->getParameter('student_id'); $stu = StudentPeer::retrieveByPk($stu_id); if ($sc && $sc->getSubjectAccal() && $sc->getSubjectAccal()->getAcademicCalendar() && $sc->getSubjectAccal()->getAcademicCalendar()->getClassGroup()) { $criteria->add(VClassGroupPeer::ID, $sc->getSubjectAccal()->getAcademicCalendar()->getClassGroup()->getChildRecurs(), Criteria::IN); } elseif ($stu && $stu->getClassGroup()) { $criteria->add(VClassGroupPeer::ID, $stu->getClassGroup()->getChildRecurs(), 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; }
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 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); }
public function executeShowStudent() { $student = StudentPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($student); $this->subtitle = $student->toString() . ' - id:' . $student->getId(); $actions = array(array('name' => 'back', 'url' => 'employee_counsel/list', 'color' => 'black')); $this->actions = $actions; $this->student = $student; $this->student_detail = $student->getStudentDetail(); }
public function executeShowStudent() { $employee_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo'); $employee = EmployeePeer::retrieveByPK($employee_id); $this->forward404Unless($employee); $this->employee = $employee; $class_agenda = ClassAgendaPeer::retrieveByPK($this->getRequestParameter('agenda_id')); $this->forward404Unless($class_agenda); $student = StudentPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($student); $this->subtitle = $student->toString() . ' - id:' . $student->getId(); $actions = array(array('name' => 'back', 'url' => 'leave/listByEmployee?agenda_id=' . $class_agenda->getId(), 'color' => 'black')); $this->actions = $actions; $this->student = $student; $this->student_detail = $student->getStudentDetail(); }
public function executeShowByStudent() { $student_id = $this->getRequestParameter('student_id'); $student = StudentPeer::retrieveByPk($student_id); $this->forward404Unless($student); $employee = EmployeePeer::retrieveByPk($this->getRequestParameter('id')); if (!$employee) { $employee_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo'); $employee = EmployeePeer::retrieveByPK($employee_id); } $this->forward404Unless($employee); $this->subtitle = $employee->toString() . ' - id:' . $employee->getId(); $c = new Criteria(); $c->add(EmployeeDetailPeer::EMPLOYEE_ID, $employee->getId()); $employee_detail = EmployeeDetailPeer::doSelectOne($c); $actions = array(array('name' => 'back', 'url' => 'employee/listByStudent?student_id=' . $student_id, 'color' => 'black')); $this->actions = $actions; $this->employee = $employee; $this->employee_detail = $employee_detail; }
public function executeUpdate() { $i18n = new sfI18N(); $i18n->initialize($this->getContext()); $i18n->setCulture($this->getUser()->getCulture()); $action_i18n = $i18n->globalMessageFormat->format('save as new'); $action_type = $this->getRequestParameter('action_type'); if ($action_type == $action_i18n || !$this->getRequestParameter('student_type_id')) { $student_type = new StudentType(); } else { $student_type = StudentTypePeer::retrieveByPk($this->getRequestParameter('student_type_id')); $this->forward404Unless($student_type); } $student = StudentPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($student); $student_type->setId($this->getRequestParameter('student_type_id')); $student_type->setStatus($student->getStatus()); $student_type->setStudentId($student->getId()); $student_type->setPayerTypeId($this->getRequestParameter('payer_type_id')); $student_type->save(); return $this->redirect('student_type/list'); }
public function executeCreateMother() { $student_id = $this->getContext()->getUser()->getAttribute('user_id', '', 'bo'); $this->forward404Unless($student_id); $student = StudentPeer::retrieveByPk($student_id); $this->forward404Unless($student); $mother = new StudentParents(); $c = new Criteria(); $c->add(StudentParentsPeer::STUDENT_ID, $student_id); $c->add(StudentParentsPeer::RELATION, 1); $father = StudentParentsPeer::doSelectOne($c); $this->setTemplate('edit'); $this->actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value")), array('name' => 'cancel', 'url' => 'student_parents_s/index', 'color' => 'black')); $this->subtitle = $student->toString(); $this->type = 'add'; $this->father = $father; $this->mother = $mother; $this->student_id = $student_id; }
public function executeUpdateStudent() { $i18n = new sfI18N(); $i18n->initialize($this->getContext()); $i18n->setCulture($this->getUser()->getCulture()); $action_i18n = $i18n->globalMessageFormat->format('save as new'); $action_type = $this->getRequestParameter('action_type'); // add/update member_detail if ($action_type == $action_i18n || !$this->getRequestParameter('member_detail_id')) { $member_detail = new MemberDetail(); } else { $member_detail = MemberDetailPeer::retrieveByPk($this->getRequestParameter('member_detail_id')); $this->forward404Unless($member_detail); } $member_detail->setId($this->getRequestParameter('member_detail_id')); $member_detail->setPob($this->getRequestParameter('pob')); if ($this->getRequestParameter('dob')) { $member_detail->setDob($this->getRequestParameter('dob')); } $member_detail->setSex($this->getRequestParameter('sex')); $member_detail->setAddress($this->getRequestParameter('address')); $member_detail->setRegionId($this->getRequestParameter('region_id')); $member_detail->setPostCode($this->getRequestParameter('post_code')); $member_detail->setPhone($this->getRequestParameter('phone')); $member_detail->setCellphone($this->getRequestParameter('cellphone')); $member_detail->setReligionId($this->getRequestParameter('religion_id')); $member_detail->setSchoolOfOrigin($this->getRequestParameter('school_of_origin')); $member_detail->setGraduationYear($this->getRequestParameter('graduation_year')); $member_detail->setGraduationGrade($this->getRequestParameter('graduation_grade')); $member_detail->setCompany($this->getRequestParameter('company')); $member_detail->setJobTitle($this->getRequestParameter('job_title')); $member_detail->setCollegeOfOrigin($this->getRequestParameter('college_of_origin')); $member_detail->setDepartmentOfOrigin($this->getRequestParameter('department_of_origin')); $member_detail->setRegYear($this->getRequestParameter('reg_year')); $member_detail->setParentName($this->getRequestParameter('parent_name')); $member_detail->save(); // add student detail if ($action_type == $action_i18n || !$this->getRequestParameter('student_detail_id')) { $student_detail = new StudentDetail(); } else { $student_detail = StudentDetailPeer::retrieveByPk($this->getRequestParameter('student_detail_id')); $this->forward404Unless($student_detail); } $student_detail->setId($this->getRequestParameter('student_detail_id')); $student_detail->setPob($this->getRequestParameter('pob')); if ($this->getRequestParameter('dob')) { $student_detail->setDob($this->getRequestParameter('dob')); } $student_detail->setSex($this->getRequestParameter('sex')); $student_detail->setAddress($this->getRequestParameter('address')); $student_detail->setRegionId($this->getRequestParameter('region_id')); $student_detail->setPostCode($this->getRequestParameter('post_code')); $student_detail->setPhone($this->getRequestParameter('phone')); $student_detail->setCellphone($this->getRequestParameter('cellphone')); $student_detail->setReligionId($this->getRequestParameter('religion_id')); $student_detail->setSchoolOfOrigin($this->getRequestParameter('school_of_origin')); $student_detail->setGraduationYear($this->getRequestParameter('graduation_year')); $student_detail->setGraduationGrade($this->getRequestParameter('graduation_grade')); $student_detail->setCompany($this->getRequestParameter('company')); $student_detail->setJobTitle($this->getRequestParameter('job_title')); $student_detail->setCollegeOfOrigin($this->getRequestParameter('college_of_origin')); $student_detail->setDepartmentOfOrigin($this->getRequestParameter('department_of_origin')); $student_detail->setRegYear($this->getRequestParameter('reg_year')); $student_detail->setParentName($this->getRequestParameter('parent_name')); $student_detail->save(); if ($action_type == $action_i18n || !$this->getRequestParameter('id')) { $member = new Member(); } else { $member = MemberPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($member); } $member->setId($this->getRequestParameter('id')); $member->setCode($this->getRequestParameter('code')); $member->setNoReg($this->getRequestParameter('no_reg')); $member->setName($this->getRequestParameter('name')); $member->setClassName($this->getRequestParameter('class_name')); $member->setDepartmentId($this->getRequestParameter('department_id')); $old_status = $member->getStatus(); $member->setStatus($this->getRequestParameter('status')); $member->setType('1'); $member->setMemberDetail($member_detail); if ($this->getRequestParameter('password') != null && strlen($this->getRequestParameter('password')) > 0) { // password set $crypted = sha1(sfConfig::get('app_salt') . $this->getRequestParameter('password')); if ($member->getPassword() != $crypted && strlen($this->getRequestParameter('password')) > 0) { // password changed $member->setPassword($crypted); } } elseif ($member->getPassword() == null || $member->getPassword() == '') { // create $crypted = sha1(sfConfig::get('app_salt') . $this->getRequestParameter('code') . $member_detail->getDob('dm')); $member->setPassword($crypted); } $member->save(); if ($action_type == $action_i18n || !$this->getRequestParameter('student_id')) { $student = new Student(); } else { $student = StudentPeer::retrieveByPk($this->getRequestParameter('student_id')); $this->forward404Unless($student); } $student->setId($this->getRequestParameter('student_id')); $student->setCode($this->getRequestParameter('code')); $student->setName($this->getRequestParameter('name')); $old_status = $student->getStatus(); $student->setMemberId($member); $student->setStatus($this->getRequestParameter('status')); $student->setStudentDetail($student_detail); if ($this->getRequestParameter('password') != null && strlen($this->getRequestParameter('password')) > 0) { // password set $crypted = sha1(sfConfig::get('app_salt') . $this->getRequestParameter('password')); if ($student->getPassword() != $crypted && strlen($this->getRequestParameter('password')) > 0) { // password changed $student->setPassword($crypted); } } elseif ($student->getPassword() == null || $student->getPassword() == '') { // create $crypted = sha1(sfConfig::get('app_salt') . $this->getRequestParameter('code') . $student_detail->getDob('dm')); $student->setPassword($crypted); } $student->save(); // save member photo $photo_dir = sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'photos' . DIRECTORY_SEPARATOR; if ($this->hasRequestParameter('photoFile') && $this->getRequestParameter('photoFile') != '' && $this->getRequestParameter('photoFile') != null) { // get photo content $photo_file = $photo_dir . 'tmp' . DIRECTORY_SEPARATOR . $this->getRequestParameter('photoFile'); $content = file_get_contents($photo_file); $im = imagecreatefromstring($content); list($w, $h) = getimagesize($photo_file); // generate photo $photo = imagecreatetruecolor(150, 200); imagecopyresized($photo, $im, 0, 0, 0, 0, 150, 200, $w, $h); // generate thumbnail $thumb = imagecreatetruecolor(100, 150); imagecopyresized($thumb, $im, 0, 0, 0, 0, 100, 150, $w, $h); // get photo record $c = new Criteria(); $c->add(MemberPhotoPeer::MEMBER_ID, $member->getId()); $member_photo = MemberPhotoPeer::doSelectOne($c); if ($member_photo == null) { $member_photo = new MemberPhoto(); $member_photo->setMember($member); } // save photo imagepng($photo, $photo_file); $member_photo->setPhoto(base64_encode(file_get_contents($photo_file))); imagepng($thumb, $photo_file); $member_photo->setThumbnail(base64_encode(file_get_contents($photo_file))); $member_photo->save(); unlink($photo_dir . 'tmp' . DIRECTORY_SEPARATOR . $this->getRequestParameter('photoFile')); } // save student photo $photo_dir = sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'photos' . DIRECTORY_SEPARATOR; if ($this->hasRequestParameter('photoFile') && $this->getRequestParameter('photoFile') != '' && $this->getRequestParameter('photoFile') != null) { // get photo content $photo_file = $photo_dir . 'tmp' . DIRECTORY_SEPARATOR . $this->getRequestParameter('photoFile'); $content = file_get_contents($photo_file); $im = imagecreatefromstring($content); list($w, $h) = getimagesize($photo_file); // generate photo $photo = imagecreatetruecolor(150, 195); imagecopyresized($photo, $im, 0, 0, 0, 0, 150, 195, $w, $h); // generate thumbnail $thumb = imagecreatetruecolor(100, 130); imagecopyresized($thumb, $im, 0, 0, 0, 0, 100, 130, $w, $h); // get photo record $c = new Criteria(); $c->add(StudentPhotoPeer::STUDENT_ID, $student->getId()); $student_photo = StudentPhotoPeer::doSelectOne($c); if ($student_photo == null) { $student_photo = new StudentPhoto(); $student_photo->setStudent($student); } // save photo imagepng($photo, $photo_file); $student_photo->setPhoto(base64_encode(file_get_contents($photo_file))); imagepng($thumb, $photo_file); $student_photo->setThumbnail(base64_encode(file_get_contents($photo_file))); $student_photo->save(); unlink($photo_dir . 'tmp' . DIRECTORY_SEPARATOR . $this->getRequestParameter('photoFile')); } if ($this->hasRequestParameter('filter_noreg') && $this->getRequestParameter('filter_noreg') != '' && $this->getRequestParameter('filter_noreg') != null) { return $this->redirect('member/listStudent?filters[NO_REG]=' . $this->getRequestParameter('no_reg')); } elseif ($this->hasRequestParameter('filter_code') && $this->getRequestParameter('filter_code') != '' && $this->getRequestParameter('filter_code') != null) { return $this->redirect('member/listStudent?filters[CODE]=' . $this->getRequestParameter('filter_code')); } elseif ($this->hasRequestParameter('filter_deptid') && $this->getRequestParameter('filter_deptid') != '' && $this->getRequestParameter('filter_deptid') != null) { return $this->redirect('member/listStudent?filters[DEPARTMENT_ID]=' . $this->getRequestParameter('filter_deptid')); } elseif ($this->hasRequestParameter('filter_status') && $this->getRequestParameter('filter_status') != '' && $this->getRequestParameter('filter_status') != null) { return $this->redirect('member/listStudent?filters[STATUS]=' . $this->getRequestParameter('filter_status')); } elseif ($this->hasRequestParameter('filter_name') && $this->getRequestParameter('filter_name') != '' && $this->getRequestParameter('filter_name') != null) { return $this->redirect('member/listStudent?filters[NAME]=' . $this->getRequestParameter('name')); } else { return $this->redirect('member/listStudent'); } }
public function executeShowByStudent2() { $student_id = $this->getRequestParameter('student_id'); $student = StudentPeer::retrieveByPk($student_id); $this->forward404Unless($student); $schedule = SchedulePeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($schedule); $this->subtitle = $schedule->toStringCap() . ' - id:' . $schedule->getId(); $actions = array(array('name' => 'back', 'url' => 'extracurricular/listByStudent2?student_id=' . $student_id, 'color' => 'black')); $this->setTemplate('show'); $this->actions = $actions; $this->schedule = $schedule; $c = new Criteria(); $c->add(ScheduleDetailPeer::SCHEDULE_ID, $schedule->getId()); $c->addDescendingOrderByColumn(ScheduleDetailPeer::ID); $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'schedule_detail')); $this->getUser()->setAttribute('max_per_page', $rpp, 'schedule_detail'); $pager = new sfPropelPager('ScheduleDetail', $rpp); $pager->setCriteria($c); $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'schedule_detail')); $this->getUser()->setAttribute('page', $page, 'schedule_detail'); $pager->setPage($page); $pager->init(); $this->pager = $pager; $actions2 = array(array('name' => 'filter', 'color' => 'white')); $this->actions2 = $actions2; }
public function executeShowByStudent() { $student_id = $this->getRequestParameter('student_id'); $student = StudentPeer::retrieveByPk($student_id); $this->forward404Unless($student); $student_achievement = StudentAchievementPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($student_achievement); $student = $student_achievement->getStudent(); $this->subtitle = $student_achievement->toString() . ' - id:' . $student_achievement->getId(); $actions = array(array('name' => 'back', 'url' => 'student_achievement/listByStudent?student_id=' . $student->getId(), 'color' => 'black')); #array_push($actions, array('name'=>'edit','url'=>'student_achievement/editByStudent?id='.$student_achievement->getId().'&student_id='.$student_achievement->getStudentId(), 'color'=>'blue')); $this->actions = $actions; $this->student_achievement = $student_achievement; }
public function postValidateAvailableStudents(sfValidatorBase $validator, $values) { $duplicated_students = array(); $student_ids = $values['course_subject_student_list']; $course_subject_id = $values['id']; foreach ($student_ids as $student_id) { if (CourseSubjectStudentPeer::countStudentInscriptionsForCareerSubjectSchoolYear($course_subject_id, $student_id) != 0) { $duplicated_students[] = StudentPeer::retrieveByPk($student_id); } } if ($duplicated_students) { $error = new sfValidatorError($validator, 'Los siguientes estudiantes seleccionados ya se encuentran inscriptos en otro curso para esta misma materia: ' . implode(',', $duplicated_students)); throw new sfValidatorErrorSchema($validator, array('course_subject_student_list' => $error)); } return $values; }
public function executeShowOut() { $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo'); $c = new Criteria(); $c->add(JobPeer::CODE, $this->getModuleName()); $job = JobPeer::doSelectOne($c); $acl = AclPeer::retrieveByPK($group_id, $job->getId()); if (!$acl) { $this->forward('default', 'error404'); } $student = StudentPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($student); $this->subtitle = $student->toString() . ' - id:' . $student->getId(); $class_name = $this->getRequestParameter('class_name'); $actions = $class_name ? array(array('name' => 'back', 'url' => 'attend/listOut?filters[CLASS_NAME]=' . $class_name, 'color' => 'black')) : array(array('name' => 'back', 'url' => 'attend/listOut', 'color' => 'black')); $this->actions = $actions; $this->student = $student; $this->student_detail = $student->getStudentDetail(); }
public function executeGetChild() { $employee_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo'); $employee = EmployeePeer::retrieveByPK($employee_id); $this->forward404Unless($employee); $this->employee_id = $employee_id; $course_schedule = CourseSchedulePeer::retrieveByPk($this->getRequestParameter('course_id')); $this->forward404Unless($course_schedule); $student = StudentPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($student); $student_id = $student->getId(); $course_schedule_id = $course_schedule->getId(); $cr = new Criteria(); $cr->add(GradeSpecPeer::PARENT, 1); $cr->addAscendingOrderByColumn(GradeSpecPeer::CODE); $this->grade1 = GradeSpecPeer::doSelect($cr); $this->count1 = GradeSpecPeer::doCount($cr); $cer = new Criteria(); $cer->add(GradeSpecPeer::PARENT, 1, Criteria::IN); $cer->add(GradeSpecPeer::ID, 85, Criteria::LESS_THAN); $cer->addAscendingOrderByColumn(GradeSpecPeer::CODE); $this->grade_up = GradeSpecPeer::doSelect($cer); $this->count_up = GradeSpecPeer::doCount($cer); $ceb = new Criteria(); $ceb->add(GradeSpecPeer::PARENT, 1, Criteria::IN); $ceb->add(GradeSpecPeer::ID, 54, Criteria::GREATER_THAN); $ceb->addAscendingOrderByColumn(GradeSpecPeer::CODE); $this->grade_down = GradeSpecPeer::doSelect($ceb); $this->count_down = GradeSpecPeer::doCount($ceb); $this->student = $student; $this->course_schedule = $course_schedule; $this->student_id = $student_id; $this->course_schedule_id = $course_schedule_id; $id = $this->getRequestParameter('id'); $this->forward404Unless($id); $level = $this->getRequestParameter('level'); if ($level == null) { $level = 0; } $this->level = $level + 1; $this->parent_id = $id; $this->parent_class = $this->getRequestParameter('parent_class'); $cem = new Criteria(); $cem->add(CourseRegulationPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId()); $cem->add(CourseRegulationPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId()); $cem->add(CourseRegulationPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId()); $course_reg = CourseRegulationPeer::doSelectOne($cem); $this->course_reg = $course_reg; }
public function executeUpdateStudent() { $student = StudentPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($student); $student->setId($this->getRequestParameter('id')); if ($this->getRequestParameter('password')) { $crypted = sha1(sfConfig::get('app_salt') . $this->getRequestParameter('password')); if ($student->getPassword() != $crypted && strlen($this->getRequestParameter('password')) > 0) { // password changed $student->setPassword($crypted); } } $student->save(); $this->getContext()->getUser()->signInStudent($user); #$this->setTemplate('index'); #return; return $this->redirect('default/index'); }
public function executeSave4() { $student = StudentPeer::retrieveByPk($this->getRequestParameter('student_id')); $this->forward404Unless($student); $student_type = new StudentType(); $student_type->setPayerTypeId($this->getRequestParameter('payer_type_id')); $student_type->setStudent($student); $student_type->setStatus(1); $student_type->save(); $filter_class = $this->getRequestParameter('filter_class'); $filter_name = $this->getRequestParameter('filter_name'); $filter_code = $this->getRequestParameter('filter_code'); $filter_payer = $this->getRequestParameter('filter_payer'); return $this->redirect('student_payment/listElse?student_id=' . $student->getId()); }
echo input_hidden_tag('employee_id', $employee_id); echo input_hidden_tag('student_id', $student_id); ?> <table class="form"> <tr><td class="form"> <table class="form_content" width="100%"> <tbody> <tr> <td class='first' width="20%" style="vertical-align:middle;"><label><?php echo __('Kepada'); ?> </label></td> <td class="first" width="2%" style="text-align:center; vertical-align:middle;">:</td> <td class="first" style="vertical-align:middle;"> <p class="detail"><?php echo $student_id ? StudentPeer::retrieveByPk($student_id)->toStringCap() : '-'; ?> </p> </td> </tr> <tr> <td style="vertical-align:middle;"><label ><?php echo __('Tanggal Kirim'); ?> </label></td> <td width="2%" style="text-align:center; vertical-align:middle;">:</td> <td style="vertical-align:middle;"> <?php echo object_input_date_tag($inbox, 'getCreatedAt', array('rich' => true, 'withtime' => true, 'calendar_button_img' => '/images/calendar.gif')); ?> <?php
public function executeCreate() { $student = StudentPeer::retrieveByPk($this->getRequestParameter('student_id')); $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo'); $c = new Criteria(); $c->add(JobPeer::CODE, $this->getModuleName()); $job = JobPeer::doSelectOne($c); $acl = AclPeer::retrieveByPK($group_id, $job->getId()); if (!$acl) { $this->forward('default', 'error404'); } $this->can_add = $acl->getAddPriv() == 1; $this->can_edit = $acl->getEditPriv() == 1; $this->can_remove = $acl->getRemovePriv() == 1; $this->student_job_history = new StudentJobHistory(); $this->setTemplate('edit'); $this->actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value")), array('name' => 'cancel', 'url' => 'student_job_history/list?student_id=' . $student->getId(), 'color' => 'white')); $this->subtitle = $student->toString(); $this->student_job_history->setStudentId($student->getId()); $this->type = 'add'; }
public function executeSaveAbsence() { $schedule = SchedulePeer::retrieveByPk($this->getRequestParameter('schedule_id')); $schedule_detail = ScheduleDetailPeer::retrieveByPk($this->getRequestParameter('schedule_detail_id')); $tanggal = $this->getRequestParameter('thn') . '-' . $this->getRequestParameter('bln') . '-' . $this->getRequestParameter('tgl'); $tgl_code = $this->getRequestParameter('tgl') . $this->getRequestParameter('bln') . $this->getRequestParameter('thn'); $waktu = $this->getRequestParameter('waktu'); $status = $this->getRequestParameter('status'); if ($status) { foreach ($status as $stu_id => $status) { $stu = StudentPeer::retrieveByPk($stu_id); $c = new Criteria(); $c->add(AbsenceEkskulPeer::STUDENT_ID, $stu_id); $c->add(AbsenceEkskulPeer::SCHEDULE_ID, $schedule->getId()); $c->add(AbsenceEkskulPeer::SCHEDULE_DETAIL_ID, $schedule_detail->getId()); $c->add(AbsenceEkskulPeer::ACADEMIC_CALENDAR_ID, $schedule->getAcademicCalendarId()); $c->add(AbsenceEkskulPeer::CLASS_GROUP_ID, $schedule->getClassGroupId()); $c->add(AbsenceEkskulPeer::GRADE_COMPONENT_ID, $schedule->getGradeComponentId()); $c->add(AbsenceEkskulPeer::TIME, $waktu); $absence_ekskul = AbsenceEkskulPeer::doSelectOne($c); $absence_ekskul->setStudentId($stu_id); $absence_ekskul->setScheduleId($schedule->getId()); $absence_ekskul->setScheduleDetailId($schedule_detail->getId()); $absence_ekskul->setAcademicCalendarId($schedule->getAcademicCalendarId()); $absence_ekskul->setClassGroupId($schedule->getClassGroupId()); $absence_ekskul->setGradeComponentId($schedule->getGradeComponentId()); $absence_ekskul->setEmployeeId($this->getRequestParameter('employee_id')); $absence_ekskul->setStatus($status); $absence_ekskul->setTime($tanggal); $absence_ekskul->setCode($tgl_code); $absence_ekskul->save(); } } return $this->redirect('course_ekskul/listAbsence?id=' . $schedule->getId() . '&detail_id=' . $schedule_detail->getId()); }
public function executeSave() { $course_schedule = CourseSchedulePeer::retrieveByPk($this->getRequestParameter('course_schedule_id')); $tanggal = $this->getRequestParameter('thn') . '-' . $this->getRequestParameter('bln') . '-' . $this->getRequestParameter('tgl'); $tgl_code = $this->getRequestParameter('tgl') . $this->getRequestParameter('bln') . $this->getRequestParameter('thn'); $bulan = $this->getRequestParameter('bln'); $tahun = $this->getRequestParameter('thn'); $status = $this->getRequestParameter('status'); if ($status) { foreach ($status as $stu_id => $status) { $stu = StudentPeer::retrieveByPk($stu_id); if ($status == AbsenceCourse::STATUS_PRESENT) { $cr = new Criteria(); $cr->add(StudentAbsencePeer::STUDENT_ID, $stu_id); $cr->add(StudentAbsencePeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId()); $cr->add(StudentAbsencePeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId()); $cr->add(StudentAbsencePeer::START, $tanggal); $sa = StudentAbsencePeer::doSelectOne($cr); if ($sa != null) { StudentAbsencePeer::doDelete($cr); } } else { $cr = new Criteria(); $cr->add(StudentAbsencePeer::STUDENT_ID, $stu_id); $cr->add(StudentAbsencePeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId()); $cr->add(StudentAbsencePeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId()); $cr->add(StudentAbsencePeer::START, $tanggal); $student_absence = StudentAbsencePeer::doSelectOne($cr); if ($student_absence == null) { $student_absence = new StudentAbsence(); } $student_absence->setStudentId($stu_id); $student_absence->setClassGroupId($course_schedule->getClassGroupId()); $student_absence->setAcademicCalendarId($course_schedule->getAcademicCalendarId()); $student_absence->setStatus($status); $student_absence->setStart($tanggal); $student_absence->setEnd($tanggal); $student_absence->setMonth($bulan); $student_absence->setYear($tahun); $student_absence->save(); } } } $cd = new Criteria(); $cd->add(AttendanceClassPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId()); $cd->add(AttendanceClassPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId()); $cd->add(AttendanceClassPeer::DATETIME, $tanggal); $class_attend = AttendanceClassPeer::doSelectOne($cd); if ($class_attend == null) { $class_attend = new AttendanceClass(); } $class_attend->setClassGroupId($course_schedule->getClassGroupId()); $class_attend->setAcademicCalendarId($course_schedule->getAcademicCalendarId()); $class_attend->setDatetime($tanggal); $class_attend->save(); $co = new Criteria(); $co->add(VAttendancePeer::DATETIME, $tanggal); $co->add(VAttendancePeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId()); $attends = VAttendancePeer::doSelect($co); $student_codes = array(); foreach ($attends as $attend) { $student_codes[] = $attend->getFingercode(); } $cm = new Criteria(); $cm->add(AttendancePeer::STUDENT_ID, $student_codes, Criteria::IN); AttendancePeer::doDelete($cm); return $this->redirect('course_absence/listShow?course_id=' . $course_schedule->getId()); }
public function executeShowStudent() { $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo'); $student = StudentPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($student); $this->subtitle = $student->toString() . ' - id:' . $student->getId(); $actions = array(array('name' => 'back', 'url' => 'subject_plan/listStudent?class_id=' . $student->getClassGroupId(), 'color' => 'white')); $this->actions = $actions; $this->student = $student; $this->student_detail = $student->getStudentDetail(); }
public function executeShowSched2() { $student_id = $this->getRequestParameter('student_id'); $student = StudentPeer::retrieveByPk($student_id); $this->forward404Unless($student); $schedule = SchedulePeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($schedule); $this->subtitle = $schedule->toString() . ' - id:' . $schedule->getId(); $actions = array(array('name' => 'back', 'url' => 'student_schedule/listSched2?student_id=' . $student_id, 'color' => 'black')); $this->setTemplate('showSched'); $this->actions = $actions; $this->schedule = $schedule; }
public function executeDelete() { $student = StudentPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($student); $ref_error = 0; foreach ($student->getRefCountMethods() as $ref) { $method = "count" . $ref['affix']; $count = $student->{$method}(); if ($count > 0) { ++$ref_error; $this->getRequest()->setError('student/delete/' . sfInflector::camelize($ref['table']), $count); } } if ($ref_error > 0) { $this->getRequest()->setError('student/delete', '_ERR_DELETE_ (' . $student->toString() . ' - id:' . $student->getId() . ')'); } else { $student->delete(); } return $this->forward('student', 'list'); }
public function executeDeleteStu() { $accal_id = $this->getRequestParameter('accal_id'); $academic_calendar = AcademicCalendarPeer::retrieveByPK($accal_id); $this->forward404Unless($academic_calendar); $schedule = SchedulePeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($schedule); $schedule_detail = ScheduleDetailPeer::retrieveByPk($this->getRequestParameter('detail_id')); $this->forward404Unless($schedule_detail); $student = StudentPeer::retrieveByPk($this->getRequestParameter('student_id')); $this->forward404Unless($student); $c = new Criteria(); $c->add(StudentRaportPeer::SCHEDULE_DETAIL_ID, $schedule_detail->getId()); $c->add(StudentRaportPeer::SCHEDULE_ID, $schedule->getId()); $c->add(StudentRaportPeer::STUDENT_ID, $student->getId()); $c->add(StudentRaportPeer::CLASS_GROUP_ID, $student->getClassGroupId()); $c->add(StudentRaportPeer::GRADE_COMPONENT_ID, $schedule->getGradeComponentId()); $c->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $schedule->getAcademicCalendarId()); $cur13_ekskul = StudentRaportPeer::doSelectOne($c); if ($cur13_ekskul != null) { $cur13_ekskul->delete(); } $this->getRequest()->setParameter('accal_id', $academic_calendar->getId()); $this->getRequest()->setParameter('id', $schedule->getId()); $this->getRequest()->setParameter('detail_id', $schedule_detail->getId()); $this->forward($this->getModuleName(), 'listEksStu'); }
public function executeDeleteByStudent() { $student_id = $this->getRequestParameter('student_id'); $student = StudentPeer::retrieveByPk($student_id); $this->forward404Unless($student); $outbox = InboxPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($outbox); $outbox->delete(); return $this->redirect('outbox/byStudent?student_id=' . $student->getId()); }
public function executeShowStudent() { $student = StudentPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($student); $this->subtitle = $student->toString() . ' - id:' . $student->getId(); $academic_calendar = AcademicCalendarPeer::retrieveByPk($this->getRequestParameter('accal_id')); $this->forward404Unless($academic_calendar); $course_schedule = CourseSchedulePeer::retrieveByPk($this->getRequestParameter('course_id')); $this->forward404Unless($course_schedule); $time = $this->getRequestParameter('time'); $status = $this->getRequestParameter('status'); $actions = array(array('name' => 'back', 'url' => 'employee_agenda/listStudent?course_id=' . $course_schedule->getId() . '&time=' . $time . '&status=' . $status . '&accal_id=' . $academic_calendar->getId(), 'color' => 'black')); $this->actions = $actions; $this->student = $student; $this->student_detail = $student->getStudentDetail(); $this->academic_calendar = $academic_calendar; }
public function executeUpdateParent() { $i18n = new sfI18N(); $i18n->initialize($this->getContext()); $i18n->setCulture($this->getUser()->getCulture()); $action_i18n = $i18n->globalMessageFormat->format('save as new'); $action_type = $this->getRequestParameter('action_type'); $counseling_id = $this->getRequestParameter('counseling_id'); $counseling = CounselingPeer::retrieveByPK($counseling_id); $this->forward404Unless($counseling); $accal_id = $this->getRequestParameter('academic_calendar_id'); $academic_calendar = AcademicCalendarPeer::retrieveByPK($accal_id); $this->forward404Unless($academic_calendar); $student_detail = StudentDetailPeer::retrieveByPk($this->getRequestParameter('student_detail_id')); $this->forward404Unless($student_detail); $student_detail->setFather($this->getRequestParameter('father')); $student_detail->setMother($this->getRequestParameter('mother')); $student_detail->save(); $student = StudentPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($student); $father = StudentParentsPeer::retrieveByPK($this->getRequestParameter('father_id')); if ($father == null) { $father = new StudentParents(); } $father->setId($this->getRequestParameter('father_id')); $father->setStudent($student); $father->setRelation(StudentParents::RELATION_FATHER); $father->setName($this->getRequestParameter('father')); $father->setPob($this->getRequestParameter('father_pob')); if ($this->getRequestParameter('father_dob')) { $father->setDob($this->getRequestParameter('father_dob')); } $father->setReligionId($this->getRequestParameter('religion_father')); $father->setCountryId($this->getRequestParameter('father_country')); $father->setDegreeId($this->getRequestParameter('degree_father')); $father->setJob($this->getRequestParameter('father_job')); $father->setNoteDetail($this->getRequestParameter('father_notedetail')); $father->setMonthlyRevenue($this->getRequestParameter('father_revenue')); $father->setOfficePhone($this->getRequestParameter('father_officephone')); $father->setEmail($this->getRequestParameter('father_email')); $father->setAddress($this->getRequestParameter('father_address')); $father->setCellphone($this->getRequestParameter('father_cellphone')); $father->save(); $mother = StudentParentsPeer::retrieveByPK($this->getRequestParameter('mother_id')); if ($mother == null) { $mother = new StudentParents(); } $mother->setId($this->getRequestParameter('mother_id')); $mother->setStudent($student); $mother->setRelation(StudentParents::RELATION_MOTHER); $mother->setName($this->getRequestParameter('mother')); $mother->setPob($this->getRequestParameter('mother_pob')); if ($this->getRequestParameter('mother_dob')) { $mother->setDob($this->getRequestParameter('mother_dob')); } $mother->setReligionId($this->getRequestParameter('religion_mother')); $mother->setCountryId($this->getRequestParameter('mother_country')); $mother->setDegreeId($this->getRequestParameter('degree_mother')); $mother->setJob($this->getRequestParameter('mother_job')); $mother->setNoteDetail($this->getRequestParameter('mother_notedetail')); $mother->setMonthlyRevenue($this->getRequestParameter('mother_revenue')); $mother->setOfficePhone($this->getRequestParameter('mother_officephone')); $mother->setEmail($this->getRequestParameter('mother_email')); $mother->setAddress($this->getRequestParameter('mother_address')); $mother->setCellphone($this->getRequestParameter('mother_cellphone')); $mother->save(); return $this->redirect('counseling_sd/listStudent?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId()); }
public function executeEditAbsence() { $employee_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo'); $employee = EmployeePeer::retrieveByPK($employee_id); $this->forward404Unless($employee); $counseling_id = $this->getRequestParameter('counseling_id'); $counseling = CounselingPeer::retrieveByPK($counseling_id); $this->forward404Unless($counseling); $accal_id = $this->getRequestParameter('accal_id'); $academic_calendar = AcademicCalendarPeer::retrieveByPK($accal_id); $this->forward404Unless($academic_calendar); $student_id = $this->getRequestParameter('student_id'); $student = StudentPeer::retrieveByPk($student_id); $this->forward404Unless($student); $date = $this->getRequestParameter('date'); $status = $this->getRequestParameter('status'); $c = new Criteria(); $c->add(StudentAbsencePeer::STUDENT_ID, $student->getId()); $c->add(StudentAbsencePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $c->add(StudentAbsencePeer::START, $date); $c->addGroupByColumn(StudentAbsencePeer::START); $c->addGroupByColumn(StudentAbsencePeer::STUDENT_ID); $c->addGroupByColumn(StudentAbsencePeer::ACADEMIC_CALENDAR_ID); $c->addGroupByColumn(StudentAbsencePeer::CLASS_GROUP_ID); $student_absence = StudentAbsencePeer::doSelectOne($c); $actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value"))); array_push($actions, array('name' => 'delete', 'url' => 'counseling_detail/deleteAbsence?date=' . $date . '&student_id=' . $student->getId() . '&counseling_id=' . $counseling->getId() . '&accal_id=' . $academic_calendar->getId(), 'color' => 'red')); array_push($actions, array('name' => 'cancel', 'url' => 'counseling_detail/listAbsence?student_id=' . $student->getId() . '&counseling_id=' . $counseling->getId() . '&accal_id=' . $academic_calendar->getId(), 'color' => 'white')); $this->actions = $actions; $this->type = 'edit'; $this->counseling = $counseling; $this->date = $date; $this->counseling_id = $counseling_id; $this->student = $student; $this->employee = $employee; $this->academic_calendar = $academic_calendar; $this->status = $status; $this->student_absence = $student_absence; $this->subtitle = $student->toString() . ' - id:' . $student->getId(); $actions2 = array(array('name' => '<span>' . $academic_calendar->toString() . '</span>', 'url' => 'counseling/listStudentByEmployee?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId() . '&employee_id=' . $employee_id, 'color' => 'sky')); array_push($actions2, array('name' => '<span>Absensi Siswa</span>', 'url' => 'counseling_detail/listAbsence?student_id=' . $student->getId() . '&counseling_id=' . $counseling->getId() . '&accal_id=' . $academic_calendar->getId(), 'color' => 'sun', 'type' => 'direct')); $this->actions2 = $actions2; }