本文整理汇总了PHP中StudentPeer类的典型用法代码示例。如果您正苦于以下问题:PHP StudentPeer类的具体用法?PHP StudentPeer怎么用?PHP StudentPeer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StudentPeer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configure
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);
}
示例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: doSelectByStudent
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;
}
示例4: executeGeneralInformation
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());
}
示例5: getStudent
public function getStudent()
{
$c = new Criteria();
$c->add(StudentPeer::ID, $this->getPayer());
$student = StudentPeer::doSelectOne($c);
return $student;
}
示例6: 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;
}
}
示例7: areAllFromSameStudent
/**
* 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;
}
示例8: 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;
}
}
示例9: canBeDeleted
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));
}
示例10: executeListByStudent
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;
}
示例11: retrieveByStudentId
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);
}
示例12: doSelectByStudentAll
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);
}
示例13: executeIndex
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'));
}
示例14: retrieveByCode
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;
}
示例15: getAvailableStudentsForExaminationRepprovedSubject
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);
}