ILIAS  release_8 Revision v8.24
ilUserProfilePromptDataGateway Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilUserProfilePromptDataGateway:

Public Member Functions

 __construct ()
 
 saveSettings (ilProfilePromptSettings $settings)
 
 getSettings ()
 
 getUserPrompt (int $user_id)
 
 saveLastUserPrompt (int $user_id, string $last_profile_prompt="")
 

Protected Attributes

ilLanguage $lng
 
ilSetting $user_settings
 
ilDBInterface $db
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Profile prompt data gateway

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 23 of file class.ilUserProfilePromptDataGateway.php.

Constructor & Destructor Documentation

◆ __construct()

ilUserProfilePromptDataGateway::__construct ( )

Definition at line 29 of file class.ilUserProfilePromptDataGateway.php.

30 {
31 global $DIC;
32
33 $this->user_settings = new ilSetting("user");
34 $this->lng = $DIC->language();
35 $this->db = $DIC->database();
36 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28

References $DIC, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ getSettings()

ilUserProfilePromptDataGateway::getSettings ( )

Definition at line 53 of file class.ilUserProfilePromptDataGateway.php.

54 {
57
58 $info_texts = $prompt_texts = [];
59 foreach ($lng->getInstalledLanguages() as $l) {
60 $info_texts[$l] = $user_settings->get("user_profile_info_" . $l);
61 $prompt_texts[$l] = $user_settings->get("user_profile_prompt_" . $l);
62 }
63
64 return new ilProfilePromptSettings(
65 (int) $user_settings->get("user_profile_prompt_mode"),
66 (int) $user_settings->get("user_profile_prompt_days"),
67 $info_texts,
68 $prompt_texts
69 );
70 }
getInstalledLanguages()
Get installed languages.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
get(string $a_keyword, ?string $a_default_value=null)
get setting

References $lng, $user_settings, ilSetting\get(), and ilLanguage\getInstalledLanguages().

+ Here is the call graph for this function:

◆ getUserPrompt()

ilUserProfilePromptDataGateway::getUserPrompt ( int  $user_id)

Definition at line 72 of file class.ilUserProfilePromptDataGateway.php.

73 {
74 $db = $this->db;
75
76 $set = $db->queryF(
77 "SELECT first_login, last_profile_prompt FROM usr_data " .
78 " WHERE usr_id = %s ",
79 array("integer"),
80 array($user_id)
81 );
82 if ($rec = $db->fetchAssoc($set)) {
83 return new ilProfileUserPrompt($user_id, $rec["last_profile_prompt"], $rec["first_login"]);
84 }
85 return new ilProfileUserPrompt($user_id, "", "");
86 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
fetchAssoc(ilDBStatement $statement)
queryF(string $query, array $types, array $values)

References $db, ilDBInterface\fetchAssoc(), and ilDBInterface\queryF().

+ Here is the call graph for this function:

◆ saveLastUserPrompt()

ilUserProfilePromptDataGateway::saveLastUserPrompt ( int  $user_id,
string  $last_profile_prompt = "" 
)

Definition at line 88 of file class.ilUserProfilePromptDataGateway.php.

88 : void
89 {
90 $db = $this->db;
91
92 if ($last_profile_prompt == "") {
93 $last_profile_prompt = ilUtil::now();
94 }
95
96 $db->update("usr_data", array(
97 "last_profile_prompt" => array("timestamp", $last_profile_prompt)
98 ), array( // where
99 "usr_id" => array("integer", $user_id)
100 ));
101 }
static now()
Return current timestamp in Y-m-d H:i:s format.
update(string $table_name, array $values, array $where)
@description $where MUST contain existing columns only.

References $db, ilUtil\now(), and ilDBInterface\update().

+ Here is the call graph for this function:

◆ saveSettings()

ilUserProfilePromptDataGateway::saveSettings ( ilProfilePromptSettings  $settings)

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

38 : void
39 {
41
42 foreach ($settings->getInfoTexts() as $l => $text) {
43 $user_settings->set("user_profile_info_" . $l, $text);
44 }
45 foreach ($settings->getPromptTexts() as $l => $text) {
46 $user_settings->set("user_profile_prompt_" . $l, $text);
47 }
48
49 $user_settings->set("user_profile_prompt_mode", $settings->getMode());
50 $user_settings->set("user_profile_prompt_days", $settings->getDays());
51 }
set(string $a_key, string $a_val)
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200

References ILIAS\LTI\ToolProvider\$settings, $user_settings, and ilSetting\set().

+ Here is the call graph for this function:

Field Documentation

◆ $db

ilDBInterface ilUserProfilePromptDataGateway::$db
protected

Definition at line 27 of file class.ilUserProfilePromptDataGateway.php.

Referenced by getUserPrompt(), and saveLastUserPrompt().

◆ $lng

ilLanguage ilUserProfilePromptDataGateway::$lng
protected

Definition at line 25 of file class.ilUserProfilePromptDataGateway.php.

Referenced by getSettings().

◆ $user_settings

ilSetting ilUserProfilePromptDataGateway::$user_settings
protected

Definition at line 26 of file class.ilUserProfilePromptDataGateway.php.

Referenced by getSettings(), and saveSettings().


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