Changeset 203
- Timestamp:
- 06/30/08 21:27:26 (6 months ago)
- Location:
- ez_publish/ezfluxbb/trunk
- Files:
-
- 3 modified
-
classes/ezfluxbb.php (modified) (1 diff)
-
classes/ezfluxbbfetchfonctions.php (modified) (1 diff)
-
modules/ezfluxbb/function_definition.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ez_publish/ezfluxbb/trunk/classes/ezfluxbb.php
r200 r203 189 189 } 190 190 191 192 193 /** 194 * Récupération des informations sur des topics 195 * 196 * @author Guillaume Kulakowski <guillaume_AT_llaumgui_DOT_com> 197 * @since 1.0 198 * 199 * @return array 200 */ 201 public function getTopics( $params ) 202 { 203 $db = eZFluxBBDB::instance(); 204 205 206 $topics = $db->arrayQuery( 'SELECT t.id topic_id, t.poster, t.subject, t.num_replies, p.id post_id, p.message ' . 207 '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) ' . 210 'WHERE forum_id ' . $params['forum_id'] . ' ' . 211 'ORDER BY ' . $params['sort_by'] .' ' . 212 'LIMIT ' . $params['offset'] . ', ' . $params['limit']); 213 214 return $topics; 215 } 216 217 218 191 219 } //EOC 192 220 -
ez_publish/ezfluxbb/trunk/classes/ezfluxbbfetchfonctions.php
r200 r203 100 100 * @return array 101 101 */ 102 function fetchTopics( )102 function fetchTopics( $forum_id_filter_type, $forum_id_filter_array, $limit, $offset, $sort_by ) 103 103 { 104 //$eZFluxBB = eZFluxBB::instance();105 //$currentUser = $eZFluxBB->getCurrentUserInfo();106 //print_r($currentUser);104 $sortingString = 't.posted'; 105 $sortOrder = true; // true is ascending 106 $sortingForum_id = 'IN'; 107 107 108 $result = array( 'result' => array( ) ); 109 return $result; 108 /* Sort_by */ 109 if ( is_array($sort_by) ) 110 { 111 if ( array_key_exists(0, $sort_by) && !empty($sort_by[0]) ) 112 { 113 $sortingString = $sort_by[0]; 114 } 115 if ( array_key_exists(1, $sort_by) && is_bool($sort_by[1]) ) 116 { 117 $sortOrder = $sort_by[1]; 118 } 119 } 120 else 121 { 122 if ( !empty($sort_by ) ) 123 { 124 $sortingString = $sort_by; 125 } 126 127 } 128 $sortingOrder = $sortOrder ? ' ASC' : ' DESC'; 129 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 144 $eZFluxBB = eZFluxBB::instance(); 145 $params = array( 'forum_id' => $sortingForum_id, 146 'limit' => $limit, 147 'offset' => $offset, 148 'sort_by' => $sortingString . ' ' . $sortingOrder ); 149 150 $topics = $eZFluxBB->getTopics( $params ); 151 152 return array( 'result' => $topics ); 110 153 } 111 154 } -
ez_publish/ezfluxbb/trunk/modules/ezfluxbb/function_definition.php
r202 r203 84 84 'type' => 'string', 85 85 'required' => false, 86 'default' => false86 'default' => 'include' 87 87 ), 88 88 array( 'name' => 'forum_id_filter_array', 89 'type' => ' string',89 'type' => 'mixed', 90 90 'required' => false, 91 91 'default' => false … … 96 96 'default' => 20 97 97 ), 98 array( 'name' => 'sort_by',99 'type' => 'array',100 'required' => false,101 'default' => array( 'last_post', false )102 ),103 98 array( 'name' => 'offset', 104 99 'type' => 'integer', … … 106 101 'default' => 0 107 102 ), 103 array( 'name' => 'sort_by', 104 'type' => 'array', 105 'required' => false, 106 'default' => array( 't.posted', false ) 107 ), 108 108 ) 109 109 );
