Changeset 976
- Timestamp:
- 01/14/12 19:32:18 (4 months ago)
- Location:
- branches/fuze
- Files:
-
- 2 edited
-
.htaccess (modified) (1 diff)
-
components/board/model.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/fuze/.htaccess
r961 r976 6 6 RewriteRule ^.htaccess$ - [F] 7 7 8 RewriteCond %{REQUEST_URI} !\.(jpg|jpeg|ico|gif|png|css|xml|js|pl|txt)$ [NC]9 8 RewriteCond %{REQUEST_FILENAME} !^/admin 10 9 RewriteCond %{REQUEST_FILENAME} !^/migrate -
branches/fuze/components/board/model.php
r961 r976 231 231 /* ==================================================================================================== */ 232 232 /* ==================================================================================================== */ 233 233 /** 234 * Возвращает категории 235 * @param int $category_id - id категории 236 * @return array 237 */ 234 238 public function getSubCats($category_id) { 235 239 $cats = array(); 236 240 237 $sql = "SELECT c.* , IFNULL(COUNT(i.id), 0) as content_count241 $sql = "SELECT c.* 238 242 FROM cms_board_cats c 239 243 LEFT JOIN cms_board_items i ON i.category_id = c.id AND i.published = 1 240 244 WHERE c.published = 1 AND c.parent_id = '$category_id' 241 GROUP BY c.id242 245 ORDER BY title ASC"; 243 246 $result = $this->inDB->query($sql); … … 249 252 $cat['obtypes'] = $this->inDB->get_field('cms_board_cats', "NSLeft <= {$cat['NSLeft']} AND NSRight >= {$cat['NSRight']} AND obtypes <> ''", 'obtypes'); 250 253 } 254 $cat['content_count'] = $this->getAdvertsCountFromCat($cat['NSLeft'], $cat['NSRight']); 251 255 $cat['ob_links'] = $this->getTypesLinks($cat['id'], $cat['obtypes']); 252 256 $cat['icon'] = $cat['icon'] ? $cat['icon'] : 'folder_grey.png'; … … 257 261 258 262 return $cats; 263 } 264 265 /** 266 * Возвращает количество объвлений в категории и подкатегориях 267 * @return int 268 */ 269 public function getAdvertsCountFromCat($left_key, $right_key) { 270 271 $sql = "SELECT i.id 272 FROM cms_board_items i 273 INNER JOIN cms_board_cats cat ON cat.id = i.category_id AND cat.NSLeft >= '$left_key' AND cat.NSRight <= '$right_key' 274 WHERE i.published = 1"; 275 276 $result = $this->inDB->query($sql); 277 278 return $this->inDB->num_rows($result); 279 259 280 } 260 281
Note: See TracChangeset
for help on using the changeset viewer.
