ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilDataCollectionRatingField Class Reference

Class ilDataCollectionField. More...

+ Inheritance diagram for ilDataCollectionRatingField:
+ Collaboration diagram for ilDataCollectionRatingField:

Public Member Functions

 __construct (ilDataCollectionRecord $record, ilDataCollectionField $field)
 
 setValue ($value)
 
 doUpdate ()
 
 doRead ()
 
 getFormInput ()
 
 getHTML ()
 
 getExportValue ()
 
 getValue ()
 
 delete ()
 delete More...
 
- Public Member Functions inherited from ilDataCollectionRecordField
 __construct (ilDataCollectionRecord $record, ilDataCollectionField $field)
 
 doUpdate ()
 Update object in database. More...
 
 delete ()
 Delete record field in database. More...
 
 getValue ()
 
 setValue ($value, $omit_parsing=false)
 Set value for record field. More...
 
 getFormInput ()
 
 getExportValue ()
 
 getPlainText ()
 
 getHTML ($link=true)
 
 getSortingValue ($link=true)
 
 getSingleHTML ()
 
 getField ()
 
 getId ()
 
 getRecord ()
 

Protected Member Functions

 loadValue ()
 override the loadValue. More...
 
- Protected Member Functions inherited from ilDataCollectionRecordField
 doRead ()
 Read object data from database. More...
 
 doCreate ()
 Create object in database. More...
 
 loadValue ()
 Load the value. More...
 

Protected Attributes

 $rated
 
 $dcl_obj_id
 
- Protected Attributes inherited from ilDataCollectionRecordField
 $id
 
 $field
 
 $record
 
 $value
 
 $lng
 
 $user
 
 $ctrl
 
 $db
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilDataCollectionRatingField::__construct ( ilDataCollectionRecord  $record,
ilDataCollectionField  $field 
)

Definition at line 31 of file class.ilDataCollectionRatingField.php.

References ilDataCollectionRecordField\getField(), and ilDataCollectionCache\getTableCache().

31  {
32  parent::__construct($record, $field);
33  $dclTable = ilDataCollectionCache::getTableCache($this->getField()->getTableId());
34  $this->dcl_obj_id = $dclTable->getCollectionObject()->getId();
35  }
+ Here is the call graph for this function:

Member Function Documentation

◆ delete()

ilDataCollectionRatingField::delete ( )

delete

Definition at line 87 of file class.ilDataCollectionRatingField.php.

References $ilDB, ilDataCollectionRecordField\getField(), and ilDataCollectionRecordField\getId().

88  {
89  global $ilDB;
90 
91  $ilDB->manipulate("DELETE FROM il_rating WHERE ".
92  "obj_id = ".$ilDB->quote((int) $this->getRecord()->getId(), "integer")." AND ".
93  "obj_type = ".$ilDB->quote("dcl_record", "text")." AND ".
94  "sub_obj_id = ".$ilDB->quote((int) $this->getField()->getId(), "integer")." AND ".
95  $ilDB->equals("sub_obj_type", "dcl_field", "text", true));
96 
97  $query2 = "DELETE FROM il_dcl_record_field WHERE id = ".$ilDB->quote($this->getId(), "integer");
98  $ilDB->manipulate($query2);
99  }
global $ilDB
+ Here is the call graph for this function:

◆ doRead()

ilDataCollectionRatingField::doRead ( )

Definition at line 52 of file class.ilDataCollectionRatingField.php.

52  {
53  // explicitly do nothing. the value is handled via the model and gui of ilRating.
54  }

◆ doUpdate()

ilDataCollectionRatingField::doUpdate ( )

Definition at line 48 of file class.ilDataCollectionRatingField.php.

48  {
49  // explicitly do nothing. the value is handled via the model and gui of ilRating.
50  }

◆ getExportValue()

ilDataCollectionRatingField::getExportValue ( )

Definition at line 73 of file class.ilDataCollectionRatingField.php.

References ilDataCollectionRecordField\getField(), ilDataCollectionRecordField\getId(), ilRating\getOverallRatingForObject(), and ilDataCollectionRecordField\getRecord().

73  {
74  $val = ilRating::getOverallRatingForObject($this->getRecord()->getId(), "dcl_record",
75  $this->getField()->getId(), "dcl_field");
76  return round($val["avg"],1)." (".$val["cnt"].")";
77  }
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.
+ Here is the call graph for this function:

◆ getFormInput()

ilDataCollectionRatingField::getFormInput ( )

Definition at line 56 of file class.ilDataCollectionRatingField.php.

References ilDataCollectionRecordField\$lng.

56  {
57  global $lng;
58  return $lng->txt("dcl_editable_in_table_gui");
59  }

◆ getHTML()

ilDataCollectionRatingField::getHTML ( )

Definition at line 61 of file class.ilDataCollectionRatingField.php.

References $ilCtrl, ilDataCollectionRecordField\getField(), ilDataCollectionRecordField\getId(), and ilDataCollectionRecordField\getRecord().

61  {
62  global $ilCtrl;
63  $rgui = new ilRatingGUI();
64  $rgui->setObject($this->getRecord()->getId(), "dcl_record",
65  $this->getField()->getId(), "dcl_field");
66  $ilCtrl->setParameterByClass("ilratinggui", "field_id", $this->getField()->getId());
67  $ilCtrl->setParameterByClass("ilratinggui", "record_id", $this->getRecord()->getId());
68  $html = $rgui->getHTML();
69 
70  return $html;
71  }
global $ilCtrl
Definition: ilias.php:18
Class ilRatingGUI.
+ Here is the call graph for this function:

◆ getValue()

ilDataCollectionRatingField::getValue ( )

Definition at line 79 of file class.ilDataCollectionRatingField.php.

References ilDataCollectionRecordField\getField(), ilDataCollectionRecordField\getId(), ilRating\getOverallRatingForObject(), and ilDataCollectionRecordField\getRecord().

79  {
80  return ilRating::getOverallRatingForObject($this->getRecord()->getId(), "dcl_record",
81  $this->getField()->getId(), "dcl_field");
82  }
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.
+ Here is the call graph for this function:

◆ loadValue()

ilDataCollectionRatingField::loadValue ( )
protected

override the loadValue.

Definition at line 40 of file class.ilDataCollectionRatingField.php.

40  {
41  // explicitly do nothing. we don't have to load the value as it is saved somewhere else.
42  }

◆ setValue()

ilDataCollectionRatingField::setValue (   $value)

Definition at line 44 of file class.ilDataCollectionRatingField.php.

44  {
45  // explicitly do nothing. the value is handled via the model and gui of ilRating.
46  }

Field Documentation

◆ $dcl_obj_id

ilDataCollectionRatingField::$dcl_obj_id
protected

Definition at line 29 of file class.ilDataCollectionRatingField.php.

◆ $rated

ilDataCollectionRatingField::$rated
protected

Definition at line 24 of file class.ilDataCollectionRatingField.php.


The documentation for this class was generated from the following file: