ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilCmiXapiUser Class Reference
+ Collaboration diagram for ilCmiXapiUser:

Public Member Functions

 __construct ($objId=null, $usrId=null, $privacyIdent=null)
 
 getObjId ()
 
 setObjId ($objId)
 
 getPrivacyIdent ()
 
 setPrivacyIdent ($privacyIdent)
 
 getUsrId ()
 
 setUsrId ($usrId)
 
 getUsrIdent ()
 
 setUsrIdent (string $usrIdent)
 
 getRegistration ()
 
 setRegistration (string $registration)
 
 hasProxySuccess ()
 
 setProxySuccess ($proxySuccess)
 
 setSatisfied ($satisfied)
 
 getSatisfied ()
 
 getFetchUntil ()
 
 setFetchUntil (ilCmiXapiDateTime $fetchUntil)
 
 load ()
 
 assignFromDbRow ($dbRow)
 
 save ()
 

Static Public Member Functions

static getIliasUuid ()
 
static getInstancesByObjectIdAndUsrId ($objId, $usrId)
 
static getInstanceByObjectIdAndUsrIdent ($objId, $usrIdent)
 
static saveProxySuccess ($objId, $usrId, $privacyIdent)
 
static getIdent ($userIdentMode, ilObjUser $user)
 
static getIdentAsId ($userIdentMode, ilObjUser $user)
 
static getName ($userNameMode, ilObjUser $user)
 
static getUsersForObject ($objId, $asUsrId=false)
 
static getUserIdents ($objId, $usrId)
 
static deleteUsersForObject (int $objId, ?array $users=[])
 
static exists ($objId, $usrId, $privacyIdent=999)
 
static getCmixObjectsHavingUsersMissingProxySuccess ()
 
static updateFetchedUntilForObjects (ilCmiXapiDateTime $fetchedUntil, $objectIds)
 
static lookupObjectIds ($usrId, $type='')
 
static getUserObjectUniqueId ( $length=32)
 
static getUUID ($length=32)
 
static generateCMI5Registration ($objId, $usrId)
 
static generateRegistration (ilObjCmiXapi $obj, ilObjUser $user)
 
static getCMI5RegistrationFromAuthToken (ilCmiXapiAuthToken $authToken)
 
static getRegistrationFromAuthToken (ilCmiXapiAuthToken $authToken)
 

Data Fields

const DB_TABLE_NAME = 'cmix_users'
 

Static Protected Member Functions

static buildPseudoEmail ($mbox, $domain)
 

Protected Attributes

 $objId
 
 $usrId
 
 $privacyIdent
 
 $proxySuccess
 
 $satisfied
 
 $fetchUntil
 
 $usrIdent
 
 $registration
 

Static Private Member Functions

static userObjectUniqueIdExists ($id)
 

Detailed Description

Definition at line 15 of file class.ilCmiXapiUser.php.

Constructor & Destructor Documentation

◆ __construct()

ilCmiXapiUser::__construct (   $objId = null,
  $usrId = null,
  $privacyIdent = null 
)

Definition at line 60 of file class.ilCmiXapiUser.php.

61 {
62 $this->objId = $objId;
63 $this->usrId = $usrId;
64 $this->privacyIdent = $privacyIdent;
65 $this->proxySuccess = false;
66 $this->satisfied = false;
67 $this->fetchUntil = new ilCmiXapiDateTime(0, IL_CAL_UNIX);
68 $this->usrIdent = '';
69 $this->registration = '';
70
71 if ($objId !== null && $usrId !== null && $privacyIdent !== null) {
72 $this->load();
73 }
74 }
const IL_CAL_UNIX

References $objId, $privacyIdent, $usrId, IL_CAL_UNIX, and load().

+ Here is the call graph for this function:

Member Function Documentation

◆ assignFromDbRow()

ilCmiXapiUser::assignFromDbRow (   $dbRow)

Definition at line 235 of file class.ilCmiXapiUser.php.

236 {
237 $this->setObjId((int) $dbRow['obj_id']);
238 $this->setUsrId((int) $dbRow['usr_id']);
239 $this->setProxySuccess((bool) $dbRow['proxy_success']);
240 $this->setSatisfied((bool) $dbRow['satisfied']);
241 $this->setFetchUntil(new ilCmiXapiDateTime($dbRow['fetched_until'], IL_CAL_DATETIME));
242 $this->setUsrIdent((string) $dbRow['usr_ident']);
243 $this->setPrivacyIdent((int) $dbRow['privacy_ident']);
244 $this->setRegistration((string) $dbRow['registration']);
245 }
const IL_CAL_DATETIME
setRegistration(string $registration)
setSatisfied($satisfied)
setProxySuccess($proxySuccess)
setPrivacyIdent($privacyIdent)
setFetchUntil(ilCmiXapiDateTime $fetchUntil)
setUsrIdent(string $usrIdent)

References IL_CAL_DATETIME, setFetchUntil(), setObjId(), setPrivacyIdent(), setProxySuccess(), setRegistration(), setSatisfied(), setUsrId(), and setUsrIdent().

Referenced by load().

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

◆ buildPseudoEmail()

static ilCmiXapiUser::buildPseudoEmail (   $mbox,
  $domain 
)
staticprotected
Parameters
string$mbox
string$domain
Returns
string

Definition at line 404 of file class.ilCmiXapiUser.php.

405 {
406 return "{$mbox}@{$domain}.ilias";
407 }

Referenced by getIdent().

+ Here is the caller graph for this function:

◆ deleteUsersForObject()

static ilCmiXapiUser::deleteUsersForObject ( int  $objId,
?array  $users = [] 
)
static
Parameters
int$objId
int[]$users

Definition at line 501 of file class.ilCmiXapiUser.php.

502 {
503 global $DIC; /* @var \ILIAS\DI\Container $DIC */
504 $query = "DELETE FROM " . self::DB_TABLE_NAME . " WHERE obj_id = ".$DIC->database()->quote($objId, 'integer');
505 if (count($users) == 0) {
506 $DIC->database()->manipulate($query);
507 }
508 else {
509 $DIC->database()->manipulateF($query." AND usr_id = %s",
510 array('integer'),
511 $users
512 );
513 }
514 }
$query
$DIC
Definition: xapitoken.php:46

References $DIC, $objId, and $query.

◆ exists()

static ilCmiXapiUser::exists (   $objId,
  $usrId,
  $privacyIdent = 999 
)
static

Definition at line 517 of file class.ilCmiXapiUser.php.

518 {
519 global $DIC; /* @var \ILIAS\DI\Container $DIC */
520 if ($privacyIdent == 999)
521 {
522 $query = "SELECT count(*) cnt FROM " . self::DB_TABLE_NAME . " WHERE obj_id = %s AND usr_id = %s";
523 $res = $DIC->database()->queryF(
524 $query,
525 array('integer', 'integer'),
526 array($objId, $usrId)
527 );
528 }
529 else
530 {
531 $query = "SELECT count(*) cnt FROM " . self::DB_TABLE_NAME . " WHERE obj_id = %s AND usr_id = %s AND privacy_ident = %s";
532 $res = $DIC->database()->queryF(
533 $query,
534 array('integer', 'integer', 'integer'),
536 );
537 }
538
539 while ($row = $DIC->database()->fetchAssoc($res)) {
540 return (bool) $row['cnt'];
541 }
542
543 return false;
544 }
foreach($_POST as $key=> $value) $res

References $DIC, $objId, $privacyIdent, $query, $res, and $usrId.

Referenced by ilLPStatusCmiXapiAbstract\determineStatus(), and ilObjCmiXapiGUI\initInfoScreenToolbar().

+ Here is the caller graph for this function:

◆ generateCMI5Registration()

static ilCmiXapiUser::generateCMI5Registration (   $objId,
  $usrId 
)
static

Definition at line 674 of file class.ilCmiXapiUser.php.

675 {
676 return (new \Ramsey\Uuid\UuidFactory())->uuid3(self::getIliasUuid(),$objId . '-' . $usrId);
677 }

References $objId, and $usrId.

Referenced by ilCmiXapiLaunchGUI\initCmixUser().

+ Here is the caller graph for this function:

◆ generateRegistration()

static ilCmiXapiUser::generateRegistration ( ilObjCmiXapi  $obj,
ilObjUser  $user 
)
static

Definition at line 679 of file class.ilCmiXapiUser.php.

680 {
681 return (new \Ramsey\Uuid\UuidFactory())->uuid3(self::getIliasUuid(),$obj->getRefId() . '-' . $user->getId());
682 }
getRefId()
get reference id @access public
getId()
get object id @access public

References ilObject\getId(), and ilObject2\getRefId().

Referenced by ilCmiXapiLaunchGUI\CMI5preLaunch(), and ilCmiXapiLaunchGUI\getLaunchParameters().

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

◆ getCMI5RegistrationFromAuthToken()

static ilCmiXapiUser::getCMI5RegistrationFromAuthToken ( ilCmiXapiAuthToken  $authToken)
static

Definition at line 684 of file class.ilCmiXapiUser.php.

684 : \Ramsey\Uuid\UuidInterface
685 {
686 return (new \Ramsey\Uuid\UuidFactory())->uuid3(self::getIliasUuid(), $authToken->getObjId() . '-' . $authToken->getUsrId());
687 }

References ilCmiXapiAuthToken\getObjId(), and ilCmiXapiAuthToken\getUsrId().

Referenced by XapiProxy\XapiProxyRequest\handleGetStatementsRequest().

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

◆ getCmixObjectsHavingUsersMissingProxySuccess()

static ilCmiXapiUser::getCmixObjectsHavingUsersMissingProxySuccess ( )
static

Definition at line 546 of file class.ilCmiXapiUser.php.

547 {
548 global $DIC; /* @var \ILIAS\DI\Container $DIC */
549
550 $query = "
551 SELECT DISTINCT cu.obj_id
552 FROM " . self::DB_TABLE_NAME . " cu
553 INNER JOIN object_data od
554 ON od.obj_id = cu.obj_id
555 AND od.type = 'cmix'
556 WHERE cu.proxy_success != %s
557 ";
558
559 $res = $DIC->database()->queryF($query, array('integer'), array(1));
560
561 $objects = array();
562
563 while ($row = $DIC->database()->fetchAssoc($res)) {
564 $objects[] = $row['obj_id'];
565 }
566
567 return $objects;
568 }

References $DIC, $query, and $res.

Referenced by ilXapiResultsCronjob\getObjectsToBeReported().

+ Here is the caller graph for this function:

◆ getFetchUntil()

ilCmiXapiUser::getFetchUntil ( )
Returns
ilCmiXapiDateTime

Definition at line 207 of file class.ilCmiXapiUser.php.

208 {
209 return $this->fetchUntil;
210 }

References $fetchUntil.

Referenced by save(), and ilObjCmiXapiGUI\sendLastFetchInfo().

+ Here is the caller graph for this function:

◆ getIdent()

static ilCmiXapiUser::getIdent (   $userIdentMode,
ilObjUser  $user 
)
static
Parameters
string$userIdentMode
ilObjUser$user
Returns
string

Definition at line 332 of file class.ilCmiXapiUser.php.

333 {
334 switch ($userIdentMode) {
336
337 return self::buildPseudoEmail($user->getId(), self::getIliasUuid());
338
340
341 return self::buildPseudoEmail($user->getLogin(), self::getIliasUuid());
342
344
345 return self::buildPseudoEmail($user->getExternalAccount(), self::getIliasUuid());
346
348
349 return self::buildPseudoEmail(hash("sha256",'' . $user->getId() . $user->getCreateDate()), self::getIliasUuid());
350
352
353 return self::buildPseudoEmail(self::getUserObjectUniqueId(), self::getIliasUuid());
354
356
357 return $user->getEmail();
358 }
359
360 return '';
361 }
static buildPseudoEmail($mbox, $domain)
const PRIVACY_IDENT_IL_UUID_USER_ID
const PRIVACY_IDENT_IL_UUID_RANDOM
const PRIVACY_IDENT_IL_UUID_LOGIN
const PRIVACY_IDENT_REAL_EMAIL
const PRIVACY_IDENT_IL_UUID_SHA256
const PRIVACY_IDENT_IL_UUID_EXT_ACCOUNT
getEmail()
get email address @access public
getLogin()
get login / username @access public
getExternalAccount()
get external account
getCreateDate()
get create date @access public

References buildPseudoEmail(), ilObject\getCreateDate(), ilObjUser\getEmail(), ilObjUser\getExternalAccount(), ilObject\getId(), ilObjUser\getLogin(), ilObjCmiXapi\PRIVACY_IDENT_IL_UUID_EXT_ACCOUNT, ilObjCmiXapi\PRIVACY_IDENT_IL_UUID_LOGIN, ilObjCmiXapi\PRIVACY_IDENT_IL_UUID_RANDOM, ilObjCmiXapi\PRIVACY_IDENT_IL_UUID_SHA256, ilObjCmiXapi\PRIVACY_IDENT_IL_UUID_USER_ID, and ilObjCmiXapi\PRIVACY_IDENT_REAL_EMAIL.

Referenced by ilCmiXapiLaunchGUI\initCmixUser(), ilLTIConsumerEmbeddedContentGUI\initCmixUser(), and ilObjLTIConsumerGUI\initInfoScreenToolbar().

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

◆ getIdentAsId()

static ilCmiXapiUser::getIdentAsId (   $userIdentMode,
ilObjUser  $user 
)
static
Parameters
string$userIdentMode
ilObjUser$user
Returns
integer/string

Definition at line 368 of file class.ilCmiXapiUser.php.

369 {
370 switch ($userIdentMode) {
372
373 return $user->getId();
374
376
377 return $user->getLogin();
378
380
381 return $user->getExternalAccount();
382
384
385 return hash("sha256",'' . $user->getId() . $user->getCreateDate());
386
388
390
392
393 return 'realemail' . $user->getId();
394 }
395
396 return '';
397 }
static getUserObjectUniqueId( $length=32)

References ilObject\getCreateDate(), ilObjUser\getExternalAccount(), ilObject\getId(), ilObjUser\getLogin(), getUserObjectUniqueId(), ilObjCmiXapi\PRIVACY_IDENT_IL_UUID_EXT_ACCOUNT, ilObjCmiXapi\PRIVACY_IDENT_IL_UUID_LOGIN, ilObjCmiXapi\PRIVACY_IDENT_IL_UUID_RANDOM, ilObjCmiXapi\PRIVACY_IDENT_IL_UUID_SHA256, ilObjCmiXapi\PRIVACY_IDENT_IL_UUID_USER_ID, and ilObjCmiXapi\PRIVACY_IDENT_REAL_EMAIL.

Referenced by ilObjLTIConsumer\buildLaunchParameters().

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

◆ getIliasUuid()

static ilCmiXapiUser::getIliasUuid ( )
static
Returns
string

Definition at line 159 of file class.ilCmiXapiUser.php.

159 : string
160 {
161 $setting = new ilSetting('cmix');
162 // Fallback
163 if (!$setting->get('ilias_uuid', false)) {
164 // $uuid = (new \Ramsey\Uuid\UuidFactory())->uuid4()->toString();
165 $uuid = self::getUUID(32);
166 $setting->set('ilias_uuid', $uuid);
167 }
168 $ilUuid = $setting->get('ilias_uuid');
169 return $ilUuid;
170 }
static getUUID($length=32)
ILIAS Setting Class.

References getUUID().

Referenced by ilCmiXapiSettingsGUI\buildForm(), ilObjCmiXapiAdministrationGUI\buildLrsTypeForm(), ilCmiXapiContentUploadImporter\generateActivityId(), and ilLTIConsumeProviderFormGUI\initForm().

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

◆ getInstanceByObjectIdAndUsrIdent()

static ilCmiXapiUser::getInstanceByObjectIdAndUsrIdent (   $objId,
  $usrIdent 
)
static

Definition at line 286 of file class.ilCmiXapiUser.php.

287 {
288 global $DIC; /* @var \ILIAS\DI\Container $DIC */
289
290 $res = $DIC->database()->queryF(
291 "SELECT * FROM " . self::DB_TABLE_NAME . " WHERE obj_id = %s AND usr_ident = %s",
292 array('integer', 'text'),
293 array($objId, $usrIdent)
294 );
295
296 $cmixUser = new self();
297
298 while ($row = $DIC->database()->fetchAssoc($res)) {
299 $cmixUser->assignFromDbRow($row);
300 }
301
302 return $cmixUser;
303 }

References $DIC, $objId, $res, and $usrIdent.

Referenced by ilXapiStatementEvaluation\getCmixUser().

+ Here is the caller graph for this function:

◆ getInstancesByObjectIdAndUsrId()

static ilCmiXapiUser::getInstancesByObjectIdAndUsrId (   $objId,
  $usrId 
)
static

Definition at line 269 of file class.ilCmiXapiUser.php.

270 {
271 global $DIC; /* @var \ILIAS\DI\Container $DIC */
272 $res = $DIC->database()->queryF(
273 "SELECT * FROM " . self::DB_TABLE_NAME . " WHERE obj_id = %s AND usr_id = %s",
274 array('integer', 'integer'),
275 array($objId, $usrId)
276 );
277 $cmixUsers = array();
278 while ($row = $DIC->database()->fetchAssoc($res)) {
279 $cmixUser = new self();
280 $cmixUser->assignFromDbRow($row);
281 $cmixUsers[] = $cmixUser;
282 }
283 return $cmixUsers;
284 }

References $DIC, $objId, $res, and $usrId.

◆ getName()

static ilCmiXapiUser::getName (   $userNameMode,
ilObjUser  $user 
)
static
Parameters
string$userNameMode
ilObjUser$user
Returns
string|null

Definition at line 414 of file class.ilCmiXapiUser.php.

415 {
416 switch ($userNameMode) {
418 $usrName = $user->getFirstname();
419 break;
420
422 $usrName = $user->getUTitle() ? $user->getUTitle() . ' ' : '';
423 $usrName .= $user->getLastname();
424 break;
425
427 $usrName = $user->getFullname();
428 break;
429
431 default:
432 $usrName = '-';
433 break;
434 }
435 return $usrName;
436 }
getLastname()
get lastname @access public
getUTitle()
get user title (note: don't mix up this method with getTitle() that is derived from ilObject and gets...
getFirstname()
get firstname @access public
getFullname($a_max_strlen=0)
get fullname @access public

References ilObjUser\getFirstname(), ilObjUser\getFullname(), ilObjUser\getLastname(), ilObjUser\getUTitle(), ilObjCmiXapi\PRIVACY_NAME_FIRSTNAME, ilObjCmiXapi\PRIVACY_NAME_FULLNAME, ilObjCmiXapi\PRIVACY_NAME_LASTNAME, and ilObjCmiXapi\PRIVACY_NAME_NONE.

Referenced by ilObjCmiXapi\getStatementActor().

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

◆ getObjId()

ilCmiXapiUser::getObjId ( )
Returns
int

Definition at line 79 of file class.ilCmiXapiUser.php.

80 {
81 return $this->objId;
82 }

References $objId.

Referenced by load(), and save().

+ Here is the caller graph for this function:

◆ getPrivacyIdent()

ilCmiXapiUser::getPrivacyIdent ( )
Returns
int

Definition at line 95 of file class.ilCmiXapiUser.php.

96 {
98 }

References $privacyIdent.

Referenced by load(), and save().

+ Here is the caller graph for this function:

◆ getRegistration()

ilCmiXapiUser::getRegistration ( )
Returns
string

Definition at line 143 of file class.ilCmiXapiUser.php.

143 : string
144 {
145 return $this->registration;
146 }

References $registration.

Referenced by save().

+ Here is the caller graph for this function:

◆ getRegistrationFromAuthToken()

static ilCmiXapiUser::getRegistrationFromAuthToken ( ilCmiXapiAuthToken  $authToken)
static

Definition at line 689 of file class.ilCmiXapiUser.php.

689 : \Ramsey\Uuid\UuidInterface
690 {
691 return (new \Ramsey\Uuid\UuidFactory())->uuid3(self::getIliasUuid(), $authToken->getRefId() . '-' . $authToken->getUsrId());
692 }

References ilCmiXapiAuthToken\getRefId(), and ilCmiXapiAuthToken\getUsrId().

Referenced by XapiProxy\XapiProxyRequest\handleGetStatementsRequest().

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

◆ getSatisfied()

ilCmiXapiUser::getSatisfied ( )
Returns
bool $satisfied

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

200 {
201 return $this->satisfied;
202 }

References $satisfied.

Referenced by save().

+ Here is the caller graph for this function:

◆ getUserIdents()

static ilCmiXapiUser::getUserIdents (   $objId,
  $usrId 
)
static
Parameters
int$objId
int$usrId
Returns
string[] $usrIdents

Definition at line 479 of file class.ilCmiXapiUser.php.

479 : array
480 {
481 global $DIC; /* @var \ILIAS\DI\Container $DIC */
482
483 $res = $DIC->database()->queryF(
484 "SELECT usr_ident FROM " . self::DB_TABLE_NAME . " WHERE obj_id = %s AND usr_id = %s",
485 array('integer','integer'),
486 array($objId,$usrId)
487 );
488
489 $usrIdents = [];
490 while ($row = $DIC->database()->fetchAssoc($res))
491 {
492 $usrIdents[] = $row['usr_ident'];
493 }
494 return $usrIdents;
495 }

References $DIC, $objId, $res, and $usrId.

Referenced by ilCmiXapiStatementsReportLinkBuilder\buildFilterStage().

+ Here is the caller graph for this function:

◆ getUserObjectUniqueId()

static ilCmiXapiUser::getUserObjectUniqueId (   $length = 32)
static
Parameters
int$length
Returns
string

Definition at line 615 of file class.ilCmiXapiUser.php.

616 {
617 // $storedId = self::readUserObjectUniqueId();
618 // if( (bool)strlen($storedId) ) {
619 // return strstr($storedId,'@', true);
620 // }
621
622 // $getId = function( $length ) {
623 // $multiplier = floor($length/8) * 2;
624 // $uid = str_shuffle(str_repeat(uniqid(), $multiplier));
625
626 // try {
627 // $ident = bin2hex(random_bytes($length));
628 // } catch (Exception $e) {
629 // $ident = $uid;
630 // }
631
632 // $start = rand(0, strlen($ident) - $length - 1);
633 // return substr($ident, $start, $length);
634 // };
635
636 $id = self::getUUID($length);//$getId($length);
637 $exists = self::userObjectUniqueIdExists($id);
638 while( $exists ) {
639 $id = self::getUUID($length);//$getId($length);
640 $exists = self::userObjectUniqueIdExists($id);
641 }
642
643 return $id;
644
645 }
static userObjectUniqueIdExists($id)

References getUUID(), and userObjectUniqueIdExists().

Referenced by getIdentAsId().

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

◆ getUsersForObject()

static ilCmiXapiUser::getUsersForObject (   $objId,
  $asUsrId = false 
)
static
Parameters
int$object
Returns
ilCmiXapiUser[]

Definition at line 442 of file class.ilCmiXapiUser.php.

442 : array
443 {
444 global $DIC; /* @var \ILIAS\DI\Container $DIC */
445
446 $res = $DIC->database()->queryF(
447 "SELECT * FROM " . self::DB_TABLE_NAME . " WHERE obj_id = %s",
448 array('integer'),
449 array($objId)
450 );
451
452 $users = [];
453
454 if ($asUsrId === false)
455 {
456 while ($row = $DIC->database()->fetchAssoc($res))
457 {
458 $cmixUser = new self();
459 $cmixUser->assignFromDbRow($row);
460
461 $users[] = $cmixUser;
462 }
463 }
464 else
465 {
466 while ($row = $DIC->database()->fetchAssoc($res))
467 {
468 $users[] = $row['usr_id'];
469 }
470 }
471 return $users;
472 }

References $DIC, $objId, and $res.

Referenced by ilCmiXapiHighscoreReport\__construct(), ilCmiXapiStatementsReport\__construct(), ilCmiXapiStatementsReportLinkBuilder\buildFilterStage(), ilCmiXapiHighscoreReportLinkBuilder\getUsersStack(), ilCmiXapiStatementsGUI\initTableData(), and ilLPStatusCmiXapiAbstract\loadStatusInfo().

+ Here is the caller graph for this function:

◆ getUsrId()

ilCmiXapiUser::getUsrId ( )
Returns
int

Definition at line 111 of file class.ilCmiXapiUser.php.

112 {
113 return $this->usrId;
114 }

References $usrId.

Referenced by ilCmiXapiStatementsTableGUI\getUsername(), load(), and save().

+ Here is the caller graph for this function:

◆ getUsrIdent()

ilCmiXapiUser::getUsrIdent ( )
Returns
string

Definition at line 127 of file class.ilCmiXapiUser.php.

127 : string
128 {
129 return $this->usrIdent;
130 }

References $usrIdent.

Referenced by ilObjLTIConsumer\buildLaunchParameters(), and save().

+ Here is the caller graph for this function:

◆ getUUID()

static ilCmiXapiUser::getUUID (   $length = 32)
static

Definition at line 647 of file class.ilCmiXapiUser.php.

648 {
649 $multiplier = floor($length/8) * 2;
650 $uid = str_shuffle(str_repeat(uniqid(), $multiplier));
651
652 try {
653 $ident = bin2hex(random_bytes($length));
654 } catch (Exception $e) {
655 $ident = $uid;
656 }
657
658 $start = rand(0, strlen($ident) - $length - 1);
659 return substr($ident, $start, $length);
660 }

References Vendor\Package\$e.

Referenced by getIliasUuid(), and getUserObjectUniqueId().

+ Here is the caller graph for this function:

◆ hasProxySuccess()

ilCmiXapiUser::hasProxySuccess ( )
Returns
bool

Definition at line 175 of file class.ilCmiXapiUser.php.

176 {
177 return $this->proxySuccess;
178 }

References $proxySuccess.

Referenced by ilObjCmiXapiGUI\isFetchXapiStatementsRequired(), and save().

+ Here is the caller graph for this function:

◆ load()

ilCmiXapiUser::load ( )

Definition at line 220 of file class.ilCmiXapiUser.php.

221 {
222 global $DIC; /* @var \ILIAS\DI\Container $DIC */
223
224 $res = $DIC->database()->queryF(
225 "SELECT * FROM " . self::DB_TABLE_NAME . " WHERE obj_id = %s AND usr_id = %s AND privacy_ident = %s",
226 array('integer', 'integer', 'integer'),
227 array($this->getObjId(), $this->getUsrId(), $this->getPrivacyIdent())
228 );
229
230 while ($row = $DIC->database()->fetchAssoc($res)) {
231 $this->assignFromDbRow($row);
232 }
233 }

References $DIC, $res, assignFromDbRow(), getObjId(), getPrivacyIdent(), and getUsrId().

Referenced by __construct().

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

◆ lookupObjectIds()

static ilCmiXapiUser::lookupObjectIds (   $usrId,
  $type = '' 
)
static

Definition at line 580 of file class.ilCmiXapiUser.php.

581 {
582 global $DIC; /* @var \ILIAS\DI\Container $DIC */
583
584 $TYPE_JOIN = '';
585
586 if (strlen($type)) {
587 $TYPE_JOIN = "
588 INNER JOIN object_data od
589 ON od.obj_id = cu.obj_id
590 AND od.type = {$DIC->database()->quote($type, 'text')}
591 ";
592 }
593
594 $query = "
595 SELECT cu.obj_id
596 FROM " . self::DB_TABLE_NAME . " cu
597 {$TYPE_JOIN}
598 WHERE cu.usr_id = {$DIC->database()->quote($usrId, 'integer')}
599 ";
600
601 $res = $DIC->database()->query($query);
602
603 $objIds = [];
604
605 while ($row = $DIC->database()->fetchAssoc($res)) {
606 $objIds[] = $row['obj_id'];
607 }
608
609 return $objIds;
610 }
$type

References $DIC, $query, $res, and $type.

◆ save()

ilCmiXapiUser::save ( )

Definition at line 247 of file class.ilCmiXapiUser.php.

248 {
249 global $DIC; /* @var \ILIAS\DI\Container $DIC */
250
251 $DIC->database()->replace(
252 self::DB_TABLE_NAME,
253 array(
254 'obj_id' => array('integer', (int) $this->getObjId()),
255 'usr_id' => array('integer', (int) $this->getUsrId()),
256 'privacy_ident' => array('integer', (int) $this->getPrivacyIdent())
257 ),
258 array(
259 'proxy_success' => array('integer', (int) $this->hasProxySuccess()),
260 'fetched_until' => array('timestamp', $this->getFetchUntil()->get(IL_CAL_DATETIME)),
261 'usr_ident' => array('text', $this->getUsrIdent()),
262 'registration' => array('text', $this->getRegistration()),
263 'satisfied' => array('integer', (int) $this->getSatisfied())
264 )
265 );
266 }

References $DIC, getFetchUntil(), getObjId(), getPrivacyIdent(), getRegistration(), getSatisfied(), getUsrId(), getUsrIdent(), hasProxySuccess(), and IL_CAL_DATETIME.

+ Here is the call graph for this function:

◆ saveProxySuccess()

static ilCmiXapiUser::saveProxySuccess (   $objId,
  $usrId,
  $privacyIdent 
)
static
Parameters
int$objId
int$usrId
int$privacyIdent

Definition at line 310 of file class.ilCmiXapiUser.php.

311 {
312 global $DIC; /* @var \ILIAS\DI\Container $DIC */
313
314 $DIC->database()->update(
315 self::DB_TABLE_NAME,
316 array(
317 'proxy_success' => array('integer', 1)
318 ),
319 array(
320 'obj_id' => array('integer', (int) $objId),
321 'usr_id' => array('integer', (int) $usrId),
322 'privacy_ident' => array('integer', (int) $privacyIdent)
323 )
324 );
325 }

References $DIC, $objId, $privacyIdent, and $usrId.

Referenced by XapiProxy\XapiProxyPolyFill\getLrsType().

+ Here is the caller graph for this function:

◆ setFetchUntil()

ilCmiXapiUser::setFetchUntil ( ilCmiXapiDateTime  $fetchUntil)
Parameters
ilCmiXapiDateTime$fetchUntil

Definition at line 215 of file class.ilCmiXapiUser.php.

216 {
217 $this->fetchUntil = $fetchUntil;
218 }

References $fetchUntil.

Referenced by assignFromDbRow().

+ Here is the caller graph for this function:

◆ setObjId()

ilCmiXapiUser::setObjId (   $objId)
Parameters
int$objId

Definition at line 87 of file class.ilCmiXapiUser.php.

88 {
89 $this->objId = $objId;
90 }

References $objId.

Referenced by assignFromDbRow().

+ Here is the caller graph for this function:

◆ setPrivacyIdent()

ilCmiXapiUser::setPrivacyIdent (   $privacyIdent)
Parameters
int$privacyIdent

Definition at line 103 of file class.ilCmiXapiUser.php.

104 {
105 $this->privacyIdent = $privacyIdent;
106 }

References $privacyIdent.

Referenced by assignFromDbRow().

+ Here is the caller graph for this function:

◆ setProxySuccess()

ilCmiXapiUser::setProxySuccess (   $proxySuccess)
Parameters
bool$proxySuccess

Definition at line 183 of file class.ilCmiXapiUser.php.

184 {
185 $this->proxySuccess = $proxySuccess;
186 }

References $proxySuccess.

Referenced by assignFromDbRow().

+ Here is the caller graph for this function:

◆ setRegistration()

ilCmiXapiUser::setRegistration ( string  $registration)
Parameters
string

Definition at line 151 of file class.ilCmiXapiUser.php.

152 {
153 $this->registration = $registration;
154 }

References $registration.

Referenced by assignFromDbRow().

+ Here is the caller graph for this function:

◆ setSatisfied()

ilCmiXapiUser::setSatisfied (   $satisfied)
Parameters
bool$satisfied

Definition at line 191 of file class.ilCmiXapiUser.php.

192 {
193 $this->satisfied = $satisfied;
194 }

References $satisfied.

Referenced by assignFromDbRow().

+ Here is the caller graph for this function:

◆ setUsrId()

ilCmiXapiUser::setUsrId (   $usrId)
Parameters
int$usrId

Definition at line 119 of file class.ilCmiXapiUser.php.

120 {
121 $this->usrId = $usrId;
122 }

References $usrId.

Referenced by assignFromDbRow().

+ Here is the caller graph for this function:

◆ setUsrIdent()

ilCmiXapiUser::setUsrIdent ( string  $usrIdent)
Parameters
string$usrIdent

Definition at line 135 of file class.ilCmiXapiUser.php.

136 {
137 $this->usrIdent = $usrIdent;
138 }

References $usrIdent.

Referenced by assignFromDbRow().

+ Here is the caller graph for this function:

◆ updateFetchedUntilForObjects()

static ilCmiXapiUser::updateFetchedUntilForObjects ( ilCmiXapiDateTime  $fetchedUntil,
  $objectIds 
)
static

Definition at line 570 of file class.ilCmiXapiUser.php.

571 {
572 global $DIC; /* @var \ILIAS\DI\Container $DIC */
573
574 $IN_objIds = $DIC->database()->in('obj_id', $objectIds, false, 'integer');
575
576 $query = "UPDATE " . self::DB_TABLE_NAME . " SET fetched_until = %s WHERE $IN_objIds";
577 $DIC->database()->manipulateF($query, array('timestamp'), array($fetchedUntil->get(IL_CAL_DATETIME)));
578 }
get($a_format, $a_format_str='', $a_tz='')
get formatted date

References $DIC, $query, ilDateTime\get(), and IL_CAL_DATETIME.

Referenced by ilXapiResultsCronjob\run().

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

◆ userObjectUniqueIdExists()

static ilCmiXapiUser::userObjectUniqueIdExists (   $id)
staticprivate

Definition at line 662 of file class.ilCmiXapiUser.php.

663 {
664 global $DIC; /* @var \ILIAS\DI\Container $DIC */
665
666 $query = "SELECT usr_ident FROM " . self::DB_TABLE_NAME . " WHERE " . $DIC->database()->like('usr_ident', 'text', $id . '@%');
667 $result = $DIC->database()->query($query);
668 if ($result->numRows() == 0) {
669 return false;
670 }
671 return true;
672 }
$result

References $DIC, $query, and $result.

Referenced by getUserObjectUniqueId().

+ Here is the caller graph for this function:

Field Documentation

◆ $fetchUntil

ilCmiXapiUser::$fetchUntil
protected

Definition at line 47 of file class.ilCmiXapiUser.php.

Referenced by getFetchUntil(), and setFetchUntil().

◆ $objId

◆ $privacyIdent

ilCmiXapiUser::$privacyIdent
protected

◆ $proxySuccess

ilCmiXapiUser::$proxySuccess
protected

Definition at line 37 of file class.ilCmiXapiUser.php.

Referenced by hasProxySuccess(), and setProxySuccess().

◆ $registration

ilCmiXapiUser::$registration
protected

Definition at line 57 of file class.ilCmiXapiUser.php.

Referenced by getRegistration(), and setRegistration().

◆ $satisfied

ilCmiXapiUser::$satisfied
protected

Definition at line 42 of file class.ilCmiXapiUser.php.

Referenced by getSatisfied(), and setSatisfied().

◆ $usrId

◆ $usrIdent

ilCmiXapiUser::$usrIdent
protected

◆ DB_TABLE_NAME

const ilCmiXapiUser::DB_TABLE_NAME = 'cmix_users'

Definition at line 17 of file class.ilCmiXapiUser.php.


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