19### ResourceLink methods
36 $id = $resourceLink->getRecordId();
37 $userResults = array();
40 $sql =
'SELECT u.user_result_pk, u.lti_result_sourcedid, u.lti_user_id, u.created, u.updated ' .
41 "FROM {$this->dbTableNamePrefix}" . static::USER_RESULT_TABLE_NAME .
' AS u ' .
42 "INNER JOIN {$this->dbTableNamePrefix}" . static::RESOURCE_LINK_TABLE_NAME .
' AS rl ' .
43 'ON u.resource_link_pk = rl.resource_link_pk ' .
44 'WHERE (rl.resource_link_pk = :id) AND (rl.primary_resource_link_pk IS NULL)';
45 $query = $this->db->prepare($sql);
46 $query->bindValue(
'id', $id, \PDO::PARAM_INT);
48 $sql =
'SELECT u.user_result_pk, u.lti_result_sourcedid, u.lti_user_id, u.created, u.updated ' .
49 "FROM {$this->dbTableNamePrefix}" . static::USER_RESULT_TABLE_NAME .
' AS u ' .
50 "INNER JOIN {$this->dbTableNamePrefix}" . static::RESOURCE_LINK_TABLE_NAME .
' AS rl ' .
51 'ON u.resource_link_pk = rl.resource_link_pk ' .
52 'WHERE ((rl.resource_link_pk = :id) AND (rl.primary_resource_link_pk IS NULL)) OR ' .
53 '((rl.primary_resource_link_pk = :pid) AND share_approved)';
54 $query = $this->db->prepare($sql);
55 $query->bindValue(
'id', $id, \PDO::PARAM_INT);
56 $query->bindValue(
'pid', $id, \PDO::PARAM_INT);
59 while ($row = $query->fetch(\PDO::FETCH_ASSOC)) {
60 $row = array_change_key_case($row);
61 $userresult = LTI\UserResult::fromRecordId($row[
'user_result_pk'], $resourceLink->getDataConnector());
62 $userresult->setRecordId(intval($row[
'user_result_pk']));
63 $userresult->ltiResultSourcedId = $row[
'lti_result_sourcedid'];
64 $userresult->created = strtotime($row[
'created']);
65 $userresult->updated = strtotime($row[
'updated']);
66 if (is_null($idScope)) {
67 $userResults[] = $userresult;
69 $userResults[$userresult->getId($idScope)] = $userresult;
78### ResourceLinkShareKey methods
90 $id = $shareKey->getId();
91 $expires = date(
"{$this->dateFormat} {$this->timeFormat}", $shareKey->expires);
92 $sql =
"INSERT INTO {$this->dbTableNamePrefix}" . static::RESOURCE_LINK_SHARE_KEY_TABLE_NAME .
' ' .
93 '(share_key_id, resource_link_pk, auto_approve, expires) ' .
94 'VALUES (:id, :prlid, :approve, :expires)';
95 $query = $this->db->prepare($sql);
96 $query->bindValue(
'id', $id, \PDO::PARAM_STR);
97 $query->bindValue(
'prlid', $shareKey->resourceLinkId, \PDO::PARAM_INT);
98 $query->bindValue(
'approve', $shareKey->autoApprove, \PDO::PARAM_INT);
99 $query->bindValue(
'expires', $expires, \PDO::PARAM_STR);
Class to represent an LTI Data Connector for PDO variations for PostgreSQL connections.
saveResourceLinkShareKey($shareKey)
Save resource link share key object.
getUserResultSourcedIDsResourceLink($resourceLink, $localOnly, $idScope)
Get array of user objects.
Class to represent an LTI Data Connector for PDO connections.
executeQuery($sql, $query, $reportError=true)
Execute a database query.
Class to provide a connection to a persistent store for LTI objects.
Class to represent a platform resource link share key.
Class to represent a platform resource link.