Skip to content

Instantly share code, notes, and snippets.

@dcnb
Created June 8, 2015 21:09
Show Gist options
  • Save dcnb/e4a03b0208f97f93f324 to your computer and use it in GitHub Desktop.
Save dcnb/e4a03b0208f97f93f324 to your computer and use it in GitHub Desktop.
Revised transcript.class.php file for Oral History Metadata Synchronizer (OHMS) system
private function formatIndex() {
if (!empty($this->index)) {
if (count($this->index->point) == 0) {
$this->indexHTML = '';
return;
}
$indexHTML = "<div id=\"accordionHolder\">\n";
foreach ($this->index->point as $point) {
$timePoint = (floor((int)$point->time / 60)) . ':' . str_pad(((int)$point->time % 60), 2, '0', STR_PAD_LEFT);
$synopsis = $point->synopsis;
$partial_transcript = $point->partial_transcript;
$keywords = $point->keywords;
$subjects = $point->subjects;
$gps = $point->gps;
$gps_text = $point->gps_text;
$hyperlink = $point->hyperlink;
$hyperlink_text = $point->hyperlink_text;
$indexHTML .= '<h3><a href="#" id="link' . $point->time . '">' . $timePoint . ' - ' . trim($point->title, ';') . "</a></h3>\n";
$indexHTML .= '<div class="point">' . "\n";
$indexHTML .= '<p><a class="indexJumpLink" href="#" data-timestamp="' . $point->time . '">Play segment</a><a class="indexSegmentLink" href="#" data-timestamp="' . $point->time . '">Segment link</a><br clear="both" /></p>';
$indexHTML .= '<p class="segmentLink" id="segmentLink' . $point->time . '"><strong>Direct segment link:</strong><br /><input type="text" readonly="readonly" class="segmentLinkTextBox" value="' . ($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . '#segment' . $point->time . '" /></p>';
$indexHTML .= '<div class="synopsis">';
$indexHTML .= '<a name="tp_' . $point->time . '"></a>';
$indexHTML .= '<p><strong>Partial Transcript:</strong><span>' . $partial_transcript . '</span></p><p><strong>Segment Synopsis:</strong><span> ' . $synopsis . '</span></p><p><strong>Keywords:</strong><span> ' . str_replace(';', '; ', $keywords) . '</span></p><p><strong>Subjects:</strong><span> ' . str_replace(';', ' ', $subjects) . '</span></p>';
if ($gps <> '') {
$indexHTML .= '<br/><strong>GPS:</strong> <a class="fancybox-media" href="' . htmlentities(str_replace(' ', '', 'http://maps.google.com/maps?ll='.$gps.'&t=m&z=10&output=embed')).'">';
if ($gps_text <> '') {
$indexHTML .= $gps_text;
}
else {
$indexHTML .= 'Link to map';
}
$indexHTML .= '</a><br/><strong>Map Coordinates:</strong> ' . $gps .'<br/>';
}
if ($hyperlink <> '') {
$indexHTML .= '<br/><strong>Hyperlink:</strong> <a class="fancybox" rel="group" target="_new" href="' . $hyperlink . '">' . $hyperlink_text . '</a><br/>';
}
$indexHTML .= '</div>';
$indexHTML .= "\n</div>\n";
}
$this->indexHTML = $indexHTML . "</div>\n";
}
}
private function formatIndex() {
if (!empty($this->index)) {
if (count($this->index->point) == 0) {
$this->indexHTML = '';
return;
}
$indexHTML = "<div id=\"accordionHolder\">\n";
foreach ($this->index->point as $point) {
$timePoint = $point->time;
$timeHour = (floor((int)$point->time / 60)) . ':' . str_pad(((int)$point->time % 60), 2, '0', STR_PAD_LEFT);
$synopsis = $point->synopsis;
$partial_transcript = $point->partial_transcript;
$keywords = $point->keywords;
$subjects = $point->subjects;
$gps = $point->gps;
$gps_text = $point->gps_text;
$hyperlink = $point->hyperlink;
$hyperlink_text = $point->hyperlink_text;
$time_min = $point->time *60;
$indexHTML .= '<h3><a href="#" id="link' . $point->time . '">' . $timePoint . ':00 - ' . trim($point->title, ';') . "</a></h3>\n";
$indexHTML .= '<div class="point">' . "\n";
$indexHTML .= '<p><a class="indexJumpLink" href="#" data-timestamp="' . $time_min . '">Play segment</a><a class="indexSegmentLink" href="#" data-timestamp="' . $time_min . '">Segment link</a><br clear="both" /></p>';
$indexHTML .= '<p class="segmentLink" id="segmentLink' . $time_min . '"><strong>Direct segment link:</strong><br /><input type="text" readonly="readonly" class="segmentLinkTextBox" value="' . ($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . '#segment' . $time_min . '" /></p>';
$indexHTML .= '<div class="synopsis">';
$indexHTML .= '<a name="tp_' . $point->time . '"></a>';
if ($partial_transcript <> '') {
$indexHTML .= '<p><strong>Partial Transcript:</strong><span>' . $partial_transcript . '</span></p>';
}
if ($synopsis <> '') {
$indexHTML .= '<p><strong>Segment Synopsis:</strong><span> ' . $synopsis . '</span></p>';
}
if ($keywords <> '') {
$indexHTML .= '<p><strong>Keywords:</strong><span> ' . str_replace(';', '; ', $keywords) . '</span></p>';
}
if ($subjects <> '') {
$indexHTML .= '<p><strong>Subjects:</strong><span> ' . str_replace(';', ' ', $subjects) . '</span></p>';
}
if ($gps <> '') {
$indexHTML .= '<br/><strong>GPS:</strong> <a class="fancybox-media" href="' . htmlentities(str_replace(' ', '', 'http://maps.google.com/maps?ll='.$gps.'&t=m&z=10&output=embed')).'">';
if ($gps_text <> '') {
$indexHTML .= $gps_text;
}
else {
$indexHTML .= 'Link to map';
}
$indexHTML .= '</a><br/><strong>Map Coordinates:</strong> ' . $gps .'<br/>';
}
if ($hyperlink <> '') {
$indexHTML .= '<br/><strong>Hyperlink:</strong> <a class="fancybox" rel="group" target="_new" href="' . $hyperlink . '">' . $hyperlink_text . '</a><br/>';
}
$indexHTML .= '</div>';
$indexHTML .= "\n</div>\n";
}
$this->indexHTML = $indexHTML . "</div>\n";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment