ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\Glossary\Flashcard\FlashcardTermDBRepository Class Reference
+ Collaboration diagram for ILIAS\Glossary\Flashcard\FlashcardTermDBRepository:

Public Member Functions

 __construct (protected \ilDBInterface $db, protected InternalDataService $data_service)
 
 getEntry (int $term_id, int $user_id, int $glo_id)
 
 getUserEntriesForBox (int $box_nr, int $user_id, int $glo_id)
 
 getAllUserEntries (int $user_id, int $glo_id)
 
 createEntry (Term $term)
 
 updateEntry (Term $term)
 
 deleteEntries (int $glo_id, int $user_id)
 
 deleteAllUserEntries (int $user_id)
 
 deleteAllGlossaryEntries (int $glo_id)
 
 deleteAllTermEntries (int $term_id)
 

Protected Member Functions

 getFromRecord (array $rec)
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Glossary\Flashcard\FlashcardTermDBRepository::__construct ( protected \ilDBInterface  $db,
protected InternalDataService  $data_service 
)

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

33  {
34  }

Member Function Documentation

◆ createEntry()

ILIAS\Glossary\Flashcard\FlashcardTermDBRepository::createEntry ( Term  $term)

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

References ILIAS\Glossary\Flashcard\Term\getBoxNr(), ILIAS\Glossary\Flashcard\Term\getGloId(), ILIAS\Glossary\Flashcard\Term\getLastAccess(), ILIAS\Glossary\Flashcard\Term\getTermId(), and ILIAS\Glossary\Flashcard\Term\getUserId().

115  : void {
116  $this->db->insert("glo_flashcard_term", [
117  "term_id" => ["integer", $term->getTermId()],
118  "user_id" => ["integer", $term->getUserId()],
119  "glo_id" => ["integer", $term->getGloId()],
120  "last_access" => ["date", $term->getLastAccess()],
121  "box_nr" => ["integer", $term->getBoxNr()]
122  ]);
123  }
+ Here is the call graph for this function:

◆ deleteAllGlossaryEntries()

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

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

References $q.

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

◆ deleteAllTermEntries()

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

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

References $q.

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

◆ deleteAllUserEntries()

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

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

References $q.

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

◆ deleteEntries()

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

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

References $q.

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

◆ getAllUserEntries()

ILIAS\Glossary\Flashcard\FlashcardTermDBRepository::getAllUserEntries ( int  $user_id,
int  $glo_id 
)
Returns
Term[]

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

References ILIAS\Glossary\Flashcard\FlashcardTermDBRepository\getFromRecord().

96  : array {
97  $set = $this->db->queryF(
98  "SELECT * FROM glo_flashcard_term " .
99  " WHERE user_id = %s AND glo_id = %s " .
100  " ORDER BY last_access ASC ",
101  ["integer", "integer"],
102  [$user_id, $glo_id]
103  );
104 
105  $entries = [];
106  while ($rec = $this->db->fetchAssoc($set)) {
107  $entries[] = $this->getFromRecord($rec);
108  }
109 
110  return $entries;
111  }
+ Here is the call graph for this function:

◆ getEntry()

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

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

References ILIAS\Glossary\Flashcard\FlashcardTermDBRepository\getFromRecord(), and null.

51  : ?Term {
52  $set = $this->db->queryF(
53  "SELECT * FROM glo_flashcard_term " .
54  " WHERE term_id = %s AND user_id = %s AND glo_id = %s ",
55  ["integer", "integer", "integer"],
56  [$term_id, $user_id, $glo_id]
57  );
58 
59  if ($rec = $this->db->fetchAssoc($set)) {
60  return $this->getFromRecord($rec);
61  }
62 
63  return null;
64  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ getFromRecord()

ILIAS\Glossary\Flashcard\FlashcardTermDBRepository::getFromRecord ( array  $rec)
protected

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

Referenced by ILIAS\Glossary\Flashcard\FlashcardTermDBRepository\getAllUserEntries(), ILIAS\Glossary\Flashcard\FlashcardTermDBRepository\getEntry(), and ILIAS\Glossary\Flashcard\FlashcardTermDBRepository\getUserEntriesForBox().

36  : Term
37  {
38  return $this->data_service->flashcardTerm(
39  (int) $rec["term_id"],
40  (int) $rec["user_id"],
41  (int) $rec["glo_id"],
42  (int) $rec["box_nr"],
43  $rec["last_access"]
44  );
45  }
+ Here is the caller graph for this function:

◆ getUserEntriesForBox()

ILIAS\Glossary\Flashcard\FlashcardTermDBRepository::getUserEntriesForBox ( int  $box_nr,
int  $user_id,
int  $glo_id 
)
Returns
Term[]

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

References ILIAS\Glossary\Flashcard\FlashcardTermDBRepository\getFromRecord().

73  : array {
74  $set = $this->db->queryF(
75  "SELECT * FROM glo_flashcard_term " .
76  " WHERE box_nr = %s AND user_id = %s AND glo_id = %s " .
77  " ORDER BY last_access ASC ",
78  ["integer", "integer", "integer"],
79  [$box_nr, $user_id, $glo_id]
80  );
81 
82  $entries = [];
83  while ($rec = $this->db->fetchAssoc($set)) {
84  $entries[] = $this->getFromRecord($rec);
85  }
86 
87  return $entries;
88  }
+ Here is the call graph for this function:

◆ updateEntry()

ILIAS\Glossary\Flashcard\FlashcardTermDBRepository::updateEntry ( Term  $term)

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

References ILIAS\Glossary\Flashcard\Term\getBoxNr(), ILIAS\Glossary\Flashcard\Term\getGloId(), ILIAS\Glossary\Flashcard\Term\getLastAccess(), ILIAS\Glossary\Flashcard\Term\getTermId(), and ILIAS\Glossary\Flashcard\Term\getUserId().

127  : void {
128  $this->db->update("glo_flashcard_term", [
129  "last_access" => ["date", $term->getLastAccess()],
130  "box_nr" => ["integer", $term->getBoxNr()]
131  ], [
132  "term_id" => ["integer", $term->getTermId()],
133  "user_id" => ["integer", $term->getUserId()],
134  "glo_id" => ["integer", $term->getGloId()]
135  ]);
136  }
+ Here is the call graph for this function:

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