From c7127b1ab2039ab4581fb425e0caec82edde7672 Mon Sep 17 00:00:00 2001
From: Kevin XU <kevin-xu@hotmail.fr>
Date: Wed, 19 Dec 2018 23:54:08 +0100
Subject: [PATCH] Graphes page user

---
 css/style.css           |  2 +-
 page_user/css/style.css |  2 +-
 page_user/user.php      | 72 +++++++++++++++++++++++++++++++++++------
 3 files changed, 65 insertions(+), 11 deletions(-)

diff --git a/css/style.css b/css/style.css
index 55abdea..c902223 100644
--- a/css/style.css
+++ b/css/style.css
@@ -268,7 +268,7 @@ button.submit:hover {
 .bg1,
 .bg2 {
     min-height: 50vw;
-    height: 700px;
+    /*height: 700px;*/
 }
 
 /*-- text Slider --*/
diff --git a/page_user/css/style.css b/page_user/css/style.css
index 1ba30c8..7899030 100644
--- a/page_user/css/style.css
+++ b/page_user/css/style.css
@@ -268,7 +268,7 @@ button.submit:hover {
 .bg1,
 .bg2 {
     min-height: 50vw;
-    height: 700px;
+    /*height: 700px;*/
 }
 
 /*-- text Slider --*/
diff --git a/page_user/user.php b/page_user/user.php
index 2f172f1..20d2da7 100644
--- a/page_user/user.php
+++ b/page_user/user.php
@@ -1,6 +1,7 @@
 <?php
 require_once('../facto.php');
 require_once('../API_Twitter/userInfosFunctions.php');
+require_once('../youtube-api/userInfos.php');
 require_once('../graphs/graphFunctions.php');
 session_start();
 
@@ -52,6 +53,13 @@ error_reporting(E_ALL);
                             $result = mysqli_query($db, $fav);
                             $fav = mysqli_fetch_assoc($result);
                             $favt = unserialize($fav['twitter']);
+
+                             $favyy = "SELECT youtube FROM favorites WHERE userid='$userid'";
+                            $result = mysqli_query($db, $favyy);
+                            $favyy = mysqli_fetch_assoc($result);
+                            $favy = unserialize($favyy['youtube']);
+                            
+                            
 														?>
 
 
@@ -68,17 +76,14 @@ error_reporting(E_ALL);
     dataSource: {
         "chart": {
             "theme": "fusion",
-            "caption": "Top 5 Stores by Sales",
-            "subCaption": "Last month",
-            "yAxisName": "Sales (In USD)",
-            "numberPrefix": "$",
+            "caption": "Followers de tes favoris",
+            "subCaption": "",
+            "yAxisName": "Followers",
+            "numberPrefix": "",
             "alignCaptionWithCanvas": "0"
         },
 
-        "data": [{
-                "label": "Bakersfield Central",
-                "value": "880000"
-            }, ';
+        "data": [';
 
 						for( $i=0 ; $i < min(10,count($favt)-2) ; $i++){
 					    $name = getUserScreenName($favt[$i]);
@@ -105,12 +110,61 @@ error_reporting(E_ALL);
 														<div id="diagtwitter">Le diagramme twitter s affiche ici !
 														</div>
 
+
+<?php echo '
+<script type="text/javascript">
+    FusionCharts.ready(function(){
+    var fusioncharts = new FusionCharts({
+    type: "bar2d",
+    renderAt: "diagy",
+    width: "500",
+    height: "400",
+    dataFormat: "json",
+    dataSource: {
+        "chart": {
+            "theme": "fusion",
+            "caption": "Nombre de suscribers de tes favoris",
+            "subCaption": "",
+            "yAxisName": "Suscribers",
+            "numberPrefix": "",
+            "alignCaptionWithCanvas": "0"
+        },
+
+        "data": [';
+
+						for( $i=0 ; $i < min(10,count($favy)-2) ; $i++){
+						    $name = getChannelUsername($favy[$i]);
+						    $followers = getChannelNbFollowers($favy[$i]);
+						    echo '  {
+						          "label": "'.$name.'",
+						          "value": "'.$followers.'"
+						      },';
+						  }
+
+
+						$name = getChannelUsername($favy[count($favy)-1]);
+						$followers = getChannelNbFollowers($favy[count($favy)-1]);
+						echo '{
+									"label": "'.$name.'",
+									"value": "'.$followers.'"
+							}
+        ]
+    }
+});
+    fusioncharts.render();
+    });
+</script>';
+?>
+														<div id="diagy">Le diagramme youtube s affiche ici !
+														</div>
+
 														<table width="400" class="hovertable" align="center" style='text-align:center;background: white' border='1'>
                                 <tr style="background: #3fcbfe;"><th>image</th><th>twitter</th></tr>
 
-														<?php
+														<?php 
                             $datarow = count($favt);
                             for($i=0;$i<$datarow;$i++){
+
                                 $twitter = getUserScreenName($favt[$i]);
                                 $id = $favt[$i];
                                 $image = getUserProfileImage($id);
-- 
GitLab