本文整理汇总了PHP中StudentPeer::retrieveByPk方法的典型用法代码示例。如果您正苦于以下问题:PHP StudentPeer::retrieveByPk方法的具体用法?PHP StudentPeer::retrieveByPk怎么用?PHP StudentPeer::retrieveByPk使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StudentPeer
的用法示例。
在下文中一共展示了StudentPeer::retrieveByPk方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
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;
}
}
示例2: validate
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;
}
示例3: doSelectOrdered
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;
}
示例4: save
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;
}
}
示例5: doSave
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);
}
示例6: executeShowStudent
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();
}
示例7: executeShowStudent
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();
}
示例8: executeShowByStudent
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;
}
示例9: executeUpdate
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');
}
示例10: executeCreateMother
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;
}
示例11: executeUpdateStudent
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);
}
//.........这里部分代码省略.........
示例12: executeShowByStudent2
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;
}
示例13: executeShowByStudent
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;
}
示例14: postValidateAvailableStudents
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;
}
示例15: executeShowOut
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();
}