コード例 #1
0
 *   http://scorm.com/moodle/
 *
 *   The SCORM Cloud Module is free software: you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License as published
 *   by the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   The SCORM Cloud Module is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with the SCORM Cloud Module.  If not, see <http://www.gnu.org/licenses/>.
 */
require_once "../../config.php";
require_once 'SCORMCloud_PHPLibrary/ScormEngineService.php';
require_once 'SCORMCloud_PHPLibrary/ServiceRequest.php';
require_once 'SCORMCloud_PHPLibrary/CourseData.php';
require_once $CFG->dirroot . '/mod/scormcloud/lib.php';
require_once $CFG->dirroot . '/mod/scormcloud/locallib.php';
$id = required_param('id', PARAM_INT);
$scormcloud = $DB->get_record('scormcloud', array('id' => $id));
require_login($scormcloud->course);
if (!scormcloud_hascapabilitytolaunch($scormcloud->course)) {
    error("You do not have permission to launch this course.");
}
$scormservice = scormcloud_get_service();
$courseservice = $scormservice->getCourseService();
$cssurl = $CFG->wwwroot . '/mod/scormcloud/packageprops.css';
echo '<script language="javascript">window.location.href = "' . $courseservice->GetPropertyEditorUrl($scormcloud->cloudid, $cssurl, null) . '";</script>';
コード例 #2
0
require_once "../../config.php";
require_once $CFG->dirroot . '/lib/datalib.php';
require_once $CFG->dirroot . '/lib/accesslib.php';
require_once "locallib.php";
require_once 'SCORMCloud_PHPLibrary/ScormEngineService.php';
require_once 'SCORMCloud_PHPLibrary/ServiceRequest.php';
require_once 'SCORMCloud_PHPLibrary/CourseData.php';
global $log;
$regid = optional_param("id", null, PARAM_ALPHANUM);
if ($regid != null) {
    $log->logDebug('In courseexit.php, received regid ' . $regid);
    if ($reg = $DB->get_record("scormcloud_registrations", array('regid' => $regid))) {
        $log->logDebug('Found scormcloud_registration for regid ' . $regid);
        if ($scormcloud = $DB->get_record("scormcloud", array('id' => $reg->scormcloudid))) {
            $log->logDebug('Found scormcloud record for id ' . $reg->scormcloudid);
            if (scormcloud_hascapabilitytolaunch($scormcloud->course) && $USER->id == $reg->userid) {
                // Get the results from the cloud.
                $scormservice = scormcloud_get_service();
                $regservice = $scormservice->getRegistrationService();
                $resultsxml = $regservice->GetRegistrationResult($regid, 0, 'xml');
                $results = simplexml_load_string($resultsxml);
                $score = $results->registrationreport->score;
                if ($score == 'unknown') {
                    $score = 0;
                }
                $log->logDebug('Updating Moodle gradebook ' . $reg->userid . ' - ' . $scormcloud->course . ' - ' . $score);
                if (scormcloud_grade_item_update($reg->userid, $reg->scormcloudid, $score)) {
                    $log->logInfo('Updated Moodle gradebook for course ' . $scormcloud->course);
                } else {
                    $log->logWarn('Error updating Moodle gradebook for course ' . $scormcloud->course . '. Retrying.');
                    if (scormcloud_grade_item_update($reg->userid, $reg->scormcloudid, $score)) {