ILIAS  release_8 Revision v8.24
ilLTIDataConnector Class Reference
+ Inheritance diagram for ilLTIDataConnector:
+ Collaboration diagram for ilLTIDataConnector:

Public Member Functions

 __construct ()
 ilLTIDataConnector constructor. More...
 
 loadPlatform (\ILIAS\LTI\ToolProvider\Platform $platform)
 Load platform object. More...
 
 loadGlobalToolConsumerSettings (ilLTIPlatform $platform)
 Load global tool consumer settings in consumer. More...
 
 lookupRecordIdByGlobalSettingsAndRefId (ilLTIPlatform $platform)
 Lookup record id for global settings and ref_id. More...
 
 saveGlobalToolConsumerSettings (ilLTIPlatform $platform)
 Save lti_ext_consumer. More...
 
 saveToolConsumerILIAS (ilLTIPlatform $platform)
 Save extended tool consumer object with ILIAS extensions. More...
 
 deleteGlobalToolConsumerSettings (ilLTIPlatform $platform)
 Delete global tool consumer settings. More...
 
 deleteToolConsumer (\ILIAS\LTI\ToolProvider\Platform $platform)
 Delete tool consumer object. More...
 
 getGlobalToolConsumerSettings ()
 Get global consumer settings. More...
 
 getToolConsumers ()
 
 loadContext (Context $context)
 Load context object. More...
 
 saveContext (Context $context)
 Save context object. More...
 
 deleteContext (Context $context)
 Delete context object. More...
 
 loadResourceLink (ResourceLink $resourceLink)
 Load resource link object. More...
 
 saveResourceLink (ResourceLink $resourceLink)
 Save resource link object. More...
 
 deleteResourceLink (ResourceLink $resourceLink)
 Delete resource link object. More...
 
 getUserResultSourcedIDsResourceLink (ResourceLink $resourceLink, bool $localOnly, int $idScope)
 Get array of user objects. More...
 
 loadPlatformNonce (\ILIAS\LTI\ToolProvider\PlatformNonce $nonce)
 Load nonce object. More...
 
 savePlatformNonce (\ILIAS\LTI\ToolProvider\PlatformNonce $nonce)
 Save nonce object. More...
 
 loadResourceLinkShareKey (ResourceLinkShareKey $shareKey)
 Load resource link share key object. More...
 
 saveResourceLinkShareKey (ResourceLinkShareKey $shareKey)
 Save resource link share key object. More...
 
 deleteResourceLinkShareKey (ResourceLinkShareKey $shareKey)
 Delete resource link share key object. More...
 
 loadUserResult (\ILIAS\LTI\ToolProvider\User $userresult)
 Load user object. More...
 
 saveUserResult (\ILIAS\LTI\ToolProvider\User $userresult)
 Save user object. More...
 
 deleteUser (\ILIAS\LTI\ToolProvider\User $user)
 Delete user object. More...
 
 lookupResourcesForUserObjectRelation (int $a_ref_id, string $a_lti_user, int $a_ext_consumer, ilDateTime $since=null)
 Lookup resources for user object relation. More...
 
 lookupResourcesForAllUsersSinceDate (ilDateTime $since)
 

Static Public Member Functions

static getDataConnector (object $db=null, string $dbTableNamePrefix='', string $type='')
 

Private Attributes

ilLogger $logger = null
 
ilDBInterface $database
 

Detailed Description

Definition at line 36 of file class.ilLTIDataConnector.php.

Constructor & Destructor Documentation

◆ __construct()

ilLTIDataConnector::__construct ( )

ilLTIDataConnector constructor.

Definition at line 45 of file class.ilLTIDataConnector.php.

46 {
47 global $DIC;
48 $this->database = $DIC->database();
49
50 $this->logger = ilLoggerFactory::getLogger('ltis');
51 $this->db = null;
52 $this->dbTableNamePrefix = "";
53 }
static getLogger(string $a_component_id)
Get component logger.
global $DIC
Definition: feed.php:28

References $DIC, ilLoggerFactory\getLogger(), and ILIAS\Repository\logger().

+ Here is the call graph for this function:

Member Function Documentation

◆ deleteContext()

ilLTIDataConnector::deleteContext ( Context  $context)

Delete context object.

Parameters
Context$contextContext object
Returns
boolean True if the Context object was successfully deleted

Definition at line 1030 of file class.ilLTIDataConnector.php.

1030 : bool
1031 {
1033
1034 // Delete any outstanding share keys for resource links for this context
1035 $query = 'DELETE sk ' .
1036 "FROM {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_SHARE_KEY_TABLE_NAME . ' sk ' .
1037 "INNER JOIN {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_TABLE_NAME . ' rl ON sk.resource_link_pk = rl.resource_link_pk ' .
1038 'WHERE rl.context_pk = %s';
1039 $types = array("integer");
1040 $values = array($context->getRecordId());
1041 $ilDB->manipulateF($query, $types, $values);
1042
1043 // Delete any users in resource links for this context
1044 $query = 'DELETE u ' .
1045 "FROM {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::USER_RESULT_TABLE_NAME . ' u ' .
1046 "INNER JOIN {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_TABLE_NAME . ' rl ON u.resource_link_pk = rl.resource_link_pk ' .
1047 'WHERE rl.context_pk = %s';
1048 $types = array("integer");
1049 $values = array($context->getRecordId());
1050 $ilDB->manipulateF($query, $types, $values);
1051
1052 // Update any resource links for which this consumer is acting as a primary resource link
1053 $query = "UPDATE {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_TABLE_NAME . ' prl ' .
1054 "INNER JOIN {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_TABLE_NAME . ' rl ON prl.primary_resource_link_pk = rl.resource_link_pk ' .
1055 'SET prl.primary_resource_link_pk = null, prl.share_approved = null ' .
1056 'WHERE rl.context_pk = %s';
1057 $types = array("integer");
1058 $values = array($context->getRecordId());
1059 $ilDB->manipulateF($query, $types, $values);
1060
1061 // Delete any resource links for this consumer
1062 $query = 'DELETE rl ' .
1063 "FROM {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_TABLE_NAME . ' rl ' .
1064 'WHERE rl.context_pk = %s';
1065 $types = array("integer");
1066 $values = array($context->getRecordId());
1067 $ilDB->manipulateF($query, $types, $values);
1068
1069 // Delete context
1070 $query = 'DELETE c ' .
1071 "FROM {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::CONTEXT_TABLE_NAME . ' c ' .
1072 'WHERE c.context_pk = %s';
1073 $types = array("integer");
1074 $values = array($context->getRecordId());
1075 $ok = (bool) $ilDB->manipulateF($query, $types, $values);
1076 if ($ok) {
1077 $context->initialize();
1078 }
1079
1080 return $ok;
1081 }
$query
$context
Definition: webdav.php:29

References $context, $database, $ilDB, and $query.

◆ deleteGlobalToolConsumerSettings()

ilLTIDataConnector::deleteGlobalToolConsumerSettings ( ilLTIPlatform  $platform)

Delete global tool consumer settings.

Definition at line 669 of file class.ilLTIDataConnector.php.

669 : bool
670 {
672
673 $query = 'DELETE FROM lti_ext_consumer WHERE id = %s';
674 $types = array("integer");
675 $values = array($platform->getExtConsumerId());
676 $ilDB->manipulateF($query, $types, $values);
677
678 $query = 'DELETE FROM lti_ext_consumer_otype WHERE consumer_id = %s';
679 $types = array("integer");
680 $values = array($platform->getExtConsumerId());
681 $ilDB->manipulateF($query, $types, $values);
682
683 $query = 'DELETE FROM lti2_consumer WHERE ext_consumer_id = %s';
684 $types = array("integer");
685 $values = array($platform->getExtConsumerId());
686 $ilDB->manipulateF($query, $types, $values);
687
688 // delete all assigned lti consumers
689 $platform->initialize();
690 return true;
691 }
initialize()
Initialise the platform.

References $database, $ilDB, $query, ilLTIPlatform\getExtConsumerId(), and ilLTIPlatform\initialize().

Referenced by ilLTIPlatform\deleteGlobalToolConsumerSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteResourceLink()

ilLTIDataConnector::deleteResourceLink ( ResourceLink  $resourceLink)

Delete resource link object.

Parameters
ResourceLink$resourceLinkResource_Link object
Returns
boolean True if the resource link object was successfully deleted

Definition at line 1285 of file class.ilLTIDataConnector.php.

1285 : bool
1286 {
1288
1289 // Delete any outstanding share keys for resource links for this consumer
1290 $query = "DELETE FROM {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_SHARE_KEY_TABLE_NAME . ' ' .
1291 'WHERE (resource_link_pk = %s)';
1292 $types = array("integer");
1293 $values = array($resourceLink->getRecordId());
1294 $ok = $ilDB->manipulateF($query, $types, $values);
1295
1296 // Delete users
1297 if ($ok) {
1298 $query = "DELETE FROM {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::USER_RESULT_TABLE_NAME . ' ' .
1299 'WHERE (resource_link_pk = %s)';
1300 $types = array("integer");
1301 $values = array($resourceLink->getRecordId());
1302 $ok = $ilDB->manipulateF($query, $types, $values);
1303 }
1304
1305 // Update any resource links for which this is the primary resource link
1306 if ($ok) {
1307 $query = "UPDATE {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_TABLE_NAME . ' ' .
1308 'SET primary_resource_link_pk = NULL ' .
1309 'WHERE (primary_resource_link_pk = %s)';
1310 $types = array("integer");
1311 $values = array($resourceLink->getRecordId());
1312 $ok = $ilDB->manipulateF($query, $types, $values);
1313 }
1314
1315 // Delete resource link
1316 if ($ok) {
1317 $query = "DELETE FROM {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_TABLE_NAME . ' ' .
1318 'WHERE (resource_link_pk = %s)';
1319 $types = array("integer");
1320 $values = array($resourceLink->getRecordId());
1321 $ok = (bool) $ilDB->manipulateF($query, $types, $values);
1322 }
1323
1324 if ($ok) {
1325 $resourceLink->initialize();
1326 }
1327
1328 return $ok;
1329 }

References $database, $ilDB, $query, ILIAS\LTI\ToolProvider\ResourceLink\getRecordId(), and ILIAS\LTI\ToolProvider\ResourceLink\initialize().

+ Here is the call graph for this function:

◆ deleteResourceLinkShareKey()

ilLTIDataConnector::deleteResourceLinkShareKey ( ResourceLinkShareKey  $shareKey)

Delete resource link share key object.

Parameters
ResourceLinkShareKey$shareKeyResource link share key object
Returns
boolean True if the resource link share key object was successfully deleted

Definition at line 1546 of file class.ilLTIDataConnector.php.

1546 : bool
1547 {
1549
1550 $query = "DELETE FROM {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_SHARE_KEY_TABLE_NAME . " WHERE share_key_id = %s";
1551 $types = array("text");
1552 $values = array($shareKey->getId());
1553 $ok = (bool) $ilDB->manipulateF($query, $types, $values);
1554
1555 if ($ok) {
1556 $shareKey->initialize();
1557 }
1558
1559 return $ok;
1560 }
initialize()
Initialise the resource link share key.

References $ilDB, $query, ILIAS\LTI\ToolProvider\ResourceLinkShareKey\getId(), and ILIAS\LTI\ToolProvider\ResourceLinkShareKey\initialize().

+ Here is the call graph for this function:

◆ deleteToolConsumer()

ilLTIDataConnector::deleteToolConsumer ( \ILIAS\LTI\ToolProvider\Platform  $platform)

Delete tool consumer object.

Parameters
Platform$platformConsumer object
Returns
boolean True if the tool consumer object was successfully deleted

Definition at line 698 of file class.ilLTIDataConnector.php.

698 : bool
699 {
701
702 // Delete any nonce values for this consumer
703 $query = "DELETE FROM {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::NONCE_TABLE_NAME . ' WHERE consumer_pk = %s';
704 $types = array("integer");
705 $values = array($platform->getRecordId());
706 $ilDB->manipulateF($query, $types, $values);
707
708 // Delete any outstanding share keys for resource links for this consumer
709 $query = 'DELETE sk ' .
710 "FROM {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_SHARE_KEY_TABLE_NAME . ' sk ' .
711 "INNER JOIN {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_TABLE_NAME . ' rl ON sk.resource_link_pk = rl.resource_link_pk ' .
712 'WHERE rl.consumer_pk = %s';
713 $types = array("integer");
714 $values = array($platform->getRecordId());
715 $ilDB->manipulateF($query, $types, $values);
716
717 // Delete any outstanding share keys for resource links for contexts in this consumer
718 $query = 'DELETE sk ' .
719 "FROM {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_SHARE_KEY_TABLE_NAME . ' sk ' .
720 "INNER JOIN {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_TABLE_NAME . ' rl ON sk.resource_link_pk = rl.resource_link_pk ' .
721 "INNER JOIN {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::CONTEXT_TABLE_NAME . ' c ON rl.context_pk = c.context_pk ' .
722 'WHERE c.consumer_pk = %s';
723 $types = array("integer");
724 $values = array($platform->getRecordId());
725 $ilDB->manipulateF($query, $types, $values);
726
727 // Delete any users in resource links for this consumer
728 $query = 'DELETE u ' .
729 "FROM {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::USER_RESULT_TABLE_NAME . ' u ' .
730 "INNER JOIN {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_TABLE_NAME . ' rl ON u.resource_link_pk = rl.resource_link_pk ' .
731 'WHERE rl.consumer_pk = %s';
732 $types = array("integer");
733 $values = array($platform->getRecordId());
734 $ilDB->manipulateF($query, $types, $values);
735
736 // Delete any users in resource links for contexts in this consumer
737 $query = 'DELETE u ' .
738 "FROM {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::USER_RESULT_TABLE_NAME . ' u ' .
739 "INNER JOIN {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_TABLE_NAME . ' rl ON u.resource_link_pk = rl.resource_link_pk ' .
740 "INNER JOIN {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::CONTEXT_TABLE_NAME . ' c ON rl.context_pk = c.context_pk ' .
741 'WHERE c.consumer_pk = %s';
742 $types = array("integer");
743 $values = array($platform->getRecordId());
744 $ilDB->manipulateF($query, $types, $values);
745
746 // Update any resource links for which this consumer is acting as a primary resource link
747 $query = "UPDATE {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_TABLE_NAME . ' prl ' .
748 "INNER JOIN {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_TABLE_NAME . ' rl ON prl.primary_resource_link_pk = rl.resource_link_pk ' .
749 'SET prl.primary_resource_link_pk = NULL, prl.share_approved = NULL ' .
750 'WHERE rl.consumer_pk = %s';
751 $types = array("integer");
752 $values = array($platform->getRecordId());
753 $ilDB->manipulateF($query, $types, $values);
754
755 // Update any resource links for contexts in which this consumer is acting as a primary resource link
756 $query = "UPDATE {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_TABLE_NAME . ' prl ' .
757 "INNER JOIN {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_TABLE_NAME . ' rl ON prl.primary_resource_link_pk = rl.resource_link_pk ' .
758 "INNER JOIN {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::CONTEXT_TABLE_NAME . ' c ON rl.context_pk = c.context_pk ' .
759 'SET prl.primary_resource_link_pk = NULL, prl.share_approved = NULL ' .
760 'WHERE c.consumer_pk = %s';
761 $types = array("integer");
762 $values = array($platform->getRecordId());
763 $ilDB->manipulateF($query, $types, $values);
764
765 // Delete any resource links for this consumer
766 $query = 'DELETE rl ' .
767 "FROM {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_TABLE_NAME . ' rl ' .
768 'WHERE rl.consumer_pk = %s';
769 $types = array("integer");
770 $values = array($platform->getRecordId());
771 $ilDB->manipulateF($query, $types, $values);
772
773 // Delete any resource links for contexts in this consumer
774 $query = 'DELETE rl ' .
775 "FROM {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_TABLE_NAME . ' rl ' .
776 "INNER JOIN {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::CONTEXT_TABLE_NAME . ' c ON rl.context_pk = c.context_pk ' .
777 'WHERE c.consumer_pk = %s';
778 $types = array("integer");
779 $values = array($platform->getRecordId());
780 $ilDB->manipulateF($query, $types, $values);
781
782 // Delete any contexts for this consumer
783 $query = 'DELETE c ' .
784 "FROM {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::CONTEXT_TABLE_NAME . ' c ' .
785 'WHERE c.consumer_pk = %s';
786 $types = array("integer");
787 $values = array($platform->getRecordId());
788 $ilDB->manipulateF($query, $types, $values);
789
790 // Delete consumer
791 $query = 'DELETE c ' .
792 "FROM {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::CONSUMER_TABLE_NAME . ' c ' .
793 'WHERE c.consumer_pk = %s';
794 $types = array("integer");
795 $values = array($platform->getRecordId());
796 $ilDB->manipulateF($query, $types, $values);
797
798 // if ($ok) {
799 $platform->initialize();
800 // }
801
802 return true;
803 }

References $database, $ilDB, and $query.

◆ deleteUser()

ilLTIDataConnector::deleteUser ( \ILIAS\LTI\ToolProvider\User  $user)

Delete user object.

Parameters
User$userUser object
Returns
boolean True if the user object was successfully deleted

Definition at line 1665 of file class.ilLTIDataConnector.php.

1665 : bool
1666 {
1668
1669 $query = 'DELETE from ' . $this->dbTableNamePrefix . ToolProvider\DataConnector\DataConnector::USER_RESULT_TABLE_NAME . ' ' .
1670 'WHERE user_pk = ' . $ilDB->quote($user->getRecordId(), 'integer');
1671
1672 $ok = false;
1673 try {
1674 $ilDB->manipulate($query);
1675 $user->initialize();
1676 $ok = true;
1677 } catch (ilDatabaseException $e) {
1678 $this->logger->error((string) $e);
1679 }
1680 return $ok;
1681 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References Vendor\Package\$e, $ilDB, $query, and ILIAS\Repository\logger().

+ Here is the call graph for this function:

◆ getDataConnector()

static ilLTIDataConnector::getDataConnector ( object  $db = null,
string  $dbTableNamePrefix = '',
string  $type = '' 
)
static

Definition at line 1746 of file class.ilLTIDataConnector.php.

1747 {
1749 return $dataConnector;
1750 }
ilLTIDataConnector $dataConnector
Data connector object.
Definition: System.php:64

References ILIAS\LTI\ToolProvider\$dataConnector.

Referenced by ilLTITool\__construct(), and ilLTIPlatform\__construct().

+ Here is the caller graph for this function:

◆ getGlobalToolConsumerSettings()

ilLTIDataConnector::getGlobalToolConsumerSettings ( )

Get global consumer settings.

Returns
\ilLTIPlatform[]

Definition at line 809 of file class.ilLTIDataConnector.php.

809 : array
810 {
812
813 $platforms = array();
814 $query = 'SELECT * from lti_ext_consumer ';
815 $res = $ilDB->query($query);
816 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
817 $platform = new ilLTIPlatform(null, $this);
818 $platform->setExtConsumerId((int) $row->id);
819 $platform->setTitle($row->title);
820 $platform->setDescription($row->description);
821 $platform->setPrefix($row->prefix);
822 $platform->setLanguage($row->user_language);
823 $platform->setRole((int) $row->role);
824 $platform->setActive((bool) $row->active);
825 $platforms[] = $platform;
826 }
827 return $platforms;
828 }
LTI provider for LTI launch.
$res
Definition: ltiservices.php:69

References $database, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilObjectConsumerTableGUI\getItems().

+ Here is the caller graph for this function:

◆ getToolConsumers()

ilLTIDataConnector::getToolConsumers ( )
Returns
\ilLTIPlatform[]

Definition at line 838 of file class.ilLTIDataConnector.php.

838 : array
839 {
841 $platforms = array();
842 $query = 'SELECT consumer_pk, name, consumer_key256, consumer_key, secret, lti_version, ' .
843 'consumer_name, consumer_version, consumer_guid, ' .
844 'profile, tool_proxy, settings, protected, enabled, ' .
845 'enable_from, enable_until, last_access, created, updated, ' .
846 'title, description, prefix, user_language, role, local_role_always_member, default_skin ' .
847 'FROM lti2_consumer, lti_ext_consumer ' .
848 'WHERE lti_ext_consumer.id = consumer_pk';
849
850 // $sql = 'SELECT consumer_pk, consumer_key, consumer_key, name, secret, lti_version, consumer_name, consumer_version, consumer_guid, ' .
851 // 'profile, tool_proxy, settings, ' .
852 // 'protected, enabled, enable_from, enable_until, last_access, created, updated ' .
853 // "FROM {$this->dbTableNamePrefix}" . Tool\DataConnector\DataConnector::CONSUMER_TABLE_NAME . ' ' .
854 // 'ORDER BY name';
855 // $rsConsumers = mysql_query($sql);
856 // if ($rsConsumers) {
857 // while ($row = mysql_fetch_object($rsConsumers)) {
858 $res = $ilDB->query($query);
859 // if ($rsConsumer) {
860 while ($row = $ilDB->fetchObject($res)) {
861 // $platform = new Tool\Platform($row->consumer_key, $this); //ACHTUNG: FEHLER IN BIBLIOTHEK; $row->consumer_key ist i.d.R. null
862 $platform = new ilLTIPlatform(null, $this);
863 $platform->setRecordId(intval($row->consumer_pk));
864 $platform->name = $row->name;
865 $platform->secret = $row->secret;
866 $platform->ltiVersion = $row->lti_version;
867 $platform->consumerName = $row->consumer_name;
868 $platform->consumerVersion = $row->consumer_version;
869 $platform->consumerGuid = $row->consumer_guid;
870 $platform->profile = json_decode($row->profile);
871 $platform->toolProxy = $row->tool_proxy;
872 $settings = unserialize($row->settings);
873 if (!is_array($settings)) {
874 $settings = array();
875 }
876 $platform->setSettings($settings);
877 $platform->protected = (intval($row->protected) === 1);
878 $platform->enabled = (intval($row->enabled) === 1);
879 $platform->enableFrom = null;
880 if (!is_null($row->enable_from)) {
881 $platform->enableFrom = strtotime($row->enable_from);
882 }
883 $platform->enableUntil = null;
884 if (!is_null($row->enable_until)) {
885 $platform->enableUntil = strtotime($row->enable_until);
886 }
887 $platform->lastAccess = null;
888 if (!is_null($row->last_access)) {
889 $platform->lastAccess = strtotime($row->last_access);
890 }
891 $platform->created = strtotime($row->created);
892 $platform->updated = strtotime($row->updated);
893 //ILIAS specific
894 $platform->setTitle($row->title);
895 $platform->setDescription($row->description);
896 $platform->setPrefix($row->prefix);
897 $platform->setLanguage($row->user_language);
898 $platform->setRole($row->role);
899 // local_role_always_member
900 // default_skin
901 $platform->setKey($row->consumer_key256);//ACHTUNG: hier müsste evtl. consumer_key sein
902 $platforms[] = $platform;
903 }
904 // mysql_free_result($rsConsumers);
905 // }
906
907 return $platforms;
908 }
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200

References $database, $ilDB, $query, $res, and ILIAS\LTI\ToolProvider\$settings.

◆ getUserResultSourcedIDsResourceLink()

ilLTIDataConnector::getUserResultSourcedIDsResourceLink ( ResourceLink  $resourceLink,
bool  $localOnly,
int  $idScope 
)

Get array of user objects.

Obtain an array of User objects for users with a result sourcedId. The array may include users from other resource links which are sharing this resource link. It may also be optionally indexed by the user ID of a specified scope.

Parameters
ResourceLink$resourceLinkResource link object
boolean$localOnlyTrue if only users within the resource link are to be returned (excluding users sharing this resource link)
int$idScopeScope value to use for user IDs
Returns
array Array of User objects

Definition at line 1340 of file class.ilLTIDataConnector.php.

1344 : array {
1346
1347 $users = array();
1348
1349 // if ($localOnly) {
1350 // $query = 'SELECT u.user_pk, u.lti_result_sourcedid, u.lti_user_id, u.created, u.updated ' .
1351 // "FROM {$this->dbTableNamePrefix}" . Tool\DataConnector\DataConnector::USER_RESULT_TABLE_NAME . ' AS u ' .
1352 // "INNER JOIN {$this->dbTableNamePrefix}" . Tool\DataConnector\DataConnector::RESOURCE_LINK_TABLE_NAME . ' AS rl ' .
1353 // 'ON u.resource_link_pk = rl.resource_link_pk ' .
1354 // "WHERE (rl.resource_link_pk = %d) AND (rl.primary_resource_link_pk IS NULL)",
1355 // $resourceLink->getRecordId());
1356 // } else {
1357 // $query = 'SELECT u.user_pk, u.lti_result_sourcedid, u.lti_user_id, u.created, u.updated ' .
1358 // "FROM {$this->dbTableNamePrefix}" . Tool\DataConnector\DataConnector::USER_RESULT_TABLE_NAME . ' AS u ' .
1359 // "INNER JOIN {$this->dbTableNamePrefix}" . Tool\DataConnector\DataConnector::RESOURCE_LINK_TABLE_NAME . ' AS rl ' .
1360 // 'ON u.resource_link_pk = rl.resource_link_pk ' .
1361 // 'WHERE ((rl.resource_link_pk = %d) AND (rl.primary_resource_link_pk IS NULL)) OR ' .
1362 // '((rl.primary_resource_link_pk = %d) AND (share_approved = 1))',
1363 // $resourceLink->getRecordId(), $resourceLink->getRecordId());
1364 // }
1365 // $rsUser = mysql_query($sql);
1366 // if ($rsUser) {
1367 // while ($row = $ilDB->fetchObject($rsUser)) {
1368 // $user = Tool\User::fromResourceLink($resourceLink, $row->lti_user_id);
1369 // $user->setRecordId(intval($row->user_pk));
1370 // $user->ltiResultSourcedId = $row->lti_result_sourcedid;
1371 // $user->created = strtotime($row->created);
1372 // $user->updated = strtotime($row->updated);
1373 // if (is_null($idScope)) {
1374 // $users[] = $user;
1375 // } else {
1376 // $users[$user->getId($idScope)] = $user;
1377 // }
1378 // }
1379 // }
1380
1381 return $users;
1382 }

◆ loadContext()

ilLTIDataConnector::loadContext ( Context  $context)

Load context object.

Parameters
Context$contextContext object
Returns
boolean True if the context object was successfully loaded

Definition at line 946 of file class.ilLTIDataConnector.php.

946 : bool
947 {
949 $ok = false;
950 if (!empty($context->getRecordId())) {
951 $query = 'SELECT context_pk, consumer_pk, lti_context_id, settings, created, updated ' .
952 "FROM {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::CONTEXT_TABLE_NAME . ' ' .
953 'WHERE (context_pk = %s)';
954 $types = array("integer");
955 $values = array($context->getRecordId());
956 } else {
957 $query = 'SELECT context_pk, consumer_pk, lti_context_id, settings, created, updated ' .
958 "FROM {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::CONTEXT_TABLE_NAME . ' ' .
959 'WHERE (consumer_pk = %s) AND (lti_context_id = %s)';
960 $types = array("integer", "text");
961 $values = array($context->getPlatform()->getRecordId(), $context->ltiContextId);
962 }
963 $rs_context = $ilDB->queryF($query, $types, $values);
964 if ($rs_context) {
965 $row = $ilDB->fetchObject($rs_context);
966 if ($row) {
967 $context->setRecordId(intval($row->context_pk));
968 $context->setPlatformId(intval($row->consumer_pk));
969 $context->ltiContextId = $row->lti_context_id;
970 $settings = json_decode($row->settings);
971 if (!is_array($settings)) {
972 $settings = array();
973 }
974 $context->setSettings($settings);
975 $context->created = strtotime($row->created);
976 $context->updated = strtotime($row->updated);
977 $ok = true;
978 }
979 }
980
981 return $ok;
982 }

References $context, $database, $ilDB, $query, and ILIAS\LTI\ToolProvider\$settings.

◆ loadGlobalToolConsumerSettings()

ilLTIDataConnector::loadGlobalToolConsumerSettings ( ilLTIPlatform  $platform)

Load global tool consumer settings in consumer.

Parameters
ilLTIPlatform$platform
Returns
bool

Definition at line 199 of file class.ilLTIDataConnector.php.

199 : bool
200 {
202
203 $query = 'SELECT * from lti_ext_consumer where id = ' . $ilDB->quote($platform->getExtConsumerId(), 'integer');
204 $res = $ilDB->query($query);
205 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
206 $platform->setTitle($row->title);
207 $platform->setDescription($row->description);
208 $platform->setPrefix($row->prefix);
209 $platform->setLanguage($row->user_language);
210 $platform->setRole((int) $row->role);
211 $platform->setActive((bool) $row->active);
212 return true;
213 }
214 return false;
215 }
setDescription(string $description)
setTitle(string $title)
setActive(bool $value)
setLanguage(string $lang)
setPrefix(string $prefix)
setRole(int $role_id)

References $database, $ilDB, $query, $res, ilDBConstants\FETCHMODE_OBJECT, ilLTIPlatform\getExtConsumerId(), ilLTIPlatform\setActive(), ilLTIPlatform\setDescription(), ilLTIPlatform\setLanguage(), ilLTIPlatform\setPrefix(), ilLTIPlatform\setRole(), and ilLTIPlatform\setTitle().

Referenced by ilLTIPlatform\fromConsumerKey(), ilLTIPlatform\fromExternalConsumerId(), ilLTIPlatform\fromPlatformId(), and ilLTIPlatform\fromRecordId().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadPlatform()

ilLTIDataConnector::loadPlatform ( \ILIAS\LTI\ToolProvider\Platform  $platform)

Load platform object.

Parameters
Platform$platformPlatform object
Returns
boolean True if the tool consumer object was successfully loaded

Definition at line 63 of file class.ilLTIDataConnector.php.

63 : bool
64 {
65 $ok = false;
66 $allowMultiple = false;
67 $id = $platform->getRecordId();
68 $query = 'SELECT consumer_pk, name, consumer_key, secret, ' .
69 'platform_id, client_id, deployment_id, public_key, ' .
70 'lti_version, signature_method, consumer_name, consumer_version, consumer_guid, ' .
71 'profile, tool_proxy, settings, protected, enabled, ' .
72 'enable_from, enable_until, last_access, created, updated, ext_consumer_id, ref_id ' .
73 'FROM lti2_consumer WHERE ';
74 if (!is_null($id)) {
75 $query .= 'consumer_pk = %s';
76 $types = array('integer');
77 $values = array($id);
78 } elseif (!empty($platform->platformId)) {
79 if (empty($platform->clientId)) {
80 $allowMultiple = true;
81 $query .= '(platform_id = %s)';
82 $types = array('text');
83 $values = array($platform->platformId);
84 } elseif (empty($platform->deploymentId)) {
85 $allowMultiple = true;
86 $query .= '(platform_id = %s) AND (client_id = %s)';
87 $types = array('text','text');
88 $values = array($platform->platformId, $platform->clientId);
89 } else {
90 $query .= '(platform_id = %s) AND (client_id = %s) AND (deployment_id = %s)';
91 $types = array('text','text','text');
92 $values = array($platform->platformId, $platform->clientId, $platform->deploymentId);
93 }
94 } elseif (!empty($platform->getKey())) {
95 $key = $platform->getKey();
96 $query .= 'consumer_key = %s';
97 $types = array('text');
98 $values = array($key);
99 } else {
100 return false;
101 }
102 // $ok = $this->executeQuery($sql, $stmt);
103 // if ($ok) {
104 // $rsConsumer = $stmt->get_result();
105 // $ok = $rsConsumer !== false;
106 // if ($ok) {
107 // $row = $rsConsumer->fetch_object();
108 // $ok = $row && ($allowMultiple || is_null($rsConsumer->fetch_object()));
109 // }
110 // }
111 // if ($ok) {
112 $res = $this->database->queryF($query, $types, $values);
113 while ($row = $this->database->fetchObject($res)) {
114 $platform->setRecordId(intval($row->consumer_pk));
115 $platform->name = $row->name;
116 $platform->setkey((string) $row->consumer_key);
117 $platform->secret = $row->secret;
118 $platform->platformId = $row->platform_id;
119 $platform->clientId = $row->client_id;
120 $platform->deploymentId = $row->deployment_id;
121 $platform->rsaKey = $row->public_key;
122 $platform->ltiVersion = $row->lti_version;
123 $platform->signatureMethod = $row->signature_method;
124 $platform->consumerName = $row->consumer_name;
125 $platform->consumerVersion = $row->consumer_version;
126 $platform->consumerGuid = $row->consumer_guid;
127 $platform->profile = json_decode((string) $row->profile);
128 $platform->toolProxy = $row->tool_proxy;
129 $settings = json_decode($row->settings, true);
130 if (!is_array($settings)) {
131 $settings = @unserialize($row->settings); // check for old serialized setting
132 }
133 if (!is_array($settings)) {
134 $settings = array();
135 }
136 $platform->setSettings($settings);
137 $platform->protected = (intval($row->protected) === 1);
138 $platform->enabled = (intval($row->enabled) === 1);
139 $platform->enableFrom = null;
140 if (!is_null($row->enable_from)) {
141 $platform->enableFrom = strtotime($row->enable_from);
142 }
143 $platform->enableUntil = null;
144 if (!is_null($row->enable_until)) {
145 $platform->enableUntil = strtotime($row->enable_until);
146 }
147 $platform->lastAccess = null;
148 if (!is_null($row->last_access)) {
149 $platform->lastAccess = strtotime($row->last_access);
150 }
151 $platform->created = strtotime($row->created);
152 $platform->updated = strtotime($row->updated);
153 //ILIAS specific
154 $platform->setExtConsumerId(intval($row->ext_consumer_id));
155 $platform->setRefId((int) $row->ref_id);
156 // if ($platform->setTitle) $platform->setTitle($row->title);
157 // if ($platform->setDescription) $platform->setDescription($row->description);
158 // if ($platform->setPrefix) $platform->setPrefix($row->prefix);
159 // if ($platform->setPrefix) $platform->setLanguage($row->user_language);
160 // if ($platform->setPrefix) $platform->setRole($row->role);
161 // local_role_always_member
162 // default_skin
163 $this->fixPlatformSettings($platform, false);
164 $ok = true;
165 }
166 return $ok;
167 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
string $key
Consumer key/client ID value.
Definition: System.php:193

References $id, ILIAS\LTI\ToolProvider\$key, $query, $res, and ILIAS\LTI\ToolProvider\$settings.

Referenced by ilLTIPlatform\fromConsumerKey(), ILIAS\LTI\ToolProvider\Platform\fromConsumerKey(), ilLTIPlatform\fromPlatformId(), and ilLTIPlatform\fromRecordId().

+ Here is the caller graph for this function:

◆ loadPlatformNonce()

ilLTIDataConnector::loadPlatformNonce ( \ILIAS\LTI\ToolProvider\PlatformNonce  $nonce)

Load nonce object.

Parameters
PlatformNonce$nonceNonce object
Returns
boolean True if the nonce object was successfully loaded

Definition at line 1425 of file class.ilLTIDataConnector.php.

1425 : bool
1426 {
1428
1429 $ok = true;
1430
1431 // Delete any expired nonce values
1432 $now = date("{$this->dateFormat} {$this->timeFormat}", time());//PRÜFEN UK
1433 $query = "DELETE FROM {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::NONCE_TABLE_NAME . " WHERE expires <= %s";
1434 $types = array("timestamp");
1435 $values = array($now);
1436 $ilDB->manipulateF($query, $types, $values);
1437 // Load the nonce
1438 $query = "SELECT value AS T FROM {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::NONCE_TABLE_NAME . ' WHERE (consumer_pk = %s) AND (value = %s)';
1439 $types = array("integer", "text");
1440 $values = array($nonce->getPlatform()->getRecordId(), $nonce->getValue());
1441 $rs_nonce = $ilDB->queryF($query, $types, $values);
1442 if ($rs_nonce) {
1443 $row = $ilDB->fetchObject($rs_nonce);
1444 if (!$row) {
1445 $ok = false;
1446 }
1447 }
1448
1449 return $ok;
1450 }

References $ilDB, and $query.

◆ loadResourceLink()

ilLTIDataConnector::loadResourceLink ( ResourceLink  $resourceLink)

Load resource link object.

Parameters
ResourceLink$resourceLinkResource_Link object
Returns
boolean True if the resource link object was successfully loaded

Definition at line 1092 of file class.ilLTIDataConnector.php.

1092 : bool
1093 {
1095
1096 $ok = false;
1097 $id = $resourceLink->getRecordId();
1098 $rid = 0;
1099 $cid = 0;
1100 if (!is_null($id)) {
1101 $query = 'SELECT resource_link_pk, context_pk, consumer_pk, lti_resource_link_id, settings, primary_resource_link_pk, share_approved, created, updated ' .
1102 "FROM {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_TABLE_NAME . ' ' .
1103 'WHERE (resource_link_pk = %s)';
1104 $types = array("integer");
1105 $values = array($id);
1106 } elseif (!is_null($resourceLink->getContext())) {
1107 $rid = $resourceLink->getId();
1108 $cid = $resourceLink->getContext()->getRecordId();
1109 $query = 'SELECT resource_link_pk, context_pk, consumer_pk, lti_resource_link_id, settings, primary_resource_link_pk, share_approved, created, updated ' .
1110 "FROM {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_TABLE_NAME . ' r ' .
1111 'WHERE (r.lti_resource_link_id = %s) AND ((r.context_pk = %s) OR (r.consumer_pk IN (' .
1112 'SELECT c.consumer_pk ' .
1113 "FROM {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::CONTEXT_TABLE_NAME . ' c ' .
1114 'WHERE (c.context_pk = %s))))';
1115 $types = array("text", "integer", "integer");
1116 $values = array($rid, $cid, $cid);
1117 } else {
1118 $id = $resourceLink->getPlatform()->getRecordId();
1119 $rid = $resourceLink->getId();
1120 $query = 'SELECT r.resource_link_pk, r.context_pk, r.consumer_pk, r.lti_resource_link_id, r.settings, r.primary_resource_link_pk, r.share_approved, r.created, r.updated ' .
1121 "FROM {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_TABLE_NAME . ' r LEFT OUTER JOIN ' .
1122 $this->dbTableNamePrefix . ToolProvider\DataConnector\DataConnector::CONTEXT_TABLE_NAME . ' c ON r.context_pk = c.context_pk ' .
1123 ' WHERE ((r.consumer_pk = %s) OR (c.consumer_pk = %s)) AND (lti_resource_link_id = %s)';
1124 $types = array("integer", "integer", "text");
1125 $values = array($id, $id, $rid);
1126 }
1127 $this->logger->debug("loadResourceLink id = " . $id . " rid =" . $rid . " cid =" . $cid . " query = " . $query);
1128 $rsContext = $ilDB->queryF($query, $types, $values);
1129 if ($rsContext) {
1130 $row = $ilDB->fetchObject($rsContext);
1131 if ($row) {
1132 $resourceLink->setRecordId(intval($row->resource_link_pk));
1133 if (!is_null($row->context_pk)) {
1134 $resourceLink->setContextId(intval($row->context_pk));
1135 } else {
1136 $resourceLink->setContextId(null);
1137 }
1138 if (!is_null($row->consumer_pk)) {
1139 $resourceLink->setPlatformId(intval($row->consumer_pk));
1140 } else {
1141 $resourceLink->setPlatformId(null);
1142 }
1143 //$resourceLink->title = $row->title;
1144 $resourceLink->ltiResourceLinkId = $row->lti_resource_link_id;
1145 $settings = json_decode($row->settings, true);
1146 if (!is_array($settings)) {
1147 $settings = @unserialize($row->settings); // check for old serialized setting
1148 }
1149 if (!is_array($settings)) {
1150 $settings = array();
1151 }
1152 $resourceLink->setSettings($settings);
1153 if (!is_null($row->primary_resource_link_pk)) {
1154 // $resourceLink->primaryResourceLinkId = intval($row->primary_resource_link_pk); //UK Check
1155 $resourceLink->primaryResourceLinkId = (string) ($row->primary_resource_link_pk);
1156 } else {
1157 $resourceLink->primaryResourceLinkId = null;
1158 }
1159 $resourceLink->shareApproved = (is_null($row->share_approved)) ? null : (intval($row->share_approved) === 1);
1160 $resourceLink->created = strtotime($row->created);
1161 $resourceLink->updated = strtotime($row->updated);
1162 } else {
1163 $ok = false;
1164 }
1165 }
1166
1167
1168 return $ok;
1169 }

References $database, $id, $ilDB, $query, ILIAS\LTI\ToolProvider\$settings, ILIAS\LTI\ToolProvider\ResourceLink\getContext(), ILIAS\LTI\ToolProvider\ResourceLink\getId(), ILIAS\LTI\ToolProvider\ResourceLink\getPlatform(), ILIAS\LTI\ToolProvider\ResourceLink\getRecordId(), ILIAS\Repository\logger(), ILIAS\LTI\ToolProvider\ResourceLink\setContextId(), ILIAS\LTI\ToolProvider\ResourceLink\setPlatformId(), ILIAS\LTI\ToolProvider\ResourceLink\setRecordId(), and ILIAS\LTI\ToolProvider\ResourceLink\setSettings().

+ Here is the call graph for this function:

◆ loadResourceLinkShareKey()

ilLTIDataConnector::loadResourceLinkShareKey ( ResourceLinkShareKey  $shareKey)

Load resource link share key object.

Parameters
ResourceLinkShareKey$shareKeyResource_Link share key object
Returns
boolean True if the resource link share key object was successfully loaded

Definition at line 1481 of file class.ilLTIDataConnector.php.

1481 : bool
1482 {
1484
1485 $ok = false;
1486
1487 // Clear expired share keys
1488 $now = date("{$this->dateFormat} {$this->timeFormat}", time());
1489 $query = "DELETE FROM {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_SHARE_KEY_TABLE_NAME . " WHERE expires <= '%s'";
1490 $types = array("timestamp");
1491 $values = array($now);
1492 $ilDB->manipulateF($query, $types, $values);
1493
1494 // Load share key
1495 // $id = mysql_real_escape_string($shareKey->getId());//ACHTUNG UK utf8
1496 $id = $shareKey->getId();
1497 $query = 'SELECT resource_link_pk, auto_approve, expires ' .
1498 "FROM {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_SHARE_KEY_TABLE_NAME . ' ' .
1499 "WHERE share_key_id = %s";
1500 $types = array("text");
1501 $values = array($id);
1502 $rsShareKey = $ilDB->queryF($query, $types, $values);
1503 if ($rsShareKey) {
1504 $row = $ilDB->fetchObject($rsShareKey);
1505 if ($row && (intval($row->resource_link_pk) === $shareKey->resourceLinkId)) {
1506 $shareKey->autoApprove = (intval($row->auto_approve) === 1);
1507 $shareKey->expires = strtotime($row->expires);
1508 $ok = true;
1509 }
1510 }
1511
1512 return $ok;
1513 }

References $id, $ilDB, $query, and ILIAS\LTI\ToolProvider\ResourceLinkShareKey\getId().

+ Here is the call graph for this function:

◆ loadUserResult()

ilLTIDataConnector::loadUserResult ( \ILIAS\LTI\ToolProvider\User  $userresult)

Load user object.

Parameters
User$userUser object
Returns
boolean True if the user object was successfully loaded

Definition at line 1572 of file class.ilLTIDataConnector.php.

1572 : bool
1573 {
1575 $id = $userresult->getRecordId();
1576 if (!is_null($id)) {
1577 $query = 'SELECT user_pk, resource_link_pk, lti_user_id, lti_result_sourcedid, created, updated ' .
1578 'FROM ' . $this->dbTableNamePrefix . ToolProvider\DataConnector\DataConnector::USER_RESULT_TABLE_NAME . ' ' .
1579 'WHERE user_pk = ' . $ilDB->quote($id, 'integer');
1580 } else {
1581 $rid = $userresult->getResourceLink()->getRecordId();
1582 $uid = $userresult->getId(ToolProvider\Tool::ID_SCOPE_ID_ONLY);
1583
1584 $query = 'SELECT user_pk, resource_link_pk, lti_user_id, lti_result_sourcedid, created, updated ' .
1585 'FROM ' . $this->dbTableNamePrefix . ToolProvider\DataConnector\DataConnector::USER_RESULT_TABLE_NAME . ' ' .
1586 'WHERE resource_link_pk = ' . $ilDB->quote($rid, 'integer') . ' ' .
1587 'AND lti_user_id = ' . $ilDB->quote($uid, 'text');
1588 }
1589
1590 $this->logger->debug('Loading user with query: ' . $query);
1591
1592 $ok = false;
1593 try {
1594 $res = $ilDB->query($query);
1595 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1596 $userresult->setRecordId((int) $row->user_pk);
1597 $userresult->setResourceLinkId((int) $row->resource_link_pk);
1598 $userresult->ltiUserId = (string) $row->lti_user_id;
1599 $userresult->ltiResultSourcedId = (string) $row->lti_result_sourcedid;
1600 $userresult->created = strtotime($row->created);
1601 $userresult->updated = strtotime($row->updated);
1602 $ok = true;
1603 }
1604 } catch (ilDatabaseException $e) {
1605 $this->logger->error((string) $e);
1606 }
1607 return $ok;
1608 }

References Vendor\Package\$e, $id, $ilDB, $query, $res, ilDBConstants\FETCHMODE_OBJECT, and ILIAS\Repository\logger().

+ Here is the call graph for this function:

◆ lookupRecordIdByGlobalSettingsAndRefId()

ilLTIDataConnector::lookupRecordIdByGlobalSettingsAndRefId ( ilLTIPlatform  $platform)

Lookup record id for global settings and ref_id.

Parameters
ilLTIPlatform$platform
Returns
int|null

Definition at line 313 of file class.ilLTIDataConnector.php.

313 : ?int
314 {
315 $db = $this->database;
316
317 $query = 'SELECT consumer_pk from lti2_consumer ' .
318 'WHERE ext_consumer_id = ' . $db->quote($platform->getExtConsumerId(), 'integer') . ' ' .
319 'AND ref_id = ' . $db->quote($platform->getRefId(), 'integer');
320 $res = $db->query($query);
321 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
322 return (int) $row->consumer_pk;
323 }
324 return null;
325 }

References $database, $query, $res, ilDBConstants\FETCHMODE_OBJECT, ilLTIPlatform\getExtConsumerId(), and ilLTIPlatform\getRefId().

Referenced by ilLTIPlatform\fromGlobalSettingsAndRefId().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupResourcesForAllUsersSinceDate()

ilLTIDataConnector::lookupResourcesForAllUsersSinceDate ( ilDateTime  $since)
Parameters
\ilDateTime$since
Returns
array<string, string[]>

Definition at line 1726 of file class.ilLTIDataConnector.php.

1726 : array
1727 {
1728 $db = $this->database;
1730
1731 $query = 'select lti_user_id, rl.resource_link_pk, ec.id, ref_id ' .
1732 'from lti2_resource_link rl join lti2_user_result ur on rl.resource_link_pk = ur.resource_link_pk ' .
1733 'join lti2_consumer c on rl.consumer_pk = c.consumer_pk ' .
1734 'join lti_ext_consumer ec on ext_consumer_id = ec.id ' .
1735 'where c.enabled = ' . $db->quote(1, 'integer') . ' ' .
1736 'and rl.updated > ' . $db->quote($since->get(IL_CAL_DATETIME), 'timestamp');
1737 $res = $db->query($query);
1738
1739 $results = [];
1740 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1741 $results[$row->id . '__' . $row->lti_user_id][] = $row->resource_link_pk . '__' . $row->ref_id;
1742 }
1743 return $results;
1744 }
const IL_CAL_DATETIME
get(int $a_format, string $a_format_str='', string $a_tz='')
get formatted date
$results

References $query, $res, $results, ilDBConstants\FETCHMODE_OBJECT, ilDateTime\get(), ilLoggerFactory\getLogger(), and IL_CAL_DATETIME.

+ Here is the call graph for this function:

◆ lookupResourcesForUserObjectRelation()

ilLTIDataConnector::lookupResourcesForUserObjectRelation ( int  $a_ref_id,
string  $a_lti_user,
int  $a_ext_consumer,
ilDateTime  $since = null 
)

Lookup resources for user object relation.

Parameters
int$a_ref_id
string$a_lti_user
int$a_ext_consumer
ilDateTime | null$since
Returns
int[]

Definition at line 1691 of file class.ilLTIDataConnector.php.

1696 : array {
1697 $db = $this->database;
1698
1700
1701 $query = 'select rl.resource_link_pk ' .
1702 'from lti2_user_result ur join lti2_resource_link rl on rl.resource_link_pk = ur.resource_link_pk ' .
1703 'join lti2_consumer c on rl.consumer_pk = c.consumer_pk ' .
1704 'join lti_ext_consumer ec on c.ext_consumer_id = ec.id ' .
1705 'where c.enabled = ' . $db->quote(1, 'integer') . ' ' .
1706 'and ref_id = ' . $db->quote($a_ref_id, 'integer') . ' ' .
1707 'and ur.lti_user_id = ' . $db->quote($a_lti_user, 'text') . ' ' .
1708 'and ec.id = ' . $db->quote($a_ext_consumer, 'integer');
1710 $resource_links = [];
1711 try {
1712 $res = $db->query($query);
1713 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1714 $resource_links[] = $row->resource_link_pk;
1715 }
1716 } catch (ilDatabaseException $e) {
1717 $logger->error('Query execution failed with message: ' . $e->getMessage());
1718 }
1719 return $resource_links;
1720 }
debug(string $a_message, array $a_context=array())
error(string $a_message)

Referenced by ilLTIAppEventListener\handleOutcomeWithoutLP().

+ Here is the caller graph for this function:

◆ saveContext()

ilLTIDataConnector::saveContext ( Context  $context)

Save context object.

Parameters
Context$contextContext object
Returns
boolean True if the context object was successfully saved

Definition at line 989 of file class.ilLTIDataConnector.php.

989 : bool
990 {
992
993 $time = time();
994 $now = date("{$this->dateFormat} {$this->timeFormat}", $time);
995 //old: $settingsValue = serialize($context->getSettings());
996 $settingsValue = json_encode($context->getSettings());
997 $id = $context->getRecordId();
998 $platform_pk = $context->getPlatform()->getRecordId();
999 if (empty($id)) {
1000 $context->setRecordId($ilDB->nextId(ToolProvider\DataConnector\DataConnector::CONTEXT_TABLE_NAME));
1001 $id = $context->getRecordId();
1002 $context->created = $time;
1003 //Check remove context_pk, add type
1004 $query = "INSERT INTO {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::CONTEXT_TABLE_NAME .
1005 ' (context_pk, consumer_pk, lti_context_id, settings, created, updated) ' .
1006 'VALUES (%s, %s, %s, %s, %s, %s)';
1007 $types = array("integer", "integer", "text", "text", "timestamp", "timestamp");
1008 $values = array($id, $platform_pk, $context->ltiContextId, $settingsValue, $now, $now);
1009 } else {
1010 $query = "UPDATE {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::CONTEXT_TABLE_NAME . ' SET ' .
1011 'lti_context_id = %s, settings = %s, ' .
1012 'updated = %s' .
1013 'WHERE (consumer_pk = %s) AND (context_pk = %s)';
1014 $types = array("text", "text", "timestamp", "integer", "integer");
1015 $values = array($context->ltiContextId, $settingsValue, $now, $platform_pk, $id);
1016 }
1017 $ok = (bool) $ilDB->manipulateF($query, $types, $values);
1018 if ($ok) {
1019 $context->updated = $time;
1020 }
1021
1022 return $ok;
1023 }
Class to provide a connection to a persistent store for LTI objects.

References $context, $database, $id, $ilDB, and $query.

◆ saveGlobalToolConsumerSettings()

ilLTIDataConnector::saveGlobalToolConsumerSettings ( ilLTIPlatform  $platform)

Save lti_ext_consumer.

Definition at line 473 of file class.ilLTIDataConnector.php.

473 : bool
474 {
476
477 if (!$platform->getExtConsumerId()) {
478 // create
479 $new_id = $ilDB->nextId('lti_ext_consumer');
480 $query = 'INSERT INTO lti_ext_consumer (title, description, prefix, user_language, role, id, active) ' .
481 'VALUES (%s, %s, %s, %s, %s, %s, %s)';
482 $types = ["text", "text", "text", "text", "integer", "integer", 'integer'];
483 $values = [
484 $platform->getTitle(),
485 $platform->getDescription(),
486 $platform->getPrefix(),
487 $platform->getLanguage(),
488 $platform->getRole(),
489 $new_id,
490 $platform->getActive()
491 ];
492 $ilDB->manipulateF($query, $types, $values);
493 $platform->setExtConsumerId($new_id);
494 return true;
495 } else {
496 // update
497 $query = 'update lti_ext_consumer set ' .
498 'title = ' . $ilDB->quote($platform->getTitle(), 'text') . ', ' .
499 'description = ' . $ilDB->quote($platform->getDescription(), 'text') . ', ' .
500 'prefix = ' . $ilDB->quote($platform->getPrefix(), 'text') . ', ' .
501 'user_language = ' . $ilDB->quote($platform->getLanguage(), 'text') . ', ' .
502 'role = ' . $ilDB->quote($platform->getRole(), 'integer') . ', ' .
503 'active = ' . $ilDB->quote((int) $platform->getActive(), 'integer') . ' ' .
504 'where id = ' . $ilDB->quote($platform->getExtConsumerId(), 'integer');
505 $ilDB->manipulate($query);
506 return true;
507 }
508 }
setExtConsumerId(int $a_id)

References $database, $ilDB, $query, ilLTIPlatform\getActive(), ilLTIPlatform\getDescription(), ilLTIPlatform\getExtConsumerId(), ilLTIPlatform\getLanguage(), ilLTIPlatform\getPrefix(), ilLTIPlatform\getRole(), ilLTIPlatform\getTitle(), and ilLTIPlatform\setExtConsumerId().

Referenced by ilLTIPlatform\saveGlobalToolConsumerSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ savePlatformNonce()

ilLTIDataConnector::savePlatformNonce ( \ILIAS\LTI\ToolProvider\PlatformNonce  $nonce)

Save nonce object.

Parameters
PlatformNonce$nonceNonce object
Returns
boolean True if the nonce object was successfully saved

Definition at line 1457 of file class.ilLTIDataConnector.php.

1457 : bool
1458 {
1460
1461 $expires = date("{$this->dateFormat} {$this->timeFormat}", $nonce->expires);
1462 $query = "INSERT INTO {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::NONCE_TABLE_NAME . " (consumer_pk, value, expires) VALUES (%s, %s, %s)";
1463 $types = array("integer", "text", "timestamp");
1464 $values = array($nonce->getPlatform()->getRecordId(), $nonce->getValue(), $expires);
1465 $ok = (bool) $ilDB->manipulateF($query, $types, $values);
1466
1467 return $ok;
1468 }

References $ilDB, and $query.

◆ saveResourceLink()

ilLTIDataConnector::saveResourceLink ( ResourceLink  $resourceLink)

Save resource link object.

Parameters
ResourceLink$resourceLinkResource_Link object
Returns
boolean True if the resource link object was successfully saved

Definition at line 1176 of file class.ilLTIDataConnector.php.

1176 : bool
1177 {
1179
1180 if (is_null($resourceLink->shareApproved)) {
1181 $approved = null;
1182 } elseif ($resourceLink->shareApproved) {
1183 $approved = '1';
1184 } else {
1185 $approved = '0';
1186 }
1187 if (empty($resourceLink->primaryResourceLinkId) || $resourceLink->primaryResourceLinkId == '0') {
1188 $primaryResourceLinkId = null;//'NULL';
1189 $resourceLink->primaryResourceLinkId = null; //Bug in 7: 0 instead of null
1190 } else {
1191 $primaryResourceLinkId = strval($resourceLink->primaryResourceLinkId);
1192 }
1193 $time = time();
1194 $now = date("{$this->dateFormat} {$this->timeFormat}", $time);
1195 $settingsValue = serialize($resourceLink->getSettings());
1196 if (!is_null($resourceLink->getContext())) {
1197 // $platformId = null;
1198 $platformId = strval($resourceLink->getPlatform()->getRecordId());
1199 $contextId = strval($resourceLink->getContext()->getRecordId());
1200 } elseif (!is_null($resourceLink->getContextId())) {
1201 // $platformId = null;
1202 $platformId = strval($resourceLink->getPlatform()->getRecordId());
1203 $contextId = strval($resourceLink->getContextId());
1204 } else {
1205 $platformId = strval($resourceLink->getPlatform()->getRecordId());
1206 $contextId = null;
1207 }
1208 $id = $resourceLink->getRecordId();
1209 if (empty($id)) {
1210 $resourceLink->setRecordId($ilDB->nextId(ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_TABLE_NAME));
1211 $id = $resourceLink->getRecordId();
1212 $resourceLink->created = $time;
1213 $query = "INSERT INTO {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_TABLE_NAME . ' (resource_link_pk, consumer_pk, context_pk, ' .
1214 'lti_resource_link_id, settings, primary_resource_link_pk, share_approved, created, updated) ' .
1215 'VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)';
1216 $types = array("integer",
1217 "integer",
1218 "integer",
1219 "text",
1220 "text",
1221 "integer",
1222 "integer",
1223 "timestamp",
1224 "timestamp"
1225 );
1226 $values = array($id,
1227 $platformId,
1228 $contextId,
1229 $resourceLink->getId(),
1230 $settingsValue,
1231 $primaryResourceLinkId,
1232 $approved,
1233 $now,
1234 $now
1235 );
1236 } elseif (!is_null($contextId)) {
1237 $query = "UPDATE {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_TABLE_NAME . ' SET ' .
1238 'consumer_pk = %s, lti_resource_link_id = %s, settings = %s, ' .
1239 'primary_resource_link_pk = %s, share_approved = %s, updated = %s ' .
1240 'WHERE (context_pk = %s) AND (resource_link_pk = %s)';
1241 $types = array("integer", "text", "text", "integer", "integer", "timestamp", "integer", "integer");
1242 $values = array($platformId,
1243 $resourceLink->getId(),
1244 $settingsValue,
1245 $primaryResourceLinkId,
1246 $approved,
1247 $now,
1248 $contextId,
1249 $id
1250 );
1251 } else {
1252 $query = "UPDATE {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_TABLE_NAME . ' SET ' .
1253 'context_pk = %s, lti_resource_link_id = %s, settings = %s, ' .
1254 'primary_resource_link_pk = %s, share_approved = %s, updated = %s ' .
1255 'WHERE (consumer_pk = %s) AND (resource_link_pk = %s)';
1256 $types = array("integer", "text", "text", "integer", "integer", "timestamp", "integer", "integer");
1257 $values = array($contextId,
1258 $resourceLink->getId(),
1259 $settingsValue,
1260 $primaryResourceLinkId,
1261 $approved,
1262 $now,
1263 $platformId,
1264 $id
1265 );
1266 }
1267 $ok = (bool) $ilDB->manipulateF($query, $types, $values);
1268 $this->logger->debug('Update resource link with query: ' . $query);
1269 // $this->logger->logStack();
1270 $this->logger->dump($values, ilLogLevel::DEBUG);
1271 $this->logger->dump($ok, ilLogLevel::DEBUG);
1272
1273 if ($ok) {
1274 $resourceLink->updated = $time;
1275 }
1276
1277 return $ok;
1278 }

References $database, $id, $ilDB, $query, ilLogLevel\DEBUG, ILIAS\LTI\ToolProvider\ResourceLink\getContext(), ILIAS\LTI\ToolProvider\ResourceLink\getContextId(), ILIAS\LTI\ToolProvider\ResourceLink\getId(), ILIAS\LTI\ToolProvider\ResourceLink\getPlatform(), ILIAS\LTI\ToolProvider\ResourceLink\getRecordId(), ILIAS\LTI\ToolProvider\ResourceLink\getSettings(), ILIAS\Repository\logger(), and ILIAS\LTI\ToolProvider\ResourceLink\setRecordId().

+ Here is the call graph for this function:

◆ saveResourceLinkShareKey()

ilLTIDataConnector::saveResourceLinkShareKey ( ResourceLinkShareKey  $shareKey)

Save resource link share key object.

Parameters
ResourceLinkShareKey$shareKeyResource link share key object
Returns
boolean True if the resource link share key object was successfully saved

Definition at line 1521 of file class.ilLTIDataConnector.php.

1521 : bool
1522 {
1524
1525 if ($shareKey->autoApprove) {
1526 $approve = 1;
1527 } else {
1528 $approve = 0;
1529 }
1530 $expires = date("{$this->dateFormat} {$this->timeFormat}", $shareKey->expires);
1531 $query = "INSERT INTO {$this->dbTableNamePrefix}" . ToolProvider\DataConnector\DataConnector::RESOURCE_LINK_SHARE_KEY_TABLE_NAME . ' ' .
1532 '(share_key_id, resource_link_pk, auto_approve, expires) ' .
1533 "VALUES (%s, %s, %s, %s)";
1534 $types = array("text", "integer", "integer", "timestamp");
1535 $values = array($shareKey->getId(), $shareKey->resourceLinkId, $approve, $expires);
1536 $ok = (bool) $ilDB->manipulateF($query, $types, $values);
1537
1538 return $ok;
1539 }

References $ilDB, $query, and ILIAS\LTI\ToolProvider\ResourceLinkShareKey\getId().

+ Here is the call graph for this function:

◆ saveToolConsumerILIAS()

ilLTIDataConnector::saveToolConsumerILIAS ( ilLTIPlatform  $platform)

Save extended tool consumer object with ILIAS extensions.

Parameters
ilLTIPlatform$platformConsumer object
Returns
boolean True if the tool consumer object was successfully saved

Definition at line 515 of file class.ilLTIDataConnector.php.

515 : bool
516 {
518
519 $id = $platform->getRecordId();
520 $key = $platform->getKey();
521 $protected = ($platform->protected) ? 1 : 0;
522 $enabled = ($platform->enabled) ? 1 : 0;
523 $profile = (!empty($platform->profile)) ? json_encode($platform->profile) : null;
524 // $settingsValue = '{}';
525 $this->fixPlatformSettings($platform, true);
526 $settingsValue = json_encode($platform->getSettings());
527 $this->fixPlatformSettings($platform, false);
528 $time = time();
529 $now = date("{$this->dateFormat} {$this->timeFormat}", $time);
530 $from = null;
531 if (!is_null($platform->enableFrom)) {
532 $from = date("{$this->dateFormat} {$this->timeFormat}", $platform->enableFrom);
533 }
534 $until = null;
535 if (!is_null($platform->enableUntil)) {
536 $until = date("{$this->dateFormat} {$this->timeFormat}", $platform->enableUntil);
537 }
538 $last = null;
539 if (!is_null($platform->lastAccess)) {
540 $last = date($this->dateFormat, $platform->lastAccess);
541 }
542
543 $platform->name = $platform->getTitle();//50UK
544 if (empty($id)) {
545 $platform->setRecordId($ilDB->nextId('lti2_consumer'));
546 $id = $platform->getRecordId();
547 $platform->created = $time;
548 $platform->updated = $time;
549
550 // $query = "INSERT INTO {$this->dbTableNamePrefix}" . $this->CONSUMER_TABLE_NAME . ' (consumer_key256, consumer_key, name, ' .
551 $query = 'INSERT INTO lti2_consumer (consumer_key, name, ' .
552 'secret, lti_version, consumer_name, consumer_version, consumer_guid, profile, tool_proxy, settings, protected, enabled, ' .
553 'enable_from, enable_until, last_access, created, updated, consumer_pk, ext_consumer_id, ref_id, platform_id, client_id, deployment_id, public_key) ' .
554 'VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)';
555 $types = array("text",
556 "text",
557 "text",
558 "text",
559 "text",
560 "text",
561 "text",
562 "text",
563 "text",
564 "text",
565 "integer",
566 "integer",
567 "timestamp",
568 "timestamp",
569 "timestamp",
570 "timestamp",
571 "timestamp",
572 "integer",
573 'integer',
574 'integer',
575 "text",
576 "text",
577 "text",
578 "text"
579 );
580 $values = array($key,
581 $platform->name,
582 $platform->secret,
583 $platform->ltiVersion,
584 $platform->consumerName,
585 $platform->consumerVersion,
586 $platform->consumerGuid,
587 $profile,
588 $platform->toolProxy,
589 $settingsValue,
590 $protected,
591 $enabled,
592 $from,
593 $until,
594 $last,
595 $now,
596 $now,
597 $id,
598 $platform->getExtConsumerId(),
599 $platform->getRefId(),
600 (string) $platform->platformId,
601 $platform->clientId,
602 $platform->deploymentId,
603 $platform->rsaKey
604 );
605 $ilDB->manipulateF($query, $types, $values);
606 } else {
607 $platform->updated = $time;
608
609 $query = 'UPDATE lti2_consumer SET ' .
610 'consumer_key = %s, name = %s, ' .
611 'secret= %s, lti_version = %s, consumer_name = %s, consumer_version = %s, consumer_guid = %s, ' .
612 'profile = %s, tool_proxy = %s, settings = %s, protected = %s, enabled = %s, ' .
613 'enable_from = %s, enable_until = %s, last_access = %s, updated = %s, ' .
614 'platform_id = %s, client_id = %s, deployment_id = %s, public_key = %s ' .
615 'WHERE consumer_pk = %s';
616 $types = array("text",
617 "text",
618 "text",
619 "text",
620 "text",
621 "text",
622 "text",
623 "text",
624 "text",
625 "text",
626 "integer",
627 "integer",
628 "timestamp",
629 "timestamp",
630 "timestamp",
631 "timestamp",
632 "text",
633 "text",
634 "text",
635 "text",
636 "integer"
637 );
638 $values = array($key,
639 $platform->name,
640 $platform->secret,
641 $platform->ltiVersion,
642 $platform->consumerName,
643 $platform->consumerVersion,
644 $platform->consumerGuid,
645 $profile,
646 $platform->toolProxy,
647 $settingsValue,
648 $protected,
649 $enabled,
650 $from,
651 $until,
652 $last,
653 $now,
654 $platform->platformId,
655 $platform->clientId,
656 $platform->deploymentId,
657 $platform->rsaKey,
658 $id
659 );
660 $ilDB->manipulateF($query, $types, $values);
661 }
662
663 return true;
664 }
bool $enabled
Whether the system instance is enabled to accept connection requests.
Definition: System.php:123

References $database, ILIAS\LTI\ToolProvider\$enabled, $id, $ilDB, ILIAS\LTI\ToolProvider\$key, $query, ilLTIPlatform\getExtConsumerId(), ilLTIPlatform\getRefId(), and ilLTIPlatform\getTitle().

Referenced by ilLTIPlatform\saveLTI().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveUserResult()

ilLTIDataConnector::saveUserResult ( \ILIAS\LTI\ToolProvider\User  $userresult)

Save user object.

Parameters
User$userUser object
Returns
boolean True if the user object was successfully saved

Definition at line 1615 of file class.ilLTIDataConnector.php.

1615 : bool
1616 {
1618
1619 $this->logger->info('Save user called with ' . $userresult->created);
1620
1621 $time = time();
1622 $now = date($this->dateFormat . ' ' . $this->timeFormat, $time);
1623 if (is_null($userresult->created)) {
1624 // if (is_null($user->getRecordId())) {
1625 $userresult->setRecordId($ilDB->nextId($this->dbTableNamePrefix . ToolProvider\DataConnector\DataConnector::USER_RESULT_TABLE_NAME));
1626 $userresult->created = $time;
1627 $rid = $userresult->getResourceLink()->getRecordId();
1628 $uid = $userresult->getId(ToolProvider\Tool::ID_SCOPE_ID_ONLY);
1629 $query = 'INSERT INTO ' . $this->dbTableNamePrefix . ToolProvider\DataConnector\DataConnector::USER_RESULT_TABLE_NAME . ' ' .
1630 '(user_pk,resource_link_pk,lti_user_id, lti_result_sourcedid, created, updated) ' .
1631 'VALUES( ' .
1632 $ilDB->quote($userresult->getRecordId(), 'integer') . ', ' .
1633 $ilDB->quote($rid, 'integer') . ', ' .
1634 $ilDB->quote($uid, 'text') . ', ' .
1635 $ilDB->quote($userresult->ltiResultSourcedId, 'text') . ', ' .
1636 $ilDB->quote($now, 'text') . ', ' .
1637 $ilDB->quote($now, 'text') .
1638 ')';
1639 } else {
1640 $query = 'UPDATE ' . $this->dbTableNamePrefix . ToolProvider\DataConnector\DataConnector::USER_RESULT_TABLE_NAME . ' ' .
1641 'SET lti_result_sourcedid = ' . $ilDB->quote($userresult->ltiResultSourcedId, 'text') . ', ' .
1642 'updated = ' . $ilDB->quote($now, 'text') . ' ' .
1643 'WHERE user_pk = ' . $ilDB->quote($userresult->getRecordId(), 'integer');
1644 }
1645
1646 $this->logger->debug('Saving user data with query: ' . $query);
1647
1648 $ok = false;
1649 try {
1650 $ilDB->manipulate($query);
1651 $userresult->updated = $time;
1652 $ok = true;
1653 } catch (ilDatabaseException $e) {
1654 $this->logger->error($e->getMessage());
1655 }
1656
1657 return $ok;
1658 }

References Vendor\Package\$e, $ilDB, $query, and ILIAS\Repository\logger().

+ Here is the call graph for this function:

Field Documentation

◆ $database

◆ $logger

ilLogger ilLTIDataConnector::$logger = null
private

Definition at line 38 of file class.ilLTIDataConnector.php.


The documentation for this class was generated from the following file: