You are here

kaltura_views_handler_field_kaltura_duration.inc in Kaltura 7.2

File

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

// $Id: kaltura_views_handler_field_kaltura_duration.inc,v 1.1.2.1 2010/08/09 04:33:33 univate Exp $

/**
 * 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 render($values) {
    $secs = $values->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 $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.