public function response_area_read_only($name, $qa, $step, $lines, $context) { global $CFG; //fetch file from storage and figure out URL $pathtofile = ""; $storedfiles = $qa->get_last_qt_files($name, $context->id); foreach ($storedfiles as $sf) { $pathtofile = $qa->get_response_file_url($sf); break; } //$pathtofile= $this->prepare_response($name, $qa, $step, $context); //return "path:" . $pathtofile ; //return "path:" . $pathtofile . "<br />" . fetchSimpleAudioPlayer('swf',$pathtofile,"http",400,25); if ($pathtofile != "") { $files = fetchSimpleAudioPlayer('swf', $pathtofile, "http", 400, 25); } else { $files = "No recording found"; } return $files; }
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; }
public function response_area_read_only($name, $qa, $step, $lines, $context) { global $CFG; //fetch file from storage and figure out URL $pathtofile = ""; $tempstuff = ""; $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; } } //return player or empty string if ($pathtofile != "") { $files = fetchSimpleAudioPlayer('auto', $pathtofile, "http", 400, 25); } else { $files = ""; } return $files; }
/** * 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('&', '&', $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('&', '&', $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; }
function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options) { global $CFG, $USER; static $htmleditorused = false; $answers =& $question->options->answers; $readonly = empty($options->readonly) ? '' : 'disabled="disabled"'; // *RELIC of essay question type* Only use the rich text editor for the first poodllrecording question on a page. // $usehtmleditor = can_use_html_editor() && !$htmleditorused; $formatoptions = new stdClass(); $formatoptions->noclean = true; $formatoptions->para = false; $inputname = $question->name_prefix; $stranswer = get_string("answer", "quiz") . ': '; /// set question text and media $questiontext = format_text($question->questiontext, $question->questiontextformat, $formatoptions, $cmoptions->course); $image = get_question_image($question); // feedback handling $feedback = ''; if ($options->feedback && !empty($answers)) { foreach ($answers as $answer) { $feedback = format_text($answer->feedback, '', $formatoptions, $cmoptions->course); } } // get response value if (isset($state->responses[''])) { //relic of essay question type //$value = stripslashes_safe($state->responses['']); $value = $state->responses['']; } else { $value = ""; } // answer if (empty($options->readonly)) { // *RELIC of essay question type* the student needs to record their voice or video so lets give them their recorder. // $answer = print_textarea($usehtmleditor, 18, 80, 630, 400, $inputname, $value, $cmoptions->course, true); $answer = fetchSimpleAudioRecorder('question/' . $question->id, $USER->id, $inputname, '') . '<input type="hidden" value="" id="' . $inputname . '" name="' . $inputname . '" />'; } else { // it is read only, so just format the students answer and output it // *RELIC of essay question type* /* $safeformatoptions = new stdClass; $safeformatoptions->para = false; $answer = format_text($value, FORMAT_MOODLE, $safeformatoptions, $cmoptions->course); $answer = '<div class="answerreview">' . $answer . '</div>'; */ //$answer = $value ; //this will show an audio player both to the grading teacher and to the student reviewing $answer = fetchSimpleAudioPlayer($value, 'rtmp', 250, 30, false); } include "{$CFG->dirroot}/question/type/poodllrecording/display.html"; // *RELIC of essay question type* /* if ($usehtmleditor && empty($options->readonly)) { use_html_editor($inputname); $htmleditorused = true; } */ }
/** * 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); } }