ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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, $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 ()
 

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)

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

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

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  }
renderWidget($a_read_only=false)
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
This class represents a custom property in a property form.
$_POST["username"]
+ Here is the call graph for this function:

◆ getHTML()

ilExcCriteriaRating::getHTML (   $a_value)

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

References renderWidget().

141  {
142  return $this->renderWidget($this->ass, $this->giver_id, $this->peer_id, true);
143  }
renderWidget($a_read_only=false)
+ Here is the call graph for this function:

◆ getRatingSubType()

ilExcCriteriaRating::getRatingSubType ( )
protected

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

References ilExcCriteria\getId().

Referenced by hasValue(), renderWidget(), resetReview(), and updateFromAjax().

51  {
52  return $this->getId()
53  ? "peer_".(int)$this->getId()
54  : "peer"; // no catalogue / v1
55  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getType()

ilExcCriteriaRating::getType ( )

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

16  {
17  return "rating";
18  }

◆ hasValue()

ilExcCriteriaRating::hasValue (   $a_value)

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

References ilExcCriteria\$giver_id, ilExcCriteria\$peer_id, ilRating\getRatingForUserAndObject(), and getRatingSubType().

Referenced by addToPeerReviewForm(), and validate().

129  {
130  include_once './Services/Rating/classes/class.ilRating.php';
132  $this->ass->getId(),
133  "ass",
135  $this->getRatingSubType(),
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.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ importFromPeerReviewForm()

ilExcCriteriaRating::importFromPeerReviewForm ( )

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.

References $html, ilExcCriteria\$peer_id, ilExcCriteria\getId(), and getRatingSubType().

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

58  {
59  include_once './Services/Rating/classes/class.ilRatingGUI.php';
60  $rating = new ilRatingGUI();
61  $rating->setObject(
62  $this->ass->getId(),
63  "ass",
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
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetReview()

ilExcCriteriaRating::resetReview ( )

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

References ilExcCriteria\$giver_id, ilExcCriteria\$peer_id, getRatingSubType(), and ilRating\resetRatingForUserAndObject().

146  {
147  include_once './Services/Rating/classes/class.ilRating.php';
149  $this->ass->getId(),
150  "ass",
152  $this->getRatingSubType(),
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.
+ Here is the call graph for this function:

◆ updateFromAjax()

ilExcCriteriaRating::updateFromAjax ( )

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

References $_POST, ilExcCriteria\$giver_id, ilExcCriteria\$peer_id, getRatingSubType(), renderWidget(), and ilRating\writeRatingForUserAndObject().

93  {
94  // save rating
95  include_once './Services/Rating/classes/class.ilRating.php';
97  $this->ass->getId(),
98  "ass",
100  $this->getRatingSubType(),
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  }
renderWidget($a_read_only=false)
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.
$_POST["username"]
+ Here is the call graph for this function:

◆ validate()

ilExcCriteriaRating::validate (   $a_value)

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

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

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:17
+ Here is the call graph for this function:

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