ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 32 of file class.ilExcCriteriaRating.php.

33 {
34 global $DIC;
35
37 $this->tpl = $DIC["tpl"];
38 $this->ctrl = $DIC->ctrl();
39 $this->lng = $DIC->language();
40 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$DIC
Definition: xapitoken.php:46

References $DIC, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ addToPeerReviewForm()

ilExcCriteriaRating::addToPeerReviewForm (   $a_value = null)

Reimplemented from ilExcCriteria.

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

51 {
54
55 $tpl->addJavaScript("Modules/Exercise/js/ilExcPeerReview.js");
56 $tpl->addOnLoadCode("il.ExcPeerReview.setAjax('" .
57 $ilCtrl->getLinkTargetByClass("ilExPeerReviewGUI", "updateCritAjax", "", true, false) .
58 "')");
59
60 $field_id = "prccc_rating_" . $this->getId();
61
62 $input = new ilCustomInputGUI($this->getTitle(), $field_id);
63 $input->setInfo($this->getDescription());
64 $input->setRequired($this->isRequired());
65 $input->setHtml($this->renderWidget());
66 $this->form->addItem($input);
67
68 // #16993 - making form checkInput() work
69 if (is_array($_POST) &&
70 array_key_exists("cmd", $_POST)) {
71 $_POST[$field_id] = $this->hasValue($a_value);
72 }
73
74 $this->form_item = $input;
75 }
$_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 158 of file class.ilExcCriteriaRating.php.

159 {
160 return $this->renderWidget($this->ass, $this->giver_id, $this->peer_id, true);
161 }

References renderWidget().

+ Here is the call graph for this function:

◆ getRatingSubType()

ilExcCriteriaRating::getRatingSubType ( )
protected

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

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

References ilExcCriteria\getId().

+ Here is the call graph for this function:

◆ getType()

ilExcCriteriaRating::getType ( )

Reimplemented from ilExcCriteria.

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

43 {
44 return "rating";
45 }

◆ hasValue()

ilExcCriteriaRating::hasValue (   $a_value)

Reimplemented from ilExcCriteria.

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

148 {
150 $this->ass->getId(),
151 "ass",
152 $this->peer_id,
153 $this->getRatingSubType(),
154 $this->giver_id
155 );
156 }
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 110 of file class.ilExcCriteriaRating.php.

111 {
112 // see updateFromAjax()
113 }

◆ renderWidget()

ilExcCriteriaRating::renderWidget (   $a_read_only = false)
protected

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

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

References 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 163 of file class.ilExcCriteriaRating.php.

164 {
166 $this->ass->getId(),
167 "ass",
168 $this->peer_id,
169 $this->getRatingSubType(),
170 $this->giver_id
171 );
172 }
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 115 of file class.ilExcCriteriaRating.php.

116 {
117 // save rating
119 $this->ass->getId(),
120 "ass",
121 $this->peer_id,
122 $this->getRatingSubType(),
123 $this->giver_id,
124 $_POST["value"]
125 );
126
127 // render current rating
128 // $ilCtrl->setParameter($this->parent_obj, "peer_id", $peer_id);
129 return $this->renderWidget($a_ass, $a_giver_id, $a_peer_id);
130 }
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 132 of file class.ilExcCriteriaRating.php.

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

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 21 of file class.ilExcCriteriaRating.php.

Referenced by addToPeerReviewForm().

◆ $lng

ilExcCriteriaRating::$lng
protected

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

Referenced by validate().

◆ $tpl

ilExcCriteriaRating::$tpl
protected

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

Referenced by addToPeerReviewForm().


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