Changeset 205

Show
Ignore:
Timestamp:
07/02/08 22:15:38 (2 months ago)
Author:
llaumgui
Message:

Amélioration et fermeture de #51. Livraison de la Milestone eZFluxBB 1.0 RC1

Location:
ez_publish/ezfluxbb/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • ez_publish/ezfluxbb/trunk/classes/ezfluxbb.php

    r204 r205  
    203203                $db             = eZFluxBBDB::instance(); 
    204204                 
    205                 $select         = 't.id topic_id, t.poster, t.subject, t.num_replies'; 
    206                 $leftJoin       = ''; 
     205                $select         =       't.id topic_id, t.subject topic_name, t.poster creator, t.num_replies, t.posted published, ' . 
     206                                                't.last_post_id, t.last_post last_post_published, t.last_poster last_post_creator'; 
     207                $leftJoin       = array(); 
     208                $innerJoin      = array(); 
     209                $where          = array(); 
     210                 
     211                /* Jointure groupe_id */ 
     212                if ( $params['group_id'] ) 
     213                { 
     214                        $select                 .= ', f.id forum_id, f.forum_name'; 
     215                        $innerJoin[]    = 'INNER JOIN '.$this->fluxBBConfig['db_prefix'].'forums AS f ON f.id=t.forum_id'; 
     216                        $leftJoin[]             = 'LEFT JOIN '.$this->fluxBBConfig['db_prefix'].'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=' . $params['group_id'] . ')'; 
     217                        $where[]                = '(fp.read_forum IS NULL OR fp.read_forum=1)'; 
     218                        $where[]                = 't.moved_to IS NULL'; 
     219                } 
    207220                 
    208221                /* Jointure avec les messages */ 
    209222                if ( $params['get_first_message'] ) 
    210223                { 
    211                         $select         .= ' ,p.id post_id, p.message'; 
    212                         $leftJoin       .= 'LEFT JOIN '.$this->fluxBBConfig['db_prefix'].'posts p ON (p.topic_id=t.id AND t.posted = p.posted)'; 
     224                        $select                 .= ', p.id post_id, p.message'; 
     225                        $leftJoin[]             = 'LEFT JOIN '.$this->fluxBBConfig['db_prefix'].'posts p ON (p.topic_id=t.id AND t.posted = p.posted)'; 
     226                } 
     227                 
     228                if ( count($where) > 0 ) 
     229                { 
     230                        $where  = ' AND ' . implode( ' AND ', $where) . ' '; 
     231                } 
     232                else 
     233                { 
     234                        $where  = '';    
    213235                } 
    214236                 
    215237                $topics         = $db->arrayQuery(      'SELECT ' . $select . ' ' . 
    216238                                                                                'FROM '.$this->fluxBBConfig['db_prefix'].'topics t ' . 
    217                                                                                         $leftJoin . ' ' . 
    218                                                                                 'WHERE forum_id ' . $params['forum_id'] . ' ' . 
     239                                                                                        implode( ' ', $innerJoin) . ' ' . 
     240                                                                                        implode( ' ', $leftJoin) . ' ' . 
     241                                                                                'WHERE t.forum_id ' . $params['forum_id'] . ' ' . 
     242                                                                                $where . ' ' . 
    219243                                                                                'ORDER BY ' . $params['sort_by'] .' ' . 
    220244                                                                                'LIMIT ' . $params['offset'] . ', ' . $params['limit']); 
  • ez_publish/ezfluxbb/trunk/classes/ezfluxbbfetchfonctions.php

    r204 r205  
    100100         * @return array 
    101101         */ 
    102         function fetchTopics( $forum_id_filter_type, $forum_id_filter_array, $limit, $offset, $sort_by, $get_first_message ) 
     102        function fetchTopics( $forum_id_filter_type, $forum_id_filter_array, $limit, $offset, $sort_by, $group_id, $get_first_message ) 
    103103        { 
    104104                $sortingString          = 't.posted'; 
     
    154154                                                                        'offset'                                        => $offset, 
    155155                                                                        'sort_by'                                       => $sortingString . ' ' . $sortingOrder, 
     156                                                                        'group_id'                                      => $group_id, 
    156157                                                                        'get_first_message'             => $get_first_message); 
    157158                 
  • ez_publish/ezfluxbb/trunk/modules/ezfluxbb/function_definition.php

    r204 r205  
    106106                                'default'  => array( 't.posted', false ) 
    107107                ), 
     108                array(  'name'     => 'group_id', 
     109                                'type'     => 'integer', 
     110                                'required' => false, 
     111                                'default'  => false 
     112                ), 
    108113                array(  'name'     => 'get_first_message', 
    109114                                'type'     => 'boolean',