Exemple #1
0
<?php

/**
 * Open Source Social Network
 *
 * @package   (Informatikon.com).ossn
 * @author    OSSN Core Team <*****@*****.**>
 * @copyright 2014 iNFORMATIKON TECHNOLOGIES
 * @license   General Public Licence http://www.opensource-socialnetwork.org/licence
 * @link      http://www.opensource-socialnetwork.org/licence
 */
$user = new OssnUser();
//get users
$by_year = $user->countByYearMonth();
if (!$by_year) {
    return;
}
//sort out data
foreach ($by_year as $item) {
    $years[] = $item->year;
    if ((int) $item->month !== 10) {
        $item->month = str_replace(0, '', $item->month);
    }
    $data[$item->year][$item->month] = $item->total;
}
//get unqiue years
$years = array_unique($years);
$years = array_reverse($years);
for ($i = 1; $i <= 12; $i++) {
    foreach ($years as $year) {
        if (!isset($data[$year][$i])) {