PHP Classes

File: uploady/admin/logic/barChart.php

Recommend this page to a friend!
  Classes of Faris AL-Otabi   Uploady PHP Upload File to MySQL   uploady/admin/logic/barChart.php   Download  
File: uploady/admin/logic/barChart.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Uploady PHP Upload File to MySQL
Store file upload details in a MySQL database
Author: By
Last change: Update of uploady/admin/logic/barChart.php
Date: 4 months ago
Size: 871 bytes
 

Contents

Class file image Download
<?php

header
("Content-Type: application/json");
require_once
'../../config/config.php';

$database = new Uploady\Database();

$utils = new Uploady\Utils();

$uploads = new Uploady\Handler\UploadHandler($database);

$count = [];

$temp = [];

if (
$uploads->countFiles() > 0) {
    foreach (
$uploads->getFiles() as $dd) {
        if (
date("Y", strtotime($dd->uploaded_at)) == date("Y")) {
           
$month = date("m", strtotime($dd->uploaded_at));

            if (!
key_exists($month, $temp)) {
               
$temp[$month] = 0;
            }

           
$temp[$month] += 1;
        }
    }

    foreach (
$temp as $key => $value) {
       
array_push($count, [
           
'label' => date('F', mktime(0, 0, 0, $key, 10)),
           
'data' => $value
       
]);
    }
} else {
   
array_push($count, ["label" => "Nothing", "data" => 0]);
}

echo
json_encode($count);