コード例 #1
0
ファイル: VClassGroupPeer.php プロジェクト: taryono/school
 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;
 }
コード例 #2
0
ファイル: SubjectAccalPeer.php プロジェクト: taryono/school
 public static function doSelectByAccal()
 {
     $student_course_id = sfContext::getInstance()->getRequest()->getParameter('id');
     $student_course = StudentCoursePeer::retrieveByPK($student_course_id);
     if ($student_course) {
         if (!$student_course->getSubjectAccal()) {
             return array();
         }
         $accal = $student_course->getSubjectAccal()->getAcademicCalendar();
     } else {
         $accal_id = sfContext::getInstance()->getRequest()->getParameter('accal_id');
         $accal = AcademicCalendarPeer::retrieveByPK($accal_id);
     }
     if ($accal == null) {
         return array();
     }
     $c = new Criteria();
     $c->addAscendingOrderByColumn(AcademicCalendarPeer::CODE);
     $c->addAscendingOrderByColumn(SubjectPeer::NAME);
     $c->addAscendingOrderByColumn(EmployeePeer::NAME);
     $c->addJoin(AcademicCalendarPeer::ID, SubjectAccalPeer::ACADEMIC_CALENDAR_ID);
     $c->addJoin(SubjectPeer::ID, SubjectAccalPeer::SUBJECT_ID);
     $c->addJoin(EmployeePeer::ID, SubjectAccalPeer::EMPLOYEE_ID);
     $c->add(SubjectAccalPeer::ACADEMIC_CALENDAR_ID, $accal->getId());
     $objs = SubjectAccalPeer::doSelect($c);
     return $objs;
 }
コード例 #3
0
ファイル: StudentCoursePeer.php プロジェクト: taryono/school
 public static function doSelectByStudentAll()
 {
     $student = StudentPeer::retrieveByPK(sfContext::getInstance()->getRequest()->getParameter('student_id'));
     if (!$student) {
         return array();
     }
     $c = new Criteria();
     $c->add(StudentCoursePeer::STUDENT_ID, $student->getId());
     return StudentCoursePeer::doSelect($c);
 }
コード例 #4
0
ファイル: listCourseSuccess.php プロジェクト: taryono/school
            $c->add(CourseScheduleDetailPeer::COURSE_SCHEDULE_ID, $cd->getId());
            $c->addDescendingOrderByColumn(CourseScheduleDetailPeer::ID);
            $cs_details = CourseScheduleDetailPeer::doSelect($c);
            foreach ($cs_details as $detail) {
                echo '&middot;' . $detail->getDayString() . ' - ' . $detail->getLocation()->toString() . ' <br> <font style="color: #017FC0;">(' . $detail->getClassSession()->getBegin() . ' - ' . $detail->getClassSession()->getEnd() . ')</font><br>';
            }
        }
        ?>
</td>
                        <td>
						<?php 
        $c = new Criteria();
        $c->add(StudentCoursePeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
        $c->add(StudentCoursePeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
        $c->add(StudentCoursePeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
        $total = StudentCoursePeer::doCount($c);
        ?>
                        <?php 
        echo link_to_remote($total, array('url' => 'course_detail/list?subject_id=' . $course_schedule->getSubjectCurrId() . '&class_id=' . $course_schedule->getClassGroupId() . '&accal_id=' . $course_schedule->getAcademicCalendarId(), 'update' => 'content', 'script' => 'true', 'loading' => "showIndicator('content', 'snakebig_black');", 'complete' => "hideIndicator()"), array('class' => 'white', 'title' => __('Jumlah Siswa')));
        ?>
                        </td>
					</tr>
				<?php 
    }
    ?>
			<?php 
}
?>
			</tbody>
		</table>
		<?php 
コード例 #5
0
 public static function doSelectJoinAllExceptScheduleDetail(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     StudentRaportPeer::addSelectColumns($c);
     $startcol2 = StudentRaportPeer::NUM_COLUMNS - StudentRaportPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     StudentPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + StudentPeer::NUM_COLUMNS;
     StudentCoursePeer::addSelectColumns($c);
     $startcol4 = $startcol3 + StudentCoursePeer::NUM_COLUMNS;
     GradeComponentPeer::addSelectColumns($c);
     $startcol5 = $startcol4 + GradeComponentPeer::NUM_COLUMNS;
     GradeSpecPeer::addSelectColumns($c);
     $startcol6 = $startcol5 + GradeSpecPeer::NUM_COLUMNS;
     CitationPeer::addSelectColumns($c);
     $startcol7 = $startcol6 + CitationPeer::NUM_COLUMNS;
     SubjectCurrPeer::addSelectColumns($c);
     $startcol8 = $startcol7 + SubjectCurrPeer::NUM_COLUMNS;
     ClassGroupPeer::addSelectColumns($c);
     $startcol9 = $startcol8 + ClassGroupPeer::NUM_COLUMNS;
     AcademicCalendarPeer::addSelectColumns($c);
     $startcol10 = $startcol9 + AcademicCalendarPeer::NUM_COLUMNS;
     SchedulePeer::addSelectColumns($c);
     $startcol11 = $startcol10 + SchedulePeer::NUM_COLUMNS;
     $c->addJoin(StudentRaportPeer::STUDENT_ID, StudentPeer::ID);
     $c->addJoin(StudentRaportPeer::STUDENT_COURSE_ID, StudentCoursePeer::ID);
     $c->addJoin(StudentRaportPeer::GRADE_COMPONENT_ID, GradeComponentPeer::ID);
     $c->addJoin(StudentRaportPeer::GRADE_SPEC_ID, GradeSpecPeer::ID);
     $c->addJoin(StudentRaportPeer::CITATION_ID, CitationPeer::ID);
     $c->addJoin(StudentRaportPeer::SUBJECT_CURR_ID, SubjectCurrPeer::ID);
     $c->addJoin(StudentRaportPeer::CLASS_GROUP_ID, ClassGroupPeer::ID);
     $c->addJoin(StudentRaportPeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID);
     $c->addJoin(StudentRaportPeer::SCHEDULE_ID, SchedulePeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = StudentRaportPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = StudentPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj2 = new $cls();
         $obj2->hydrate($rs, $startcol2);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj2 = $temp_obj1->getStudent();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addStudentRaport($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initStudentRaports();
             $obj2->addStudentRaport($obj1);
         }
         $omClass = StudentCoursePeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj3 = new $cls();
         $obj3->hydrate($rs, $startcol3);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj3 = $temp_obj1->getStudentCourse();
             if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj3->addStudentRaport($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj3->initStudentRaports();
             $obj3->addStudentRaport($obj1);
         }
         $omClass = GradeComponentPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj4 = new $cls();
         $obj4->hydrate($rs, $startcol4);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj4 = $temp_obj1->getGradeComponent();
             if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj4->addStudentRaport($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj4->initStudentRaports();
             $obj4->addStudentRaport($obj1);
         }
         $omClass = GradeSpecPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj5 = new $cls();
         $obj5->hydrate($rs, $startcol5);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj5 = $temp_obj1->getGradeSpec();
             if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj5->addStudentRaport($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj5->initStudentRaports();
             $obj5->addStudentRaport($obj1);
         }
         $omClass = CitationPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj6 = new $cls();
         $obj6->hydrate($rs, $startcol6);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj6 = $temp_obj1->getCitation();
             if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj6->addStudentRaport($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj6->initStudentRaports();
             $obj6->addStudentRaport($obj1);
         }
         $omClass = SubjectCurrPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj7 = new $cls();
         $obj7->hydrate($rs, $startcol7);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj7 = $temp_obj1->getSubjectCurr();
             if ($temp_obj7->getPrimaryKey() === $obj7->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj7->addStudentRaport($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj7->initStudentRaports();
             $obj7->addStudentRaport($obj1);
         }
         $omClass = ClassGroupPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj8 = new $cls();
         $obj8->hydrate($rs, $startcol8);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj8 = $temp_obj1->getClassGroup();
             if ($temp_obj8->getPrimaryKey() === $obj8->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj8->addStudentRaport($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj8->initStudentRaports();
             $obj8->addStudentRaport($obj1);
         }
         $omClass = AcademicCalendarPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj9 = new $cls();
         $obj9->hydrate($rs, $startcol9);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj9 = $temp_obj1->getAcademicCalendar();
             if ($temp_obj9->getPrimaryKey() === $obj9->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj9->addStudentRaport($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj9->initStudentRaports();
             $obj9->addStudentRaport($obj1);
         }
         $omClass = SchedulePeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj10 = new $cls();
         $obj10->hydrate($rs, $startcol10);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj10 = $temp_obj1->getSchedule();
             if ($temp_obj10->getPrimaryKey() === $obj10->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj10->addStudentRaport($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj10->initStudentRaports();
             $obj10->addStudentRaport($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
コード例 #6
0
ファイル: actions.class.php プロジェクト: taryono/school
 public function executeUpdateProfile()
 {
     $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 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->setParentName($this->getRequestParameter('parent_name'));
     $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->setResidenceStatus($this->getRequestParameter('residence_status'));
     $student_detail->setHomeDistance($this->getRequestParameter('home_distance'));
     $student_detail->setTransport($this->getRequestParameter('transport'));
     $student_detail->setNativeLanguage($this->getRequestParameter('native_language'));
     $student_detail->setChildNumber($this->getRequestParameter('child_number'));
     $student_detail->setBloodSiblings($this->getRequestParameter('blood_siblings'));
     $student_detail->setStepSiblings($this->getRequestParameter('step_siblings'));
     $student_detail->setAdoptSiblings($this->getRequestParameter('adopt_siblings'));
     $student_detail->setOrphanageStatus($this->getRequestParameter('orphanage_status'));
     $student_detail->setNationality($this->getRequestParameter('nationality'));
     $student_detail->setShortName($this->getRequestParameter('short_name'));
     $student_detail->setIntelligency($this->getRequestParameter('intelligency'));
     if ($this->getRequestParameter('test_date') != '') {
         $student_detail->setTestDate($this->getRequestParameter('test_date'));
     }
     $student_detail->save();
     ### 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->setResidenceStatus($this->getRequestParameter('residence_status'));
     $member_detail->setHomeDistance($this->getRequestParameter('home_distance'));
     $member_detail->setTransport($this->getRequestParameter('transport'));
     $member_detail->setNativeLanguage($this->getRequestParameter('native_language'));
     $member_detail->setChildNumber($this->getRequestParameter('child_number'));
     $member_detail->setBloodSiblings($this->getRequestParameter('blood_siblings'));
     $member_detail->setStepSiblings($this->getRequestParameter('step_siblings'));
     $member_detail->setAdoptSiblings($this->getRequestParameter('adopt_siblings'));
     $member_detail->setOrphanageStatus($this->getRequestParameter('orphanage_status'));
     $member_detail->setNationality($this->getRequestParameter('nationality'));
     $member_detail->setShortName($this->getRequestParameter('short_name'));
     $member_detail->setIntelligency($this->getRequestParameter('intelligency'));
     if ($this->getRequestParameter('test_date') != '') {
         $member_detail->setTestDate($this->getRequestParameter('test_date'));
     }
     $member_detail->save();
     if ($action_type == $action_i18n || !$this->getRequestParameter('member_id')) {
         $member = new Member();
     } else {
         $member = MemberPeer::retrieveByPk($this->getRequestParameter('member_id'));
         #$this->forward404Unless($member);
     }
     $member->setId($this->getRequestParameter('member_id'));
     $member->setCode($this->getRequestParameter('code'));
     $member->setName($this->getRequestParameter('name'));
     $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('id')) {
         $student = new Student();
     } else {
         $student = StudentPeer::retrieveByPk($this->getRequestParameter('id'));
         #$this->forward404Unless($student);
     }
     $student->setId($this->getRequestParameter('id'));
     $student->setCode($this->getRequestParameter('code'));
     $student->setCode2($this->getRequestParameter('code2'));
     $student->setName($this->getRequestParameter('name'));
     $student->setClassName($this->getRequestParameter('class_name'));
     $student->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
     $student->setClassGroupId($this->getRequestParameter('class_group_id'));
     $student->setTestApplicantId($this->getRequestParameter('test_applicant_id'));
     $old_status = $student->getStatus();
     $student->setStatus($this->getRequestParameter('status'));
     $student->setStudentDetail($student_detail);
     $student->setMember($member);
     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') . $student_detail->getDob('dmY'));
         $student->setPassword($crypted);
     }
     $student->save();
     if ($student->getStatus() == Student::STATUS_FINAL) {
         $c = new Criteria();
         $c->add(SubjectPeer::IS_COMPREHENSIVE_SUBJECT, true);
         $c->addJoin(SubjectPeer::ID, SubjectAccalPeer::SUBJECT_ID);
         $c->addJoin(SubjectAccalPeer::ID, StudentCoursePeer::SUBJECT_ACCAL_ID);
         $c->add(StudentCoursePeer::STATUS, StudentCourse::STATUS_ACTIVE);
         $c->add(StudentCoursePeer::STUDENT_ID, $student->getId());
         $sc = StudentCoursePeer::doSelectOne($c);
         if ($sc) {
             $accal_id = $sc->getSubjectAccal()->getAcademicCalendarId();
             $st = new StudentThesis();
             $st->setStudentid($student->getId());
             $st->setStatus(StudentThesis::STATUS_ACTIVE);
             $st->setAcademicCalendarId($accal_id);
             $st->save();
         } else {
             $student->setStatus($old_status);
             $student->save();
         }
     } elseif ($student->getStatus() == Student::STATUS_GRADUATE) {
         $student->setGraduationDate(date('Y/m/d'));
         $student->save();
     }
     // save 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'));
     }
     // 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'));
     }
     $filter_class = $this->getRequestParameter('filter_class');
     $filter_name = $this->getRequestParameter('filter_name');
     $filter_code = $this->getRequestParameter('filter_code');
     $filter_code2 = $this->getRequestParameter('filter_code2');
     if ($filter_class) {
         return $this->redirect('student/listProfile?filters[CLASS_NAME]=' . $filter_class);
     } elseif ($filter_name) {
         return $this->redirect('student/listProfile?filters[NAME]=' . $filter_name);
     } elseif ($filter_code) {
         return $this->redirect('student/listProfile?filters[CODE]=' . $filter_code);
     } elseif ($filter_code2) {
         return $this->redirect('student/listProfile?filters[CODE2]=' . $filter_code2);
     } else {
         return $this->redirect('student/listProfile');
     }
 }
コード例 #7
0
ファイル: BaseVStudentScore.php プロジェクト: taryono/school
 public function getStudentCourse($con = null)
 {
     include_once 'lib/model/om/BaseStudentCoursePeer.php';
     if ($this->aStudentCourse === null && $this->student_course_id !== null) {
         $this->aStudentCourse = StudentCoursePeer::retrieveByPK($this->student_course_id, $con);
     }
     return $this->aStudentCourse;
 }
コード例 #8
0
ファイル: actions.class.php プロジェクト: taryono/school
 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('id')) {
         $class_course = new ClassCourse();
         $class_course->setClassGroupId($this->getRequestParameter('class_group_id'));
         $class_course->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
         $class_course->setStatus(3);
         $class_course->save();
         $academic_calendar_id = $this->getRequestParameter('academic_calendar_id');
         $academic_calendar = AcademicCalendarPeer::retrieveByPK($academic_calendar_id);
         $this->forward404Unless($academic_calendar);
         $class_group_id = $this->getRequestParameter('class_group_id');
         $class_group = ClassGroupPeer::retrieveByPK($class_group_id);
         $this->forward404Unless($class_group);
         $c = new Criteria();
         $c->add(StudentPeer::CLASS_GROUP_ID, $class_group_id);
         $students = StudentPeer::doSelect($c);
         foreach ($students as $student) {
             $c = new Criteria();
             $c->add(VCourseSchedulePeer::CLASS_GROUP_ID, $class_group_id);
             $c->add(VCourseSchedulePeer::ACADEMIC_CALENDAR_ID, $academic_calendar_id);
             $courses = VCourseSchedulePeer::doSelect($c);
             foreach ($courses as $course) {
                 $student_course = new StudentCourse();
                 $student_course->setStudentId($student->getId());
                 $student_course->setSubjectAccalId($course->getSubjectAccalId());
                 $student_course->setClassGroupId($course->getClassGroupId());
                 $student_course->setStatus(3);
                 $student_course->save();
             }
         }
     } else {
         $class_course = ClassCoursePeer::retrieveByPk($this->getRequestParameter('id'));
         $this->forward404Unless($class_course);
         $class_course->setId($this->getRequestParameter('id'));
         $class_course->setClassGroupId($this->getRequestParameter('class_group_id'));
         $class_course->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
         $class_course->setStatus(3);
         $class_course->save();
         $academic_calendar_id = $this->getRequestParameter('academic_calendar_id');
         $class_group_id = $this->getRequestParameter('class_group_id');
         $c = new Criteria();
         $c->add(StudentPeer::CLASS_GROUP_ID, $class_group_id);
         $students = StudentPeer::doSelect($c);
         foreach ($students as $student) {
             $c = new Criteria();
             $c->add(VCourseSchedulePeer::CLASS_GROUP_ID, $class_group_id);
             $c->add(VCourseSchedulePeer::ACADEMIC_CALENDAR_ID, $academic_calendar_id);
             $courses = VCourseSchedulePeer::doSelect($c);
             foreach ($courses as $course) {
                 $c = new Critaria();
                 $c->add(StudenCoursePeer::STUDENT_ID, $student->getId());
                 $stu_courses = StudentCoursePeer::doSelect($c);
                 foreach ($stu_courses as $stu_courses) {
                     $student_course = StudentCoursePeer::retrieveByPk($stu_courses->getId());
                     $student_course->setStudentId($student->getId());
                     $student_course->setSubjectAccalId($course->getSubjectAccalId());
                     $student_course->setClassGroupId($course->getClassGroupId());
                     $student_course->setStatus(3);
                     $student_course->save();
                 }
             }
         }
     }
     return $this->redirect('subject_plan/list');
 }
コード例 #9
0
ファイル: BaseClassCourse.php プロジェクト: taryono/school
 public function countStudentCourses($criteria = null, $distinct = false, $con = null)
 {
     include_once 'lib/model/om/BaseStudentCoursePeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     $criteria->add(StudentCoursePeer::CLASS_GROUP_ID, $this->getClassGroupId());
     return StudentCoursePeer::doCount($criteria, $distinct, $con);
 }
コード例 #10
0
ファイル: BaseVRaportPeer.php プロジェクト: taryono/school
 public static function doSelectJoinAllExceptAcademicCalendar(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     VRaportPeer::addSelectColumns($c);
     $startcol2 = VRaportPeer::NUM_COLUMNS - VRaportPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     StudentCoursePeer::addSelectColumns($c);
     $startcol3 = $startcol2 + StudentCoursePeer::NUM_COLUMNS;
     GradeComponentPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + GradeComponentPeer::NUM_COLUMNS;
     GradeSpecPeer::addSelectColumns($c);
     $startcol5 = $startcol4 + GradeSpecPeer::NUM_COLUMNS;
     CitationPeer::addSelectColumns($c);
     $startcol6 = $startcol5 + CitationPeer::NUM_COLUMNS;
     SubjectPeer::addSelectColumns($c);
     $startcol7 = $startcol6 + SubjectPeer::NUM_COLUMNS;
     $c->addJoin(VRaportPeer::STUDENT_COURSE_ID, StudentCoursePeer::ID);
     $c->addJoin(VRaportPeer::GRADE_COMPONENT_ID, GradeComponentPeer::ID);
     $c->addJoin(VRaportPeer::GRADE_SPEC_ID, GradeSpecPeer::ID);
     $c->addJoin(VRaportPeer::CITATION_ID, CitationPeer::ID);
     $c->addJoin(VRaportPeer::SUBJECT_ID, SubjectPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = VRaportPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = StudentCoursePeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj2 = new $cls();
         $obj2->hydrate($rs, $startcol2);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj2 = $temp_obj1->getStudentCourse();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addVRaport($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initVRaports();
             $obj2->addVRaport($obj1);
         }
         $omClass = GradeComponentPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj3 = new $cls();
         $obj3->hydrate($rs, $startcol3);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj3 = $temp_obj1->getGradeComponent();
             if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj3->addVRaport($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj3->initVRaports();
             $obj3->addVRaport($obj1);
         }
         $omClass = GradeSpecPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj4 = new $cls();
         $obj4->hydrate($rs, $startcol4);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj4 = $temp_obj1->getGradeSpec();
             if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj4->addVRaport($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj4->initVRaports();
             $obj4->addVRaport($obj1);
         }
         $omClass = CitationPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj5 = new $cls();
         $obj5->hydrate($rs, $startcol5);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj5 = $temp_obj1->getCitation();
             if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj5->addVRaport($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj5->initVRaports();
             $obj5->addVRaport($obj1);
         }
         $omClass = SubjectPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj6 = new $cls();
         $obj6->hydrate($rs, $startcol6);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj6 = $temp_obj1->getSubject();
             if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj6->addVRaport($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj6->initVRaports();
             $obj6->addVRaport($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
コード例 #11
0
ファイル: actions.class.php プロジェクト: taryono/school
 public function executeGetKkm()
 {
     $sc_id = $this->getRequestParameter('student_course_id');
     $sc = StudentCoursePeer::retrieveByPK($sc_id);
     $this->forward404Unless($sc);
     $c = new Criteria();
     $c->add(SubjectGradingPeer::SUBJECT_ACCAL_ID, $sc->getSubjectAccalId());
     $sg = SubjectGradingPeer::doSelectOne($c);
     $this->forward404Unless($sg);
     return $this->renderText("<input type='text' size='7' value='" . $sg->getPercentage() . "' id='kkm' name='kkm'/>");
 }
コード例 #12
0
 public static function doSelectJoinAllExceptCitation(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     StudentScorePeer::addSelectColumns($c);
     $startcol2 = StudentScorePeer::NUM_COLUMNS - StudentScorePeer::NUM_LAZY_LOAD_COLUMNS + 1;
     StudentCoursePeer::addSelectColumns($c);
     $startcol3 = $startcol2 + StudentCoursePeer::NUM_COLUMNS;
     GradeComponentPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + GradeComponentPeer::NUM_COLUMNS;
     $c->addJoin(StudentScorePeer::STUDENT_COURSE_ID, StudentCoursePeer::ID);
     $c->addJoin(StudentScorePeer::GRADE_COMPONENT_ID, GradeComponentPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = StudentScorePeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = StudentCoursePeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj2 = new $cls();
         $obj2->hydrate($rs, $startcol2);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj2 = $temp_obj1->getStudentCourse();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addStudentScore($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initStudentScores();
             $obj2->addStudentScore($obj1);
         }
         $omClass = GradeComponentPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj3 = new $cls();
         $obj3->hydrate($rs, $startcol3);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj3 = $temp_obj1->getGradeComponent();
             if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj3->addStudentScore($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj3->initStudentScores();
             $obj3->addStudentScore($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
コード例 #13
0
ファイル: actions.class.php プロジェクト: taryono/school
 public function executeSavePreview()
 {
     $class_id = $this->getRequestParameter('class_group_id');
     $accal_id = $this->getRequestParameter('academic_calendar_id');
     $c = new Criteria();
     $c->add(StudentPeer::CLASS_GROUP_ID, $this->getRequestParameter('class_group_id'));
     $students = StudentPeer::doSelect($c);
     $counts = StudentPeer::doCount($c);
     $c = new Criteria();
     $c->add(GradeComponentPeer::GRADE_SPEC_ID, '20');
     $c->add(GradeComponentPeer::PUBLISHED, '1');
     $components = GradeComponentPeer::doSelect($c);
     $accal = AcademicCalendarPeer::retrieveByPk($this->getRequestParameter('academic_calendar_id'));
     $c = new Criteria();
     $c->add(CourseSchedulePeer::ACADEMIC_CALENDAR_ID, $accal_id);
     $c->add(CourseSchedulePeer::CLASS_GROUP_ID, $class_id);
     $course_schedules = CourseSchedulePeer::doSelect($c);
     $counts = CourseSchedulePeer::doCount($c);
     if ($accal->getCurriculum()->getCourseModel() == Curriculum::CM_PACKAGED || $accal->getCurriculum()->getCourseModel() == Curriculum::CM_PACKAGED_CUSTOM) {
         #if ($counts > 1) {
         foreach ($course_schedules as $course_schedule) {
             foreach ($students as $student) {
                 $c = new Criteria();
                 $c->add(StudentCoursePeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                 $c->add(StudentCoursePeer::STUDENT_ID, $student->getId());
                 $stu_courses = StudentCoursePeer::doCount($c);
                 if ($stu_courses < 1) {
                     $student_course = new StudentCourse();
                     $student_course->setStudentId($student->getId());
                     $student_course->setSubjectCurrId($course_schedule->getSubjectCurrId());
                     $student_course->setStatus(1);
                     $student_course->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
                     $student_course->setClassGroupId($this->getRequestParameter('class_group_id'));
                     $student_course->save();
                 }
             }
         }
         foreach ($students as $student) {
             foreach ($components as $component) {
                 $c = new Criteria();
                 $c->add(StudentCoursePeer::STUDENT_ID, $student->getId());
                 $c->add(StudentCoursePeer::GRADE_COMPONENT_ID, $component->getId());
                 $com_courses = StudentCoursePeer::doCount($c);
                 if ($com_courses < 1) {
                     $student_course = new StudentCourse();
                     $student_course->setStudentId($student->getId());
                     $student_course->setStatus(1);
                     $student_course->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
                     $student_course->setClassGroupId($this->getRequestParameter('class_group_id'));
                     $student_course->setGradeComponentId($component->getId());
                     $student_course->save();
                 }
             }
         }
         #}
     }
     return $this->redirect('course_schedule/list');
 }
コード例 #14
0
ファイル: actions.class.php プロジェクト: taryono/school
 public function executeTranscript()
 {
     $student = StudentPeer::retrieveByPK($this->getContext()->getUser()->getAttribute('user_id', '', 'bo'));
     $this->forward404Unless($student);
     $c = new Criteria();
     $c->add(StudentCoursePeer::STUDENT_ID, $student->getId());
     $c->addAscendingOrderByColumn(SubjectPeer::CODE);
     $c->addJoin(SubjectAccalPeer::ID, StudentCoursePeer::SUBJECT_ACCAL_ID);
     $c->addJoin(SubjectPeer::ID, SubjectAccalPeer::SUBJECT_ID);
     $c->add(StudentCoursePeer::STATUS, StudentCourse::STATUS_CLOSED);
     $courses = StudentCoursePeer::doSelect($c);
     $this->courses = $courses;
     $this->student = $student;
     $this->setViewClass('sfDomPDF');
 }
コード例 #15
0
ファイル: BaseStudentCourse.php プロジェクト: taryono/school
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = StudentCoursePeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setStudentId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setSubjectAccalId($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setSubjectCurrId($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setClassGroupId($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setAcademicCalendarId($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setGradeComponentId($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setScheduleId($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setScheduleDetailId($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setStatus($arr[$keys[9]]);
     }
 }
コード例 #16
0
ファイル: listAsCSVSuccess.php プロジェクト: taryono/school
echo __('Subject');
?>
","<?php 
echo __('Credit');
?>
","<?php 
echo __('Subject group');
?>
"
<?php 
$i = 0;
foreach ($pager->getResults() as $subject_curr) {
    $c = new Criteria();
    $c->addJoin(StudentCoursePeer::SUBJECT_ACCAL_ID, SubjectAccalPeer::ID);
    $c->add(SubjectAccalPeer::SUBJECT_ID, $subject_curr->getSubjectId());
    $sc = StudentCoursePeer::doCount($c);
    ++$i;
    ?>
"<?php 
    echo $i + ($pager->getPage() - 1) * $pager->getMaxPerPage();
    ?>
","<?php 
    echo $subject_curr->getSubject() && strlen($subject_curr->getSubject()->toString()) > 0 ? $subject_curr->getSubject()->toString() : 'n/a';
    ?>
","<?php 
    echo $subject_curr->getSubject()->getCredit();
    ?>
","<?php 
    echo $subject_curr->getSubject()->getSubjectGroup() ? $subject_curr->getSubject()->getSubjectGroup()->toString() : '-';
    ?>
"
コード例 #17
0
 public static function retrieveByPKs($pks, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria();
         $criteria->add(StudentCoursePeer::ID, $pks, Criteria::IN);
         $objs = StudentCoursePeer::doSelect($criteria, $con);
     }
     return $objs;
 }
コード例 #18
0
ファイル: actions.class.php プロジェクト: taryono/school
 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');
     $student = StudentPeer::retrieveByPK($this->getRequestParameter('student_id'));
     $this->forward404Unless($student);
     $this->student = $student;
     if ($action_type == $action_i18n || !$this->getRequestParameter('id')) {
         $student_leave = new StudentLeave();
         $student_leave->setStatus(StudentLeave::STATUS_PROPOSED);
     } else {
         $student_leave = StudentLeavePeer::retrieveByPk($this->getRequestParameter('id'));
         $this->forward404Unless($student_leave);
         $student_leave->setStatus(StudentLeave::STATUS_CANCELED);
     }
     $student_leave->setId($this->getRequestParameter('id'));
     $student_leave->setStudentId($this->getRequestParameter('student_id'));
     $student_leave->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
     $student_leave->save();
     $stu = $student_leave->getStudent();
     if ($student_leave->getStatus() == StudentLeave::STATUS_ACTIVE) {
         // add payment journal
         $job = JobPeer::retrieveByCode($this->getModuleName());
         $academic_process = $job->getAcademicProcess();
         $c = new Criteria();
         $c->add(AcademicCostPeer::ACADEMIC_PROCESS_ID, $academic_process->getId());
         $c->add(AcademicCostPeer::ACADEMIC_CALENDAR_ID, $student_leave->getAcademicCalendarId());
         $costs = AcademicCostPeer::doSelect($c);
         foreach ($costs as $c) {
             $pj = new PaymentJournal();
             $pj->setPayer($stu->getId());
             $pj->setAcademicCost($c);
             $pj->setJob($job);
             $pj->setAmount($c->getAmount());
             $pj->setPaid($c->getAmount());
             $pj->setReceivable(0);
             $pj->setAcademicProcess($academic_process);
             $pj->setPayerType(PaymentJournal::PAYER_TYPE_STUDENT);
             $pj->save();
             $ph = new PaymentHistory();
             $ph->setPaymentJournal($pj);
             $ph->setAmount($c->getAmount());
             $ph->save();
         }
         // set student status
         $stu->setStatus(Student::STATUS_INACTIVE);
         $stu->save();
         // cancelled all student course
         $c = new Criteria();
         $c->add(StudentCoursePeer::STUDENT_ID, $stu->getId());
         $c->add(StudentCoursePeer::STATUS, array(StudentCourse::STATUS_PLANNED, StudentCourse::STATUS_APPROVED, StudentCourse::STATUS_ACTIVE), Criteria::IN);
         $scs = StudentCoursePeer::doSelect($c);
         foreach ($scs as $sc) {
             $sc->setStatus(StudentCourse::STATUS_CANCELED);
             $sc->save();
         }
     } elseif ($student_leave->getStatus() == StudentLeave::STATUS_DONE) {
         $stu->setStatus(Student::STATUS_ACTIVE);
         $stu->save();
     }
     return $this->redirect('student_leave_s/list?student_id=' . $student->getId());
 }
コード例 #19
0
ファイル: actions.class.php プロジェクト: taryono/school
 public function executeSelectByAccal()
 {
     $student_course_id = $this->getRequestParameter('student_course_id');
     $student_course = StudentCoursePeer::retrieveByPK($student_course_id);
     if (!$student_course) {
         $student_course = new StudentCourse();
     }
     $student_id = $this->getRequestParameter('student_id');
     $student = StudentPeer::retrieveByPK($student_id);
     //		$this->forward404Unless($student);
     $accal_id = $this->getRequestParameter('accal_id');
     $accal = AcademicCalendarPeer::retrieveByPK($accal_id);
     $disabled = array();
     if ($student) {
         $student_courses = $student->getStudentCoursesJoinSubjectAccal();
         foreach ($student_courses as $sc) {
             if ($sc->getSubjectAccal()->getAcademicCalendarId() == $accal->getId() && $student_course->getSubjectAccalId() != $sc->getSubjectAccal()->getId()) {
                 $disabled[] = $sc->getSubjectAccal()->getId();
             }
         }
     }
     $content = array();
     $objs = SubjectAccalPeer::doSelectByAccal();
     if ($student) {
         foreach ($objs as $o) {
             $content[$o->getId()] = $o->toString();
             $c = new Criteria();
             $c->add(SubjectAccalPeer::ID, $o->getId());
             $c->add(SubjectCurrPeer::SUBJECT_ID, $o->getSubjectId());
             $c->addJoin(AcademicCalendarPeer::ID, SubjectAccalPeer::ACADEMIC_CALENDAR_ID);
             $c->addJoin(AcademicCalendarPeer::CURRICULUM_ID, SubjectCurrPeer::CURRICULUM_ID);
             $c->addJoin(SubjectCurrPeer::ID, SubjectPrereqPeer::SUBCURR);
             $sps = SubjectPrereqPeer::doSelect($c);
             foreach ($sps as $sp) {
                 $s = $sp->getSubjectCurrRelatedBySubcurrPrereq()->getSubject();
                 // prereq subject must be in closed state
                 $c = new Criteria();
                 $c->add(SubjectAccalPeer::SUBJECT_ID, $s->getId());
                 $c->add(StudentCoursePeer::STUDENT_ID, $student_id);
                 $c->add(StudentCoursePeer::STATUS, StudentCourse::STATUS_CLOSED);
                 $c->addJoin(StudentCoursePeer::SUBJECT_ACCAL_ID, SubjectAccalPeer::ID);
                 $scs = StudentCoursePeer::doSelect($c);
                 $isPassGrade = false;
                 $isPassCredit = true;
                 $isPassIndex = true;
                 foreach ($scs as $sc) {
                     $grade = $sc->getFinalGrade();
                     $gc = GradeConversionPeer::retrieveByName($grade[0]);
                     // check prereq subject grade
                     if ($gc && $gc->getGrade() >= $sp->getGradeConversion()->getGrade()) {
                         $isPassGrade = true;
                     } else {
                         $isPassGrade = false;
                     }
                     // check credit requirement
                     if ($sp->getTotalCredit() > 0) {
                         if ($sc->getTotalCreditClosed() >= $sp->getTotalCredit()) {
                             $isPassCredit = true;
                         } else {
                             $isPassCredit = false;
                         }
                     }
                     // check index requirement
                     if ($sp->getPerformanceIndex() > 0) {
                         if ($sc->getPerformanceIndex() >= $sp->getPerformanceIndex()) {
                             $isPassIndex = true;
                         } else {
                             $isPassIndex = false;
                         }
                     }
                 }
                 $s0 = $sp->getSubjectCurrRelatedBySubcurrPrereq()->getSubject()->toString();
                 $s1 = $sp->getSubjectCurrRelatedBySubcurr()->getSubject()->toString();
                 //				echo "<div align=left><pre>";
                 //				echo "$s1 -> $s0 | isPassGrade:$isPassGrade isPassCredit:$isPassCredit isPassIndex:$isPassIndex";
                 //				echo "</pre></div>";
                 if (!$isPassGrade || !$isPassCredit || !$isPassIndex) {
                     $disabled[] = $o->getId();
                 }
             }
         }
     } else {
         foreach ($objs as $o) {
             $content[$o->getId()] = $o->toString();
         }
     }
     $this->content = $content;
     $this->disabled = $disabled;
 }
コード例 #20
0
ファイル: BaseSubjectCurr.php プロジェクト: taryono/school
 public function getStudentCoursesJoinScheduleDetail($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseStudentCoursePeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collStudentCourses === null) {
         if ($this->isNew()) {
             $this->collStudentCourses = array();
         } else {
             $criteria->add(StudentCoursePeer::SUBJECT_CURR_ID, $this->getId());
             $this->collStudentCourses = StudentCoursePeer::doSelectJoinScheduleDetail($criteria, $con);
         }
     } else {
         $criteria->add(StudentCoursePeer::SUBJECT_CURR_ID, $this->getId());
         if (!isset($this->lastStudentCourseCriteria) || !$this->lastStudentCourseCriteria->equals($criteria)) {
             $this->collStudentCourses = StudentCoursePeer::doSelectJoinScheduleDetail($criteria, $con);
         }
     }
     $this->lastStudentCourseCriteria = $criteria;
     return $this->collStudentCourses;
 }
コード例 #21
0
ファイル: actions.class.php プロジェクト: taryono/school
 public function executeSelectByStudentCourse()
 {
     $student_course_id = $this->getRequestParameter('student_course_id');
     $student_course = StudentCoursePeer::retrieveByPK($student_course_id);
     $this->forward404Unless($student_course);
     $content = array();
     $subject_accal = $student_course->getSubjectAccal();
     $objs = $subject_accal->getSubjectGradings();
     foreach ($objs as $o) {
         $content[$o->getGradeComponentId()] = $o->getGradeComponent()->toString();
     }
     $this->content = $content;
 }
コード例 #22
0
        echo $subject->getSubjectCurrId() ? $subject->getSubjectCurr()->getSubject()->getName() : '-';
        ?>
</td>
                    <td style="color: #017FC0;">
					<?php 
        $cs_detail = CourseScheduleDetailPeer::retrieveByPk($subject->getId());
        echo $cs_detail->getCourseSchedule()->getKkm() ? $cs_detail->getCourseSchedule()->getKkm() : '0';
        ?>
</td>
            	<?php 
        $c = new Criteria();
        $c->add(StudentCoursePeer::STUDENT_ID, $student->getId());
        $c->add(StudentCoursePeer::SUBJECT_CURR_ID, $subject->getSubjectCurrId());
        $c->add(StudentCoursePeer::CLASS_GROUP_ID, $subject->getClassGroupId());
        $c->add(StudentCoursePeer::ACADEMIC_CALENDAR_ID, $subject->getAcademicCalendarId());
        $student_course = StudentCoursePeer::doSelectOne($c);
        ?>
                <?php 
        foreach ($grade1 as $g1) {
            $cr = new Criteria();
            $cr->add(StudentRaportPeer::STUDENT_COURSE_ID, $student_course->getId());
            $cr->add(StudentRaportPeer::GRADE_SPEC_ID, $g1->getId());
            $sr1 = StudentRaportPeer::doSelectOne($cr);
            ?>
                	<td align="center" style="text-align:center" class="first">
					<?php 
            echo $sr1 != null ? $sr1->getGrade() : '-';
            ?>
                    </td>
				<?php 
        }
コード例 #23
0
 public static function doSelectJoinAllExceptStudent(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     VSubjectAccalLectorStudentDetailPeer::addSelectColumns($c);
     $startcol2 = VSubjectAccalLectorStudentDetailPeer::NUM_COLUMNS - VSubjectAccalLectorStudentDetailPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     SubjectAccalPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + SubjectAccalPeer::NUM_COLUMNS;
     ClassGroupPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + ClassGroupPeer::NUM_COLUMNS;
     AcademicCalendarPeer::addSelectColumns($c);
     $startcol5 = $startcol4 + AcademicCalendarPeer::NUM_COLUMNS;
     SubjectPeer::addSelectColumns($c);
     $startcol6 = $startcol5 + SubjectPeer::NUM_COLUMNS;
     EmployeePeer::addSelectColumns($c);
     $startcol7 = $startcol6 + EmployeePeer::NUM_COLUMNS;
     CurriculumPeer::addSelectColumns($c);
     $startcol8 = $startcol7 + CurriculumPeer::NUM_COLUMNS;
     DepartmentPeer::addSelectColumns($c);
     $startcol9 = $startcol8 + DepartmentPeer::NUM_COLUMNS;
     StudentCoursePeer::addSelectColumns($c);
     $startcol10 = $startcol9 + StudentCoursePeer::NUM_COLUMNS;
     $c->addJoin(VSubjectAccalLectorStudentDetailPeer::SUBJECT_ACCAL_ID, SubjectAccalPeer::ID);
     $c->addJoin(VSubjectAccalLectorStudentDetailPeer::CLASS_GROUP_ID, ClassGroupPeer::ID);
     $c->addJoin(VSubjectAccalLectorStudentDetailPeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID);
     $c->addJoin(VSubjectAccalLectorStudentDetailPeer::SUBJECT_ID, SubjectPeer::ID);
     $c->addJoin(VSubjectAccalLectorStudentDetailPeer::EMPLOYEE_ID, EmployeePeer::ID);
     $c->addJoin(VSubjectAccalLectorStudentDetailPeer::CURRICULUM_ID, CurriculumPeer::ID);
     $c->addJoin(VSubjectAccalLectorStudentDetailPeer::DEPARTMENT_ID, DepartmentPeer::ID);
     $c->addJoin(VSubjectAccalLectorStudentDetailPeer::STUDENT_COURSE_ID, StudentCoursePeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = VSubjectAccalLectorStudentDetailPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = SubjectAccalPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj2 = new $cls();
         $obj2->hydrate($rs, $startcol2);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj2 = $temp_obj1->getSubjectAccal();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addVSubjectAccalLectorStudentDetail($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initVSubjectAccalLectorStudentDetails();
             $obj2->addVSubjectAccalLectorStudentDetail($obj1);
         }
         $omClass = ClassGroupPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj3 = new $cls();
         $obj3->hydrate($rs, $startcol3);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj3 = $temp_obj1->getClassGroup();
             if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj3->addVSubjectAccalLectorStudentDetail($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj3->initVSubjectAccalLectorStudentDetails();
             $obj3->addVSubjectAccalLectorStudentDetail($obj1);
         }
         $omClass = AcademicCalendarPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj4 = new $cls();
         $obj4->hydrate($rs, $startcol4);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj4 = $temp_obj1->getAcademicCalendar();
             if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj4->addVSubjectAccalLectorStudentDetail($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj4->initVSubjectAccalLectorStudentDetails();
             $obj4->addVSubjectAccalLectorStudentDetail($obj1);
         }
         $omClass = SubjectPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj5 = new $cls();
         $obj5->hydrate($rs, $startcol5);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj5 = $temp_obj1->getSubject();
             if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj5->addVSubjectAccalLectorStudentDetail($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj5->initVSubjectAccalLectorStudentDetails();
             $obj5->addVSubjectAccalLectorStudentDetail($obj1);
         }
         $omClass = EmployeePeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj6 = new $cls();
         $obj6->hydrate($rs, $startcol6);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj6 = $temp_obj1->getEmployee();
             if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj6->addVSubjectAccalLectorStudentDetail($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj6->initVSubjectAccalLectorStudentDetails();
             $obj6->addVSubjectAccalLectorStudentDetail($obj1);
         }
         $omClass = CurriculumPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj7 = new $cls();
         $obj7->hydrate($rs, $startcol7);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj7 = $temp_obj1->getCurriculum();
             if ($temp_obj7->getPrimaryKey() === $obj7->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj7->addVSubjectAccalLectorStudentDetail($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj7->initVSubjectAccalLectorStudentDetails();
             $obj7->addVSubjectAccalLectorStudentDetail($obj1);
         }
         $omClass = DepartmentPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj8 = new $cls();
         $obj8->hydrate($rs, $startcol8);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj8 = $temp_obj1->getDepartment();
             if ($temp_obj8->getPrimaryKey() === $obj8->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj8->addVSubjectAccalLectorStudentDetail($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj8->initVSubjectAccalLectorStudentDetails();
             $obj8->addVSubjectAccalLectorStudentDetail($obj1);
         }
         $omClass = StudentCoursePeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj9 = new $cls();
         $obj9->hydrate($rs, $startcol9);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj9 = $temp_obj1->getStudentCourse();
             if ($temp_obj9->getPrimaryKey() === $obj9->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj9->addVSubjectAccalLectorStudentDetail($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj9->initVSubjectAccalLectorStudentDetails();
             $obj9->addVSubjectAccalLectorStudentDetail($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }