function scormcloud_get_service() { global $CFG; global $log; $module = new stdClass(); require 'version.php'; $origin = ScormEngineUtilities::getCanonicalOriginString('Rustici Software', 'Moodle', '2.0-' . $module->version); $log->logDebug("Building ScormEngineService with origin = {$origin}"); return new ScormEngineService($CFG->scormcloud_serviceurl, $CFG->scormcloud_appid, $CFG->scormcloud_secretkey, $origin); }
public static function get_cloud_service($force_network_settings = false) { require_once 'SCORMCloud_PHPLibrary/ScormEngineService.php'; require_once 'SCORMCloud_PHPLibrary/ScormEngineUtilities.php'; if (ScormCloudPlugin::is_network_managed() || $force_network_settings) { $appid = get_site_option('scormcloud_appid'); $secretkey = get_site_option('scormcloud_secretkey'); $engine_url = get_site_option('scormcloud_engine_url'); $proxy = get_site_option('proxy'); } else { $appid = get_option('scormcloud_appid'); $secretkey = get_option('scormcloud_secretkey'); $engine_url = get_option('scormcloud_engine_url'); $proxy = get_option('proxy'); } $origin = ScormEngineUtilities::getCanonicalOriginString('Rustici Software', 'WordPress', '1.1.2'); //arbitrary number 17 is the length of 'EngineWebServices' if (strlen($engine_url) < 17) { $engine_url = "http://cloud.scorm.com/EngineWebServices"; } return new ScormEngineService($engine_url, $appid, $secretkey, $origin, $proxy); }
* names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL Rustici Software, LLC BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /// Configuration File require_once '../ScormEngineUtilities.php'; unset($CFG); $CFG->wwwroot = ''; // e.g. "http://localhost/PhpLibrary/samples/"; //Rustici Software SCORM Cloud API Key Settings $CFG->scormcloudurl = 'http://cloud.scorm.com/EngineWebServices/'; $CFG->scormcloudsecretkey = ''; // e.g. '3nrJQ50o8AOF7qsP0649KfLyXOlfgyxyyt7ecd2U'; $CFG->scormcloudappid = ''; // e.g. '321WUXJHRT'; $CFG->scormcloudmanagersecretkey = ''; // e.g. 'JQ53nr0o8AOF7qsP0649KfLyXOlfgyxyyt7ecd2U'; $CFG->scormcloudappmanagerid = ''; // e.g. '123WUXJHRT'; $CFG->scormcloudorigin = ScormEngineUtilities::getCanonicalOriginString('Your Company', 'Your Application', 'Version 2.0');
public static function getRegistrationResult($idRegistration) { $app = \Slim\Slim::getInstance(); try { $scormcloudorigin = ScormEngineUtilities::getCanonicalOriginString("IgnitorLabs", "Ignitor Portal", "Version 2.0"); $ScormService = new ScormEngineService(ScormCloudAPIController::$scromCloudUrl, ScormCloudAPIController::$scromCloudAppId, ScormCloudAPIController::$scormCloudSecretKey, ScormCloudAPIController::$scormcloudorigin, null, ScormCloudAPIController::$scromCloudMgmtAppId, ScormCloudAPIController::$scormCloudMgmtSecretKey); $registrationService = $ScormService->getRegistrationService(); if ($registrationService->Exists($idRegistration)) { $regResult = $registrationService->GetRegistrationResult($idRegistration, 2, 1); $json_result = json_encode(simplexml_load_string($regResult), JSON_PRETTY_PRINT); $data = array("action" => "get", "type" => "scorm-cloud", "source" => "api", "source_version" => "1.0", "description" => $json_result, "ip" => $_SERVER['REMOTE_ADDR'], "browser_type" => $_SERVER['HTTP_USER_AGENT'], "referral" => $_SERVER['HTTP_REFERER'], "auth_token" => $app->request->headers->get('X_Authorization')); $log = Log::create($data); $log->save(); $app->redirect(ScormCloudAPIController::$websiteLink . "/library"); // return "<html><head><script type=\"text/javascript\">window.location=\"" . ScormCloudAPIController::$websiteLink . "/library\"</script></head><body></body></html>"; } else { return json_encode("failure"); } } catch (Exception $e) { $app->halt("400", json_encode($e->getMessage())); return json_encode("failure"); } }