function getTables() { $query = "SHOW TABLES"; $q = new DbMySql($query); $tables = array(); while ($q->nextRecord()) { $tables[] = $q->f('Tables_in_' . $q->database); } return $tables; }
$fieldValue = $db->f('free_widgets'); $resWidgets[$db->f('ord_date')]['free_widgets'] = isset($resWidgets[$db->f('ord_date')]['free_widgets']) ? $resWidgets[$db->f('ord_date')]['free_widgets'] + $fieldValue : $fieldValue; $resWidgets[$db->f('ord_date')]['total_widgets'] = isset($resWidgets[$db->f('ord_date')]['total_widgets']) ? $resWidgets[$db->f('ord_date')]['free_widgets'] + $fieldValue : $fieldValue; } #points $query = "SELECT COUNT(`id`) AS `points_widgets`, DATE_FORMAT(`date_premium`, '{$dateFormatSQL}') as `ord_date` FROM `quizzes`\n\t\tWHERE DATE_FORMAT(`date_premium`, '%Y-%m-%d') >= '{$_POST['date_from']}' \n\t\tAND DATE_FORMAT(`date_premium`, '%Y-%m-%d') <= '{$_POST['date_to']}' AND `flags` & " . Quiz::FLAG_PREMIUM . " AND `premium_type` = 'points' \n\t\tGROUP BY `ord_date` "; $db = new DbMySql($query); while ($db->nextRecord()) { $fieldValue = $db->f('points_widgets'); $resWidgets[$db->f('ord_date')]['points_widgets'] = isset($resWidgets[$db->f('ord_date')]['points_widgets']) ? $resWidgets[$db->f('ord_date')]['points_widgets'] + $fieldValue : $fieldValue; $resWidgets[$db->f('ord_date')]['total_widgets'] = isset($resWidgets[$db->f('ord_date')]['total_widgets']) ? $resWidgets[$db->f('ord_date')]['total_widgets'] + $fieldValue : $fieldValue; } #vip $query = "SELECT COUNT(`id`) AS `vip_widgets`, DATE_FORMAT(`date_premium`, '{$dateFormatSQL}') as `ord_date` FROM `quizzes`\n\t\tWHERE DATE_FORMAT(`date_premium`, '%Y-%m-%d') >= '{$_POST['date_from']}' \n\t\tAND DATE_FORMAT(`date_premium`, '%Y-%m-%d') <= '{$_POST['date_to']}' AND `flags` & " . Quiz::FLAG_PREMIUM . " AND `premium_type` = 'subscription' \n\t\tGROUP BY `ord_date` "; $db = new DbMySql($query); while ($db->nextRecord()) { $fieldValue = $db->f('vip_widgets'); $resWidgets[$db->f('ord_date')]['vip_widgets'] = isset($resWidgets[$db->f('ord_date')]['vip_widgets']) ? $resWidgets[$db->f('ord_date')]['vip_widgets'] + $fieldValue : $fieldValue; $resWidgets[$db->f('ord_date')]['total_widgets'] = isset($resWidgets[$db->f('ord_date')]['total_widgets']) ? $resWidgets[$db->f('ord_date')]['total_widgets'] + $fieldValue : $fieldValue; } $xml = new XmlBuilder(); $xml->Push('response'); $xml->Element('code', 200); $xml->Element('status', ServMessages::getMessage(20)); foreach ($resPoints as $date => $result) { $xml->Push('results_points'); $xml->Element('date', $date); $xml->Element('used_points', isset($result['used_points']) ? $result['used_points'] : 0); $xml->Element('vip_used_points', isset($result['vip_used_points']) ? $result['vip_used_points'] : 0); $xml->Element('total_used_points', isset($result['total_used_points']) ? $result['total_used_points'] : 0); $xml->Pop('results_points');