Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#102 Popular Downloads Query

closed
Victor Stone
ccHost (86)
5
2009-04-21
2009-04-16
Michael Krnac
No

On this Page:
http://summerstyle.net/openclipart.org/?ccm=/view/media/browse

I get the Highest rated Cliparts of the past 4 weeks with this query call:
%query('t=ocal_widget_show_recent_browseview&limit=6&sort=score&sinced=4 weeks ago')%

Is it possible to get the popular downloads (ighest download count) with a query too?

Discussion

  • Victor Stone
    Victor Stone
    2009-04-16

    • labels: --> ccHost
    • assigned_to: nobody --> fourstones
     
  • Victor Stone
    Victor Stone
    2009-04-21

    bug fixes in SVN 12326 allow for the following code to work (drop that into a file with a PHP extension into your local_files/lib directory

    <?

    CCEvents::AddHandler(CC_EVENT_API_QUERY_SETUP, 'download_sorter_query_setup');

    function download_sorter_query_setup( &$args, &$queryObj, $requiresValidation )
    {
    if( !empty($args['sort']) && $args['sort'] == 'download' )
    {
    $ord = empty($args['ord']) || (strtoupper($args['ord']) == 'DESC') ? 'DESC' : 'ASC';

    $queryObj->sql_p['order'] = 'upload_dl_count ' . $ord;
    }
    }

    ?>

     
  • Victor Stone
    Victor Stone
    2009-04-21

    • status: open --> closed