ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilExcCriteriaRating Class Reference

Class ilExcCriteriaRating. More...

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

Public Member Functions

 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)
 
 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 ()
 

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)
 
- Protected Attributes inherited from ilExcCriteria
 $id
 
 $parent
 
 $title
 
 $desc
 
 $required
 
 $pos
 
 $def
 
 $form
 
 $ass
 
 $giver_id
 
 $peer_id
 

Detailed Description

Member Function Documentation

◆ addToPeerReviewForm()

ilExcCriteriaRating::addToPeerReviewForm (   $a_value = null)

Reimplemented from ilExcCriteria.

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

24 {
25 global $tpl, $ilCtrl;
26
27 $tpl->addJavaScript("Modules/Exercise/js/ilExcPeerReview.js");
28 $tpl->addOnLoadCode("il.ExcPeerReview.setAjax('".
29 $ilCtrl->getLinkTargetByClass("ilExPeerReviewGUI", "updateCritAjax", "", true, false).
30 "')");
31
32 $field_id = "prccc_rating_".$this->getId();
33
34 $input = new ilCustomInputGUI($this->getTitle(), $field_id);
35 $input->setInfo($this->getDescription());
36 $input->setRequired($this->isRequired());
37 $input->setHtml($this->renderWidget());
38 $this->form->addItem($input);
39
40 // #16993 - making form checkInput() work
41 if(is_array($_POST) &&
42 array_key_exists("cmd", $_POST))
43 {
44 $_POST[$field_id] = $this->hasValue($a_value);
45 }
46
47 $this->form_item = $input;
48 }
global $tpl
Definition: ilias.php:8
This class represents a custom property in a property form.
renderWidget($a_read_only=false)
$_POST['username']
Definition: cron.php:12
global $ilCtrl
Definition: ilias.php:18

References $_POST, $ilCtrl, $tpl, ilExcCriteria\getDescription(), 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 140 of file class.ilExcCriteriaRating.php.

141 {
142 return $this->renderWidget($this->ass, $this->giver_id, $this->peer_id, true);
143 }

References renderWidget().

+ Here is the call graph for this function:

◆ getRatingSubType()

ilExcCriteriaRating::getRatingSubType ( )
protected

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

51 {
52 return $this->getId()
53 ? "peer_".(int)$this->getId()
54 : "peer"; // no catalogue / v1
55 }

References ilExcCriteria\getId().

+ Here is the call graph for this function:

◆ getType()

ilExcCriteriaRating::getType ( )

Reimplemented from ilExcCriteria.

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

16 {
17 return "rating";
18 }

◆ hasValue()

ilExcCriteriaRating::hasValue (   $a_value)

Reimplemented from ilExcCriteria.

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

129 {
130 include_once './Services/Rating/classes/class.ilRating.php';
132 $this->ass->getId(),
133 "ass",
134 $this->peer_id,
135 $this->getRatingSubType(),
136 $this->giver_id
137 );
138 }
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 87 of file class.ilExcCriteriaRating.php.

88 {
89 // see updateFromAjax()
90 }

◆ renderWidget()

ilExcCriteriaRating::renderWidget (   $a_read_only = false)
protected

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

58 {
59 include_once './Services/Rating/classes/class.ilRatingGUI.php';
60 $rating = new ilRatingGUI();
61 $rating->setObject(
62 $this->ass->getId(),
63 "ass",
64 $this->peer_id,
65 $this->getRatingSubType()
66 );
67 $rating->setUserId($this->giver_id);
68
69 $ajax_id = $this->getId()
70 ? (int)$this->getId()
71 : "'rating'";
72
73 if(!(bool)$a_read_only)
74 {
75 $html = '<div class="crit_widget">'.
76 $rating->getHTML(false, true, "il.ExcPeerReview.saveCrit(this, ".$this->peer_id.", ".$ajax_id.", %rating%)").
77 '</div>';
78 }
79 else
80 {
81 $html = $rating->getHTML(false, false);
82 }
83
84 return $html;
85 }
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 145 of file class.ilExcCriteriaRating.php.

146 {
147 include_once './Services/Rating/classes/class.ilRating.php';
149 $this->ass->getId(),
150 "ass",
151 $this->peer_id,
152 $this->getRatingSubType(),
153 $this->giver_id
154 );
155 }
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 92 of file class.ilExcCriteriaRating.php.

93 {
94 // save rating
95 include_once './Services/Rating/classes/class.ilRating.php';
97 $this->ass->getId(),
98 "ass",
99 $this->peer_id,
100 $this->getRatingSubType(),
101 $this->giver_id,
102 $_POST["value"]
103 );
104
105 // render current rating
106 // $ilCtrl->setParameter($this->parent_obj, "peer_id", $peer_id);
107 return $this->renderWidget($a_ass, $a_giver_id, $a_peer_id);
108 }
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 110 of file class.ilExcCriteriaRating.php.

111 {
112 global $lng;
113
114 if($this->isRequired())
115 {
116 if(!$this->hasValue($a_value))
117 {
118 if($this->form)
119 {
120 $this->form->getItemByPostVar("prccc_rating_".$this->getId())->setAlert($lng->txt("msg_input_is_required"));
121 }
122 return false;
123 }
124 }
125 return true;
126 }
global $lng
Definition: privfeed.php:40

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

+ Here is the call graph for this function:

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