📄 v6.php
字号:
<?PHPclass hotpot_xml_quiz_template extends hotpot_xml_template_default { // left and right items for JMatch var $l_items = array(); var $r_items = array(); // constructor function for this class function hotpot_xml_quiz_template(&$parent) { $this->parent = &$parent; $get_js = optional_param('js', false); $get_css = optional_param('css', false); if (!empty($get_css)) { // set $this->css $this->v6_expand_StyleSheet(); } else if (!empty($get_js)) { // set $this->js $this->read_template($this->parent->draganddrop.$this->parent->quiztype.'6.js_', 'js'); } else { // set $this->html $this->read_template($this->parent->draganddrop.$this->parent->quiztype.'6.ht_', 'html'); } // expand special strings, if any $pattern = ''; switch ($this->parent->quiztype) { case 'jcloze': $pattern = '/\[(PreloadImageList)\]/'; break; case 'jcross': $pattern = '/\[(PreloadImageList|ShowHideClueList)\]/'; break; case 'jmatch': $pattern = '/\[(PreloadImageList|QsToShow|FixedArray|DragArray)\]/'; break; case 'jmix': $pattern = '/\[(PreloadImageList|SegmentArray|AnswerArray)\]/'; break; case 'jquiz': $pattern = '/\[(PreloadImageList|QsToShow)\]/'; break; } if (!empty($pattern)) { $this->expand_strings('html', $pattern); } } // captions and messages function v6_expand_AlsoCorrect() { return $this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',also-correct'); } function v6_expand_CapitalizeFirst() { return $this->bool_value('hotpot-config-file,'.$this->parent->quiztype.',capitalize-first-letter'); } function v6_expand_CheckCaption() { return $this->parent->xml_value('hotpot-config-file,global,check-caption'); } function v6_expand_CorrectIndicator() { return $this->js_value('hotpot-config-file,global,correct-indicator'); } function v6_expand_Back() { return $this->int_value('hotpot-config-file,global,include-back'); } function v6_expand_BackCaption() { return $this->parent->xml_value('hotpot-config-file,global,back-caption'); } function v6_expand_ClickToAdd() { return $this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',click-to-add'); } function v6_expand_ClueCaption() { return $this->parent->xml_value('hotpot-config-file,global,clue-caption'); } function v6_expand_Clues() { return $this->int_value('hotpot-config-file,'.$this->parent->quiztype.',include-clues'); } function v6_expand_Contents() { return $this->int_value('hotpot-config-file,global,include-contents'); } function v6_expand_ContentsCaption() { return $this->parent->xml_value('hotpot-config-file,global,contents-caption'); } function v6_expand_GuessCorrect() { return $this->js_value('hotpot-config-file,'.$this->parent->quiztype.',guess-correct'); } function v6_expand_GuessIncorrect() { return $this->js_value('hotpot-config-file,'.$this->parent->quiztype.',guess-incorrect'); } function v6_expand_Hint() { return $this->int_value('hotpot-config-file,'.$this->parent->quiztype.',include-hint'); } function v6_expand_HintCaption() { return $this->parent->xml_value('hotpot-config-file,global,hint-caption'); } function v6_expand_IncorrectIndicator() { return $this->js_value('hotpot-config-file,global,incorrect-indicator'); } function v6_expand_LastQCaption() { $caption = $this->parent->xml_value('hotpot-config-file,global,last-q-caption'); return ($caption=='<=' ? '<=' : $caption); } function v6_expand_NextCorrect() { $value = $this->js_value('hotpot-config-file,'.$this->parent->quiztype.',next-correct-part'); if (empty($value)) { // jquiz $value = $this->js_value('hotpot-config-file,'.$this->parent->quiztype.',next-correct-letter'); } return $value; } function v6_expand_NextEx() { return $this->int_value('hotpot-config-file,global,include-next-ex'); } function v6_expand_NextExCaption() { $caption = $this->parent->xml_value('hotpot-config-file,global,next-ex-caption'); return ($caption=='=>' ? '=>' : $caption); } function v6_expand_NextQCaption() { return $this->parent->xml_value('hotpot-config-file,global,next-q-caption'); } function v6_expand_OKCaption() { return $this->parent->xml_value('hotpot-config-file,global,ok-caption'); } function v6_expand_Restart() { return $this->int_value('hotpot-config-file,'.$this->parent->quiztype.',include-restart'); } function v6_expand_RestartCaption() { return $this->parent->xml_value('hotpot-config-file,global,restart-caption'); } function v6_expand_ShowAllQuestionsCaption() { return $this->js_value('hotpot-config-file,global,show-all-questions-caption'); } function v6_expand_ShowOneByOneCaption() { return $this->js_value('hotpot-config-file,global,show-one-by-one-caption'); } function v6_expand_TheseAnswersToo() { return $this->js_value('hotpot-config-file,'.$this->parent->quiztype.',also-correct'); } function v6_expand_ThisMuch() { return $this->js_value('hotpot-config-file,'.$this->parent->quiztype.',this-much-correct'); } function v6_expand_Undo() { return $this->int_value('hotpot-config-file,'.$this->parent->quiztype.',include-undo'); } function v6_expand_UndoCaption() { return $this->parent->xml_value('hotpot-config-file,global,undo-caption'); } function v6_expand_YourScoreIs() { return $this->js_value('hotpot-config-file,global,your-score-is'); } // reading function v6_expand_Reading() { return $this->int_value('data,reading,include-reading'); } function v6_expand_ReadingText() { $title = $this->v6_expand_ReadingTitle(); $value = $this->parent->xml_value('data,reading,reading-text'); $value = empty($value) ? '' : ('<div class="ReadingText">'.$value.'</div>'); return $title.$value; } function v6_expand_ReadingTitle() { $value = $this->parent->xml_value('data,reading,reading-title'); return empty($value) ? '' : ('<h3 class="ExerciseSubtitle">'.$value.'</h3>'); } // timer function v6_expand_Timer() { return $this->int_value('data,timer,include-timer'); } function v6_expand_JSTimer() { return $this->read_template('hp6timer.js_'); } function v6_expand_Seconds() { return $this->parent->xml_value('data,timer,seconds'); } // send results function v6_expand_SendResults() { return $this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',send-email'); } function v6_expand_JSSendResults() { return $this->read_template('hp6sendresults.js_'); } function v6_expand_FormMailURL() { return $this->parent->xml_value('hotpot-config-file,global,formmail-url'); } function v6_expand_EMail() { return $this->parent->xml_value('hotpot-config-file,global,email'); } function v6_expand_NamePlease() { return $this->js_value('hotpot-config-file,global,name-please'); } // preload images function v6_expand_PreloadImages() { $value = $this->v6_expand_PreloadImageList(); return empty($value) ? false : true; } function v6_expand_PreloadImageList() { // check it has not been set already if (!isset($this->PreloadImageList)) { // the list of image urls $list = array(); // extract <img> tags $img_tag = htmlspecialchars('|<img.*?src="(.*?)".*?>|is'); if (preg_match_all($img_tag, $this->parent->source, $matches)) { $list = $matches[1]; // remove duplicates $list = array_unique($list); } // convert to comma delimited string $this->PreloadImageList = empty($list) ? '' : "'".implode(',', $list)."'"; } return $this->PreloadImageList; } // html files (all quiz types) function v6_expand_PlainTitle() { return $this->parent->xml_value('data,title'); } function v6_expand_ExerciseSubtitle() { return $this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',exercise-subtitle'); } function v6_expand_Instructions() { return $this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',instructions'); } function v6_expand_DublinCoreMetadata() { $dc = '<link rel="schema.DC" href="'.$this->parent->xml_value('', "['rdf:RDF'][0]['@']['xmlns:dc']").'" />'."\n"; if (is_string($this->parent->xml_value('rdf:RDF,rdf:Description'))) { // do nothing (there is no more dc info) } else { $dc .= '<meta name="DC:Creator" content="'.$this->parent->xml_value('rdf:RDF,rdf:Description,dc:creator').'" />'."\n"; $dc .= '<meta name="DC:Title" content="'.strip_tags($this->parent->xml_value('rdf:RDF,rdf:Description,dc:title')).'" />'."\n"; } return $dc; } function v6_expand_FullVersionInfo() { global $CFG; require_once($CFG->hotpotroot.DIRECTORY_SEPARATOR.'version.php'); // set $module return $this->parent->xml_value('version').'.x (Moodle '.$CFG->release.', hotpot-module '.$this->parent->obj_value($module, 'release').')'; } function v6_expand_HeaderCode() { return $this->parent->xml_value('hotpot-config-file,global,header-code'); } function v6_expand_StyleSheet() { $this->read_template('hp6.cs_', 'css'); $this->css = hotpot_convert_stylesheets_urls($this->parent->get_baseurl(), $this->parent->reference, $this->css); return $this->css; } // stylesheet (hp6.cs_) function v6_expand_PageBGColor() { return $this->parent->xml_value('hotpot-config-file,global,page-bg-color'); } function v6_expand_GraphicURL() { return $this->parent->xml_value('hotpot-config-file,global,graphic-url'); } function v6_expand_ExBGColor() { return $this->parent->xml_value('hotpot-config-file,global,ex-bg-color'); } function v6_expand_FontFace() { return $this->parent->xml_value('hotpot-config-file,global,font-face'); } function v6_expand_FontSize() { $value = $this->parent->xml_value('hotpot-config-file,global,font-size'); return (empty($value) ? 'small' : $value); } function v6_expand_TextColor() { return $this->parent->xml_value('hotpot-config-file,global,text-color'); } function v6_expand_TitleColor() { return $this->parent->xml_value('hotpot-config-file,global,title-color'); } function v6_expand_LinkColor() { return $this->parent->xml_value('hotpot-config-file,global,link-color'); } function v6_expand_VLinkColor() { return $this->parent->xml_value('hotpot-config-file,global,vlink-color'); } function v6_expand_NavTextColor() { return $this->parent->xml_value('hotpot-config-file,global,page-bg-color'); } function v6_expand_NavBarColor() { return $this->parent->xml_value('hotpot-config-file,global,nav-bar-color'); } function v6_expand_NavLightColor() { $color = $this->parent->xml_value('hotpot-config-file,global,nav-bar-color'); return $this->get_halfway_color($color, '#ffffff'); } function v6_expand_NavShadeColor() { $color = $this->parent->xml_value('hotpot-config-file,global,nav-bar-color'); return $this->get_halfway_color($color, '#000000'); } function v6_expand_FuncLightColor() { // top-left of buttons $color = $this->parent->xml_value('hotpot-config-file,global,ex-bg-color'); return $this->get_halfway_color($color, '#ffffff'); } function v6_expand_FuncShadeColor() { // bottom right of buttons $color = $this->parent->xml_value('hotpot-config-file,global,ex-bg-color'); return $this->get_halfway_color($color, '#000000'); } // navigation buttons function v6_expand_NavButtons() { $back = $this->v6_expand_Back(); $next_ex = $this->v6_expand_NextEx(); $contents = $this->v6_expand_Contents(); return (empty($back) && empty($next_ex) && empty($contents) ? false : true); } function v6_expand_NavBarJS() { return $this->v6_expand_NavButtons(); } // switch off scorm function v6_expand_Scorm12() { return false; } // js files (all quiz types) function v6_expand_JSBrowserCheck() { return $this->read_template('hp6browsercheck.js_'); } function v6_expand_JSButtons() { return $this->read_template('hp6buttons.js_'); } function v6_expand_JSCard() { return $this->read_template('hp6card.js_'); } function v6_expand_JSCheckShortAnswer() { return $this->read_template('hp6checkshortanswer.js_'); } function v6_expand_JSHotPotNet() { return $this->read_template('hp6hotpotnet.js_'); } function v6_expand_JSShowMessage() { return $this->read_template('hp6showmessage.js_'); } function v6_expand_JSUtilities() { return $this->read_template('hp6utilities.js_'); } // js files function v6_expand_JSJCloze6() { return $this->read_template('jcloze6.js_'); } function v6_expand_JSJCross6() { return $this->read_template('jcross6.js_'); } function v6_expand_JSJMatch6() { return $this->read_template('jmatch6.js_'); } function v6_expand_JSJMix6() { return $this->read_template('jmix6.js_'); } function v6_expand_JSJQuiz6() {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -