Ignore:
Timestamp:
02/14/12 16:52:04 (12 years ago)
Author:
acoutinho
Message:

Ticket #2434 - Implementacao anexos, acls e delegacao de participantes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/prototype/services/PostgreSQL.php

    r5441 r5514  
    210210            if( isset($criteria["order"]) ) 
    211211            { 
    212                     $result .= ' ORDER BY '.( is_array($criteria["order"]) ? implode(', ', $criteria["order"]) : $criteria["order"] ).' '; 
     212                    $result .= ' ORDER BY '.self::parseOrder( $criteria["order"], $map ).' '; 
    213213            } 
    214214            if( isset($criteria["limit"]) ) 
     
    300300        return $return;   
    301301    } 
    302     
     302 
     303   private static function parseOrder($order , &$map) 
     304    { 
     305                   
     306        if($notArray = !is_array($order)) //Caso seja um full select pegar todas as keys 
     307            $order = array( $order ); 
     308 
     309        $return = array(); 
     310 
     311        foreach ($order as &$value)  
     312        { 
     313            if(!isset($map[$value])) continue; //Escapa itens não existentes no mapa 
     314 
     315            $value = $map[$value]; 
     316        } 
     317 
     318        return ( $notArray ?  $order[0] : implode(', ', $order) ); 
     319    } 
    303320} 
    304321 
Note: See TracChangeset for help on using the changeset viewer.