ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 
5 
18 {
19 
23  protected $rated;
24 
28  protected $dcl_obj_id;
29 
31  {
32  parent::__construct($record, $field);
33 
34  $dclTable = ilDclCache::getTableCache($this->getField()->getTableId());
35  $this->dcl_obj_id = $dclTable->getCollectionObject()->getId();
36  }
37 
38 
39  public function addHiddenItemsToConfirmation(ilConfirmationGUI &$confirmation)
40  {
41  return;
42  }
43 
44 
48  protected function loadValue()
49  {
50  // explicitly do nothing. we don't have to load the value as it is saved somewhere else.
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  public function doUpdate()
65  {
66  // explicitly do nothing. the value is handled via the model and gui of ilRating.
67  }
68 
69  public function doRead()
70  {
71  // explicitly do nothing. the value is handled via the model and gui of ilRating.
72  }
73 
78  public function getExportValue()
79  {
80  $val = ilRating::getOverallRatingForObject($this->getRecord()->getId(), "dcl_record", $this->getField()->getId(), "dcl_field");
81  return round($val["avg"], 1) . " (" . $val["cnt"] . ")";
82  }
83 
87  public function getValue()
88  {
89  return ilRating::getOverallRatingForObject($this->getRecord()->getId(), "dcl_record", $this->getField()->getId(), "dcl_field");
90  }
91 
95  public function delete()
96  {
97  global $DIC;
98  $ilDB = $DIC['ilDB'];
99 
100  $ilDB->manipulate("DELETE FROM il_rating WHERE " .
101  "obj_id = " . $ilDB->quote((int) $this->getRecord()->getId(), "integer") . " AND " .
102  "obj_type = " . $ilDB->quote("dcl_record", "text") . " AND " .
103  "sub_obj_id = " . $ilDB->quote((int) $this->getField()->getId(), "integer") . " AND " .
104  $ilDB->equals("sub_obj_type", "dcl_field", "text", true));
105 
106  $query2 = "DELETE FROM il_dcl_record_field WHERE id = " . $ilDB->quote($this->getId(), "integer");
107  $ilDB->manipulate($query2);
108  }
109 }
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.