Changeset 830

Show
Ignore:
Timestamp:
12/05/06 09:15:26 (2 years ago)
Author:
takayama
Message:

Fixed AssetCount SQL BugId: 45098

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/wheeljack/php/lib/function.MTAssetCount.php

    r821 r830  
    22function smarty_function_MTAssetCount($args, &$ctx) { 
    33    $args['blog_id'] = $ctx->stash('blog_id'); 
    4     $assets = $ctx->mt->db->fetch_assets($args); 
    5     return count($assets)
     4    $count = $ctx->mt->db->asset_count($args); 
     5    return $count
    66} 
  • branches/wheeljack/php/lib/mtdb_base.php

    r825 r830  
    14951495        } 
    14961496        return $results; 
     1497    } 
     1498 
     1499    function asset_count($args) { 
     1500        if (isset($args['blog_id'])) { 
     1501            $blog_filter = 'and asset_blog_id = '.intval($args['blog_id']); 
     1502        } 
     1503 
     1504        # Adds a type filter 
     1505        if (isset($args['type'])) { 
     1506            $type_filter = "and asset_class ='" . $args['type'] . "'"; 
     1507        } 
     1508 
     1509        $count = $this->get_var(" 
     1510            select count(*) 
     1511              from mt_asset 
     1512             where 
     1513                   1 = 1 
     1514                   $blog_filter 
     1515                   $type_filter 
     1516        "); 
     1517        return $count; 
    14971518    } 
    14981519