diff --git a/plugin/AD_Server/Objects/VastCampaignsLogs.php b/plugin/AD_Server/Objects/VastCampaignsLogs.php index e8a2364ce..177d816da 100755 --- a/plugin/AD_Server/Objects/VastCampaignsLogs.php +++ b/plugin/AD_Server/Objects/VastCampaignsLogs.php @@ -1,114 +1,115 @@ id; } function getUsers_id() { return $this->users_id; } function getType() { return $this->type; } function getVast_campaigns_has_videos_id() { return $this->vast_campaigns_has_videos_id; } function setId($id) { $this->id = $id; } function setUsers_id($users_id) { $this->users_id = $users_id; } function setType($type) { $this->type = $type; } function setVast_campaigns_has_videos_id($vast_campaigns_has_videos_id) { $this->vast_campaigns_has_videos_id = $vast_campaigns_has_videos_id; } function getIp() { return $this->ip; } function save() { $this->ip = getRealIpAddr(); return parent::save(); } static function getViews(){ global $global; $sql = "SELECT count(*) as total FROM vast_campaigns_logs WHERE `type` = 'start'"; + $res = sqlDAL::readSql($sql); $data = sqlDAL::fetchAssoc($res); sqlDAL::close($res); if ($res) { $row = $data; } else { $row = false; } return $row['total']; } static function getData($vast_campaigns_has_videos_id){ global $global; $sql = "SELECT `type`, count(*) as total FROM vast_campaigns_logs WHERE vast_campaigns_has_videos_id = $vast_campaigns_has_videos_id GROUP BY `type`"; $res = sqlDAL::readSql($sql); $fullData = sqlDAL::fetchAllAssoc($res); sqlDAL::close($res); $data = array(); if ($res!=false) { foreach ($fullData as $row) { $data[$row['type']] = $row['total']; } } else { die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error); } return $data; } static function getDataFromCampaign($vast_campaigns_id){ global $global; $sql = "SELECT `type`, count(vast_campaigns_id) as total FROM vast_campaigns_logs vcl " . " LEFT JOIN vast_campaigns_has_videos vchv ON vast_campaigns_has_videos_id = vchv.id " . " WHERE vast_campaigns_id = $vast_campaigns_id GROUP BY `type`"; //echo $sql."\n"; $res = sqlDAL::readSql($sql); $fullData = sqlDAL::fetchAllAssoc($res); sqlDAL::close($res); $data = array(); if ($res!=false) { foreach ($fullData as $row) { $data[$row['type']] = $row['total']; } } else { die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error); } return $data; } }