ILIAS  release_8 Revision v8.23
class.ilDclRatingRecordFieldModel.php
Go to the documentation of this file.
1 <?php
2 
20 {
21  protected int $dcl_obj_id;
22 
24  {
25  parent::__construct($record, $field);
26 
27  $dclTable = ilDclCache::getTableCache($this->getField()->getTableId());
28  $this->dcl_obj_id = $dclTable->getCollectionObject()->getId();
29  }
30 
31  public function addHiddenItemsToConfirmation(ilConfirmationGUI $confirmation): void
32  {
33  }
34 
38  protected function loadValue(): void
39  {
40  // explicitly do nothing. we don't have to load the value as it is saved somewhere else.
41  }
42 
48  public function setValue($value, bool $omit_parsing = false): void
49  {
50  // explicitly do nothing. the value is handled via the model and gui of ilRating.
51  }
52 
53  public function doUpdate(): void
54  {
55  // explicitly do nothing. the value is handled via the model and gui of ilRating.
56  }
57 
58  protected function doRead(): void
59  {
60  // explicitly do nothing. the value is handled via the model and gui of ilRating.
61  }
62 
67  public function getExportValue(): string
68  {
70  $this->getRecord()->getId(),
71  "dcl_record",
72  $this->getField()->getId(),
73  "dcl_field"
74  );
75 
76  return round($val["avg"], 1) . " (" . $val["cnt"] . ")";
77  }
78 
82  public function getValue(): array
83  {
85  $this->getRecord()->getId(),
86  "dcl_record",
87  $this->getField()->getId(),
88  "dcl_field"
89  );
90  }
91 
95  public function delete(): void
96  {
97  global $DIC;
98  $ilDB = $DIC['ilDB'];
99 
100  $ilDB->manipulate(
101  "DELETE FROM il_rating WHERE " .
102  "obj_id = " . $ilDB->quote($this->getRecord()->getId(), "integer") . " AND " .
103  "obj_type = " . $ilDB->quote("dcl_record", "text") . " AND " .
104  "sub_obj_id = " . $ilDB->quote((int) $this->getField()->getId(), "integer") . " AND " .
105  $ilDB->equals("sub_obj_type", "dcl_field", "text", true)
106  );
107 
108  $query2 = "DELETE FROM il_dcl_record_field WHERE id = " . $ilDB->quote($this->getId(), "integer");
109  $ilDB->manipulate($query2);
110  }
111 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setValue($value, bool $omit_parsing=false)
Set value for record field.
__construct(ilDclBaseRecordModel $record, ilDclBaseFieldModel $field)
global $DIC
Definition: feed.php:28
static getTableCache(int $table_id=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...