Ejemplo n.º 1
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = CounselingTutorPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setCounselingId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setEmployeeId($arr[$keys[2]]);
     }
 }
            </tr>
            <tr><td colspan="3" height="30px"></td></tr>
            <tr>
                    <td></td>
                    <td style="text-align: left; font-size: 10px; font-weight: bold;">
                    <?php 
$c = new Criteria();
$c->add(EmployeePeer::DEPARTMENT_ID, $counseling->getAcademicCalendar()->getDepartmentId());
$c->add(EmployeePeer::STAFF_TYPE_ID, 14);
$employee = EmployeePeer::doSelectOne($c);
echo $employee->getName() ? $employee->getName() : '-';
?>
                    </td>
                    <td style="text-align: left; font-size: 10px; font-weight: bold;">
                    <?php 
$cb = new Criteria();
$cb->add(CounselingTutorPeer::COUNSELING_ID, $counseling->getId());
$cb->addAscendingOrderByColumn(CounselingTutorPeer::ID);
$counseling_tutor = CounselingTutorPeer::doSelect($cb);
$tutors = array();
foreach ($counseling_tutor as $cr) {
    $tutors[] = $cr->getEmployee() ? $cr->getEmployee()->getName() : '';
}
echo join(",&nbsp;", $tutors);
?>
                    </td>
            </tr>
    </table>

    </center>
Ejemplo n.º 3
0
 public function getCounselingTutorsJoinCounseling($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseCounselingTutorPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collCounselingTutors === null) {
         if ($this->isNew()) {
             $this->collCounselingTutors = array();
         } else {
             $criteria->add(CounselingTutorPeer::EMPLOYEE_ID, $this->getId());
             $this->collCounselingTutors = CounselingTutorPeer::doSelectJoinCounseling($criteria, $con);
         }
     } else {
         $criteria->add(CounselingTutorPeer::EMPLOYEE_ID, $this->getId());
         if (!isset($this->lastCounselingTutorCriteria) || !$this->lastCounselingTutorCriteria->equals($criteria)) {
             $this->collCounselingTutors = CounselingTutorPeer::doSelectJoinCounseling($criteria, $con);
         }
     }
     $this->lastCounselingTutorCriteria = $criteria;
     return $this->collCounselingTutors;
 }
Ejemplo n.º 4
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(CounselingTutorPeer::ID, $pks, Criteria::IN);
         $objs = CounselingTutorPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Ejemplo n.º 5
0
 public function executeSave()
 {
     $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');
     $counseling = new Counseling();
     $counseling->setId($this->getRequestParameter('id'));
     $counseling->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
     $counseling->setClassGroupId($this->getRequestParameter('class_group_id'));
     $counseling->setEmployeeId($this->getRequestParameter('employee_id'));
     $counseling->setClassTypeId($this->getRequestParameter('class_type_id'));
     $counseling->save();
     $c = new Criteria();
     $c->add(CounselingTutorPeer::COUNSELING_ID, $counseling->getId());
     CounselingTutorPeer::doDelete($c);
     $tutors = $this->getRequestParameter('isSelected');
     if ($tutors) {
         foreach ($tutors as $id) {
             $cr = new CounselingTutor();
             $cr->setCounseling($counseling);
             $cr->setEmployeeId($id);
             $cr->save();
         }
     }
     return $this->redirect('counselor/edit?id=' . $counseling->getId());
 }
Ejemplo n.º 6
0
 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');
     $counseling = CounselingPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($counseling);
     $counseling->setId($this->getRequestParameter('id'));
     $counseling->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
     $counseling->setClassGroupId($this->getRequestParameter('class_group_id'));
     $counseling->save();
     $c = new Criteria();
     $c->add(CounselingTutorPeer::COUNSELING_ID, $counseling->getId());
     CounselingTutorPeer::doDelete($c);
     $tutors = $this->getRequestParameter('isSelected');
     if ($tutors) {
         foreach ($tutors as $id) {
             $cr = new CounselingTutor();
             $cr->setCounseling($counseling);
             $cr->setEmployeeId($id);
             $cr->save();
         }
     }
     $params = array();
     foreach (explode('&', $this->getRequestParameter('student_list_ser')) as $p) {
         $p = explode('=', $p);
         $params[rawurldecode($p[0])][] = rawurldecode($p[1]);
     }
     $accal = AcademicCalendarPeer::retrieveByPk($this->getRequestParameter('academic_calendar_id'));
     if (array_key_exists('students', $params)) {
         foreach ($params['students'] as $stu_id) {
             $stu = StudentPeer::retrieveByPk($stu_id);
             $stu->setAcademicCalendarId($counseling->getAcademicCalendarId());
             $stu->setClassGroupId($counseling->getClassGroupId());
             $stu->save();
             $c = new Criteria();
             $c->add(AcademicCalendarPeer::PARENT, $counseling->getAcademicCalendarId());
             $academics = AcademicCalendarPeer::doSelect($c);
             if ($academics) {
                 foreach ($academics as $academic) {
                     $cr = new Criteria();
                     $cr->add(StudentAccalPeer::STUDENT_ID, $stu_id);
                     $cr->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $academic->getId());
                     #$cr->add(StudentAccalPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
                     $stu_accal = StudentAccalPeer::doSelectOne($cr);
                     if ($stu_accal == null) {
                         $stu_accal = new StudentAccal();
                     }
                     $stu_accal->setStudentId($stu_id);
                     $stu_accal->setAcademicCalendarId($academic->getId());
                     $stu_accal->setClassGroupId($counseling->getClassGroupId());
                     $stu_accal->save();
                 }
             }
         }
     }
     return $this->redirect('counselor/showPreview?id=' . $counseling->getId());
 }
Ejemplo n.º 7
0
        }
        ?>

		</tbody>   		
  	</table> 

	<br /><br />

	<table align="center" style="border-collapse:collapse; margin-left: 0px;width:90%; page-break-after: always;">
		<tr>
			<?php 
        $cb = new Criteria();
        $cb->add(CounselingTutorPeer::COUNSELING_ID, $counseling->getId());
        $cb->addAscendingOrderByColumn(CounselingTutorPeer::ID);
        $counseling_tutor = CounselingTutorPeer::doSelect($cb);
        $tutor_count = CounselingTutorPeer::doCount($cb);
        ?>
			
	
			<?php 
        if ($tutor_count > 1) {
            ?>

				<td width="40%" style="vertical-align: top; font-size: 11px;"></td>
				<td width="60%" style="vertical-align: top; font-size: 11px;">
			
			<?php 
        } else {
            ?>
				
				<td width="60%" style="vertical-align: top; font-size: 11px;"></td>