| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | $total = $db->getOne('SELECT value FROM global_data WHERE name=?', array('nb_nodians')); |
|---|
| 27 | |
|---|
| 28 | $country_r = $db->query('SELECT DISTINCT(country) AS name, COUNT(id) AS nb FROM user_contact WHERE country IS NOT NULL GROUP BY country ORDER BY nb DESC LIMIT 10'); |
|---|
| 29 | |
|---|
| 30 | while($country = $country_r->fetchRow()) |
|---|
| 31 | { |
|---|
| 32 | $country['male'] = $db->getOne('SELECT COUNT(id) FROM cache_user WHERE country=? AND gender=?', array($country['name'], 'male')); |
|---|
| 33 | $country['female'] = $db->getOne('SELECT COUNT(id) FROM cache_user WHERE country=? AND gender=?', array($country['name'], 'female')); |
|---|
| 34 | $stats['country'][$country['name']]['nb'] = $country['nb']; |
|---|
| 35 | $stats['country'][$country['name']]['percent'] = $country['nb']/$total*100; |
|---|
| 36 | $stats['country'][$country['name']]['male'] = $country['male']/$country['nb']*100; |
|---|
| 37 | $stats['country'][$country['name']]['female'] = $country['female']/$country['nb']*100; |
|---|
| 38 | } |
|---|
| 39 | |
|---|
| 40 | $stats['interest'][tr($labels['profile']['here_for']['friend'])] = $db->getOne('SELECT COUNT(id) as nb FROM cache_user WHERE here_for=here_for|1')/$total*100; |
|---|
| 41 | $stats['interest'][tr($labels['profile']['here_for']['business'])] = $db->getOne('SELECT COUNT(id) as nb FROM cache_user WHERE here_for=here_for|2')/$total*100; |
|---|
| 42 | $stats['interest'][tr($labels['profile']['here_for']['dating'])] = $db->getOne('SELECT COUNT(id) as nb FROM cache_user WHERE here_for=here_for|4')/$total*100; |
|---|
| 43 | $stats['interest'][tr($labels['profile']['here_for']['partners'])] = $db->getOne('SELECT COUNT(id) as nb FROM cache_user WHERE here_for=here_for|8')/$total*100; |
|---|
| 44 | |
|---|
| 45 | $relationship_r = $db->query('SELECT DISTINCT(relationship_status) AS name, COUNT(id) AS nb FROM cache_user GROUP BY relationship_status ORDER BY nb DESC LIMIT 10'); |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | $relationship_r = $db->query('SELECT DISTINCT(relationship_status) AS name, COUNT(id) AS nb FROM cache_user WHERE relationship_status IS NOT NULL GROUP BY relationship_status ORDER BY nb DESC'); |
|---|
| 49 | |
|---|
| 50 | while($relationship = $relationship_r->fetchRow()) |
|---|
| 51 | { |
|---|
| 52 | if(!$relationship['name']) |
|---|
| 53 | continue; |
|---|
| 54 | |
|---|
| 55 | |
|---|
| 56 | $relationship['male'] = $db->getOne('SELECT COUNT(id) FROM cache_user WHERE relationship_status=? AND gender=?', array($relationship['name'], 'male')); |
|---|
| 57 | $relationship['female'] = $db->getOne('SELECT COUNT(id) FROM cache_user WHERE relationship_status=? AND gender=?', array($relationship['name'], 'female')); |
|---|
| 58 | $stats['relationship'][$relationship['name']]['nb'] = $relationship['nb']; |
|---|
| 59 | $stats['relationship'][$relationship['name']]['percent'] = $relationship['nb']/$total*100; |
|---|
| 60 | $stats['relationship'][$relationship['name']]['male'] = ( $relationship['male'] / $relationship['nb'] ) * 100 ; |
|---|
| 61 | |
|---|
| 62 | $stats['relationship'][$relationship['name']]['female'] = ($relationship['female']/$relationship['nb'])*100; |
|---|
| 63 | $stats['relationship'][$relationship['name']]['label'] = $labels['profile']['relationship_status_cb'][$relationship['name']]; |
|---|
| 64 | } |
|---|
| 65 | |
|---|
| 66 | $_SMARTY['stats'] = $stats; |
|---|
| 67 | ?> |
|---|