<?php |
<?php |
|
//select tgid, extract(hour from call_timestamp) ahour, date_trunc('day', call_timestamp) aday, count(filename), array_to_string(array_agg(filename), ' ') from recordings group by tgid, ahour, aday order by aday, ahour, tgid |
include('common.inc.php'); |
include('common.inc.php'); |
$sth = $conn->prepare('select * from recordings limit 100;'); |
$sth = $conn->prepare('select * from recordings limit 100;'); |
|
|
$sth->execute(); |
$sth->execute(); |
$recordings = $sth->fetchAll(); |
$recordings = $sth->fetchAll(); |
$convos = Array(); |
$convos = Array(); |
$convo = Array(); |
$convo = Array(); |
foreach ($recordings as $i => $recording) { |
foreach ($recordings as $i => $recording) { |
|
|
if (count($convo) > 0) { |
if (count($convo) > 0) { |
echo "<br> " . strcasecmp($convos[count($convos) - 1][0]['call_timestamp'], $recording['call_timestamp']); |
echo "<br> " . strcasecmp($convos[count($convos) - 1][0]['call_timestamp'], $recording['call_timestamp']); |
if (abs(strcasecmp($convos[count($convos) - 1][0]['call_timestamp'], $recording['call_timestamp'])) > 2) { |
if (abs(strcasecmp($convos[count($convos) - 1][0]['call_timestamp'], $recording['call_timestamp'])) > 2) { |
echo " " . $convos[count($convos) - 1][0]['call_timestamp'] . " " . $recording['call_timestamp']; |
echo " " . $convos[count($convos) - 1][0]['call_timestamp'] . " " . $recording['call_timestamp']; |
} |
} |
if (strcasecmp($convos[count($convos) - 1][0]['tgid'], $recording['tgid']) != 0) { |
if (strcasecmp($convos[count($convos) - 1][0]['tgid'], $recording['tgid']) != 0) { |
$convos[] = $convo; |
$convos[] = $convo; |
$convo = Array(); |
$convo = Array(); |
} |
} |
} |
} |
; |
; |
//print_r($recording); |
//print_r($recording); |
$convo[] = $recording; |
$convo[] = $recording; |
//print_r($convo); |
//print_r($convo); |
//echo "<br>\n"; |
//echo "<br>\n"; |
} |
} |
foreach ($convos as $i => $convo) { |
foreach ($convos as $i => $convo) { |
foreach ($convo as $recording) { |
foreach ($convo as $recording) { |
echo $recording['filename'] . " , "; |
echo $recording['filename'] . " , "; |
} |
} |
echo "<br><hr>\n"; |
echo "<br><hr>\n"; |
} |
} |
?> |
?> |
|
|
|
|