public function filterOut($c, $filters) { $filters_key = array_keys($filters); foreach ($filters_key as $key) { $value = $filters[$key]; if ($value == '' || $value == null) { continue; } if ($key == 'NAME') { $c->addJoin(OutclassCounselingPeer::STUDENT_ID, StudentPeer::ID); $column = StudentPeer::getTableMap()->getColumn('NAME'); } elseif ($key == 'CODE') { $c->addJoin(OutclassCounselingPeer::STUDENT_ID, StudentPeer::ID); $column = StudentPeer::getTableMap()->getColumn('CODE'); } elseif ($key == 'CODE2') { $c->addJoin(OutclassCounselingPeer::STUDENT_ID, StudentPeer::ID); $column = StudentPeer::getTableMap()->getColumn('CODE2'); } elseif ($key == 'YEAR') { $c->addJoin(OutclassCounselingPeer::STUDENT_ID, StudentPeer::ID); $column = StudentPeer::getTableMap()->getColumn('YEAR'); } else { $column = OutclassCounselingPeer::getTableMap()->getColumn($key); } $name = $column->getFullyQualifiedName(); $creoleType = $column->getCreoleType(); if ($creoleType == CreoleTypes::TIMESTAMP) { $c->add($name, $value, Criteria::LIKE); } else { if ($creoleType == CreoleTypes::DATE) { $c->add($name, $value, Criteria::LIKE); } else { if ($creoleType == CreoleTypes::INTEGER) { $c->add($name, $value, Criteria::EQUAL); } else { if ($creoleType == CreoleTypes::VARCHAR || $creoleType == CreoleTypes::CHAR) { $c->add($name, "%{$value}%", Criteria::LIKE); } } } } } }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = OutclassCounselingPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setEmployeeId($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setStudentInformer($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setTimeReport($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setLocationId($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setLocationDetail($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setDetail($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setAction($arr[$keys[7]]); } if (array_key_exists($keys[8], $arr)) { $this->setStatus($arr[$keys[8]]); } if (array_key_exists($keys[9], $arr)) { $this->setStudentId($arr[$keys[9]]); } if (array_key_exists($keys[10], $arr)) { $this->setCounselingStatusId($arr[$keys[10]]); } if (array_key_exists($keys[11], $arr)) { $this->setClassGroupId($arr[$keys[11]]); } if (array_key_exists($keys[12], $arr)) { $this->setGrade($arr[$keys[12]]); } if (array_key_exists($keys[13], $arr)) { $this->setReward($arr[$keys[13]]); } if (array_key_exists($keys[14], $arr)) { $this->setAcademicCalendarId($arr[$keys[14]]); } }
public function executeShowOutclassCounseling() { $class_counseling = OutclassCounselingPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($class_counseling); $this->subtitle = StudentPeer::retrieveByPK($class_counseling->getStudentId())->toString() . ' - id:' . $class_counseling->getId(); $actions = array(array('name' => 'back', 'url' => 'sm_content/listOutclassCounseling', 'color' => 'black')); $this->actions = $actions; $actions2 = array(array('name' => '<span>Konseling Dalam Kelas</span>', 'url' => 'sm_content/listCounseling', 'color' => 'sky')); array_push($actions2, array('name' => '<span>Konseling Luar Kelas</span>', 'url' => 'sm_content/listOutclassCounseling', 'color' => 'sun', 'type' => 'direct')); $this->actions2 = $actions2; $this->class_counseling = $class_counseling; }
public function executeSaveEmail() { $employee_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo'); $employee = EmployeePeer::retrieveByPK($employee_id); $this->forward404Unless($employee); $outclass_counseling = OutclassCounselingPeer::retrieveByPK($this->getRequestParameter('outclass_counseling_id')); $this->forward404Unless($outclass_counseling); $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 (!$this->getRequestParameter('student_id')) { $emp = EmployeePeer::retrieveByPK($this->getRequestParameter('employee_2')); $this->forward404Unless($emp); $inbox_emp = new InboxEmp(); $inbox_emp->setEmployee2($this->getRequestParameter('employee_id')); $inbox_emp->setEmployeeId($emp->getId()); $inbox_emp->setSubject($this->getRequestParameter('subject')); $inbox_emp->setDetail($this->getRequestParameter('detail')); $inbox_emp->setType(2); $inbox_emp->setCreatedAt($this->getRequestParameter('created_at')); $inbox_emp->setCode($emp->toString()); $inbox_emp->save(); $employee = EmployeePeer::retrieveByPK($this->getRequestParameter('employee_id')); $this->forward404Unless($employee); $outbox_emp = new OutboxEmp(); $outbox_emp->setEmployee2($this->getRequestParameter('employee_id')); $outbox_emp->setEmployeeId($emp->getId()); $outbox_emp->setSubject($this->getRequestParameter('subject')); $outbox_emp->setDetail($this->getRequestParameter('detail')); $outbox_emp->setType(2); $outbox_emp->setCreatedAt($this->getRequestParameter('created_at')); $outbox_emp->setCode($employee->toString()); $outbox_emp->save(); } else { $emp = EmployeePeer::retrieveByPK($this->getRequestParameter('employee_2')); $this->forward404Unless($emp); $inbox_stu = new InboxStu(); $inbox_stu->setStudent2($this->getRequestParameter('student_id')); $inbox_stu->setEmployeeId($emp->getId()); $inbox_stu->setSubject($this->getRequestParameter('subject')); $inbox_stu->setDetail($this->getRequestParameter('detail')); $inbox_stu->setType(1); $inbox_stu->setCreatedAt($this->getRequestParameter('created_at')); $inbox_stu->setCode($emp->toString()); $inbox_stu->save(); $stu = StudentPeer::retrieveByPK($this->getRequestParameter('student_id')); $this->forward404Unless($stu); $outbox_emp = new OutboxEmp(); $outbox_emp->setStudentId($this->getRequestParameter('student_id')); $outbox_emp->setEmployeeId($emp->getId()); $outbox_emp->setSubject($this->getRequestParameter('subject')); $outbox_emp->setDetail($this->getRequestParameter('detail')); $outbox_emp->setType(1); $outbox_emp->setCreatedAt($this->getRequestParameter('created_at')); $outbox_emp->setCode($stu->toStringCap()); $outbox_emp->save(); /* SMS ADD */ if (SF_ENVIRONMENT == 'dev') { if ($this->getRequestParameter('send_message') == 1) { $lekarSms = new lekarSms(); $sms = array('subject' => $this->getRequestParameter('subject'), 'message' => $this->getRequestParameter('detail')); $userType = $this->getContext()->getUser()->getAttribute('usertype', '', 'bo'); $lekarSms->sendSmsCounseling($userType, $emp->getId(), $this->getRequestParameter('student_id'), $sms); } } /* ------------------------------- */ } if ($outclass_counseling->getAcademicCalendar()->getCourseModel() == 'A') { return $this->redirect('course_counseling/listEmployee'); } else { return $this->redirect('course_counseling/listEmployee2'); } }
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(OutclassCounselingPeer::ID, $pks, Criteria::IN); $objs = OutclassCounselingPeer::doSelect($criteria, $con); } return $objs; }