ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilWorkspaceFolderUserSettingsRepository 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 ilWorkspaceFolderUserSettingsRepository:

Public Member Functions

 __construct (int $user_id, ?ilDBInterface $db=null)
 Constructor. More...
 
 getSortation (int $wfld_id)
 
 getSortationMultiple (array $wfld_ids)
 
 updateSortation (int $wfld_id, int $sortation)
 

Protected Attributes

int $user_id
 
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 Stores user settings per workspace folder Table: wfld_user_setting (rw)

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

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

Constructor & Destructor Documentation

◆ __construct()

ilWorkspaceFolderUserSettingsRepository::__construct ( int  $user_id,
?ilDBInterface  $db = null 
)

Constructor.

Definition at line 33 of file class.ilWorkspaceFolderUserSettingsRepository.php.

36 {
37 global $DIC;
38
39 $this->user_id = $user_id;
40 $this->db = ($db != null)
41 ? $db
42 : $DIC->database();
43 }
global $DIC
Definition: shib_login.php:26

References $db, $DIC, and $user_id.

Member Function Documentation

◆ getSortation()

ilWorkspaceFolderUserSettingsRepository::getSortation ( int  $wfld_id)

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

45 : int
46 {
47 $db = $this->db;
48
49 $set = $db->queryF(
50 "SELECT * FROM wfld_user_setting " .
51 " WHERE user_id = %s " .
52 " AND wfld_id = %s ",
53 array("integer", "integer"),
54 array($this->user_id, $wfld_id)
55 );
56 $rec = $db->fetchAssoc($set);
57 return (int) ($rec["sortation"] ?? 0);
58 }
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:

◆ getSortationMultiple()

ilWorkspaceFolderUserSettingsRepository::getSortationMultiple ( array  $wfld_ids)

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

60 : array
61 {
62 $db = $this->db;
63
64 $set = $db->queryF(
65 "SELECT * FROM wfld_user_setting " .
66 " WHERE user_id = %s " .
67 " AND " . $db->in("wfld_id", $wfld_ids, false, "integer"),
68 array("integer"),
69 array($this->user_id)
70 );
71 $ret = [];
72
73 while ($rec = $db->fetchAssoc($set)) {
74 $ret[$rec["wfld_id"]] = (int) $rec["sortation"];
75 }
76 foreach ($wfld_ids as $id) {
77 if (!isset($ret[$id])) {
78 $ret[$id] = 0;
79 }
80 }
81 return $ret;
82 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
in(string $field, array $values, bool $negate=false, string $type="")

References $db, $id, ilDBInterface\fetchAssoc(), ilDBInterface\in(), ILIAS\Repository\int(), and ilDBInterface\queryF().

+ Here is the call graph for this function:

◆ updateSortation()

ilWorkspaceFolderUserSettingsRepository::updateSortation ( int  $wfld_id,
int  $sortation 
)

Definition at line 84 of file class.ilWorkspaceFolderUserSettingsRepository.php.

85 {
86 $db = $this->db;
87
88 $db->replace("wfld_user_setting", array( // pk
89 "user_id" => array("integer", $this->user_id),
90 "wfld_id" => array("integer", $wfld_id)
91 ), array(
92 "sortation" => array("integer", $sortation)
93 ));
94 }
replace(string $table, array $primary_keys, array $other_columns)
Replace into method.

References $db, and ilDBInterface\replace().

+ Here is the call graph for this function:

Field Documentation

◆ $db

ilDBInterface ilWorkspaceFolderUserSettingsRepository::$db
protected

◆ $user_id

int ilWorkspaceFolderUserSettingsRepository::$user_id
protected

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

Referenced by __construct().


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