Exemplo n.º 1
0
 public function filter($c, $filters)
 {
     $filters_key = array_keys($filters);
     foreach ($filters_key as $key) {
         $value = $filters[$key];
         if ($value == '' || $value == null) {
             continue;
         }
         if ($key == 'GRADE_COMPONENT_ID') {
             $c->addJoin(ClassAgendaPeer::SUBJECT_GRADING_ID, SubjectGradingPeer::ID);
             $c->addJoin(SubjectGradingPeer::GRADE_COMPONENT_ID, GradeComponentPeer::ID);
             $column = GradeComponentPeer::gettableMap()->getColumn('ID');
         } elseif ($key == 'SUBJECT_NAME') {
             $c->addJoin(ClassAgendaPeer::COURSE_SCHEDULE_ID, CourseSchedulePeer::ID);
             $c->addJoin(CourseSchedulePeer::SUBJECT_CURR_ID, SubjectCurrPeer::ID);
             $c->addJoin(SubjectCurrPeer::SUBJECT_ID, SubjectPeer::ID);
             $column = SubjectPeer::gettableMap()->getColumn('NAME');
         } else {
             $column = ClassAgendaPeer::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);
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 public function filter($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(ClassCounselingPeer::STUDENT_ID, StudentPeer::ID);
             $column = StudentPeer::getTableMap()->getColumn('NAME');
         } elseif ($key == 'CODE') {
             $c->addJoin(ClassCounselingPeer::STUDENT_ID, StudentPeer::ID);
             $column = StudentPeer::getTableMap()->getColumn('CODE');
         } elseif ($key == 'CODE2') {
             $c->addJoin(ClassCounselingPeer::STUDENT_ID, StudentPeer::ID);
             $column = StudentPeer::getTableMap()->getColumn('CODE2');
         } elseif ($key == 'YEAR') {
             $c->addJoin(ClassCounselingPeer::STUDENT_ID, StudentPeer::ID);
             $column = StudentPeer::getTableMap()->getColumn('YEAR');
         } elseif ($key == 'SUBJECT_NAME') {
             $c->addJoin(ClassCounselingPeer::COURSE_SCHEDULE_ID, CourseSchedulePeer::ID);
             $c->addJoin(CourseSchedulePeer::SUBJECT_CURR_ID, SubjectCurrPeer::ID);
             $c->addJoin(SubjectCurrPeer::SUBJECT_ID, SubjectPeer::ID);
             $column = SubjectPeer::gettableMap()->getColumn('NAME');
         } elseif ($key == 'CLASS_NAME') {
             $c->addJoin(ClassCounselingPeer::CLASS_GROUP_ID, ClassGroupPeer::ID);
             $column = ClassGroupPeer::getTableMap()->getColumn('NAME');
         } else {
             $column = ClassCounselingPeer::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);
                     }
                 }
             }
         }
     }
 }