ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilExcCriteriaRating Class Reference

Class ilExcCriteriaRating. More...

+ Inheritance diagram for ilExcCriteriaRating:
+ Collaboration diagram for ilExcCriteriaRating:

Public Member Functions

 __construct ()
 Constructor. More...
 
 getType ()
 
 addToPeerReviewForm ($a_value=null)
 
 importFromPeerReviewForm ()
 
 updateFromAjax ()
 
 validate ($a_value)
 
 hasValue ($a_value)
 
 getHTML ($a_value)
 
 resetReview ()
 
- Public Member Functions inherited from ilExcCriteria
 getTranslatedType ()
 
 getId ()
 
 getType ()
 
 setParent ($a_value)
 
 getParent ()
 
 setTitle ($a_value)
 
 getTitle ()
 
 setDescription ($a_value)
 
 getDescription ()
 
 setRequired ($a_value)
 
 isRequired ()
 
 setPosition ($a_value)
 
 getPosition ()
 
 importDefinition ($a_def, $a_def_json)
 
 save ()
 
 update ()
 
 delete ()
 
 cloneObject ($a_target_parent_id)
 
 initCustomForm (ilPropertyFormGUI $a_form)
 
 exportCustomForm (ilPropertyFormGUI $a_form)
 
 importCustomForm (ilPropertyFormGUI $a_form)
 
 setPeerReviewContext (ilExAssignment $a_ass, $a_giver_id, $a_peer_id, ilPropertyFormGUI $a_form=null)
 
 addToPeerReviewForm ($a_value=null)
 
 importFromPeerReviewForm ()
 
 updateFromAjax ()
 
 validate ($a_value)
 
 hasValue ($a_value)
 
 getHTML ($a_value)
 
 resetReview ()
 

Protected Member Functions

 getRatingSubType ()
 
 renderWidget ($a_read_only=false)
 
- Protected Member Functions inherited from ilExcCriteria
 __construct ()
 
 setId ($a_id)
 
 setDefinition (array $a_value=null)
 
 getDefinition ()
 
 importFromDB (array $a_row)
 
 getDBProperties ()
 
 getLastPosition ()
 

Protected Attributes

 $tpl
 
 $ctrl
 
 $lng
 
- Protected Attributes inherited from ilExcCriteria
 $db
 
 $id
 
 $parent
 
 $title
 
 $desc
 
 $required
 
 $pos
 
 $def
 
 $form
 
 $ass
 
 $giver_id
 
 $peer_id
 

Additional Inherited Members

- Static Public Member Functions inherited from ilExcCriteria
static getInstanceById ($a_id)
 
static getInstancesByParentId ($a_parent_id)
 
static getTypesMap ()
 
static getInstanceByType ($a_type)
 
static deleteByParent ($a_parent_id)
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilExcCriteriaRating::__construct ( )

Constructor.

Reimplemented from ilExcCriteria.

Definition at line 34 of file class.ilExcCriteriaRating.php.

35 {
36 global $DIC;
37
38 parent::__construct();
39 $this->tpl = $DIC["tpl"];
40 $this->ctrl = $DIC->ctrl();
41 $this->lng = $DIC->language();
42 }
global $DIC
Definition: saml.php:7

References $DIC.

Member Function Documentation

◆ addToPeerReviewForm()

ilExcCriteriaRating::addToPeerReviewForm (   $a_value = null)

Reimplemented from ilExcCriteria.

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

53 {
56
57 $tpl->addJavaScript("Modules/Exercise/js/ilExcPeerReview.js");
58 $tpl->addOnLoadCode("il.ExcPeerReview.setAjax('" .
59 $ilCtrl->getLinkTargetByClass("ilExPeerReviewGUI", "updateCritAjax", "", true, false) .
60 "')");
61
62 $field_id = "prccc_rating_" . $this->getId();
63
64 $input = new ilCustomInputGUI($this->getTitle(), $field_id);
65 $input->setInfo($this->getDescription());
66 $input->setRequired($this->isRequired());
67 $input->setHtml($this->renderWidget());
68 $this->form->addItem($input);
69
70 // #16993 - making form checkInput() work
71 if (is_array($_POST) &&
72 array_key_exists("cmd", $_POST)) {
73 $_POST[$field_id] = $this->hasValue($a_value);
74 }
75
76 $this->form_item = $input;
77 }
$_POST["username"]
This class represents a custom property in a property form.
renderWidget($a_read_only=false)
global $ilCtrl
Definition: ilias.php:18

References $_POST, $ctrl, $ilCtrl, $tpl, ilExcCriteria\getDescription(), ilExcCriteria\getId(), ilExcCriteria\getTitle(), hasValue(), ilExcCriteria\isRequired(), and renderWidget().

+ Here is the call graph for this function:

◆ getHTML()

ilExcCriteriaRating::getHTML (   $a_value)

Reimplemented from ilExcCriteria.

Definition at line 163 of file class.ilExcCriteriaRating.php.

164 {
165 return $this->renderWidget($this->ass, $this->giver_id, $this->peer_id, true);
166 }

References renderWidget().

+ Here is the call graph for this function:

◆ getRatingSubType()

ilExcCriteriaRating::getRatingSubType ( )
protected

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

80 {
81 return $this->getId()
82 ? "peer_" . (int) $this->getId()
83 : "peer"; // no catalogue / v1
84 }

References ilExcCriteria\getId().

+ Here is the call graph for this function:

◆ getType()

ilExcCriteriaRating::getType ( )

Reimplemented from ilExcCriteria.

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

45 {
46 return "rating";
47 }

◆ hasValue()

ilExcCriteriaRating::hasValue (   $a_value)

Reimplemented from ilExcCriteria.

Definition at line 151 of file class.ilExcCriteriaRating.php.

152 {
153 include_once './Services/Rating/classes/class.ilRating.php';
155 $this->ass->getId(),
156 "ass",
157 $this->peer_id,
158 $this->getRatingSubType(),
159 $this->giver_id
160 );
161 }
static getRatingForUserAndObject( $a_obj_id, $a_obj_type, $a_sub_obj_id, $a_sub_obj_type, $a_user_id, $a_category_id=null)
Get rating for a user and an object.

References ilRating\getRatingForUserAndObject().

Referenced by addToPeerReviewForm(), and validate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ importFromPeerReviewForm()

ilExcCriteriaRating::importFromPeerReviewForm ( )

Reimplemented from ilExcCriteria.

Definition at line 113 of file class.ilExcCriteriaRating.php.

114 {
115 // see updateFromAjax()
116 }

◆ renderWidget()

ilExcCriteriaRating::renderWidget (   $a_read_only = false)
protected

Definition at line 86 of file class.ilExcCriteriaRating.php.

87 {
88 include_once './Services/Rating/classes/class.ilRatingGUI.php';
89 $rating = new ilRatingGUI();
90 $rating->setObject(
91 $this->ass->getId(),
92 "ass",
93 $this->peer_id,
94 $this->getRatingSubType()
95 );
96 $rating->setUserId($this->giver_id);
97
98 $ajax_id = $this->getId()
99 ? (int) $this->getId()
100 : "'rating'";
101
102 if (!(bool) $a_read_only) {
103 $html = '<div class="crit_widget">' .
104 $rating->getHTML(false, true, "il.ExcPeerReview.saveCrit(this, " . $this->peer_id . ", " . $ajax_id . ", %rating%)") .
105 '</div>';
106 } else {
107 $html = $rating->getHTML(false, false);
108 }
109
110 return $html;
111 }
Class ilRatingGUI.
$html
Definition: example_001.php:87

References $html, and ilExcCriteria\getId().

Referenced by addToPeerReviewForm(), getHTML(), and updateFromAjax().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetReview()

ilExcCriteriaRating::resetReview ( )

Reimplemented from ilExcCriteria.

Definition at line 168 of file class.ilExcCriteriaRating.php.

169 {
170 include_once './Services/Rating/classes/class.ilRating.php';
172 $this->ass->getId(),
173 "ass",
174 $this->peer_id,
175 $this->getRatingSubType(),
176 $this->giver_id
177 );
178 }
static resetRatingForUserAndObject( $a_obj_id, $a_obj_type, $a_sub_obj_id, $a_sub_obj_type, $a_user_id)
Reset rating for a user and an object.

References ilRating\resetRatingForUserAndObject().

+ Here is the call graph for this function:

◆ updateFromAjax()

ilExcCriteriaRating::updateFromAjax ( )

Reimplemented from ilExcCriteria.

Definition at line 118 of file class.ilExcCriteriaRating.php.

119 {
120 // save rating
121 include_once './Services/Rating/classes/class.ilRating.php';
123 $this->ass->getId(),
124 "ass",
125 $this->peer_id,
126 $this->getRatingSubType(),
127 $this->giver_id,
128 $_POST["value"]
129 );
130
131 // render current rating
132 // $ilCtrl->setParameter($this->parent_obj, "peer_id", $peer_id);
133 return $this->renderWidget($a_ass, $a_giver_id, $a_peer_id);
134 }
static writeRatingForUserAndObject( $a_obj_id, $a_obj_type, $a_sub_obj_id, $a_sub_obj_type, $a_user_id, $a_rating, $a_category_id=0)
Write rating for a user and an object.

References $_POST, renderWidget(), and ilRating\writeRatingForUserAndObject().

+ Here is the call graph for this function:

◆ validate()

ilExcCriteriaRating::validate (   $a_value)

Reimplemented from ilExcCriteria.

Definition at line 136 of file class.ilExcCriteriaRating.php.

137 {
139
140 if ($this->isRequired()) {
141 if (!$this->hasValue($a_value)) {
142 if ($this->form) {
143 $this->form->getItemByPostVar("prccc_rating_" . $this->getId())->setAlert($lng->txt("msg_input_is_required"));
144 }
145 return false;
146 }
147 }
148 return true;
149 }

References $lng, ilExcCriteria\getId(), hasValue(), and ilExcCriteria\isRequired().

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilExcCriteriaRating::$ctrl
protected

Definition at line 23 of file class.ilExcCriteriaRating.php.

Referenced by addToPeerReviewForm().

◆ $lng

ilExcCriteriaRating::$lng
protected

Definition at line 28 of file class.ilExcCriteriaRating.php.

Referenced by validate().

◆ $tpl

ilExcCriteriaRating::$tpl
protected

Definition at line 18 of file class.ilExcCriteriaRating.php.

Referenced by addToPeerReviewForm().


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