public static function getPhpNameMap()
 {
     if (self::$phpNameMap === null) {
         $map = ClassCounselingPeer::getTableMap();
         $columns = $map->getColumns();
         $nameMap = array();
         foreach ($columns as $column) {
             $nameMap[$column->getPhpName()] = $column->getColumnName();
         }
         self::$phpNameMap = $nameMap;
     }
     return self::$phpNameMap;
 }
Example #2
0
 public function filterCounseling($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 == 'ACADEMIC_CALENDAR_ID') {
             $c->addJoin(ClassCounselingPeer::COURSE_SCHEDULE_ID, CourseSchedulePeer::ID);
             $c->addJoin(CourseSchedulePeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID);
             $column = AcademicCalendarPeer::getTableMap()->getColumn('ID');
         } 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);
                     }
                 }
             }
         }
     }
 }