コード例 #1
0
    print_error('cannotviewassignment', 'assignment');
}
if ($assignment->assignmenttype != 'babelium') {
    print_error('invalidtype', 'assignment');
}
$assignmentinstance = new assignment_babelium($cm->id, $assignment, $cm, $course);
if ($submission = $assignmentinstance->get_submission($user->id)) {
    $PAGE->set_pagelayout('popup');
    $PAGE->set_title(fullname($user, true) . ': ' . $assignment->name);
    echo $OUTPUT->header();
    echo $OUTPUT->box_start('generalbox boxaligcenter', 'dates');
    echo '<table>';
    if ($assignment->timedue) {
        echo '<tr><td class="c0">' . get_string('duedate', 'assignment') . ':</td>';
        echo '    <td class="c1">' . userdate($assignment->timedue) . '</td></tr>';
    }
    echo '<tr><td class="c0">' . get_string('lastedited') . ':</td>';
    echo '    <td class="c1">' . userdate($submission->timemodified);
    echo '</td></tr></table>';
    echo $OUTPUT->box_end();
    $html_content = '';
    $response_data = babelium_get_response_data($submission->data1);
    if ($response_data) {
        $html_content = babelium_html_output(0, $response_data['info'], $response_data['subtitles']);
    }
    echo $OUTPUT->box($html_content, 'generalbox boxaligncenter boxwidthwide');
    echo $OUTPUT->close_window_button();
    echo $OUTPUT->footer();
} else {
    print_string('emptysubmission', 'assignment');
}
コード例 #2
0
 function definition()
 {
     global $CFG, $SESSION, $PAGE;
     $PAGE->requires->string_for_js('babeliumViewRecording', 'assignment_babelium');
     $PAGE->requires->string_for_js('babeliumViewExercise', 'assignment_babelium');
     $PAGE->requires->string_for_js('babeliumStartRecording', 'assignment_babelium');
     $PAGE->requires->string_for_js('babeliumStopRecording', 'assignment_babelium');
     $mform = $this->_form;
     list($data, $exinfo, $exroles, $exlangs, $exsubs) = $this->_customdata;
     $roleMenu = array();
     if ($exroles && count($exroles) > 0) {
         foreach ($exroles as $exrole) {
             if (isset($exrole['characterName']) && $exrole['characterName'] != "NPC") {
                 $roleMenu[$exrole['characterName']] = $exrole['characterName'];
             }
         }
     }
     //TODO Currently we only allow one language for the subtitles so this element is not needed for now
     //$localeMenu = array();
     //if($exlangs && count($exlangs) > 0){
     //	foreach($exlangs as $exlang){
     //		if(isset($exlang['locale']))
     //			$localeMenu[$exlang['locale']] = $exlang['locale'];
     //	}
     //}
     // hidden params
     $mform->addElement('hidden', 'id');
     $mform->setType('id', PARAM_INT);
     $mform->addElement('hidden', 'edit');
     $mform->setType('edit', PARAM_INT);
     $mform->addElement('hidden', 'data1');
     //$mform->setType('data1', PARAM_INT);
     $mform->addElement('hidden', 'data2');
     $mform->setType('data2', PARAM_TEXT);
     //$mform->addRule('data2','You cannot save the assignment without recording something','required');
     $mform->addRule('data2', get_string('required'), 'required', null, 'client');
     //The role selected in the combobox the last time the user pushed the 'Start Recording' button
     $mform->addElement('hidden', 'recordedRole');
     $mform->setType('recordedRole', PARAM_TEXT);
     $mform->addElement('hidden', 'subtitleId', $exsubs[0]['subtitleId']);
     $mform->addElement('hidden', 'exerciseDuration', $exinfo['duration']);
     //Returns a string with all the html and script tags needed to init the babelium widget
     $html_content = babelium_html_output(!empty($data->data2), $exinfo, $exsubs);
     $mform->addElement('html', $html_content);
     $mform->addElement('select', 'roleCombo', get_string('babeliumChooseRole', 'assignment_babelium'), $roleMenu);
     //TODO Currently, we only allow one language for the subtitles so this element is not needed for now
     //$mform->addElement('select', 'localeCombo', get_string('babeliumChooseSubLang', 'assignment_babelium'), $localeMenu);
     $recmethods = array();
     $recmethods[] = $mform->createElement('radio', 'recmethod', 'none', get_string('babeliumMicOnly', 'assignment_babelium'), 0);
     $recmethods[] = $mform->createElement('radio', 'recmethod', 'none', get_string('babeliumWebcamMic', 'assignment_babelium'), 1);
     $mform->addGroup($recmethods, 'radioar', get_string('babeliumChooseRecMethod', 'assignment_babelium'), array(' '), false);
     //TODO check how the help dynamic popups retrieve their texts to apply the same principle to the label of these two buttons
     $babeliumactions = array();
     $babeliumactions[] = $mform->createElement('button', 'startStopRecordingBtn', get_string('babeliumStartRecording', 'assignment_babelium'));
     //$babeliumactions[] = $mform->createElement('button', 'viewRecordingExerciseBtn', get_string('babeliumViewExercise', 'assignment_babelium'), empty($data->data2) ? 'style="display:none;"' : null);
     $babeliumactions[] = $mform->createElement('button', 'viewRecordingBtn', get_string('babeliumViewRecording', 'assignment_babelium'), empty($data->data2) ? 'style="display:none;"' : null);
     $babeliumactions[] = $mform->createElement('button', 'viewExerciseBtn', get_string('babeliumViewExercise', 'assignment_babelium'), empty($data->data2) ? 'style="display:none;"' : null);
     $mform->addGroup($babeliumactions, 'babeliumActions', '', '', false);
     $this->add_action_buttons();
     $this->set_data($data);
 }