本文整理汇总了PHP中StudentPeer::retrieveByPK方法的典型用法代码示例。如果您正苦于以下问题:PHP StudentPeer::retrieveByPK方法的具体用法?PHP StudentPeer::retrieveByPK怎么用?PHP StudentPeer::retrieveByPK使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StudentPeer
的用法示例。
在下文中一共展示了StudentPeer::retrieveByPK方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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);
}
示例3: executeListSched
public function executeListSched()
{
$student_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo');
$student = StudentPeer::retrieveByPK($student_id);
$this->forward404Unless($student);
$c = new Criteria();
$c->add(SchedulePeer::ACADEMIC_CALENDAR_ID, $student->getAcademicCalendar()->getChildRecurs(), Criteria::IN);
$c->add(SchedulePeer::CLASS_GROUP_ID, $student->getClassGroupId(), Criteria::IN);
$c->add(SchedulePeer::TYPE, Schedule::IS_SCHED, Criteria::IN);
$c->addAscendingOrderByColumn(SchedulePeer::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(), 'schedule'));
$this->getUser()->setAttribute('max_per_page', $rpp, 'schedule');
$pager = new sfPropelPager('Schedule', $rpp);
$pager->setCriteria($c);
$page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'schedule'));
$this->getUser()->setAttribute('page', $page, 'schedule');
$pager->setPage($page);
$pager->init();
$this->pager = $pager;
$filter_string = "";
if ($this->filters) {
foreach ($this->filters as $key => $val) {
$filter_string .= "&filters[{$key}]={$val}";
}
$filter_string = preg_replace('/^&/', '', $filter_string);
}
$actions = array(array('name' => 'filter', 'color' => 'white'));
array_unshift($actions, array('name' => '_AS_CSV_', 'url' => "student_schedule/listSchedAsCSV?{$filter_string}", 'color' => 'black', 'type' => 'direct'));
array_unshift($actions, array('name' => '_AS_PDF_', 'url' => "student_schedule/listSchedAsPDF?{$filter_string}", 'color' => 'black', 'type' => 'direct'));
$this->actions = $actions;
$this->subtitle = $student->getName() . ' - ' . $student->getClassGroup()->toString();
$this->student_id = $student_id;
}
示例4: 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;
}
示例5: 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);
}
示例6: 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);
}
示例7: 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'));
}
示例8: setStudentsIds
public function setStudentsIds($students_ids)
{
foreach ($students_ids as $student_id) {
$student = StudentPeer::retrieveByPK($student_id);
$this->setWidget("student_{$student_id}", new mtWidgetFormPlain(array("object" => $student, "add_hidden_input" => true, "use_retrieved_value" => false)));
$this->setValidator("student_{$student_id}", new sfValidatorPropelChoice(array("model" => "Student", "required" => true)));
$this->setDefault("student_{$student_id}", $student_id);
$this->widgetSchema->setLabel("student_{$student_id}", "Student");
$this->widgetSchema->moveField("shift_id", "after", "student_{$student_id}");
}
}
示例9: preExecute
/**
* 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();
}
示例10: executeByStudent
public function executeByStudent()
{
$student_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo');
$student = StudentPeer::retrieveByPK($student_id);
$this->forward404Unless($student);
$c = new Criteria();
$cton1 = $c->getNewCriterion(InboxPeer::STUDENT_ID, $student_id, Criteria::IN);
$cton2 = $c->getNewCriterion(InboxPeer::TYPE, 2, Criteria::IN);
$cton1->addAnd($cton2);
$c->add($cton1);
$c->addDescendingOrderByColumn(InboxPeer::SUBJECT);
$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(), 'outbox'));
$this->getUser()->setAttribute('max_per_page', $rpp, 'outbox');
$pager = new sfPropelPager('Inbox', $rpp);
$pager->setCriteria($c);
$page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'outbox'));
$this->getUser()->setAttribute('page', $page, 'outbox');
$pager->setPage($page);
$pager->init();
$this->pager = $pager;
$actions = array(array('name' => 'filter', 'color' => 'black'));
$this->actions = $actions;
$this->subtitle = $student->toString();
$this->student_id = $student_id;
}
示例11: executeListByStudent
public function executeListByStudent()
{
$student_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo');
$student = StudentPeer::retrieveByPK($student_id);
$this->forward404Unless($student);
$c = new Criteria();
$c->add(AbsencePeer::STUDENT_ID, $student->getId());
$c->addAscendingOrderByColumn(AbsencePeer::TIME_IN);
$this->sort($c);
if ($this->getRequest()->hasParameter('filters')) {
$filters = $this->getRequestParameter('filters');
if ($this->hasRequestParameter('student_name') && $this->getRequestParameter('student_name') == '') {
$filters['STUDENT_ID'] = null;
}
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(), 'attendance'));
$this->getUser()->setAttribute('max_per_page', $rpp, 'attendance');
$pager = new sfPropelPager('Absence', $rpp);
$pager->setCriteria($c);
$page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'attendance'));
$this->getUser()->setAttribute('page', $page, 'attendance');
$pager->setPage($page);
$pager->init();
$this->pager = $pager;
$actions = array(array('name' => 'filter', 'color' => 'white'));
$this->actions = $actions;
$this->subtitle = $student->toString();
$this->student_id = $student_id;
}
示例12: sendSmsAttendance
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());
}
示例13: preExecute
/**
* 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();
}
示例14: executeUpdateEquivalence
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');
}
示例15: doSelectByStudentCurriculum
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;
}