ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Notes\NoteSettingsDBRepository Class Reference
+ Collaboration diagram for ILIAS\Notes\NoteSettingsDBRepository:

Public Member Functions

 __construct (InternalDataService $data, \ilDBInterface $db)
 
 commentsActive (int $obj_id)
 Are comments activated for object? More...
 
 commentsActiveMultiple (array $obj_ids)
 
 activateComments (int $obj_id, int $sub_obj_id, string $obj_type, bool $a_activate=true)
 Activate notes feature. More...
 

Protected Attributes

ilDBInterface $db
 
InternalDataService $data
 

Detailed Description

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

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

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Notes\NoteSettingsDBRepository::__construct ( InternalDataService  $data,
\ilDBInterface  $db 
)

Member Function Documentation

◆ activateComments()

ILIAS\Notes\NoteSettingsDBRepository::activateComments ( int  $obj_id,
int  $sub_obj_id,
string  $obj_type,
bool  $a_activate = true 
)

Activate notes feature.

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

84 : void {
85 $db = $this->db;
86
87 if ($obj_type === "") {
88 $obj_type = "-";
89 }
90
91 $db->replace(
92 "note_settings",
93 [
94 "rep_obj_id" => ["integer", $obj_id],
95 "obj_id" => ["integer", $sub_obj_id],
96 "obj_type" => ["string", $obj_type],
97 ],
98 [
99 "activated" => ["integer", (int) $a_activate]
100 ]
101 );
102 }
replace(string $table, array $primary_keys, array $other_columns)
Replace into method.

◆ commentsActive()

ILIAS\Notes\NoteSettingsDBRepository::commentsActive ( int  $obj_id)

Are comments activated for object?

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

44 : bool {
45 $db = $this->db;
46 $set = $db->query(
47 "SELECT rep_obj_id FROM note_settings " .
48 " WHERE rep_obj_id = " . $db->quote($obj_id, "integer") .
49 " AND activated = " . $db->quote(1, "integer")
50 );
51 if ($db->fetchAssoc($set)) {
52 return true;
53 }
54 return false;
55 }
quote($value, string $type)
query(string $query)
Run a (read-only) Query on the database.
fetchAssoc(ilDBStatement $statement)

◆ commentsActiveMultiple()

ILIAS\Notes\NoteSettingsDBRepository::commentsActiveMultiple ( array  $obj_ids)

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

59 : array {
60 $db = $this->db;
61
62 $set = $db->query("SELECT * FROM note_settings " .
63 " WHERE " . $db->in("rep_obj_id", $obj_ids, false, "integer") .
64 " AND obj_id = 0 ");
65 $activations = [];
66 while ($rec = $db->fetchAssoc($set)) {
67 if ($rec["activated"]) {
68 $activations[$rec["rep_obj_id"]] = true;
69 }
70 }
71
72 return $activations;
73 }
in(string $field, array $values, bool $negate=false, string $type="")

Field Documentation

◆ $data

InternalDataService ILIAS\Notes\NoteSettingsDBRepository::$data
protected

◆ $db

ilDBInterface ILIAS\Notes\NoteSettingsDBRepository::$db
protected

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