示例#1
0
 public static function getPhpNameMap()
 {
     if (self::$phpNameMap === null) {
         $map = VInfaqPaymentPeer::getTableMap();
         $columns = $map->getColumns();
         $nameMap = array();
         foreach ($columns as $column) {
             $nameMap[$column->getPhpName()] = $column->getColumnName();
         }
         self::$phpNameMap = $nameMap;
     }
     return self::$phpNameMap;
 }
示例#2
0
 public function filterPayment($c, $filters)
 {
     $filters_key = array_keys($filters);
     foreach ($filters_key as $key) {
         $value = $filters[$key];
         if ($value == '' || $value == null) {
             continue;
         }
         if ($key == 'DEPARTMENT_ID') {
             $c->addJoin(DepartmentPeer::ID, AcademicCalendarPeer::DEPARTMENT_ID);
             $c->addJoin(VInfaqPaymentPeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID);
             $column = DepartmentPeer::getTableMap()->getColumn('ID');
         } elseif ($key == 'USER_NAME') {
             $c->addJoin(VInfaqPaymentPeer::USER_ID, UserPeer::ID);
             $column = UserPeer::getTableMap()->getColumn('LOGIN');
         } elseif ($key == 'NAME') {
             $c->addJoin(VInfaqPaymentPeer::STUDENT_ID, StudentPeer::ID);
             $column = StudentPeer::getTableMap()->getColumn('NAME');
         } elseif ($key == 'CODE') {
             $c->addJoin(VInfaqPaymentPeer::STUDENT_ID, StudentPeer::ID);
             $column = StudentPeer::getTableMap()->getColumn('CODE');
         } elseif ($key == 'STUDENT_TYPE_ID') {
             $c->addJoin(VInfaqPaymentPeer::STUDENT_TYPE_ID, PayerTypePeer::ID);
             $column = PayerTypePeer::getTableMap()->getColumn('ID');
         } else {
             $column = VInfaqPaymentPeer::getTableMap()->getColumn($key);
         }
         $name = $column->getFullyQualifiedName();
         $creoleType = $column->getCreoleType();
         if ($creoleType == CreoleTypes::TIMESTAMP) {
             $from = $value['from'];
             $to = $value['to'];
             $c2 = null;
             if ($from != '' && $from != null) {
                 $c->add($name, $from, Criteria::GREATER_EQUAL);
                 $c2 = $c->getCriterion($name);
             }
             if ($from != '' && $from != null && $to != '' && $to != null) {
                 $c3 = new Criterion($c, $name, $to, Criteria::LESS_EQUAL);
                 $c2->addAnd($c3);
             }
             if (($from == '' || $from == null) && $to != '' && $to != null) {
                 $c->add($name, $to, Criteria::LESS_EQUAL);
             }
         } else {
             if ($creoleType == CreoleTypes::DATE) {
                 $from = $value['from'];
                 $to = $value['to'];
                 $c2 = null;
                 if ($from != '' && $from != null) {
                     $c->add($name, $from, Criteria::GREATER_EQUAL);
                     $c2 = $c->getCriterion($name);
                 }
                 if ($from != '' && $from != null && $to != '' && $to != null) {
                     $c3 = new Criterion($c, $name, $to, Criteria::LESS_EQUAL);
                     $c2->addAnd($c3);
                 }
                 if (($from == '' || $from == null) && $to != '' && $to != null) {
                     $c->add($name, $to, Criteria::LESS_EQUAL);
                 }
                 #$c->add($name, $value, Criteria::LIKE );
             } else {
                 if ($creoleType == CreoleTypes::INTEGER || $creoleType == CreoleTypes::NUMERIC || $creoleType == CreoleTypes::CHAR) {
                     $c->add($name, $value, Criteria::EQUAL);
                 } else {
                     if ($creoleType == CreoleTypes::VARCHAR) {
                         $c->add($name, "%{$value}%", Criteria::LIKE);
                     }
                 }
             }
         }
     }
 }