ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilDclRatingRecordFieldModel.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
23 protected int $dcl_obj_id;
24
26 {
28
29 $dclTable = ilDclCache::getTableCache($this->getField()->getTableId());
30 $this->dcl_obj_id = $dclTable->getCollectionObject()->getId();
31 }
32
33 public function addHiddenItemsToConfirmation(ilConfirmationGUI $confirmation): void
34 {
35 }
36
40 protected function loadValue(): void
41 {
42 // explicitly do nothing. we don't have to load the value as it is saved somewhere else.
43 }
44
50 public function setValue($value, bool $omit_parsing = false): void
51 {
52 // explicitly do nothing. the value is handled via the model and gui of ilRating.
53 }
54
55 public function doUpdate(): void
56 {
57 // explicitly do nothing. the value is handled via the model and gui of ilRating.
58 }
59
60 protected function doRead(): void
61 {
62 // explicitly do nothing. the value is handled via the model and gui of ilRating.
63 }
64
69 public function getExportValue(): string
70 {
72 $this->getRecord()->getId(),
73 "dcl_record",
74 (int) $this->getField()->getId(),
75 "dcl_field"
76 );
77
78 return round($val["avg"], 1) . " (" . $val["cnt"] . ")";
79 }
80
84 public function getValue(): array
85 {
87 $this->getRecord()->getId(),
88 "dcl_record",
89 (int) $this->getField()->getId(),
90 "dcl_field"
91 );
92 }
93
97 public function delete(): void
98 {
99 global $DIC;
100 $ilDB = $DIC['ilDB'];
101
102 $ilDB->manipulate(
103 "DELETE FROM il_rating WHERE " .
104 "obj_id = " . $ilDB->quote($this->getRecord()->getId(), "integer") . " AND " .
105 "obj_type = " . $ilDB->quote("dcl_record", "text") . " AND " .
106 "sub_obj_id = " . $ilDB->quote((int) $this->getField()->getId(), "integer") . " AND " .
107 $ilDB->equals("sub_obj_type", "dcl_field", "text", true)
108 );
109
110 $query2 = "DELETE FROM il_dcl_record_field WHERE id = " . $ilDB->quote($this->getId(), "integer");
111 $ilDB->manipulate($query2);
112 }
113}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getTableCache(?int $table_id=null)
setValue($value, bool $omit_parsing=false)
Set value for record field.
doRead()
Read object data from database.
__construct(ilDclBaseRecordModel $record, ilDclBaseFieldModel $field)
addHiddenItemsToConfirmation(ilConfirmationGUI $confirmation)
static getOverallRatingForObject(int $a_obj_id, string $a_obj_type, ?int $a_sub_obj_id=null, ?string $a_sub_obj_type=null, ?int $a_category_id=null)
Get overall rating for an object.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26