示例#1
0
function filter_poodll_callback(array $link)
{
    global $CFG, $COURSE, $USER;
    ///$PAGE->requires->js_init_call('M.filter_poodll.init', array());
    //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 = "";
    //Runtime JS or Flash
    if (empty($filterprops['runtime'])) {
        $filterprops['runtime'] = 'auto';
    }
    //depending on the type of filter
    switch ($filterprops['type']) {
        case 'adminconsole':
            $returnHtml = fetch_poodllconsole($filterprops['runtime']);
            break;
        case 'audio':
            $returnHtml = fetchSimpleAudioPlayer($filterprops['runtime'], $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', false, !empty($filterprops['usepoodlldata']) ? $filterprops['usepoodlldata'] == 'true' : false, !empty($filterprops['splashurl']) ? $filterprops['splashurl'] : '');
            break;
        case 'audiolist':
            $returnHtml = fetchAudioListPlayer($filterprops['runtime'], $filterprops['path'], !empty($filterprops['filearea']) ? $filterprops['filearea'] : 'content', !empty($filterprops['protocol']) ? $filterprops['protocol'] : 'rtmp', !empty($filterprops['width']) ? $filterprops['width'] : 400, !empty($filterprops['height']) ? $filterprops['height'] : 250, !empty($filterprops['sequentialplay']) ? $filterprops['sequentialplay'] : 'true', !empty($filterprops['player']) ? $filterprops['player'] : $CFG->filter_poodll_defaultplayer, !empty($filterprops['showplaylist']) ? $filterprops['showplaylist'] == 'true' : true, !empty($filterprops['usepoodlldata']) ? $filterprops['usepoodlldata'] == 'true' : false);
            break;
        case 'audiorecorder':
            $returnHtml = fetchSimpleAudioRecorder($filterprops['runtime'], !empty($filterprops['savefolder']) ? $filterprops['savefolder'] : '');
            break;
        case 'audiotest':
            $returnHtml = fetchAudioTestPlayer($filterprops['runtime'], $filterprops['path'], !empty($filterprops['protocol']) ? $filterprops['protocol'] : 'rtmp', !empty($filterprops['width']) ? $filterprops['width'] : 400, !empty($filterprops['height']) ? $filterprops['height'] : 50, !empty($filterprops['filearea']) ? $filterprops['filearea'] : 'content', !empty($filterprops['usepoodlldata']) ? $filterprops['usepoodlldata'] == 'true' : false);
            break;
        case 'talkback':
            $returnHtml = fetchTalkbackPlayer($filterprops['runtime'], $filterprops['path'], !empty($filterprops['protocol']) ? $filterprops['protocol'] : 'rtmp', !empty($filterprops['recordable']) ? $filterprops['recordable'] : 'false', !empty($filterprops['savefolder']) ? $filterprops['savefolder'] : 'default');
            break;
        case 'bigvideogallery':
            $returnHtml = fetchBigVideoGallery($filterprops['runtime'], $filterprops['path'], !empty($filterprops['filearea']) ? $filterprops['filearea'] : 'content', !empty($filterprops['protocol']) ? $filterprops['protocol'] : 'http', !empty($filterprops['width']) ? $filterprops['width'] : $CFG->filter_poodll_biggallwidth, !empty($filterprops['height']) ? $filterprops['height'] : $CFG->filter_poodll_biggallheight, !empty($filterprops['usepoodlldata']) ? $filterprops['usepoodlldata'] == 'true' : false);
            break;
        case 'calculator':
            $returnHtml = fetch_poodllcalc($filterprops['runtime'], !empty($filterprops['width']) ? $filterprops['width'] : 300, !empty($filterprops['height']) ? $filterprops['height'] : 400, !empty($filterprops['size']) ? $filterprops['size'] : 'normal');
            break;
        case 'cambroadcaster':
            $returnHtml = fetchCamBroadcaster($filterprops['runtime'], !empty($filterprops['mename']) ? $filterprops['mename'] : '', !empty($filterprops['broadcastkey']) ? $filterprops['broadcastkey'] : '1234567');
            break;
        case 'countdown':
            $returnHtml = fetch_countdowntimer($filterprops['runtime'], $filterprops['initseconds'], !empty($filterprops['usepresets']) ? $filterprops['usepresets'] : 'false', !empty($filterprops['width']) ? $filterprops['width'] : 400, !empty($filterprops['height']) ? $filterprops['height'] : 300, !empty($filterprops['fontheight']) ? $filterprops['fontheight'] : 64, !empty($filterprops['mode']) ? $filterprops['mode'] : 'normal', !empty($filterprops['permitfullscreen']) ? $filterprops['permitfullscreen'] : false, !empty($filterprops['uniquename']) ? $filterprops['uniquename'] : 'auniquename');
            break;
        case 'counter':
            $returnHtml = fetch_counter($filterprops['runtime'], !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['fontheight']) ? $filterprops['fontheight'] : 64, !empty($filterprops['permitfullscreen']) ? $filterprops['permitfullscreen'] : false);
            break;
        case 'dice':
            $returnHtml = fetch_dice($filterprops['runtime'], !empty($filterprops['dicecount']) ? $filterprops['dicecount'] : 1, !empty($filterprops['dicesize']) ? $filterprops['dicesize'] : 200, !empty($filterprops['width']) ? $filterprops['width'] : 600, !empty($filterprops['height']) ? $filterprops['height'] : 300);
            break;
        case 'explorer':
            $returnHtml = fetch_explorer($filterprops['runtime'], !empty($filterprops['width']) ? $filterprops['width'] : 1250, !empty($filterprops['height']) ? $filterprops['height'] : 800, !empty($filterprops['moduleid']) ? $filterprops['moduleid'] : '');
            break;
        case 'flashcards':
            $returnHtml = fetch_flashcards($filterprops['runtime'], !empty($filterprops['cardset']) ? $filterprops['cardset'] : -1, !empty($filterprops['qname']) ? $filterprops['qname'] : "", !empty($filterprops['frontcolor']) ? $filterprops['frontcolor'] : "0xDDDDDD", !empty($filterprops['backcolor']) ? $filterprops['backcolor'] : "0x000000", !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 'miniplayer':
            $returnHtml = fetch_miniplayer($filterprops['runtime'], $filterprops['url'], !empty($filterprops['protocol']) ? $filterprops['protocol'] : 'http', !empty($filterprops['imageurl']) ? $filterprops['imageurl'] : '', !empty($filterprops['width']) ? $filterprops['width'] : $CFG->filter_poodll_miniplayerwidth, !empty($filterprops['height']) ? $filterprops['height'] : $CFG->filter_poodll_miniplayerwidth, !empty($filterprops['iframe']) ? $filterprops['iframe'] == 'true' : false);
            break;
        case 'onceplayer':
            $returnHtml = fetch_onceplayer($filterprops['runtime'], $filterprops['url'], !empty($filterprops['protocol']) ? $filterprops['protocol'] : 'http', !empty($filterprops['width']) ? $filterprops['width'] : 0, !empty($filterprops['height']) ? $filterprops['height'] : 0, !empty($filterprops['iframe']) ? $filterprops['iframe'] == 'true' : false);
            break;
        case 'newpoodllpairwork':
            $returnHtml = fetch_embeddablepairclient($filterprops['runtime'], !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 'stopwatch':
            $returnHtml = fetch_stopwatch($filterprops['runtime'], !empty($filterprops['width']) ? $filterprops['width'] : 400, !empty($filterprops['height']) ? $filterprops['height'] : 265, !empty($filterprops['fontheight']) ? $filterprops['fontheight'] : 64, !empty($filterprops['mode']) ? $filterprops['mode'] : 'normal', !empty($filterprops['permitfullscreen']) ? $filterprops['permitfullscreen'] : false, !empty($filterprops['uniquename']) ? $filterprops['uniquename'] : 'auniquename');
            break;
        case 'smallvideogallery':
            $returnHtml = fetchSmallVideoGallery($filterprops['runtime'], $filterprops['path'], !empty($filterprops['filearea']) ? $filterprops['filearea'] : 'content', !empty($filterprops['protocol']) ? $filterprops['protocol'] : 'http', !empty($filterprops['width']) ? $filterprops['width'] : $CFG->filter_poodll_smallgallwidth, !empty($filterprops['height']) ? $filterprops['height'] : $CFG->filter_poodll_smallgallheight, !empty($filterprops['permitfullscreen']) ? $filterprops['permitfullscreen'] : false, !empty($filterprops['usepoodlldata']) ? $filterprops['usepoodlldata'] == 'true' : false);
            break;
        case 'screensubscribe':
            $returnHtml = fetch_screencast_subscribe($filterprops['runtime'], !empty($filterprops['mename']) ? $filterprops['mename'] : '', true, !empty($filterprops['width']) ? $filterprops['width'] : $CFG->filter_poodll_showwidth, !empty($filterprops['height']) ? $filterprops['height'] : $CFG->filter_poodll_showheight, !empty($filterprops['broadcastkey']) ? $filterprops['broadcastkey'] : '1234567');
            break;
        case 'poodllpalette':
            $returnHtml = fetch_poodllpalette($filterprops['runtime'], $filterprops['width'], $filterprops['height'], "swf");
            break;
        case 'wordplayer':
            $returnHtml = fetch_wordplayer($filterprops['runtime'], $filterprops['url'], $filterprops['word'], !empty($filterprops['fontsize']) ? $filterprops['fontsize'] : $CFG->filter_poodll_wordplayerfontsize, !empty($filterprops['protocol']) ? $filterprops['protocol'] : 'http', !empty($filterprops['width']) ? $filterprops['width'] : "0", !empty($filterprops['height']) ? $filterprops['height'] : "0", !empty($filterprops['iframe']) ? $filterprops['iframe'] == 'true' : false);
            break;
        case 'whiteboard':
            $returnHtml = fetch_whiteboard($filterprops['runtime'], !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 = $poodllpairworkplayer;
            break;
        case 'quizlet':
            $returnHtml = fetch_quizlet($filterprops['id'], !empty($filterprops['title']) ? $filterprops['title'] : 'quizlet', !empty($filterprops['mode']) ? $filterprops['mode'] : 'familiarize', !empty($filterprops['width']) ? $filterprops['width'] : '100%', !empty($filterprops['height']) ? $filterprops['height'] : '310');
            break;
        case 'scrollerstart':
            $returnHtml = fetch_poodllscroller(true, !empty($filterprops['width']) ? $filterprops['width'] : '400', !empty($filterprops['height']) ? $filterprops['height'] : '200', !empty($filterprops['speed']) ? $filterprops['speed'] : '10', !empty($filterprops['repeat']) ? $filterprops['repeat'] : 'yes', !empty($filterprops['axis']) ? $filterprops['axis'] : 'y', !empty($filterprops['pixelshift']) ? $filterprops['pixelshift'] : '2');
            break;
        case 'scrollerstop':
            $returnHtml = fetch_poodllscroller(false);
            break;
        case 'sliderocket':
            $returnHtml = fetch_sliderocket($filterprops['id'], !empty($filterprops['width']) ? $filterprops['width'] : '400', !empty($filterprops['height']) ? $filterprops['height'] : '326');
            break;
        case 'snapshot':
            $returnHtml = fetchSnapshotCamera(!empty($filterprops['updatecontrol']) ? $filterprops['updatecontrol'] : 'filename', !empty($filterprops['filename']) ? $filterprops['filename'] : 'filename', !empty($filterprops['width']) ? $filterprops['width'] : '350', !empty($filterprops['height']) ? $filterprops['height'] : '400');
            break;
        case 'teachersrecorder':
            $returnHtml = fetch_teachersrecorder($filterprops['runtime'], $filterprops['savepath'], "");
            break;
        case 'videorecorder':
            $returnHtml = fetchSimpleVideoRecorder($filterprops['runtime'], !empty($filterprops['savefolder']) ? $filterprops['savefolder'] : '');
            break;
        case 'video':
            //$returnHtml= fetchSimpleVideoPlayer($filterprops['path'],$filterprops['width'],$filterprops['height']);
            $returnHtml = fetchSimpleVideoPlayer($filterprops['runtime'], $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', !empty($filterprops['splashurl']) ? $filterprops['splashurl'] : '');
            break;
        case 'wmvvideo':
            $returnHtml = fetchWMVPlayer($filterprops['runtime'], $filterprops['path'], !empty($filterprops['width']) ? $filterprops['width'] : $CFG->filter_poodll_videowidth, !empty($filterprops['height']) ? $filterprops['height'] : $CFG->filter_poodll_videoheight);
            break;
        default:
    }
    //return our html
    return $returnHtml;
}
示例#2
0
文件: filter.php 项目: laiello/poodll
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;
}
示例#3
0
 /**
  *  Display a single submission, ready for grading on a popup window
  * Justin: I just lifted this from assignments/lib.php because  I needed to show the conversation entries properly.beneath the feedback form.
  * This default method prints the teacher info and submissioncomment box at the top and
  * the student info and submission at the bottom.
  * This method also fetches the necessary data in order to be able to
  * provide a "Next submission" button.
  * Calls preprocess_submission() to give assignment type plug-ins a chance
  * to process submissions before they are graded
  * This method gets its arguments from the page parameters userid and offset
  */
 function display_submission($extra_javascript = '')
 {
     global $CFG;
     require_once $CFG->libdir . '/gradelib.php';
     require_once $CFG->libdir . '/tablelib.php';
     $userid = required_param('userid', PARAM_INT);
     $offset = required_param('offset', PARAM_INT);
     //offset for where to start looking for student.
     if (!($user = get_record('user', 'id', $userid))) {
         error('No such user!');
     }
     if (!($submission = $this->get_submission($user->id))) {
         $submission = $this->prepare_new_submission($userid);
     }
     if ($submission->timemodified > $submission->timemarked) {
         $subtype = 'assignmentnew';
     } else {
         $subtype = 'assignmentold';
     }
     $grading_info = grade_get_grades($this->course->id, 'mod', 'assignment', $this->assignment->id, array($user->id));
     $disabled = $grading_info->items[0]->grades[$userid]->locked || $grading_info->items[0]->grades[$userid]->overridden;
     /// construct SQL, using current offset to find the data of the next student
     $course = $this->course;
     $assignment = $this->assignment;
     $cm = $this->cm;
     $context = get_context_instance(CONTEXT_MODULE, $cm->id);
     /// Get all ppl that can submit assignments
     $currentgroup = groups_get_activity_group($cm);
     if ($users = get_users_by_capability($context, 'mod/assignment:submit', 'u.id', '', '', '', $currentgroup, '', false)) {
         $users = array_keys($users);
     }
     // if groupmembersonly used, remove users who are not in any group
     if ($users and !empty($CFG->enablegroupings) and $cm->groupmembersonly) {
         if ($groupingusers = groups_get_grouping_members($cm->groupingid, 'u.id', 'u.id')) {
             $users = array_intersect($users, array_keys($groupingusers));
         }
     }
     $nextid = 0;
     if ($users) {
         $select = 'SELECT u.id, u.firstname, u.lastname, u.picture, u.imagealt,
                           s.id AS submissionid, s.grade, s.submissioncomment,
                           s.timemodified, s.timemarked,
                           COALESCE(SIGN(SIGN(s.timemarked) + SIGN(s.timemarked - s.timemodified)), 0) AS status ';
         $sql = 'FROM ' . $CFG->prefix . 'user u ' . 'LEFT JOIN ' . $CFG->prefix . 'assignment_submissions s ON u.id = s.userid
                                                                   AND s.assignment = ' . $this->assignment->id . ' ' . 'WHERE u.id IN (' . implode(',', $users) . ') ';
         if ($sort = flexible_table::get_sql_sort('mod-assignment-submissions')) {
             $sort = 'ORDER BY ' . $sort . ' ';
         }
         if (($auser = get_records_sql($select . $sql . $sort, $offset + 1, 1)) !== false) {
             $nextuser = array_shift($auser);
             /// Calculate user status
             $nextuser->status = $nextuser->timemarked > 0 && $nextuser->timemarked >= $nextuser->timemodified;
             $nextid = $nextuser->id;
         }
     }
     print_header(get_string('feedback', 'assignment') . ':' . fullname($user, true) . ':' . format_string($this->assignment->name));
     /// Print any extra javascript needed for saveandnext
     echo $extra_javascript;
     ///SOme javascript to help with setting up >.>
     echo '<script type="text/javascript">' . "\n";
     echo 'function setNext(){' . "\n";
     echo 'document.getElementById(\'submitform\').mode.value=\'next\';' . "\n";
     echo 'document.getElementById(\'submitform\').userid.value="' . $nextid . '";' . "\n";
     echo '}' . "\n";
     echo 'function saveNext(){' . "\n";
     echo 'document.getElementById(\'submitform\').mode.value=\'saveandnext\';' . "\n";
     echo 'document.getElementById(\'submitform\').userid.value="' . $nextid . '";' . "\n";
     echo 'document.getElementById(\'submitform\').saveuserid.value="' . $userid . '";' . "\n";
     echo 'document.getElementById(\'submitform\').menuindex.value = document.getElementById(\'submitform\').grade.selectedIndex;' . "\n";
     echo '}' . "\n";
     echo '</script>' . "\n";
     echo '<table cellspacing="0" class="feedback ' . $subtype . '" >';
     ///Start of teacher info row
     echo '<tr>';
     echo '<td class="picture teacher">';
     //Edited by justin 20081003: otherwise regardlss of which teacher is logged in ,
     //first teacher to write in journal would be shown,
     //if ($submission->teacher) {
     if (false) {
         $teacher = get_record('user', 'id', $submission->teacher);
     } else {
         global $USER;
         $teacher = $USER;
     }
     print_user_picture($teacher, $this->course->id, $teacher->picture);
     echo '</td>';
     echo '<td class="content">';
     echo '<form id="submitform" action="submissions.php" method="post">';
     echo '<div>';
     // xhtml compatibility - invisiblefieldset was breaking layout here
     echo '<input type="hidden" name="offset" value="' . ($offset + 1) . '" />';
     echo '<input type="hidden" name="userid" value="' . $userid . '" />';
     echo '<input type="hidden" name="id" value="' . $this->cm->id . '" />';
     echo '<input type="hidden" name="mode" value="grade" />';
     echo '<input type="hidden" name="menuindex" value="0" />';
     //selected menu index
     //new hidden field, initialized to -1.
     echo '<input type="hidden" name="saveuserid" value="-1" />';
     if ($submission->timemarked) {
         echo '<div class="from">';
         echo '<div class="fullname">' . fullname($teacher, true) . '</div>';
         echo '<div class="time">' . userdate($submission->timemarked) . '</div>';
         echo '</div>';
     }
     //if we are grading journals
     if ($this->assignment->grade > 0) {
         echo '<div class="grade"><label for="menugrade">' . get_string('grade') . '</label> ';
         choose_from_menu(make_grades_menu($this->assignment->grade), 'grade', $submission->grade, get_string('nograde'), '', -1, false, $disabled);
         echo '</div>';
         echo '<div class="clearer"></div>';
         echo '<div class="finalgrade">' . get_string('finalgrade', 'grades') . ': ' . $grading_info->items[0]->grades[$userid]->str_grade . '</div>';
         echo '<div class="clearer"></div>';
         if (!empty($CFG->enableoutcomes)) {
             foreach ($grading_info->outcomes as $n => $outcome) {
                 echo '<div class="outcome"><label for="menuoutcome_' . $n . '">' . $outcome->name . '</label> ';
                 $options = make_grades_menu(-$outcome->scaleid);
                 if ($outcome->grades[$submission->userid]->locked) {
                     $options[0] = get_string('nooutcome', 'grades');
                     echo $options[$outcome->grades[$submission->userid]->grade];
                 } else {
                     choose_from_menu($options, 'outcome_' . $n . '[' . $userid . ']', $outcome->grades[$submission->userid]->grade, get_string('nooutcome', 'grades'), '', 0, false, false, 0, 'menuoutcome_' . $n);
                 }
                 echo '</div>';
                 echo '<div class="clearer"></div>';
             }
         }
         //if we are not grading journals
     } else {
         echo '<input type="hidden" name="grade" value="-1" />';
     }
     $this->preprocess_submission($submission);
     if ($disabled) {
         echo '<div class="disabledfeedback">' . $grading_info->items[0]->grades[$userid]->str_feedback . '</div>';
     } else {
         //---------------Justin Video Message start 20090105-------------------
         if ($CFG->filter_poodll_journal_video || $CFG->filter_poodll_journal_audio) {
             echo '<a href="#" onclick="document.getElementById(\'teacherrecorder\').style.display=\'block\';">Record Audio/Video</a>';
             echo "<div id='teacherrecorder' style='display: none'>";
             //$rtmplink = "rtmp://{$CFG->rtmp}";
             $rtmplink = $CFG->poodll_media_server;
             //$filename='poodlljournal/' . $this->assignment->id . $submission->userid . time(). rand() . '.flv';
             $filename = 'moddata/assignment/' . $this->assignment->id . '/' . $submission->userid . '/teacher_' . time() . rand() . '.flv';
             $mediadata = fetch_teachersrecorder($filename, "mediafilename");
             echo $mediadata;
             echo '<input type="hidden" value="" id="mediafilename" name="mediafilename" />';
             echo "</div>";
         }
         //---------------Video Message end 20090105---------------------
         //Justin: We never edit old submissions so we show a blank area in the feedback box
         //print_textarea($this->usehtmleditor, 14, 58, 0, 0, 'submissioncomment', $submission->submissioncomment, $this->course->id);
         print_textarea($this->usehtmleditor, 14, 58, 0, 0, 'submissioncomment', "", $this->course->id);
         if ($this->usehtmleditor) {
             echo '<input type="hidden" name="format" value="' . FORMAT_HTML . '" />';
         } else {
             echo '<div class="format">';
             choose_from_menu(format_text_menu(), "format", $submission->format, "");
             helpbutton("textformat", get_string("helpformatting"));
             echo '</div>';
         }
     }
     $lastmailinfo = get_user_preferences('assignment_mailinfo', 1) ? 'checked="checked"' : '';
     ///Print Buttons in Single View
     echo '<input type="hidden" name="mailinfo" value="0" />';
     echo '<input type="checkbox" id="mailinfo" name="mailinfo" value="1" ' . $lastmailinfo . ' /><label for="mailinfo">' . get_string('enableemailnotification', 'assignment') . '</label>';
     echo '<div class="buttons">';
     echo '<input type="submit" name="submit" value="' . get_string('savechanges') . '" onclick = "document.getElementById(\'submitform\').menuindex.value = document.getElementById(\'submitform\').grade.selectedIndex" />';
     echo '<input type="submit" name="cancel" value="' . get_string('cancel') . '" />';
     //if there are more to be graded.
     if ($nextid) {
         echo '<input type="submit" name="saveandnext" value="' . get_string('saveandnext') . '" onclick="saveNext()" />';
         echo '<input type="submit" name="next" value="' . get_string('next') . '" onclick="setNext();" />';
     }
     echo '</div>';
     echo '</div></form>';
     $customfeedback = $this->custom_feedbackform($submission, true);
     if (!empty($customfeedback)) {
         echo $customfeedback;
     }
     echo '</td></tr>';
     ///End of teacher info row, Start of student info row
     if (!empty($submission)) {
         $comments = explode(COMMENTSDELIM, $submission->data1);
         foreach ($comments as $comment) {
             $commentParts = explode(PARTSDELIM, $comment);
             if (sizeof($commentParts) > 2) {
                 $feedback = $commentParts[0];
                 $personId = $commentParts[1];
                 $comment_date = $commentParts[2];
                 $person = get_record('user', 'id', $personId);
                 /// Print the feedback
                 //print_heading(get_string('feedbackfromteacher', 'assignment', $this->course->teacher));
                 //echo '<table cellspacing="0" class="feedback">';
                 echo '<tr>';
                 echo '<td class="left picture">';
                 if ($person) {
                     print_user_picture($person, $this->course->id, $person->picture);
                 }
                 echo '</td>';
                 echo '<td class="topic">';
                 echo '<div class="from">';
                 if ($person) {
                     echo '<div class="fullname">' . fullname($person) . '</div>';
                 }
                 echo '<div class="time">' . userdate($comment_date) . '</div>';
                 echo '</div>';
                 echo '</td>';
                 echo '</tr>';
                 echo '<tr>';
                 echo '<td class="content" colspan="2">';
                 echo '<div class="comment">';
                 echo format_text($feedback);
                 echo '</div>';
                 echo '</td>';
                 echo '</tr>';
             }
             //end of if sizeof > 2
         }
         //end of for each
     }
     //end of if submission not empty
     ///End of student info row
     echo '</table>';
     if (!$disabled and $this->usehtmleditor) {
         use_html_editor();
     }
     print_footer('none');
 }