コード例 #1
0
ファイル: actions.class.php プロジェクト: taryono/school
 public function executeSaveScore()
 {
     $student_id = $this->getRequestParameter('student_id');
     $student = StudentPeer::retrieveByPK($student_id);
     $this->forward404Unless($student);
     $academic_calendar_id = $this->getRequestParameter('academic_calendar_id');
     $academic_calendar = AcademicCalendarPeer::retrieveByPK($academic_calendar_id);
     $this->forward404Unless($academic_calendar);
     $counseling_id = $this->getRequestParameter('counseling_id');
     $counseling = CounselingPeer::retrieveByPK($counseling_id);
     $this->forward404Unless($counseling);
     $student_accal_id = $this->getRequestParameter('student_accal_id');
     $student_accal = StudentAccalPeer::retrieveByPK($student_accal_id);
     $this->forward404Unless($student_accal);
     $scores = $this->getRequestParameter('score');
     foreach ($scores as $k => $score) {
         if ($score != null) {
             $cb = new Criteria();
             $cb->add(CounselingRaportPeer::STUDENT_ACCAL_ID, $student_accal->getId());
             $cb->add(CounselingRaportPeer::COUNSELING_SPEC_ID, $k);
             $raport = CounselingRaportPeer::doSelectOne($cb);
             if ($raport == null) {
                 $raport = new CounselingRaport();
             }
             $raport->setStudentAccalId($student_accal->getId());
             $raport->setCounselingSpecId($k);
             $raport->setGrade($score);
             $raport->save();
         } else {
             $cb = new Criteria();
             $cb->add(CounselingRaportPeer::STUDENT_ACCAL_ID, $student_accal->getId());
             $cb->add(CounselingRaportPeer::COUNSELING_SPEC_ID, $k);
             $raport = CounselingRaportPeer::doSelectOne($cb);
             if ($raport != null) {
                 $raport->delete();
             }
         }
     }
     return $this->redirect('counseling_raport/listCounselingScore?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId());
 }
コード例 #2
0
ファイル: BaseCounselingSpec.php プロジェクト: taryono/school
 public function getCounselingRaportsJoinSubjectCurr($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseCounselingRaportPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collCounselingRaports === null) {
         if ($this->isNew()) {
             $this->collCounselingRaports = array();
         } else {
             $criteria->add(CounselingRaportPeer::COUNSELING_SPEC_ID, $this->getId());
             $this->collCounselingRaports = CounselingRaportPeer::doSelectJoinSubjectCurr($criteria, $con);
         }
     } else {
         $criteria->add(CounselingRaportPeer::COUNSELING_SPEC_ID, $this->getId());
         if (!isset($this->lastCounselingRaportCriteria) || !$this->lastCounselingRaportCriteria->equals($criteria)) {
             $this->collCounselingRaports = CounselingRaportPeer::doSelectJoinSubjectCurr($criteria, $con);
         }
     }
     $this->lastCounselingRaportCriteria = $criteria;
     return $this->collCounselingRaports;
 }
コード例 #3
0
 public static function retrieveByPK($id, $student_accal_id, $subject_curr_id, $counseling_spec_id, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $criteria = new Criteria();
     $criteria->add(CounselingRaportPeer::ID, $id);
     $criteria->add(CounselingRaportPeer::STUDENT_ACCAL_ID, $student_accal_id);
     $criteria->add(CounselingRaportPeer::SUBJECT_CURR_ID, $subject_curr_id);
     $criteria->add(CounselingRaportPeer::COUNSELING_SPEC_ID, $counseling_spec_id);
     $v = CounselingRaportPeer::doSelect($criteria, $con);
     return !empty($v) ? $v[0] : null;
 }
コード例 #4
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = CounselingRaportPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setStudentAccalId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setSubjectCurrId($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setCounselingSpecId($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setGrade($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setDescription($arr[$keys[5]]);
     }
 }
コード例 #5
0
<?php

use_helper('Number', 'myHelper');
foreach ($students as $student) {
    $student_detail = $student->getStudentDetail();
    echo include_partial('global/printCover');
    $cem = new Criteria();
    $cem->add(StudentAccalPeer::STUDENT_ID, $student->getId());
    $cem->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
    $cem->add(StudentAccalPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
    $cem->add(StudentAccalPeer::STATUS, 1);
    $stu_acc = StudentAccalPeer::doSelectOne($cem);
    $cr = new Criteria();
    $cr->add(CounselingRaportPeer::STUDENT_ACCAL_ID, $stu_acc->getId());
    $student_couns = CounselingRaportPeer::doSelect($cr);
    $stu_coun = array();
    foreach ($student_couns as $student_coun) {
        $stu_coun[$student_coun->getCounselingSpecId()] = $student_coun->getGrade();
    }
    ?>

            <table border="0" width="100%" style="page-break-after: always;">
                <tr>
                    <td colspan="2" width="100%" align="left" valign="top" <?php 
    if ($score_rule->getImage() != 1) {
        echo 'height="30px"';
    }
    ?>
>
                        <?php 
    if ($score_rule->getImage() == 1) {