예제 #1
0
    /**
     * Get the content and return it in HTML
     * @global stdClass $CFG
     * @global stdClass $COURSE
     * @global moodle_page $PAGE
     * @global core_renderer $OUTPUT
     * @return string Return the formatted content 
     */
    function get_content()
    {
        global $CFG, $COURSE, $PAGE;
        //Get global/admin tts configs
        require_once 'settings_base.php';
        $numSelection = numSelection();
        $volume = volumeSelection();
        $services = serviceSelection();
        //$language = languageSelection();
        $course = $this->page->course;
        $context = get_context_instance(CONTEXT_COURSE, $course->id);
        $this->content = new stdClass();
        $ttsAppURL = $CFG->wwwroot . '/blocks/tts/app/';
        $this->content->text = '<script type="text/javascript">
            
var ttsAppURL = "' . $ttsAppURL . '";
var ttsService = "' . $services[$CFG->block_tts_default_service] . '";   
var ttsVolume =  "' . $volume[$CFG->block_tts_sm_starting_volume] . '";
var course =  ' . $COURSE->id . ';  
var ttsLang =  "' . lang(current_language()) . '";

var ttsMaxReq =  "' . $numSelection[$CFG->block_tts_max_requests] . '";    
var ttsMaxErr =  "' . $numSelection[$CFG->block_tts_max_errors] . '";    
var ttsFatFet =  "' . $numSelection[$CFG->block_tts_max_fat_fetch_attempts] . '";

var ttsImgUrl = "' . $ttsAppURL . '_images/";
</script>';
        //$PAGE->requires->js('/blocks/tts/tts.js');
        $PAGE->requires->css('/blocks/tts/app/_css/player.css');
        $PAGE->requires->css('/blocks/tts/app/_css/jquery.ui.core.css');
        $PAGE->requires->css('/blocks/tts/app/_css/jquery.ui.slider.css');
        $PAGE->requires->css('/blocks/tts/app/_css/jquery.ui.theme.css');
        $PAGE->requires->js('/blocks/tts/app/_scripts/jquery-1.6.1.min.js');
        $PAGE->requires->js('/blocks/tts/app/_scripts/jquery.ui.core.js');
        $PAGE->requires->js('/blocks/tts/app/_scripts/jquery.ui.widget.js');
        $PAGE->requires->js('/blocks/tts/app/_scripts/jquery.ui.mouse.js');
        $PAGE->requires->js('/blocks/tts/app/_scripts/jquery.ui.slider.js');
        $PAGE->requires->js('/blocks/tts/app/_scripts/json2.js');
        $PAGE->requires->js('/blocks/tts/app/_scripts/jquery.store.js');
        $PAGE->requires->js('/blocks/tts/app/_scripts/md4.js');
        $PAGE->requires->js('/blocks/tts/app/_scripts/tts.js');
        $PAGE->requires->js('/blocks/tts/app/_scripts/tts_init.js');
        $ttsControls = '<div id="tts_controls"><ul style="padding:5px;" id="tts_control_list">';
        $ttsControls .= '<li style="padding-right:5px;"><a href="#" id="tts_play"><img alt="play button: text to speech" src="' . $ttsAppURL . '_images/play.png" class="play"/></a></li>';
        $ttsControls .= '<li style="padding-right:20px;"><a href="#" id="tts_pause"><img alt="pause button: text to speech" src="' . $ttsAppURL . '_images/pause.png" class="pause" /></a></li>';
        $ttsControls .= '<li style="padding-right:5px;"><a href="#" id="tts_skip_backward"><img alt="skip backward button: text to speech" class="backward" src="' . $ttsAppURL . '_images/backward.png"/></a></li>';
        $ttsControls .= '<li><a href="#" id="tts_skip_forward"><img alt="skip forward button: text to speech" src="' . $ttsAppURL . '_images/forward.png" class="forward"/></a></li>';
        $ttsControls .= '<li style="display:inherit">
                <a href="#" id="tts_volume_down"><img src="' . $ttsAppURL . '_images/volumedown.png" class="volumedown"/></a>
                <div id="tts_volume_slider"></div>
                <a href="#" id="tts_volume_up"><img src="' . $ttsAppURL . '_images/volumeup.png" class="volumeup"/></a>
                <a href="#" id="tts_mute"><img alt="mute button: text to speech" src="' . $ttsAppURL . '_images/mute.png" class="mute"/></a>             
            </li>';
        //$ttsControls .= '<li><a href="#" id="tts_volume_down"><img alt="decrease volume button: text to speech" src="'.$ttsAppURL.'_images/volumedown.png" height="15" width="18" /></a></li>';
        //$ttsControls .= '<li><a href="#" id="tts_volume_up"><img alt="increase volume button: text to speech" src="'.$ttsAppURL.'_images/volumeup.png" height="15" width="18" /></a></li>';
        //$ttsControls .= '<li><a href="#" id="tts_mute"><img alt="mute button: text to speech" src="'.$ttsAppURL.'_images/mute.png" height="15" width="18" /></a></li></ul>';
        $ttsControls .= '</ul>';
        $this->content->text .= $ttsControls;
        if (has_capability('moodle/course:manageactivities', $context)) {
            $this->content->footer = '<a href="' . $CFG->wwwroot . '/blocks/tts/lexicon.php?courseid=' . $course->id . '">Lexicon</a>';
            global $OUTPUT;
            $this->content->footer .= $OUTPUT->help_icon('lexicon', 'block_tts');
        }
        $this->content->text .= '</div>';
        return $this->content;
    }
예제 #2
0
<?php

/**
 * *************************************************************************
 * *                    OOHOO - TTS - Text To Speech                      **
 * *************************************************************************
 * @package     block                                                     **
 * @subpackage  TTS                                                       **
 * @name        TTS                                                       **
 * @copyright   oohoo.biz                                                 **
 * @link        http://oohoo.biz                                          **
 * @author      Ryan Thomas (Original Author)                             **
 * @author      Dustin Durand                                             **
 * @author      Nicolas Bretin                                            **
 * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later  **
 * *************************************************************************
 * ************************************************************************ */
defined('MOODLE_INTERNAL') || die;
require_once 'settings_base.php';
if ($ADMIN->fulltree) {
    $numSelection = numSelection();
    $volume = volumeSelection();
    $services = serviceSelection();
    $language = languageSelection();
    $settings->add(new admin_setting_configselect('block_tts_max_requests', get_string('max_requests', 'block_tts'), get_string('max_requestsdef', 'block_tts'), 0, $numSelection));
    $settings->add(new admin_setting_configselect('block_tts_max_errors', get_string('max_errors', 'block_tts'), get_string('max_errorsdef', 'block_tts'), 2, $numSelection));
    $settings->add(new admin_setting_configselect('block_tts_max_fat_fetch_attempts', get_string('max_fat_fetch_attempts', 'block_tts'), get_string('max_fat_fetch_attemptsdef', 'block_tts'), 1, $numSelection));
    $settings->add(new admin_setting_configselect('block_tts_sm_starting_volume', get_string('sm_starting_volume', 'block_tts'), get_string('sm_starting_volumedef', 'block_tts'), 5, $volume));
    $settings->add(new admin_setting_configselect('block_tts_default_service', get_string('default_service', 'block_tts'), get_string('default_servicedef', 'block_tts'), 1, $services));
}