ILIAS  release_7 Revision v7.30-3-g800a261c036
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.

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

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

33  {
34  global $DIC;
35 
37  $this->tpl = $DIC["tpl"];
38  $this->ctrl = $DIC->ctrl();
39  $this->lng = $DIC->language();
40  }
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ addToPeerReviewForm()

ilExcCriteriaRating::addToPeerReviewForm (   $a_value = null)

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

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

51  {
52  $tpl = $this->tpl;
53  $ilCtrl = $this->ctrl;
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  }
renderWidget($a_read_only=false)
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 158 of file class.ilExcCriteriaRating.php.

References renderWidget().

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

◆ getRatingSubType()

ilExcCriteriaRating::getRatingSubType ( )
protected

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

References ilExcCriteria\getId().

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

78  {
79  return $this->getId()
80  ? "peer_" . (int) $this->getId()
81  : "peer"; // no catalogue / v1
82  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getType()

ilExcCriteriaRating::getType ( )

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

43  {
44  return "rating";
45  }

◆ hasValue()

ilExcCriteriaRating::hasValue (   $a_value)

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

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

Referenced by addToPeerReviewForm(), and validate().

148  {
150  $this->ass->getId(),
151  "ass",
153  $this->getRatingSubType(),
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.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ importFromPeerReviewForm()

ilExcCriteriaRating::importFromPeerReviewForm ( )

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.

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

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

85  {
86  $rating = new ilRatingGUI();
87  $rating->setObject(
88  $this->ass->getId(),
89  "ass",
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.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetReview()

ilExcCriteriaRating::resetReview ( )

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

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

164  {
166  $this->ass->getId(),
167  "ass",
169  $this->getRatingSubType(),
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.
+ Here is the call graph for this function:

◆ updateFromAjax()

ilExcCriteriaRating::updateFromAjax ( )

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

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

116  {
117  // save rating
119  $this->ass->getId(),
120  "ass",
122  $this->getRatingSubType(),
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.
renderWidget($a_read_only=false)
$_POST["username"]
+ Here is the call graph for this function:

◆ validate()

ilExcCriteriaRating::validate (   $a_value)

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

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

133  {
134  $lng = $this->lng;
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  }
+ 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: