public function response_area_read_only($name, $qa, $step, $lines, $context)
 {
     //fetch file from storage and figure out URL
     $storedfiles = $qa->get_last_qt_files($name, $context->id);
     foreach ($storedfiles as $sf) {
         $pathtofile = $qa->get_response_file_url($sf);
         break;
     }
     return fetchSimpleVideoPlayer('swf', $pathtofile, 400, 380, "http");
 }
Esempio n. 2
0
function poodll_callback($link)
{
    global $CFG, $COURSE, $USER;
    //get our filter props
    //we use a function in the poodll poodllresourcelib, because
    //parsing will also need to be done by the html editor
    $filterprops = fetch_filter_properties($link[0]);
    //if we have no props, quit
    if (empty($filterprops)) {
        return "";
    }
    //if we want to ignore the filter (for "how to use a filter" demos) we let it go
    //to use this, make the last parameter of the filter passthrough=1
    if (!empty($filterprops['passthrough'])) {
        return str_replace(",passthrough=1", "", $link[0]);
    }
    //Init our return variable
    $returnHtml = "";
    //depending on the type of filter
    switch ($filterprops['type']) {
        case 'video':
            //$returnHtml="<BR />" . fetchSimpleVideoPlayer($filterprops['path'],$filterprops['width'],$filterprops['height']);
            $returnHtml = "<BR />" . fetchSimpleVideoPlayer($filterprops['path'], !empty($filterprops['width']) ? $filterprops['width'] : $CFG->filter_poodll_videowidth, !empty($filterprops['height']) ? $filterprops['height'] : $CFG->filter_poodll_videoheight, !empty($filterprops['protocol']) ? $filterprops['protocol'] : 'rtmp', !empty($filterprops['embed']) ? $filterprops['embed'] == 'true' : false, !empty($filterprops['permitfullscreen']) ? $filterprops['permitfullscreen'] : false, !empty($filterprops['embedstring']) ? $filterprops['embedstring'] : 'Play');
            break;
        case 'wmvvideo':
            $returnHtml = "<BR />" . fetchWMVPlayer($filterprops['path'], !empty($filterprops['width']) ? $filterprops['width'] : $CFG->filter_poodll_videowidth, !empty($filterprops['height']) ? $filterprops['height'] : $CFG->filter_poodll_videoheight);
            break;
        case 'audio':
            $returnHtml = "<BR />" . fetchSimpleAudioPlayer($filterprops['path'], !empty($filterprops['protocol']) ? $filterprops['protocol'] : 'rtmp', !empty($filterprops['width']) ? $filterprops['width'] : $CFG->filter_poodll_audiowidth, !empty($filterprops['height']) ? $filterprops['height'] : $CFG->filter_poodll_audioheight, !empty($filterprops['embed']) ? $filterprops['embed'] == 'true' : false, !empty($filterprops['embedstring']) ? $filterprops['embedstring'] : 'Play');
            break;
        case 'audiolist':
            $returnHtml = "<BR />" . fetchAudioListPlayer($filterprops['path'], !empty($filterprops['protocol']) ? $filterprops['protocol'] : 'rtmp', !empty($filterprops['width']) ? $filterprops['width'] : 400, !empty($filterprops['height']) ? $filterprops['height'] : 250, !empty($filterprops['sequentialplay']) ? $filterprops['sequentialplay'] : 'true');
            break;
        case 'audiotest':
            $returnHtml = "<BR />" . fetchAudioTestPlayer($filterprops['path'], !empty($filterprops['protocol']) ? $filterprops['protocol'] : 'rtmp', !empty($filterprops['width']) ? $filterprops['width'] : 400, !empty($filterprops['height']) ? $filterprops['height'] : 50);
            break;
        case 'talkback':
            $returnHtml = "<BR />" . fetchTalkbackPlayer($filterprops['path'], !empty($filterprops['protocol']) ? $filterprops['protocol'] : 'rtmp', !empty($filterprops['recordable']) ? $filterprops['recordable'] : 'false', !empty($filterprops['savefolder']) ? $filterprops['savefolder'] : 'default');
            break;
        case 'bigvideogallery':
            $returnHtml = "<BR />" . fetchBigVideoGallery($filterprops['path'], !empty($filterprops['protocol']) ? $filterprops['protocol'] : 'rtmp', !empty($filterprops['width']) ? $filterprops['width'] : $CFG->filter_poodll_biggallwidth, !empty($filterprops['height']) ? $filterprops['height'] : $CFG->filter_poodll_biggallheight);
            break;
        case 'videorecorder':
            $returnHtml = "<BR />" . fetchSimpleVideoRecorder($filterprops['savefolder']);
            break;
        case 'audiorecorder':
            $returnHtml = "<BR />" . fetchSimpleAudioRecorder($filterprops['savefolder']);
            break;
        case 'calculator':
            $returnHtml = "<BR />" . fetch_poodllcalc(!empty($filterprops['width']) ? $filterprops['width'] : 300, !empty($filterprops['height']) ? $filterprops['height'] : 400);
            break;
        case 'teachersrecorder':
            $returnHtml = "<BR />" . fetch_teachersrecorder($filterprops['savepath'], "");
            break;
        case 'adminconsole':
            $returnHtml = "<BR />" . fetch_poodllconsole("", "billybob", -1, true);
            break;
        case 'countdown':
            $returnHtml = "<BR />" . fetch_countdowntimer($filterprops['initseconds'], !empty($filterprops['usepresets']) ? $filterprops['usepresets'] : 'false', !empty($filterprops['width']) ? $filterprops['width'] : 400, !empty($filterprops['height']) ? $filterprops['height'] : 265, !empty($filterprops['fontsize']) ? $filterprops['fontsize'] : 64, !empty($filterprops['mode']) ? $filterprops['mode'] : 'normal', !empty($filterprops['permitfullscreen']) ? $filterprops['permitfullscreen'] : false, !empty($filterprops['uniquename']) ? $filterprops['uniquename'] : 'auniquename');
            break;
        case 'counter':
            $returnHtml = "<BR />" . fetch_counter(!empty($filterprops['initcount']) ? $filterprops['initcount'] : 0, !empty($filterprops['usepresets']) ? $filterprops['usepresets'] : 'false', !empty($filterprops['width']) ? $filterprops['width'] : 480, !empty($filterprops['height']) ? $filterprops['height'] : 265, !empty($filterprops['fontsize']) ? $filterprops['fontsize'] : 64, !empty($filterprops['permitfullscreen']) ? $filterprops['permitfullscreen'] : false);
            break;
        case 'dice':
            $returnHtml = "<BR />" . fetch_dice(!empty($filterprops['dicecount']) ? $filterprops['dicecount'] : 1, !empty($filterprops['dicesize']) ? $filterprops['dicesize'] : 200, !empty($filterprops['width']) ? $filterprops['width'] : 300, !empty($filterprops['height']) ? $filterprops['height'] : 300);
            break;
        case 'flashcards':
            $returnHtml = "<BR />" . fetch_flashcards($filterprops['cardset'], !empty($filterprops['cardwidth']) ? $filterprops['cardwidth'] : 300, !empty($filterprops['cardheight']) ? $filterprops['cardheight'] : 150, !empty($filterprops['randomize']) ? $filterprops['randomize'] : 'yes', !empty($filterprops['width']) ? $filterprops['width'] : 400, !empty($filterprops['height']) ? $filterprops['height'] : 300);
            break;
        case 'stopwatch':
            $returnHtml = "<BR />" . fetch_stopwatch(!empty($filterprops['width']) ? $filterprops['width'] : 400, !empty($filterprops['height']) ? $filterprops['height'] : 265, !empty($filterprops['fontsize']) ? $filterprops['fontsize'] : 64, !empty($filterprops['mode']) ? $filterprops['mode'] : 'normal', !empty($filterprops['permitfullscreen']) ? $filterprops['permitfullscreen'] : false, !empty($filterprops['uniquename']) ? $filterprops['uniquename'] : 'auniquename');
            break;
        case 'smallvideogallery':
            $returnHtml = "<BR />" . fetchSmallVideoGallery($filterprops['path'], !empty($filterprops['protocol']) ? $filterprops['protocol'] : 'rtmp', !empty($filterprops['width']) ? $filterprops['width'] : $CFG->filter_poodll_smallgallwidth, !empty($filterprops['height']) ? $filterprops['height'] : $CFG->filter_poodll_smallgallheight, !empty($filterprops['permitfullscreen']) ? $filterprops['permitfullscreen'] : false);
            break;
        case 'newpoodllpairwork':
            $returnHtml = "<BR />" . fetch_embeddablepairclient(!empty($filterprops['width']) ? $filterprops['width'] : $CFG->filter_poodll_newpairwidth, !empty($filterprops['height']) ? $filterprops['height'] : $CFG->filter_poodll_newpairheight, !empty($filterprops['chat']) ? $filterprops['chat'] : true, !empty($filterprops['whiteboard']) ? $filterprops['whiteboard'] : false, !empty($filterprops['showvideo']) ? $filterprops['showvideo'] : false, !empty($filterprops['whiteboardback']) ? $filterprops['whiteboardback'] : '');
            break;
        case 'screensubscribe':
            $returnHtml = "<BR />" . fetch_screencast_subscribe("", true, !empty($filterprops['width']) ? $filterprops['width'] : $CFG->filter_poodll_showwidth, !empty($filterprops['height']) ? $filterprops['height'] : $CFG->filter_poodll_showheight);
            break;
        case 'poodllpalette':
            $returnHtml = "<BR />" . fetch_poodllpalette($filterprops['width'], $filterprops['height']);
            break;
        case 'whiteboard':
            $returnHtml = "<BR />" . fetch_whiteboard(!empty($filterprops['boardname']) ? $filterprops['boardname'] : "whiteboard", !empty($filterprops['backimage']) ? $filterprops['backimage'] : "", !empty($filterprops['slave']) && $filterprops['slave'] == 'true' ? $filterprops['slave'] : false, !empty($filterprops['rooms']) ? $filterprops['rooms'] : "", !empty($filterprops['width']) ? $filterprops['width'] : $CFG->filter_poodll_whiteboardwidth, !empty($filterprops['height']) ? $filterprops['height'] : $CFG->filter_poodll_whiteboardheight, !empty($filterprops['mode']) ? $filterprops['mode'] : 'normal', !empty($filterprops['standalone']) && $filterprops['standalone'] == 'true' ? $filterprops['standalone'] : 'false');
            break;
        case 'poodllpairwork':
            $courseid = $COURSE->id;
            $username = $USER->username;
            $poodllpairworkplayer = "";
            $studentalias = "";
            $pairmap = "";
            if ($pairmap = get_record("poodllpairwork_usermap", "username", $username, "course", $courseid)) {
                $studentalias = $pairmap->role;
            }
            //if we have a role and hence a session.
            if ($studentalias != "") {
                $me = get_record('user', 'username', $username);
                $partner = get_record('user', 'username', $pairmap->partnername);
                $partnerpic = fetch_user_picture($partner, 35);
                $mepic = fetch_user_picture($me, 35);
                $poodllpairworkplayer = "<h4>" . get_string("yourpartneris", "poodllpairwork") . fullname($partner) . "</h4>";
                $poodllpairworkplayer .= fetchPairworkPlayer($pairmap->username, $pairmap->partnername, $mepic, fullname($me), $partnerpic, fullname($partner));
            }
            $returnHtml = "<BR />" . $poodllpairworkplayer;
            break;
        default:
    }
    //return our html
    return $returnHtml;
}
Esempio n. 3
0
 public function response_area_read_only($name, $qa, $step, $lines, $context)
 {
     $pathtofile = "";
     //fetch file from storage and figure out URL
     $storedfiles = $qa->get_last_qt_files($name, $context->id);
     foreach ($storedfiles as $sf) {
         //when we find the file that matches the filename in $step, use that
         $usefilename = strip_tags($step->get_qt_var($name));
         $storedfilename = strip_tags($sf->get_filename());
         if ($usefilename === $storedfilename) {
             $pathtofile = $qa->get_response_file_url($sf);
             break;
         }
     }
     //if we do not have a file submission, return an empty string
     if (empty($pathtofile)) {
         return "";
     } else {
         return fetchSimpleVideoPlayer('auto', $pathtofile, 400, 380, "http");
     }
 }
Esempio n. 4
0
/**
 * Replace mp4 or flv links with player
 *
 * @param  $link
 * @return string
 */
function filter_poodll_mp4flv_callback($link)
{
    global $CFG;
    //clean up url
    $url = $link[1];
    $url = str_replace('&amp;', '&', $url);
    $url = clean_param($url, PARAM_URL);
    //use default widths or explicit width/heights if they were passed in ie http://url.to.video.mp4?d=640x480
    if (empty($link[3]) or empty($link[4])) {
        $width = $CFG->filter_poodll_videowidth;
        $height = $CFG->filter_poodll_videoheight;
    } else {
        $width = $link[3];
        $height = $link[4];
    }
    //get the url and massage it a little
    $url = $link[1];
    $rawurl = str_replace('&amp;', '&', $url);
    //test for presence of player selectors and serve up the correct player
    //determine the file extension
    $ext = substr($filename, -3);
    $len = strlen($link[5]);
    if (strrpos($link[5], '.mini.' . $ext) === $len - 9) {
        $returnHtml = fetch_miniplayer('auto', $rawurl, 'http', '', 0, 0, true);
    } else {
        if (strrpos($link[2], '.once.' . $ext) === $len - 9) {
            $returnHtml = fetch_onceplayer('auto', $rawurl, 'http');
        } elseif (strrpos($link[5], '.word.' . $ext) === $len - 9) {
            $word = substr($link[5], 0, $len - 9);
            $returnHtml = fetch_wordplayer('auto', $rawurl, $word, 0, 'http', 0, 0, true);
        } elseif (strrpos($link[5], '.audio.' . $ext) === $len - 10) {
            $returnHtml = fetchSimpleAudioPlayer('auto', $rawurl, 'http', $CFG->filter_poodll_audiowidth, $CFG->filter_poodll_audioheight, false, 'Play');
        } elseif (strrpos($link[5], '.inlineword.' . $ext) === $len - 15) {
            $word = substr($link[5], 0, $len - 15);
            $returnHtml = fetch_wordplayer('js', $rawurl, $word, 0, 'http', 0, 0, true);
        } else {
            $returnHtml = fetchSimpleVideoPlayer('auto', $url, $width, $height, 'http', false, true, 'Play');
        }
    }
    return $returnHtml;
}
if (!isset($CFG)) {
    require_once "../../config.php";
}
require_once $CFG->dirroot . '/filter/poodll/poodllresourcelib.php';
global $PAGE, $USER;
//this doesnt seem to work here. So had to put an echos  below
//$PAGE->requires->js(new moodle_url($CFG->httpswwwroot . '/filter/poodll/flash/embed-compressed.js'),true);
//$PAGE->requires->js(new moodle_url($CFG->httpswwwroot . '/filter/poodll/flowplayer/flowplayer-3.2.9.min.js'),true);
// we get the request parameters:
$mediapath = optional_param('mediapath', '', PARAM_TEXT);
// path to mediafile
// we output a simple HTML page with the poodll recorder code in it
//$PAGE->set_generaltype('popup');
$PAGE->set_context(get_context_instance(CONTEXT_USER, $USER->id));
//$PAGE->set_url($CFG->wwwroot.'/repository/poodll/iframeplayer.php', array('repo_id' => $repo_id));
$PAGE->set_url($CFG->wwwroot . '/repository/poodll/iframeplayer.php', null);
//print_header(null, get_string('recordnew', 'repository_poodll'),null, null, null, false);
?>

<div style="text-align: center;">
<?php 
if ($mediapath != '') {
    echo "<script type=\"text/javascript\" src=\"{$CFG->wwwroot}/filter/poodll/flowplayer/flowplayer-3.2.9.min.js\"></script> ";
    echo "<script type=\"text/javascript\" src=\"{$CFG->wwwroot}/filter/poodll/flash/embed-compressed.js\"></script> ";
    echo fetchSimpleVideoPlayer('swf', "{$CFG->wwwroot}/{$CFG->filter_poodll_datadir}/" . $mediapath, 400, 350, "http");
}
?>
</div>
<?php 
//$OUTPUT->footer();
//print_footer();
Esempio n. 6
0
/**
 * Show a mediaplayer loaded with a media
 * For use as a media resource from DB with options set
 *
 * @param integer $mediaid The id of the media to show
 */
function fetch_mediaplayer($mediaid, $usefileid = "")
{
    global $CFG, $USER, $COURSE;
    // get accessed by card
    $sql = "\n        SELECT\n           reference servername, alltext mediafile, options \n        FROM\n            {$CFG->prefix}resource       \n        WHERE\n            id = " . $mediaid;
    $theResource = get_record_sql($sql);
    $id = 'filter_flv_' . time();
    //we need something unique because it might be stored in text cache
    $cleanurl = addslashes_js($theResource->servername);
    //Massage the media file name if we have a username variable passed in . (A Justin special)
    //This allows us to show different video to each student
    $mediafile = str_replace("@@username@@", $USER->username, $theResource->mediafile);
    if ($usefileid != "") {
        $mediafile = str_replace("@@usefileid@@", $usefileid, $theResource->mediafile);
    }
    //Set the file location
    $flvserver = $theResource->servername;
    //see if we have data in options
    $options = $theResource->options;
    if (!empty($options)) {
        $mediaoptions = explode(';', $options);
        $mediatype = $mediaoptions[0];
        $videowidth = $mediaoptions[1];
        $videoheight = $mediaoptions[2];
        $videobuffer = $mediaoptions[3];
        $autostart = $mediaoptions[4] == "1" ? "true" : "false";
        $repeat = $mediaoptions[5] == "1" ? "true" : "false";
        $allowfullscreen = $mediaoptions[6] == "1" ? "true" : "false";
    } else {
        $videowidth = $CFG->filter_poodll_videowidth;
        $videoheight = $CFG->filter_poodll_videoheight;
        //$videobuffer =  $CFG->filter_poodll_buffer;
        //$autostart=  $CFG->filter_poodll_autostart==1 ? "true" : "false";
        //$repeat=  $CFG->filter_poodll_repeat==1 ? "true" : "false";
        //$allowfullscreen=  $CFG->filter_poodll_allowfs==1 ? "true" : "false";
    }
    //Jump in here if it is a talkback, fetch the talkbackplayer
    if ($mediatype == MR_TYPETALKBACK) {
        return fetchTalkbackPlayer($mediafile);
    }
    //Jump in here if it is an video, fetch PoodLLVideoPlayer
    if ($mediatype == MR_TYPEVIDEO) {
        return fetchSimpleVideoPlayer($mediafile, $videowidth, $videoheight);
    }
    //Jump in here if it is an audio, fetch poodllaudioplayer
    if ($mediatype == MR_TYPEAUDIO) {
        return fetchSimpleAudioPlayer($mediafile, "", $videowidth, $videoheight);
    }
}