ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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
5require_once ('./Modules/DataCollection/classes/Fields/Base/class.ilDclBaseRecordFieldModel.php');
6require_once ('./Services/Rating/classes/class.ilRating.php');
7
20
24 protected $rated;
25
29 protected $dcl_obj_id;
30
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 return;
41 }
42
43
47 protected function loadValue(){
48 // explicitly do nothing. we don't have to load the value as it is saved somewhere else.
49 }
50
57 public function setValue($value, $omit_parsing = false) {
58 // explicitly do nothing. the value is handled via the model and gui of ilRating.
59 }
60
61 public function doUpdate(){
62 // explicitly do nothing. the value is handled via the model and gui of ilRating.
63 }
64
65 public function doRead(){
66 // explicitly do nothing. the value is handled via the model and gui of ilRating.
67 }
68
73 public function getExportValue(){
74 $val = ilRating::getOverallRatingForObject($this->getRecord()->getId(), "dcl_record", $this->getField()->getId(), "dcl_field");
75 return round($val["avg"],1)." (".$val["cnt"].")";
76 }
77
81 public function getValue(){
82 return ilRating::getOverallRatingForObject($this->getRecord()->getId(), "dcl_record", $this->getField()->getId(), "dcl_field");
83 }
84
88 public function delete()
89 {
90 global $DIC;
91 $ilDB = $DIC['ilDB'];
92
93 $ilDB->manipulate("DELETE FROM il_rating WHERE ".
94 "obj_id = ".$ilDB->quote((int) $this->getRecord()->getId(), "integer")." AND ".
95 "obj_type = ".$ilDB->quote("dcl_record", "text")." AND ".
96 "sub_obj_id = ".$ilDB->quote((int) $this->getField()->getId(), "integer")." AND ".
97 $ilDB->equals("sub_obj_type", "dcl_field", "text", true));
98
99 $query2 = "DELETE FROM il_dcl_record_field WHERE id = ".$ilDB->quote($this->getId(), "integer");
100 $ilDB->manipulate($query2);
101 }
102}
103?>
An exception for terminatinating execution or to throw for unit testing.
Confirmation screen class.
Class ilDclBaseFieldModel.
Class ilDclBaseRecordModel.
static getTableCache($table_id=0)
addHiddenItemsToConfirmation(ilConfirmationGUI &$confirmation)
setValue($value, $omit_parsing=false)
Set value for record field.
doRead()
Read object data from database.
__construct(ilDclBaseRecordModel $record, ilDclBaseFieldModel $field)
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.
global $ilDB
global $DIC