瀏覽代碼

Expose manual classifications in portal

Closes #37
tags/SensorLogger/0.2.0
Chris Smith 14 年之前
父節點
當前提交
dea9ef4ad5
共有 1 個文件被更改,包括 23 次插入0 次删除
  1. 23
    0
      website/portal.php

+ 23
- 0
website/portal.php 查看文件

@@ -84,8 +84,31 @@
84 84
   <h2>Your records</h2>
85 85
 <?PHP
86 86
 
87
+ $acs = getActivityArray();
88
+
87 89
  foreach ($data as $datum) {
88 90
   echo '<h3>', htmlentities($datum['log_activity']), '</h3>';
91
+
92
+  $sql = 'SELECT activity_id AS name, COUNT(*) AS num FROM windowclassifications WHERE log_id = ' . $datum['log_id'] . ' GROUP BY activity_id';
93
+  $res = mysql_query($sql);
94
+  $cls = array();
95
+
96
+  while ($row = mysql_fetch_assoc($res)) {
97
+   $cls[$row['name']] = $row['num'];
98
+  }
99
+
100
+  if (!empty($cls)) {
101
+   echo '<p>This sample has been manually classified into the following activities: ';
102
+
103
+   $first = true;
104
+   foreach ($cls as $id => $count) {
105
+    if ($first) { $first = false; } else { echo '; '; }
106
+    echo $acs[$id], ' (', $count, ' window', $count == 1 ? '' : 's', ')';
107
+   }
108
+
109
+   echo '</p>';
110
+  }
111
+
89 112
   echo '<div style="height: 700px; overflow: auto;">';
90 113
   echo '<img src="/android/g/', CODE, '/', $datum['log_id'], '/1" height="330" alt="Graph of accelerometer data"/><br/>';
91 114
   echo '<img src="/android/g/', CODE, '/', $datum['log_id'] . '/2" height="330" alt="Graph of magnetic fielddata"/>';

Loading…
取消
儲存