Simple Machines Community Forum

SMF Support => Language Specific Support => Italiano (Italian) => Topic started by: hollywood9111 on December 29, 2012, 03:50:46 AM

Title: conteggio allegati
Post by: hollywood9111 on December 29, 2012, 03:50:46 AM
e possibile avere una statistica oltre a quelle già esistenti di quante volte e stato scaricato un allegato? avendo quindi i primi 10 allegati scaricati?
Title: Re: conteggio allegati
Post by: emanuele on December 29, 2012, 05:31:10 AM
Caspita, questa è una cosa che non ha ancora chiesto nessuno...mi sarei aspettato di trovare almeno un paio di topic in giro...

Arg...al momento non mi ricordo più un paio di cose sugli allegati, quindi non posso scrivere la query, devo fare due prove...
Title: Re: conteggio allegati
Post by: hollywood9111 on December 29, 2012, 05:33:12 AM
va bene ;)
Title: Re: conteggio allegati
Post by: emanuele on January 01, 2013, 08:42:38 AM
Dove esattamente vorresti piazzare questa statistica? Nella pagina delle statistiche? (chiedo per essere sicuro ;))
Title: Re: conteggio allegati
Post by: hollywood9111 on January 01, 2013, 01:05:12 PM
Sisi va bene
Title: Re: conteggio allegati
Post by: hollywood9111 on January 03, 2013, 09:00:30 PM
ancora nulla?
Title: Re: conteggio allegati
Post by: emanuele on January 04, 2013, 03:21:53 PM
Nope, sorry. Sono in apnea cercando di ri-fare un progetto.
Title: Re: conteggio allegati
Post by: hollywood9111 on January 04, 2013, 06:00:34 PM
va bene ;)
Title: Re: conteggio allegati
Post by: emanuele on January 06, 2013, 05:27:29 AM
Allora, iniziamo con le cose semplici: la string di testo (io direi mettila in Modifications.english.php):
$txt['attach_downloads'] = 'Most downloaded';

Poi, in Stats.php, per esempio prima della riga:
// Are you on a larger forum?  If so, let's try to limit the number of topics we search through.
aggiungi:
// Attachment top 10.
$boards_result = $smcFunc['db_query']('', '
SELECT a.id_attach, a.filename, a.downloads, t.id_topic
FROM {db_prefix}attachments AS a
LEFT JOIN {db_prefix}messages as m ON (m.id_msg = a.id_msg)
LEFT JOIN {db_prefix}topics as t ON (t.id_topic = m.id_topic)
LEFT JOIN {db_prefix}boards as b ON (b.id_board = m.id_board)
WHERE {query_see_board}
AND attachment_type = {int:attachment_type}
AND id_member = {int:avatars}
ORDER BY downloads DESC
LIMIT 10',
array(
'recycle_board' => $modSettings['recycle_board'],
'blank_redirect' => '',
'attachment_type' => 0,
'avatars' => 0,
)
);
$context['top_attachs'] = array();
$max_downloads = 1;
while ($row_attach = $smcFunc['db_fetch_assoc']($boards_result))
{
$context['top_attachs'][] = array(
'id' => $row_attach['id_attach'],
'name' => $row_attach['filename'],
'downloads' => $row_attach['downloads'],
'href' => $scripturl . '?dlattach;topic=' . $row_attach['id_topic'] . '.0;attach=' . $row_attach['id_attach'],
'link' => '<a href="' . $scripturl . '?dlattach;topic=' . $row_attach['id_topic'] . '.0;attach=' . $row_attach['id_attach'] . '">' . $row_attach['filename'] . '</a>'
);

if ($max_downloads < $row_attach['downloads'])
$max_downloads = $row_attach['downloads'];
}
$smcFunc['db_free_result']($boards_result);

foreach ($context['top_attachs'] as $i => $attach)
{
$context['top_attachs'][$i]['attach_percent'] = round(($attach['downloads'] * 100) / $max_downloads);
$context['top_attachs'][$i]['downloads'] = comma_format($context['top_attachs'][$i]['downloads']);
}


Quindi il template, io l'ho messo appena prima di:
<br class="clear" />
aggiungi:
<div class="flow_hidden">
<div id="top_attach_downloads">
<div class="title_bar">
<h4 class="titlebg">
<span class="ie6_header floatleft">
<img src="', $settings['images_url'], '/stats_replies.gif" class="icon" alt="" /> ', $txt['attach_downloads'], '
</span>
</h4>
</div>
<div class="windowbg2">
<span class="topslice"><span></span></span>
<div class="content">
<dl class="stats">';

foreach ($context['top_attachs'] as $attach)
{
echo '
<dt>
', $attach['link'], '
</dt>
<dd class="statsbar">';

if (!empty($attach['attach_percent']))
echo '
<div class="bar" style="width: ', $attach['attach_percent'] + 4, 'px;">
<div style="width: ', $attach['attach_percent'], 'px;"></div>
</div>';

echo '
<span class="righttext">', $attach['downloads'], '</span>
</dd>';
}

echo '
</dl>
<div class="clear"></div>
</div>
<span class="botslice"><span></span></span>
</div>
</div>
</div>
Title: Re: conteggio allegati
Post by: hollywood9111 on January 12, 2013, 10:12:23 AM
funziona però ho notato questa cosa
come e possibile ciò?
il topic le 5 leggende e stato visulizzato 1300 volte e download cosi tanti come mai?
(http://i49.tinypic.com/21eb98j.png)
Title: Re: conteggio allegati
Post by: emanuele on January 12, 2013, 12:08:27 PM
Gli utenti si scambiano ( o scambiano all'esterno) i link diretti ai download?
Title: Re: conteggio allegati
Post by: hollywood9111 on January 12, 2013, 12:15:29 PM
no.. ma li conteggia il downloa deffettuato.. non si puo avere un link diretto del file
Title: Re: conteggio allegati
Post by: emanuele on January 12, 2013, 12:27:05 PM
Ho cambiato il codice sopra per togliere gli avatar.
Quindi dici che nella discussione vedi 1300 download e qui molti di più?
Title: Re: conteggio allegati
Post by: hollywood9111 on January 12, 2013, 12:30:48 PM
no dico vedo 1300 visite al topic ed e impossibil avere tutti quei daownload anche perch su tutti i topic e maggiora la visibilità che il download del file
Title: Re: conteggio allegati
Post by: emanuele on January 12, 2013, 03:09:02 PM
Ed allora, se vai nel topic, quanti download sono riportati?
Title: Re: conteggio allegati
Post by: hollywood9111 on January 12, 2013, 03:20:10 PM
esempio 1300 visite
download 800 circa
Title: Re: conteggio allegati
Post by: emanuele on January 12, 2013, 03:44:45 PM
Cioè, quel file quando vai ad prire il topic in cui è stato allegato riporta 800 download?
Title: Re: conteggio allegati
Post by: hollywood9111 on January 12, 2013, 04:33:44 PM
si circa e non quelli riportati nella foto.. cioè
no aspetta
nopn capisco perchè da 32000 download e 1300 visite e impossibile per scaricarlo devi dare la visualizzazione
Title: Re: conteggio allegati
Post by: emanuele on January 12, 2013, 05:28:07 PM
Sì o no?
Per piacere...sto già sbroccando per altre cose, un problema alla volta.
Non mi interessano le visite, voglio sapere quando vai nel topic il file che numero di download ha di fianco.
Title: Re: conteggio allegati
Post by: hollywood9111 on January 12, 2013, 05:41:05 PM
di fianco e quello dell'immagine però mi pare impossibile
Title: Re: conteggio allegati
Post by: emanuele on January 13, 2013, 03:23:01 AM
Cosa?
Title: Re: conteggio allegati
Post by: hollywood9111 on January 13, 2013, 05:10:12 AM
che il numero di download e maggiore delle visualizzazioni
Title: Re: conteggio allegati
Post by: emanuele on January 13, 2013, 07:11:32 AM
E' il motivo per cui le statistiche sono spesso inutili...
Non so, bisognerebbe vedere i dettagli.