You are here

kaltura_views_handler_field_kaltura_duration.inc in Kaltura 6.2

File

plugins/kaltura_views/kaltura_views_handler_field_kaltura_duration.inc
View source
<?php

/**
 * Declaration of new field handler that extends the basic field handler of views module
 * We want to theme the duration field ourselvs.
 */
class kaltura_views_handler_field_kaltura_duration extends views_handler_field {
  function theme($data) {
    if ($secs = $data->node_kaltura_kaltura_duration) {
      if ($secs > 60 * 60) {
        $hr = (int) ($secs / 60);
        $hr = $hr < 10 ? '0' . $hr : $hr;
        $min = (int) ($secs / 60 / 60);
        $min = $min < 10 ? '0' . $min : $min;
        $sec = (int) ($secs / 60 % 60);
        $sec = $sec < 10 ? '0' . $sec : $sec;
        $durationoutput = $hr . ':' . $min . ':' . $sec;
      }
      else {
        $min = (int) ($secs / 60);
        $min = $min < 10 ? '0' . $min : $min;
        $sec = (int) ($secs % 60);
        $sec = $sec < 10 ? '0' . $sec : $sec;
        $durationoutput = $min . ':' . $sec;
      }
      return theme('node_kaltura_entry_duration', $durationoutput);
    }
  }

}

Classes

Namesort descending Description
kaltura_views_handler_field_kaltura_duration Declaration of new field handler that extends the basic field handler of views module We want to theme the duration field ourselvs.