Menu

#78 I would like to know how many times each file was downloaded

Next_Release
open
nobody
None
1
2014-05-02
2013-03-14
Anonymous
No

I would like to know how many times each file was downloaded

Discussion

  • Alessandro Briosi

    you'll need to implement a plugin to do this.

     
  • Anonymous

    Anonymous - 2014-05-02

    Here is the code ( by Alessandro )

    Add a integer column, counter, in the file table.

    In template fileList add a th on line 25:

    _tag_stack[] = array('tr', array()); $_block_repeat=true;smarty_block_tr($this->_tag_stack[count($this->_tag_stack)-1][1], null, $this, $_block_repeat);while ($_block_repeat) { ob_start(); ?>

    Downloads

    In template fileList add a td on line 83:
    _tpl_vars['rid']; ?>
    " style="text-align:right">_tpl_vars['f']['counter']; ?>  

    In template fileList add a td on line 99:
    _tpl_vars['rid']; ?>
    ">

    Add the following logic in lib/modules/default/files.inc.php on line 402:
    $filec=$finfo[$num];
    $filec['counter']=$finfo[$num]['counter']+1;
    app()->db->update('files',$filec,array('id' => $finfo[$num]['id']),array('counter'));

    _tag_stack[count($this->_tag_stack)-1][1], $_block_content, $this, $_block_repeat); } array_pop($this->_tag_stack); ?>
     
  • Alessandro Briosi

    The above code is wrong. Why are you modifying the templates_c files???? It's INSANE!
    Please modify the fileList.tpl file in templates/default and simply add a column in the html table (also add the header).

    {$f.counter}
     

    Last edit: Alessandro Briosi 2014-05-02

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.