3 declare(strict_types=0);
24 $this->db = $DIC->database();
25 $this->
logger = $DIC->logger()->trac();
27 $this->obj_id = $a_obj_id;
28 $this->mode = $a_mode;
31 $this->
read($a_obj_id);
39 $path =
"Services/Tracking/classes/collection/";
91 $mappings = $cwo->getMappings();
94 $new_collection =
new static($target_obj_id,
$this->mode);
95 foreach ($this->items as $item) {
96 if (!isset($mappings[$item]) or !$mappings[$item]) {
100 $new_collection->addEntry($mappings[$item]);
102 $this->
logger->debug(
'cloned learning progress collection.');
110 protected function read(
int $a_obj_id): void
113 $res = $this->db->query(
114 "SELECT * FROM ut_lp_collections" .
115 " WHERE obj_id = " . $this->db->quote($a_obj_id,
"integer")
119 $items[] = $row->item_id;
127 public function delete():
void 129 $query =
"DELETE FROM ut_lp_collections" .
130 " WHERE obj_id = " . $this->db->quote($this->obj_id,
"integer");
131 $this->db->manipulate(
$query);
133 $query =
"DELETE FROM ut_lp_coll_manual" .
134 " WHERE obj_id = " . $this->db->quote($this->obj_id,
"integer");
135 $this->db->manipulate(
$query);
137 $this->items = array();
151 if (is_array($this->items)) {
152 return in_array($a_item_id, $this->items);
160 $query =
"INSERT INTO ut_lp_collections" .
161 " (obj_id, lpmode, item_id)" .
162 " VALUES (" . $this->db->quote($this->obj_id,
"integer") .
163 ", " . $this->db->quote($this->mode,
"integer") .
164 ", " . $this->db->quote($a_item_id,
"integer") .
166 $this->db->manipulate(
$query);
167 $this->items[] = $a_item_id;
174 $query =
"DELETE FROM ut_lp_collections" .
175 " WHERE obj_id = " . $this->db->quote($this->obj_id,
"integer") .
176 " AND item_id = " . $this->db->quote($a_item_id,
"integer");
177 $this->db->manipulate(
$query);
186 foreach ($a_item_ids as $item_id) {
196 foreach ($a_item_ids as $item_id) {
cloneCollection(int $a_target_id, int $a_copy_id)
const LP_MODE_MANUAL_BY_TUTOR
LP collection of objectives.
LP collection of learning module chapters.
deleteEntry(int $a_item_id)
const LP_MODE_COLLECTION_MANUAL
isAssignedEntry(int $a_item_id)
const LP_MODE_COLLECTION_TLT
static _lookupObjId(int $ref_id)
validateEntry(int $a_item_id)
LP collection of repository objects.
static getInstanceByMode(int $a_obj_id, int $a_mode)
deactivateEntries(array $a_item_ids)
__construct(int $a_obj_id, int $a_mode)
LP collection base class.
const LP_MODE_COLLECTION_MOBS
activateEntries(array $a_item_ids)
static _getInstance(int $a_copy_id)
static getCollectionModes()