コード例 #1
0
ファイル: view.php プロジェクト: kevin-bruton/marsupial
$contextmodule = context_module::instance($cm->id);
$pagetitle = strip_tags(format_string($rcontent->name));
$PAGE->set_title($pagetitle);
$PAGE->set_heading($course->fullname);
$url = new moodle_url('/mod/rcontent/view.php', array('id' => $id));
// Base URL
$PAGE->set_focuscontrol('');
$PAGE->set_cacheable(true);
$PAGE->navbar->add(get_string('modulenameplural', 'rcontent'), new moodle_url('/mod/rcontent/index.php', array('id' => $course->id)));
$PAGE->navbar->add($rcontent->name);
$PAGE->set_url($url);
//call to autentification web services
require_once $CFG->dirroot . '/local/rcommon/WebServices/AuthenticateContent.php';
$rcontent->module = 'rcontent';
$rcontent->cmid = $cm->id;
$return = AuthenticateUserContent($rcontent);
if ($return->AutenticarUsuarioContenidoResult->Codigo <= 0 || !isset($return->AutenticarUsuarioContenidoResult->URL) || empty($return->AutenticarUsuarioContenidoResult->URL)) {
    print_error(get_string('error_authentication', 'local_rcommon') . $return->AutenticarUsuarioContenidoResult->Codigo . ', ' . $return->AutenticarUsuarioContenidoResult->Descripcion);
}
$url = $return->AutenticarUsuarioContenidoResult->URL;
if ($rcontent->popup == 1) {
    $options = $rcontent->popup_options;
    if (core_text::strpos($options, ',height') !== false) {
        $options = core_text::substr($options, 0, core_text::strpos($options, ',height'));
    }
    $PAGE->requires->data_for_js('rcontentplayerdata', array('cwidth' => str_replace('%', '', $rcontent->width), 'cheight' => str_replace('%', '', $rcontent->height), 'popupoptions' => $options, 'courseid' => $rcontent->course, 'launch' => true, 'launch_url' => $url), true);
    echo $OUTPUT->header();
    echo $OUTPUT->heading(format_string($rcontent->name));
    $content = '<a target="_blank" href="' . $url . '">' . get_string('popupblockedlinkname', 'rcontent') . '</a>';
    echo $OUTPUT->box(get_string('popupblocked', 'rcontent', $content));
    $PAGE->requires->js('/mod/rcontent/view.js');
コード例 #2
0
<?php

require_once '../../../config.php';
require_once $CFG->libdir . '/adminlib.php';
require_once $CFG->dirroot . '/local/rcommon/WebServices/AuthenticateContent.php';
$cred = optional_param('id_cr', '', PARAM_INT);
$credential = $DB->get_record_sql("SELECT b.id AS bookid, cred.euserid as userid, cred.credentials\n    \tFROM {rcommon_user_credentials} cred\n    \tLEFT JOIN {rcommon_books} b ON cred.isbn = b.isbn\n    \tWHERE cred.id = '{$cred}'");
$data = new stdClass();
$data->bookid = $credential->bookid;
$data->id = 0;
$data->unitid = 0;
$data->activityid = 0;
$data->course = 1;
$data->module = 'check_credentials';
$data->cmid = 0;
$usr_creden = new stdClass();
$usr_creden->credentials = $credential->credentials;
$usr_creden->euserid = $credential->userid;
try {
    $result = AuthenticateUserContent($data, $usr_creden, false);
    if ($result->AutenticarUsuarioContenidoResult->Codigo == 1) {
        echo '<span style="color:green">' . get_string('good_connection', 'local_rcommon') . '</span>';
    } else {
        echo '<span style="color:red">' . get_string('bad_connection', 'local_rcommon') . ': <span style="font-size:small">' . get_string('error_code_' . $result->AutenticarUsuarioContenidoResult->Codigo, 'local_rcommon') . '</span></span>';
    }
} catch (Exception $e) {
    echo '<span style="color:red">' . get_string('bad_connection', 'local_rcommon') . ': <span style="font-size:small">' . $e->getMessage() . '</span></span>';
}