ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilDclRatingRecordFieldModel.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
17 {
18 
22  protected $rated;
26  protected $dcl_obj_id;
27 
28 
30  {
31  parent::__construct($record, $field);
32 
33  $dclTable = ilDclCache::getTableCache($this->getField()->getTableId());
34  $this->dcl_obj_id = $dclTable->getCollectionObject()->getId();
35  }
36 
37 
38  public function addHiddenItemsToConfirmation(ilConfirmationGUI &$confirmation)
39  {
40  return;
41  }
42 
43 
47  protected function loadValue()
48  {
49  // explicitly do nothing. we don't have to load the value as it is saved somewhere else.
50  }
51 
52 
59  public function setValue($value, $omit_parsing = false)
60  {
61  // explicitly do nothing. the value is handled via the model and gui of ilRating.
62  }
63 
64 
65  public function doUpdate()
66  {
67  // explicitly do nothing. the value is handled via the model and gui of ilRating.
68  }
69 
70 
71  public function doRead()
72  {
73  // explicitly do nothing. the value is handled via the model and gui of ilRating.
74  }
75 
76 
82  public function getExportValue()
83  {
84  $val = ilRating::getOverallRatingForObject($this->getRecord()->getId(), "dcl_record", $this->getField()->getId(), "dcl_field");
85 
86  return round($val["avg"], 1) . " (" . $val["cnt"] . ")";
87  }
88 
89 
93  public function getValue()
94  {
95  return ilRating::getOverallRatingForObject($this->getRecord()->getId(), "dcl_record", $this->getField()->getId(), "dcl_field");
96  }
97 
98 
102  public function delete()
103  {
104  global $DIC;
105  $ilDB = $DIC['ilDB'];
106 
107  $ilDB->manipulate(
108  "DELETE FROM il_rating WHERE " .
109  "obj_id = " . $ilDB->quote((int) $this->getRecord()->getId(), "integer") . " AND " .
110  "obj_type = " . $ilDB->quote("dcl_record", "text") . " AND " .
111  "sub_obj_id = " . $ilDB->quote((int) $this->getField()->getId(), "integer") . " AND " .
112  $ilDB->equals("sub_obj_type", "dcl_field", "text", true)
113  );
114 
115  $query2 = "DELETE FROM il_dcl_record_field WHERE id = " . $ilDB->quote($this->getId(), "integer");
116  $ilDB->manipulate($query2);
117  }
118 }
Class ilDclBaseFieldModel.
global $DIC
Definition: saml.php:7
setValue($value, $omit_parsing=false)
Set value for record field.
__construct(ilDclBaseRecordModel $record, ilDclBaseFieldModel $field)
addHiddenItemsToConfirmation(ilConfirmationGUI &$confirmation)
static getTableCache($table_id=0)
static getOverallRatingForObject($a_obj_id, $a_obj_type, $a_sub_obj_id=null, $a_sub_obj_type=null, $a_category_id=null)
Get overall rating for an object.
Class ilDclBaseRecordModel.
global $ilDB
Confirmation screen class.