function process_export($args) { $acs = getActivityArray(); $sql = 'SELECT wc_offset, activity_id, log_data FROM activities NATURAL JOIN windowclassifications NATURAL JOIN sensorlogger WHERE log_statuscode = 1 AND (0'; foreach ($acs as $id => $name) { if (substr($name, 0, 10) == 'CLASSIFIED') { $sql .= ' OR activity_id = ' . $id; } } $sql .= ')'; $res = mysql_query($sql); header('Content-type: text/plain'); header('Content-disposition: attachment; filename=data.txt'); while ($row = mysql_fetch_assoc($res)) { echo 'Activity: ', $acs[$row['activity_id']], "\n"; $data = array_slice(explode("\n", $row['log_data']), $row['wc_offset'], 128); echo implode("\n", $data); echo "\n"; } exit; }
} else { ?> <p>Oh dear, that's all of your records. Make sure you're using the <a href="/android/">latest version</a> to ensure you get the best results. Record some more and check back soon!</p> <?php } } else { ?> <p>Our system didn't find any problems with your records, so all of them are shown below:</p> <?php } if ($rejects < $num) { ?> <h2>Your records</h2> <?php $acs = getActivityArray(); foreach ($data as $datum) { echo '<h3>', htmlentities($datum['log_activity']), '</h3>'; $sql = 'SELECT activity_id AS name, COUNT(*) AS num FROM windowclassifications WHERE log_id = ' . $datum['log_id'] . ' GROUP BY activity_id'; $res = mysql_query($sql); $cls = array(); while ($row = mysql_fetch_assoc($res)) { $cls[$row['name']] = $row['num']; } if (!empty($cls)) { echo '<p>This sample has been manually classified into the following activities: '; $first = true; foreach ($cls as $id => $count) { if ($first) { $first = false; } else {