Example #1
0
function get_path_color($id, $path){

    $color_status = check_video_status($id);

    if ($color_status == 1){
        $color = 'green';
    }else if ($color_status == 0){
        $color = 'red';
    }else if ($color_status == 2){
        $color = 'blue';
    }else if ($color_status == 3){
        $color = '#f4c430';
    }
    return "<span id='path_$id' style='color:".$color."'>$path</span>";
}
<?php

require_once "../../config.php";
require_once $CFG->dirroot . '/mod/kaltura/lib.php';
$type = "video";
if (isset($_POST["type"])) {
    $type = $_POST["type"];
}
if ($type == 'ppt') {
    check_ppt_status($_POST["downloadUrl"]);
} else {
    check_video_status($_POST["entryid"]);
}
function check_video_status($entryId)
{
    try {
        $client = KalturaHelpers::getKalturaClient();
        $entry = $client->baseEntry->get($entryId);
        if ($entry->status == KalturaEntryStatus::READY) {
            echo 'y:<img src="' . KalturaHelpers::getThumbnailUrl(null, $entryId, 140, 105) . '" />';
        } else {
            echo 'n:';
        }
    } catch (Exception $exp) {
        die('e:' . $exp->getMessage());
    }
}
function check_ppt_status($url)
{
    // change $url to verify swf exists on kaltura
    $random_hit = time() + rand(0, 2000);