⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 v6.php

📁 很棒的在线教学系统
💻 PHP
📖 第 1 页 / 共 4 页
字号:
        return $this->read_template('jquiz6.js_');    }    // drag and drop    function v6_expand_JSDJMatch6() {        return $this->read_template('djmatch6.js_');    }    function v6_expand_JSDJMix6() {        return $this->read_template('djmix6.js_');    }    // what are these for?    function v6_expand_JSFJMatch6() {        return $this->read_template('fjmatch6.js_');    }    function v6_expand_JSFJMix6() {        return $this->read_template('fjmix6.js_');    }    // jmatch6.js_    function v6_expand_ShuffleQs() {        return $this->bool_value('hotpot-config-file,'.$this->parent->quiztype.',shuffle-questions');    }    function v6_expand_QsToShow() {        $i = $this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',show-limited-questions');        if ($i) {            $i = $this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',questions-to-show');        }        if (empty($i)) {            $i = 0;            switch ($this->parent->quiztype) {                case 'jmatch':                    $values = $this->parent->xml_values('data,matching-exercise,pair');                    $i = count($values);                    break;                case 'jquiz':                    $tags = 'data,questions,question-record';                    while (($question="[$i]['#']") && $this->parent->xml_value($tags, $question)) {                        $i++;                    }                    break;            } // end switch        }        return $i;    }    function v6_expand_MatchDivItems() {        $this->set_jmatch_items();        $l_keys = $this->shuffle_jmatch_items($this->l_items);        $r_keys = $this->shuffle_jmatch_items($this->r_items);        $options = '<option value="x">'.$this->parent->xml_value('data,matching-exercise,default-right-item').'</option>';        foreach ($r_keys as $key) {            if (! $this->r_items[$key]['fixed']) {                $options .= '<option value="'.$key.'">'.$this->r_items[$key]['text'].'</option>'."\n";            }        }        $str = '';        foreach ($l_keys as $key) {            $str .= '<tr><td class="LeftItem">'.$this->l_items[$key]['text'].'</td>';            $str .= '<td class="RightItem">';            if ($this->r_items[$key]['fixed']) {                $str .= $this->r_items[$key]['text'];            }  else {                $str .= '<select id="s'.$key.'_'.$key.'">'.$options.'</select>';            }            $str .= '</td><td></td></tr>';        }        return $str;    }    // jmix6.js_    function v6_expand_Punctuation() {        $tags = 'data,jumbled-order-exercise';        $chars = array_merge(            $this->jmix_Punctuation("$tags,main-order,segment"),            $this->jmix_Punctuation("$tags,alternate")        );        $chars = array_unique($chars);        $chars = implode('', $chars);        $chars = $this->js_safe($chars, true);        return $chars;    }    function jmix_Punctuation($tags) {        $chars = array();        // all punctutation except '&#;' (because they are used in html entities)        $ENTITIES = $this->jmix_encode_punctuation('!"$%'."'".'()*+,-./:<=>?@[\]^_`{|}~');        $pattern = "/&#x([0-9A-F]+);/i";        $i = 0;        // get next segment (or alternate answer)        while ($value = $this->parent->xml_value($tags, "[$i]['#']")) {            // convert low-ascii punctuation to entities            $value = strtr($value, $ENTITIES);            // extract all hex HTML entities            if (preg_match_all($pattern, $value, $matches)) {                // loop through hex entities                $m_max = count($matches[0]);                for ($m=0; $m<$m_max; $m++) {                    // convert to hex number                    eval('$hex=0x'.$matches[1][$m].';');                    // is this a punctuation character?                    if (                        ($hex>=0x0020 && $hex<=0x00BF) || // ascii punctuation                        ($hex>=0x2000 && $hex<=0x206F) || // general punctuation                        ($hex>=0x3000 && $hex<=0x303F) || // CJK punctuation                        ($hex>=0xFE30 && $hex<=0xFE4F) || // CJK compatability                        ($hex>=0xFE50 && $hex<=0xFE6F) || // small form variants                        ($hex>=0xFF00 && $hex<=0xFF40) || // halfwidth and fullwidth forms (1)                        ($hex>=0xFF5B && $hex<=0xFF65) || // halfwidth and fullwidth forms (2)                        ($hex>=0xFFE0 && $hex<=0xFFEE)    // halfwidth and fullwidth forms (3)                    ) {                        // add this character                        $chars[] = $matches[0][$m];                    }                }            }            $i++;        }        return $chars;    }    function v6_expand_OpenPunctuation() {        $tags = 'data,jumbled-order-exercise';        $chars = array_merge(            $this->jmix_OpenPunctuation("$tags,main-order,segment"),            $this->jmix_OpenPunctuation("$tags,alternate")        );        $chars = array_unique($chars);        $chars = implode('', $chars);        $chars = $this->js_safe($chars, true);        return $chars;    }    function jmix_OpenPunctuation($tags) {        $chars = array();        // unicode punctuation designations (pi="initial quote", ps="open")        //  http://www.sql-und-xml.de/unicode-database/pi.html        //  http://www.sql-und-xml.de/unicode-database/ps.html        $pi = '0022|0027|00AB|2018|201B|201C|201F|2039';        $ps = '0028|005B|007B|0F3A|0F3C|169B|201A|201E|2045|207D|208D|2329|23B4|2768|276A|276C|276E|2770|2772|2774|27E6|27E8|27EA|2983|2985|2987|2989|298B|298D|298F|2991|2993|2995|2997|29D8|29DA|29FC|3008|300A|300C|300E|3010|3014|3016|3018|301A|301D|FD3E|FE35|FE37|FE39|FE3B|FE3D|FE3F|FE41|FE43|FE47|FE59|FE5B|FE5D|FF08|FF3B|FF5B|FF5F|FF62';        $pattern = "/(&#x($pi|$ps);)/i";        $ENTITIES = $this->jmix_encode_punctuation('"'."'".'(<[{');        $i = 0;        while ($value = $this->parent->xml_value($tags, "[$i]['#']")) {            $value = strtr($value, $ENTITIES);            if (preg_match_all($pattern, $value, $matches)) {                $chars = array_merge($chars, $matches[0]);            }            $i++;        }        return $chars;    }    function jmix_encode_punctuation($str) {        $ENTITIES = array();        $i_max = strlen($str);        for ($i=0; $i<$i_max; $i++) {            $ENTITIES[$str{$i}] = '&#x'.sprintf('%04X', ord($str{$i})).';';        }        return $ENTITIES;    }    function v6_expand_ExerciseTitle() {        return $this->parent->xml_value('data,title');    }    // Jmix specials    function v6_expand_SegmentArray() {        $segments = array();        $values = array();        $VALUES = array();        // XML tags to the start of a segment        $tags = 'data,jumbled-order-exercise,main-order,segment';        $i = 0;        while ($value = $this->parent->xml_value($tags, "[$i]['#']")) {            $VALUE = strtoupper($value);            $key = array_search($VALUE, $VALUES);            if (is_numeric($key)) {                $segments[] = $key;            } else {                $segments[] = $i;                $values[$i] = $value;                $VALUES[$i] = $VALUE;            }            $i++;        }        $this->seed_random_number_generator();        $keys = array_keys($segments);        shuffle($keys);        $str = '';        for($i=0; $i<count($keys); $i++) {            $key = $segments[$keys[$i]];            $str .= "Segments[$i] = new Array();\n";            $str .= "Segments[$i][0] = '".$this->js_safe($values[$key], true)."';\n";            $str .= "Segments[$i][1] = ".($key+1).";\n";            $str .= "Segments[$i][2] = 0;\n";        }        return $str;    }    function v6_expand_AnswerArray() {        $segments = array();        $values = array();        $VALUES = array();        $escapedvalues = array();        // XML tags to the start of a segment        $tags = 'data,jumbled-order-exercise,main-order,segment';        $i = 0;        while ($value = $this->parent->xml_value($tags, "[$i]['#']")) {            $VALUE = strtoupper($value);            $key = array_search($VALUE, $VALUES);            if (is_numeric($key)) {                $segments[] = $key+1;            } else {                $segments[] = $i+1;                $values[$i] = $value;                $VALUES[$i] = $VALUE;                $escapedvalues[] = preg_quote($value, '/');            }            $i++;        }        // start the answers array        $a = 0;        $str = 'Answers['.($a++).'] = new Array('.implode(',', $segments).");\n";        // pattern to match the next part of an alternate answer        $pattern = '/^('.implode('|', $escapedvalues).')\\s*/i';        // XML tags to the start of an alternate answer        $tags = 'data,jumbled-order-exercise,alternate';        $i = 0;        while ($value = $this->parent->xml_value($tags, "[$i]['#']")) {            $segments = array();            while (strlen($value) && preg_match($pattern, $value, $matches)) {                $key = array_search($matches[1], $values);                if (is_numeric($key)) {                    $segments[] = $key+1;                    $value = substr($value, strlen($matches[0]));                } else {                    // invalid alternate sequence                    $segments = array();                    break;                }            }            if (count($segments)) {                $str .= 'Answers['.($a++).'] = new Array('.implode(',', $segments).");\n";            }            $i++;        }        return $str;    }    // ===============================================================    // JMix (jmix6.js_)    function v6_expand_RemainingWords() {        return $this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',remaining-words');    }    function v6_expand_TimesUp() {        return $this->js_safe($this->parent->xml_value('hotpot-config-file,global,times-up'));    }    // nav bar    function v6_expand_NavBar($navbarid='') {        $this->navbarid = $navbarid;        $tag = 'navbar';        $this->read_template('hp6navbar.ht_', $tag);        unset($this->navbarid);        return $this->$tag;    }    function v6_expand_TopNavBar() {        return $this->v6_expand_NavBar('TopNavBar');    }    function v6_expand_BottomNavBar() {        return $this->v6_expand_NavBar('BottomNavBar');    }    // hp6navbar.ht_    function v6_expand_NavBarID() {        // $this->navbarid is set in "$this->v6_expand_NavBar"        return empty($this->navbarid) ? '' : $this->navbarid;    }    function v6_expand_ContentsURL() {        $url = $this->parent->xml_value('hotpot-config-file,global,contents-url');        if ($url) {            $url = hotpot_convert_navbutton_url($this->parent->get_baseurl(), $this->parent->reference, $url, $this->parent->course);        }        return $url;    }    function v6_expand_NextExURL() {        $url = $this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',next-ex-url');        if ($url) {            $url = hotpot_convert_navbutton_url($this->parent->get_baseurl(), $this->parent->reference, $url, $this->parent->course);        }        return $url;    }    // conditional blocks    function v6_expand_ShowAnswer() {        return $this->int_value('hotpot-config-file,'.$this->parent->quiztype.',include-show-answer');    }    function v6_expand_Slide() {        return true; // whats's this (JMatch drag and drop)    }    // specials (JMatch)    function v6_expand_FixedArray() {        $this->set_jmatch_items();        $str = '';        foreach ($this->l_items as $i=>$item) {            for ($ii=0; $ii<$i; $ii++) {                if ($this->r_items[$ii]['text']==$this->r_items[$i]['text']) {                    break;                }            }            $str .= "F[$i] = new Array();\n";            $str .= "F[$i][0] = '".$this->js_safe($item['text'], true)."';\n";            $str .= "F[$i][1] = ".($ii+1).";\n";        }        return $str;    }    function v6_expand_DragArray() {        $this->set_jmatch_items();        $str = '';        foreach ($this->r_items as $i=>$item) {            for ($ii=0; $ii<$i; $ii++) {                if ($this->r_items[$ii]['text']==$this->r_items[$i]['text']) {                    break;                }            }            $str .= "D[$i] = new Array();\n";            $str .= "D[$i][0] = '".$this->js_safe($item['text'], true)."';\n";            $str .= "D[$i][1] = ".($ii+1).";\n";            $str .= "D[$i][2] = ".$item['fixed'].";\n";        }        return $str;    }    function set_jmatch_items() {        if (count($this->l_items)) {            return;        }        $tags = 'data,matching-exercise,pair';        $i = 0;        while (($item = "[$i]['#']") && $this->parent->xml_value($tags, $item)) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -