Commit 3804811e authored by Nico Schallehn's avatar Nico Schallehn

test

parent bf100e9f
......@@ -406,39 +406,47 @@ class MediaDBAPI{
if ($Statistik == true) {
if (($GET_arr['Tabelle'] == "Staffeln")) { //TODO hier ist auch was geändert aber noch nicht getestet!!
//var_dump($this->SpaltenEpi);
$Query = 'SELECT '.(in_array("checked", $this->SpaltenEpi)==1?'avg(e.checked) AS Checked,':'').' '.(in_array("views", $this->SpaltenEpi)==1?'avg(e.views) AS Views,':'').' SUM(e.size) AS Size, SUM(e.duration) AS Duration, COUNT(e.name) AS Count '.
$Query = 'SELECT '.
(in_array("checked", $this->SpaltenEpi)==1?'avg(e.checked) AS Checked,':'').' '.
(in_array("views", $this->SpaltenEpi)==1?'avg(e.views) AS Views,':'').' '.
(in_array("size", $this->SpaltenEpi)==1?'SUM(e.size) AS Size,':'').' SUM(e.duration) AS Duration, COUNT(e.name) AS Count '.
'FROM Staffeln AS s JOIN Episoden AS e ON s.season_nr = e.season_nr '.
'WHERE s.season_nr = '.$entry["season_nr"];
$result = $this->query($Query);
/*$result = $this->query($Query);
if($this->DB_Objekt->error != ""){ return $this->error(1005, $this->DB_Objekt->error);}
$resultArr = $result->fetch_array();
$tempArray["Checked"] = ($resultArr["Checked"]== null?"":$resultArr["Checked"]);
$tempArray["Views"] = ($resultArr["Views"] == null?0:$resultArr["Views"]);
$tempArray["Size"] = ($resultArr["Size"] == null?0:$resultArr["Size"]);
$tempArray["Duration"] = ($resultArr["Duration"] == null?0:$resultArr["Duration"]);
$tempArray["Count"] = ($resultArr["Count"] == null?0:$resultArr["Count"]);
$tempArray["Count"] = ($resultArr["Count"] == null?0:$resultArr["Count"]);*/
}else if (($GET_arr['Tabelle'] == "Serien")){
//JETZT
//var_dump( $this->SpaltenEpi);
/*echo in_array("checked", $this->SpaltenEpi).PHP_EOL;
echo in_array("views", $this->SpaltenEpi).PHP_EOL;
*/$Query = 'SELECT '.(in_array("checked", $this->SpaltenEpi)==1?'avg(e.checked) AS Checked,':'').' '.(in_array("views", $this->SpaltenEpi)==1?'avg(e.views) AS Views,':'').' SUM(e.size) AS Size, SUM(e.duration) AS Duration, COUNT(e.name) AS Count '.
*/$Query = 'SELECT '.(in_array("checked", $this->SpaltenEpi)==1?'avg(e.checked) AS Checked,':'').' '.
(in_array("views", $this->SpaltenEpi)==1?'avg(e.views) AS Views,':'').' '.
(in_array("size", $this->SpaltenEpi)==1?'SUM(e.size) AS Size,':'').' SUM(e.duration) AS Duration, COUNT(e.name) AS Count '.
'FROM Serien AS se JOIN Staffeln AS st ON se.series_nr=st.series_nr JOIN Episoden AS e ON st.season_nr = e.season_nr '.
'WHERE se.series_nr = '.$entry["series_nr"];
$result = $this->query($Query);
if($this->DB_Objekt->error != ""){ return $this->error(1005, $this->DB_Objekt->error);}
$resultArr = $result->fetch_array();
if(in_array("checked", $this->SpaltenEpi)==1){
$tempArray["Checked"] = ($resultArr["Checked"]== null?"":$resultArr["Checked"]);
}
if(in_array("views", $this->SpaltenEpi)==1){
$tempArray["Views"] = ($resultArr["Views"] == null?0:$resultArr["Views"]);
}
}
$result = $this->query($Query);
if($this->DB_Objekt->error != ""){ return $this->error(1005, $this->DB_Objekt->error);}
$resultArr = $result->fetch_array();
if(in_array("checked", $this->SpaltenEpi)==1){
$tempArray["Checked"] = ($resultArr["Checked"]== null?"":$resultArr["Checked"]);
}
if(in_array("views", $this->SpaltenEpi)==1){
$tempArray["Views"] = ($resultArr["Views"] == null?0:$resultArr["Views"]);
}
if(in_array("size", $this->SpaltenEpi)==1){
$tempArray["Size"] = ($resultArr["Size"] == null?0:$resultArr["Size"]);
$tempArray["Duration"] = ($resultArr["Duration"] == null?0:$resultArr["Duration"]);
$tempArray["Count"] = ($resultArr["Count"] == null?0:$resultArr["Count"]);
}
$tempArray["Duration"] = ($resultArr["Duration"] == null?0:$resultArr["Duration"]);
$tempArray["Count"] = ($resultArr["Count"] == null?0:$resultArr["Count"]);
}
array_push($entryArray,$tempArray);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment