Changeset 204
- Timestamp:
- 07/02/08 20:45:58 (6 months ago)
- Location:
- ez_publish/ezfluxbb/trunk
- Files:
-
- 3 modified
-
classes/ezfluxbb.php (modified) (1 diff)
-
classes/ezfluxbbfetchfonctions.php (modified) (2 diffs)
-
modules/ezfluxbb/function_definition.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ez_publish/ezfluxbb/trunk/classes/ezfluxbb.php
r203 r204 203 203 $db = eZFluxBBDB::instance(); 204 204 205 206 $topics = $db->arrayQuery( 'SELECT t.id topic_id, t.poster, t.subject, t.num_replies, p.id post_id, p.message ' . 205 $select = 't.id topic_id, t.poster, t.subject, t.num_replies'; 206 $leftJoin = ''; 207 208 /* Jointure avec les messages */ 209 if ( $params['get_first_message'] ) 210 { 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)'; 213 } 214 215 $topics = $db->arrayQuery( 'SELECT ' . $select . ' ' . 207 216 'FROM '.$this->fluxBBConfig['db_prefix'].'topics t ' . 208 /* TODO : Rendre la jointure paramÚtrable */ 209 'LEFT JOIN '.$this->fluxBBConfig['db_prefix'].'posts p ON (p.topic_id=t.id AND t.posted = p.posted) ' . 217 $leftJoin . ' ' . 210 218 'WHERE forum_id ' . $params['forum_id'] . ' ' . 211 219 'ORDER BY ' . $params['sort_by'] .' ' . -
ez_publish/ezfluxbb/trunk/classes/ezfluxbbfetchfonctions.php
r203 r204 100 100 * @return array 101 101 */ 102 function fetchTopics( $forum_id_filter_type, $forum_id_filter_array, $limit, $offset, $sort_by )102 function fetchTopics( $forum_id_filter_type, $forum_id_filter_array, $limit, $offset, $sort_by, $get_first_message ) 103 103 { 104 104 $sortingString = 't.posted'; … … 129 129 130 130 /* $forum_id */ 131 if ( $forum_id_filter_type == 'exclude' ) 132 { 133 $sortingForum_id = 'NOT IN'; 134 } 135 if ( is_array( $forum_id_filter_array ) ) 136 { 137 $sortingForum_id .= ' (' . implode( ', ', $forum_id_filter_array) . ')'; 138 } 139 else 140 { 141 $sortingForum_id .= ' (' . $forum_id_filter_array . ')'; 142 } 143 131 if ( $forum_id_filter_array ) 132 { 133 if ( $forum_id_filter_type == 'exclude' ) 134 { 135 $sortingForum_id = 'NOT IN'; 136 } 137 if ( is_array( $forum_id_filter_array ) ) 138 { 139 $sortingForum_id .= ' (' . implode( ', ', $forum_id_filter_array) . ')'; 140 } 141 else 142 { 143 $sortingForum_id .= ' (' . $forum_id_filter_array . ')'; 144 } 145 } 146 else 147 { 148 $sortingForum_id = ""; 149 } 150 144 151 $eZFluxBB = eZFluxBB::instance(); 145 152 $params = array( 'forum_id' => $sortingForum_id, 146 153 'limit' => $limit, 147 154 'offset' => $offset, 148 'sort_by' => $sortingString . ' ' . $sortingOrder ); 155 'sort_by' => $sortingString . ' ' . $sortingOrder, 156 'get_first_message' => $get_first_message); 149 157 150 158 $topics = $eZFluxBB->getTopics( $params ); -
ez_publish/ezfluxbb/trunk/modules/ezfluxbb/function_definition.php
r203 r204 106 106 'default' => array( 't.posted', false ) 107 107 ), 108 array( 'name' => 'get_first_message', 109 'type' => 'boolean', 110 'required' => false, 111 'default' => false 112 ), 108 113 ) 109 114 );
