226        $this->groupSets = 
null;
 
  227        $this->groups = 
null;
 
  228        $this->primaryResourceLinkId = 
null;
 
  229        $this->shareApproved = 
null;
 
  230        $this->created = 
null;
 
  231        $this->updated = 
null;
 
  257            $this->settingsChanged = 
false;
 
  269    public function delete()
 
  284        if (is_null($this->consumer)) {
 
  286            #if (!is_null($this->context) || !is_null($this->contextId)) { 
  287                        if($this->context || $this->contextId) {
 
  288                $this->consumer = $this->
getContext()->getConsumer();
 
  306        $this->consumer = 
null;
 
  319        if (is_null($this->context) && !is_null($this->contextId)) {
 
  347        $this->context = 
null;
 
  443        if ($value !== $old_value) {
 
  444            if (!empty($value)) {
 
  449            $this->settingsChanged = 
true;
 
  486        if ($this->settingsChanged) {
 
  551        $this->extResponse = 
null;
 
  554        $sourceResourceLink = $user->getResourceLink();
 
  555        $sourcedId = $user->ltiResultSourcedId;
 
  558        $urlLTI11 = $sourceResourceLink->getSetting(
'lis_outcome_service_url');
 
  559        $urlExt = $sourceResourceLink->getSetting(
'ext_ims_lis_basic_outcome_url');
 
  560        if ($urlExt || $urlLTI11) {
 
  563                    if ($urlLTI11 && ($ltiOutcome->type === self::EXT_TYPE_DECIMAL)) {
 
  565                    } 
else if ($urlExt) {
 
  567                        $do = 
'basic-lis-readresult';
 
  571                    if ($urlLTI11 && $this->
checkValueType($ltiOutcome, array(self::EXT_TYPE_DECIMAL))) {
 
  572                        $do = 
'replaceResult';
 
  575                        $do = 
'basic-lis-updateresult';
 
  579                    if ($urlLTI11 && ($ltiOutcome->type === self::EXT_TYPE_DECIMAL)) {
 
  580                        $do = 
'deleteResult';
 
  581                    } 
else if ($urlExt) {
 
  583                        $do = 
'basic-lis-deleteresult';
 
  589            $value = $ltiOutcome->getValue();
 
  590            if (is_null($value)) {
 
  595                if (
$action === self::EXT_WRITE) {
 
  600            <language>{$ltiOutcome->language}</language>
 
  601            <textString>{$value}</textString>
 
  606                $sourcedId = htmlentities($sourcedId);
 
  610          <sourcedId>{$sourcedId}</sourcedId>
 
  617                            if (!isset($this->extNodes[
'imsx_POXBody'][
"{$do}Response"][
'result'][
'resultScore'][
'textString'])) {
 
  620                                $ltiOutcome->setValue($this->extNodes[
'imsx_POXBody'][
"{$do}Response"][
'result'][
'resultScore'][
'textString']);
 
  630                $params[
'sourcedid'] = $sourcedId;
 
  631                $params[
'result_resultscore_textstring'] = $value;
 
  632                if (!empty($ltiOutcome->language)) {
 
  633                    $params[
'result_resultscore_language'] = $ltiOutcome->language;
 
  635                if (!empty($ltiOutcome->status)) {
 
  636                    $params[
'result_statusofresult'] = $ltiOutcome->status;
 
  638                if (!empty($ltiOutcome->date)) {
 
  639                    $params[
'result_date'] = $ltiOutcome->date;
 
  641                if (!empty($ltiOutcome->type)) {
 
  642                    $params[
'result_resultvaluesourcedid'] = $ltiOutcome->type;
 
  644                if (!empty($ltiOutcome->data_source)) {
 
  645                    $params[
'result_datasource'] = $ltiOutcome->data_source;
 
  650                            if (isset($this->extNodes[
'result'][
'resultscore'][
'textstring'])) {
 
  651                                $response = $this->extNodes[
'result'][
'resultscore'][
'textstring'];
 
  684        $this->extResponse = 
null;
 
  693            $this->groupSets = array();
 
  694            $this->groups = array();
 
  700            if (!isset($this->extNodes[
'memberships'][
'member'])) {
 
  702            } 
else if (!isset($this->extNodes[
'memberships'][
'member'][0])) {
 
  704                $members[0] = $this->extNodes[
'memberships'][
'member'];
 
  706                $members = $this->extNodes[
'memberships'][
'member'];
 
  709            for (
$i = 0; 
$i < count($members); 
$i++) {
 
  714                $firstname = (isset($members[
$i][
'person_name_given'])) ? $members[
$i][
'person_name_given'] : 
'';
 
  715                $lastname = (isset($members[
$i][
'person_name_family'])) ? $members[
$i][
'person_name_family'] : 
'';
 
  716                $fullname = (isset($members[
$i][
'person_name_full'])) ? $members[
$i][
'person_name_full'] : 
'';
 
  717                $user->setNames($firstname, $lastname, $fullname);
 
  720                $email = (isset($members[
$i][
'person_contact_email_primary'])) ? $members[
$i][
'person_contact_email_primary'] : 
'';
 
  724                if (isset($members[
$i][
'roles'])) {
 
  729                if (!isset($members[
$i][
'groups'][
'group'])) {
 
  731                } 
else if (!isset($members[
$i][
'groups'][
'group'][0])) {
 
  733                    $groups[0] = $members[
$i][
'groups'][
'group'];
 
  735                    $groups = $members[
$i][
'groups'][
'group'];
 
  737                for ($j = 0; $j < count(
$groups); $j++) {
 
  739                    if (isset($group[
'set'])) {
 
  740                        $set_id = $group[
'set'][
'id'];
 
  741                        if (!isset($this->groupSets[$set_id])) {
 
  742                            $this->groupSets[$set_id] = array(
'title' => $group[
'set'][
'title'], 
'groups' => array(),
 
  743                               'num_members' => 0, 
'num_staff' => 0, 
'num_learners' => 0);
 
  745                        $this->groupSets[$set_id][
'num_members']++;
 
  746                        if ($user->isStaff()) {
 
  747                            $this->groupSets[$set_id][
'num_staff']++;
 
  749                        if ($user->isLearner()) {
 
  750                            $this->groupSets[$set_id][
'num_learners']++;
 
  752                        if (!in_array($group[
'id'], $this->groupSets[$set_id][
'groups'])) {
 
  753                            $this->groupSets[$set_id][
'groups'][] = $group[
'id'];
 
  755                        $this->groups[$group[
'id']] = array(
'title' => $group[
'title'], 
'set' => $set_id);
 
  757                        $this->groups[$group[
'id']] = array(
'title' => $group[
'title']);
 
  759                    $user->groups[] = $group[
'id'];
 
  763                if (isset($members[
$i][
'lis_result_sourcedid'])) {
 
  764                    $user->ltiResultSourcedId = $members[
$i][
'lis_result_sourcedid'];
 
  774            foreach ($oldUsers as 
$id => $user) {
 
  797        $this->extResponse = 
null;
 
  800                $do = 
'basic-lti-loadsetting';
 
  803                $do = 
'basic-lti-savesetting';
 
  806                $do = 
'basic-lti-deletesetting';
 
  814            if (is_null($value)) {
 
  822                        if (isset($this->extNodes[
'setting'][
'value'])) {
 
  823                            $response = $this->extNodes[
'setting'][
'value'];
 
  830                        $this->
setSetting(
'ext_ims_lti_tool_setting', $value);
 
  904        $has = !empty($this->contextId);
 
  922        if (!empty($this->contextId)) {
 
  923            $url = $this->
getContext()->getSetting(
'custom_context_memberships_url');
 
  948        return $this->
getDataConnector()->getUserResultSourcedIDsResourceLink($this, $localOnly, $idScope);
 
  977        $resourceLink->dataConnector = 
$consumer->getDataConnector();
 
  980            $resourceLink->load();
 
  981            if (is_null($resourceLink->id) && !empty($tempId)) {
 
  982                $resourceLink->ltiResourceLinkId = $tempId;
 
  983                $resourceLink->load();
 
  988        return $resourceLink;
 
 1004        $resourceLink->setContextId(
$context->getRecordId());
 
 1006        $resourceLink->dataConnector = 
$context->getDataConnector();
 
 1009            $resourceLink->load();
 
 1010            if (is_null($resourceLink->id) && !empty($tempId)) {
 
 1011                $resourceLink->ltiResourceLinkId = $tempId;
 
 1012                $resourceLink->load();
 
 1017        return $resourceLink;
 
 1033        $resourceLink->load(
$id);
 
 1035        return $resourceLink;
 
 1071        if (empty($supportedTypes)) {
 
 1072            $supportedTypes = explode(
',', str_replace(
' ', 
'', strtolower($this->
getSetting(
'ext_ims_lis_resultvalue_sourcedids', self::EXT_TYPE_DECIMAL))));
 
 1074        $type = $ltiOutcome->type;
 
 1075        $value = $ltiOutcome->getValue();
 
 1077        $ok = in_array(
$type, $supportedTypes) || (strlen($value) <= 0);
 
 1080            if (
$type === self::EXT_TYPE_PERCENTAGE) {
 
 1081                if (substr($value, -1) === 
'%') {
 
 1082                    $value = substr($value, 0, -1);
 
 1084                $ok = is_numeric($value) && ($value >= 0) && ($value <= 100);
 
 1086                    $ltiOutcome->setValue($value / 100);
 
 1089            } 
else if (
$type === self::EXT_TYPE_RATIO) {
 
 1090                $parts = explode(
'/', $value, 2);
 
 1091                $ok = (count($parts) === 2) && is_numeric($parts[0]) && is_numeric($parts[1]) && ($parts[0] >= 0) && ($parts[1] > 0);
 
 1093                    $ltiOutcome->setValue($parts[0] / $parts[1]);
 
 1097            } 
else if (
$type === self::EXT_TYPE_LETTER_AF) {
 
 1098                if (in_array(self::EXT_TYPE_LETTER_AF_PLUS, $supportedTypes)) {
 
 1101                } 
else if (in_array(self::EXT_TYPE_TEXT, $supportedTypes)) {
 
 1106            } 
else if (
$type === self::EXT_TYPE_LETTER_AF_PLUS) {
 
 1107                if (in_array(self::EXT_TYPE_LETTER_AF, $supportedTypes) && (strlen($value) === 1)) {
 
 1110                } 
else if (in_array(self::EXT_TYPE_TEXT, $supportedTypes)) {
 
 1115            } 
else if (
$type === self::EXT_TYPE_TEXT) {
 
 1116                $ok = is_numeric($value) && ($value >= 0) && ($value <=1);
 
 1119                } 
else if (substr($value, -1) === 
'%') {
 
 1120                    $value = substr($value, 0, -1);
 
 1121                    $ok = is_numeric($value) && ($value >= 0) && ($value <=100);
 
 1123                        if (in_array(self::EXT_TYPE_PERCENTAGE, $supportedTypes)) {
 
 1126                            $ltiOutcome->setValue($value / 100);
 
 1151        $this->extRequest = 
null;
 
 1152        $this->extRequestHeaders = 
'';
 
 1153        $this->extResponse = 
null;
 
 1154        $this->extResponseHeaders = 
'';
 
 1160            if (
$http->send()) {
 
 1161                $this->extResponse = 
$http->response;
 
 1162                $this->extResponseHeaders = 
$http->responseHeaders;
 
 1164                    $this->extDoc = 
new DOMDocument();
 
 1165                    $this->extDoc->loadXML(
$http->response);
 
 1166                    $this->extNodes = $this->
domnodeToArray($this->extDoc->documentElement);
 
 1167                    if (isset($this->extNodes[
'statusinfo'][
'codemajor']) && ($this->extNodes[
'statusinfo'][
'codemajor'] === 
'Success')) {
 
 1170                } 
catch (\Exception $e) {
 
 1173            $this->extRequest = 
$http->request;
 
 1174            $this->extRequestHeaders = 
$http->requestHeaders;
 
 1194        $this->extRequest = 
null;
 
 1195        $this->extRequestHeaders = 
'';
 
 1196        $this->extResponse = 
null;
 
 1197        $this->extResponseHeaders = 
'';
 
 1200            $xmlRequest = <<< EOD
 
 1201<?xml version = 
"1.0" encoding = 
"UTF-8"?>
 
 1202<imsx_POXEnvelopeRequest xmlns = 
"http://www.imsglobal.org/services/ltiv1p1/xsd/imsoms_v1p0">
 
 1204    <imsx_POXRequestHeaderInfo>
 
 1205      <imsx_version>V1.0</imsx_version>
 
 1206      <imsx_messageIdentifier>{
$id}</imsx_messageIdentifier>
 
 1207    </imsx_POXRequestHeaderInfo>
 
 1214</imsx_POXEnvelopeRequest>
 
 1217            $hash = base64_encode(sha1($xmlRequest, 
true));
 
 1218            $params = array(
'oauth_body_hash' => $hash);
 
 1227            $header .= 
"\nContent-Type: application/xml";
 
 1231            if (
$http->send()) {
 
 1232                $this->extResponse = 
$http->response;
 
 1233                $this->extResponseHeaders = 
$http->responseHeaders;
 
 1235                    $this->extDoc = 
new DOMDocument();
 
 1236                    $this->extDoc->loadXML(
$http->response);
 
 1237                    $this->extNodes = $this->
domnodeToArray($this->extDoc->documentElement);
 
 1238                    if (isset($this->extNodes[
'imsx_POXHeader'][
'imsx_POXResponseHeaderInfo'][
'imsx_statusInfo'][
'imsx_codeMajor']) &&
 
 1239                        ($this->extNodes[
'imsx_POXHeader'][
'imsx_POXResponseHeaderInfo'][
'imsx_statusInfo'][
'imsx_codeMajor'] === 
'success')) {
 
 1242                } 
catch (\Exception $e) {
 
 1245            $this->extRequest = 
$http->request;
 
 1246            $this->extRequestHeaders = 
$http->requestHeaders;
 
 1264        switch ($node->nodeType) {
 
 1265            case XML_CDATA_SECTION_NODE:
 
 1267                $output = trim($node->textContent);
 
 1269            case XML_ELEMENT_NODE:
 
 1270                for (
$i = 0; 
$i < $node->childNodes->length; 
$i++) {
 
 1271                    $child = $node->childNodes->item(
$i);
 
 1273                    if (isset($child->tagName)) {
 
 1274                        $t = $child->tagName;
 
 1281                        if (strlen(
$s) > 0) {
 
 1287                    if ($node->attributes->length) {
 
 1289                        foreach ($node->attributes as $attrName => $attrNode) {
 
 1290                            $a[$attrName] = (string) $attrNode->value;
 
 1295                        if (is_array($v) && count($v)==1 && 
$t!=
'@attributes') {
 
const EOF
How fgetc() reports an End Of File.
An exception for terminatinating execution or to throw for unit testing.
Class to represent an HTTP message.
Class to represent an OAuth Consumer.
static from_consumer_and_token($consumer, $token, $http_method, $http_url, $parameters=null)
pretty much a helper function to set up the request
Class to represent an OAuth HMAC_SHA1 signature method.
static fromRecordId($id, $dataConnector)
Load the context from the database.
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output