ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ILIAS\Glossary\Flashcard\FlashcardTermDBRepository Class Reference
+ Collaboration diagram for ILIAS\Glossary\Flashcard\FlashcardTermDBRepository:

Public Member Functions

 __construct (\ilDBInterface $db)
 
 getUserEntriesForBox (int $box_nr, int $user_id, int $glo_id)
 
 getAllUserEntries (int $user_id, int $glo_id)
 
 getBoxNr (int $term_id, int $user_id, int $glo_id)
 
 createEntry (int $term_id, int $user_id, int $glo_id, int $box_nr, string $date)
 
 updateEntry (int $term_id, int $user_id, int $glo_id, int $box_nr, string $date)
 
 deleteEntries (int $glo_id, int $user_id)
 
 deleteAllUserEntries (int $user_id)
 
 deleteAllGlossaryEntries (int $glo_id)
 
 deleteAllTermEntries (int $term_id)
 

Protected Attributes

ilDBInterface $db
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Glossary\Flashcard\FlashcardTermDBRepository::__construct ( \ilDBInterface  $db)

Member Function Documentation

◆ createEntry()

ILIAS\Glossary\Flashcard\FlashcardTermDBRepository::createEntry ( int  $term_id,
int  $user_id,
int  $glo_id,
int  $box_nr,
string  $date 
)

Definition at line 108 of file class.FlashcardTermDBRepository.php.

114  : void {
115  $this->db->insert("glo_flashcard_term", [
116  "term_id" => ["integer", $term_id],
117  "user_id" => ["integer", $user_id],
118  "glo_id" => ["integer", $glo_id],
119  "last_access" => ["date", $date],
120  "box_nr" => ["integer", $box_nr]
121  ]);
122  }

◆ deleteAllGlossaryEntries()

ILIAS\Glossary\Flashcard\FlashcardTermDBRepository::deleteAllGlossaryEntries ( int  $glo_id)

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

References $q.

161  : void {
162  $q = "DELETE FROM glo_flashcard_term " .
163  " WHERE glo_id = " . $this->db->quote($glo_id, "integer");
164  $this->db->manipulate($q);
165  }
$q
Definition: shib_logout.php:21

◆ deleteAllTermEntries()

ILIAS\Glossary\Flashcard\FlashcardTermDBRepository::deleteAllTermEntries ( int  $term_id)

Definition at line 167 of file class.FlashcardTermDBRepository.php.

References $q.

169  : void {
170  $q = "DELETE FROM glo_flashcard_term " .
171  " WHERE term_id = " . $this->db->quote($term_id, "integer");
172  $this->db->manipulate($q);
173  }
$q
Definition: shib_logout.php:21

◆ deleteAllUserEntries()

ILIAS\Glossary\Flashcard\FlashcardTermDBRepository::deleteAllUserEntries ( int  $user_id)

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

References $q.

153  : void {
154  $q = "DELETE FROM glo_flashcard_term " .
155  " WHERE user_id = " . $this->db->quote($user_id, "integer");
156  $this->db->manipulate($q);
157  }
$q
Definition: shib_logout.php:21

◆ deleteEntries()

ILIAS\Glossary\Flashcard\FlashcardTermDBRepository::deleteEntries ( int  $glo_id,
int  $user_id 
)

Definition at line 141 of file class.FlashcardTermDBRepository.php.

References $q.

144  : void {
145  $q = "DELETE FROM glo_flashcard_term " .
146  " WHERE glo_id = " . $this->db->quote($glo_id, "integer") .
147  " AND user_id = " . $this->db->quote($user_id, "integer");
148  $this->db->manipulate($q);
149  }
$q
Definition: shib_logout.php:21

◆ getAllUserEntries()

ILIAS\Glossary\Flashcard\FlashcardTermDBRepository::getAllUserEntries ( int  $user_id,
int  $glo_id 
)

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

66  : array {
67  $set = $this->db->queryF(
68  "SELECT * FROM glo_flashcard_term " .
69  " WHERE user_id = %s AND glo_id = %s " .
70  " ORDER BY last_access ASC ",
71  ["integer", "integer"],
72  [$user_id, $glo_id]
73  );
74 
75  $entries = [];
76  while ($rec = $this->db->fetchAssoc($set)) {
77  $entries[] = [
78  "term_id" => $rec["term_id"],
79  "user_id" => $rec["user_id"],
80  "glo_id" => $rec["glo_id"],
81  "last_access" => $rec["last_access"],
82  "box_nr" => $rec["box_nr"]
83  ];
84  }
85 
86  return $entries;
87  }

◆ getBoxNr()

ILIAS\Glossary\Flashcard\FlashcardTermDBRepository::getBoxNr ( int  $term_id,
int  $user_id,
int  $glo_id 
)

Definition at line 89 of file class.FlashcardTermDBRepository.php.

93  : int {
94  $set = $this->db->queryF(
95  "SELECT box_nr FROM glo_flashcard_term " .
96  " WHERE term_id = %s AND user_id = %s AND glo_id = %s ",
97  ["integer", "integer", "integer"],
98  [$term_id, $user_id, $glo_id]
99  );
100 
101  if ($rec = $this->db->fetchAssoc($set)) {
102  return (int) $rec["box_nr"];
103  }
104 
105  return 0;
106  }

◆ getUserEntriesForBox()

ILIAS\Glossary\Flashcard\FlashcardTermDBRepository::getUserEntriesForBox ( int  $box_nr,
int  $user_id,
int  $glo_id 
)

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

40  : array {
41  $set = $this->db->queryF(
42  "SELECT * FROM glo_flashcard_term " .
43  " WHERE box_nr = %s AND user_id = %s AND glo_id = %s " .
44  " ORDER BY last_access ASC ",
45  ["integer", "integer", "integer"],
46  [$box_nr, $user_id, $glo_id]
47  );
48 
49  $entries = [];
50  while ($rec = $this->db->fetchAssoc($set)) {
51  $entries[] = [
52  "term_id" => $rec["term_id"],
53  "user_id" => $rec["user_id"],
54  "glo_id" => $rec["glo_id"],
55  "last_access" => $rec["last_access"],
56  "box_nr" => $rec["box_nr"]
57  ];
58  }
59 
60  return $entries;
61  }

◆ updateEntry()

ILIAS\Glossary\Flashcard\FlashcardTermDBRepository::updateEntry ( int  $term_id,
int  $user_id,
int  $glo_id,
int  $box_nr,
string  $date 
)

Definition at line 124 of file class.FlashcardTermDBRepository.php.

130  : void {
131  $this->db->update("glo_flashcard_term", [
132  "last_access" => ["date", $date],
133  "box_nr" => ["integer", $box_nr]
134  ], [
135  "term_id" => ["integer", $term_id],
136  "user_id" => ["integer", $user_id],
137  "glo_id" => ["integer", $glo_id]
138  ]);
139  }

Field Documentation

◆ $db

ilDBInterface ILIAS\Glossary\Flashcard\FlashcardTermDBRepository::$db
protected

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