ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilObjUseBookDBRepository 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 ilObjUseBookDBRepository:

Public Member Functions

 __construct (\ilDBInterface $db)
 
 updateUsedBookingPools (int $obj_id, array $book_obj_ids)
 
 getUsedBookingPools (int $obj_id, bool $include_deleted=true)
 
 deleteEntriesOfBookRefId (int $ref_id)
 

Protected Attributes

const TABLE_NAME = 'book_obj_use_book'
 
ilTree $tree
 
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 This repo stores infos on repository objects that are using booking managers as a service (resource management).

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

Definition at line 24 of file class.ilObjUseBookDBRepository.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjUseBookDBRepository::__construct ( \ilDBInterface  $db)

Definition at line 31 of file class.ilObjUseBookDBRepository.php.

References $db, and $DIC.

32  {
33  global $DIC;
34  $this->tree = $DIC->repositoryTree();
35  $this->db = $db;
36  }
global $DIC
Definition: shib_login.php:22

Member Function Documentation

◆ deleteEntriesOfBookRefId()

ilObjUseBookDBRepository::deleteEntriesOfBookRefId ( int  $ref_id)

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

84  : void
85  {
86  $this->db->manipulateF(
87  "DELETE FROM " . self::TABLE_NAME . " WHERE " .
88  " book_ref_id = %s",
89  ["integer"],
90  [$ref_id]
91  );
92  }
$ref_id
Definition: ltiauth.php:65

◆ getUsedBookingPools()

ilObjUseBookDBRepository::getUsedBookingPools ( int  $obj_id,
bool  $include_deleted = true 
)
Returns
int[] ref ids

Definition at line 65 of file class.ilObjUseBookDBRepository.php.

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

Referenced by ILIAS\BookingManager\getObjectSettingsCommandHandler\handle().

65  : array
66  {
67  $db = $this->db;
68 
69  $set = $db->queryF(
70  "SELECT * FROM " . self::TABLE_NAME . " " .
71  " WHERE obj_id = %s ",
72  array("integer"),
73  array($obj_id)
74  );
75  $book_ids = [];
76  while ($rec = $db->fetchAssoc($set)) {
77  if ($include_deleted || $this->tree->isInTree((int) $rec["book_ref_id"])) {
78  $book_ids[] = $rec["book_ref_id"];
79  }
80  }
81  return $book_ids;
82  }
fetchAssoc(ilDBStatement $statement)
queryF(string $query, array $types, array $values)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateUsedBookingPools()

ilObjUseBookDBRepository::updateUsedBookingPools ( int  $obj_id,
array  $book_obj_ids 
)
Parameters
int[]$book_obj_ids

Definition at line 41 of file class.ilObjUseBookDBRepository.php.

References $db, $id, ilDBInterface\insert(), and ilDBInterface\manipulateF().

Referenced by ILIAS\BookingManager\saveObjectSettingsCommandHandler\handle().

44  : void {
45  $db = $this->db;
46 
48  "DELETE FROM " . self::TABLE_NAME . " WHERE " .
49  " obj_id = %s",
50  array("integer"),
51  array($obj_id)
52  );
53 
54  foreach ($book_obj_ids as $id) {
55  $db->insert(self::TABLE_NAME, array(
56  "obj_id" => array("integer", $obj_id),
57  "book_ref_id" => array("integer", $id)
58  ));
59  }
60  }
insert(string $table_name, array $values)
manipulateF(string $query, array $types, array $values)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilDBInterface ilObjUseBookDBRepository::$db
protected

◆ $tree

ilTree ilObjUseBookDBRepository::$tree
protected

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

◆ TABLE_NAME

const ilObjUseBookDBRepository::TABLE_NAME = 'book_obj_use_book'
protected

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


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