ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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
 __construct ()
 
 getTranslatedType ()
 
 getId ()
 
 getType ()
 
 setParent (?int $a_value)
 
 getParent ()
 
 setTitle (?string $a_value)
 
 getTitle ()
 
 setDescription (?string $a_value)
 
 getDescription ()
 
 setRequired (bool $a_value)
 
 isRequired ()
 
 setPosition (int $a_value)
 
 getPosition ()
 
 importDefinition (string $a_def, string $a_def_json)
 
 save ()
 
 update ()
 
 delete ()
 
 cloneObject (int $a_target_parent_id)
 
 initCustomForm (ilPropertyFormGUI $a_form)
 
 exportCustomForm (ilPropertyFormGUI $a_form)
 
 importCustomForm (ilPropertyFormGUI $a_form)
 
 setPeerReviewContext (ilExAssignment $a_ass, int $a_giver_id, int $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 (bool $a_read_only=false)
 
- Protected Member Functions inherited from ilExcCriteria
 setId (?int $a_id)
 
 setDefinition (?array $a_value=null)
 
 getDefinition ()
 
 importFromDB (array $a_row)
 
 getDBProperties ()
 
 getLastPosition ()
 

Protected Attributes

ILIAS HTTP Services $http
 
ilGlobalTemplateInterface $tpl
 
ilCustomInputGUI $form_item
 
GUIRequest $request
 
- Protected Attributes inherited from ilExcCriteria
ILIAS Exercise InternalGUIService $gui
 
ilLanguage $lng
 
ilCtrl $ctrl
 
ilDBInterface $db
 
int $id = null
 
int $parent = null
 
string $title = ""
 
string $desc = ""
 
bool $required = false
 
int $pos = 0
 
array $def = null
 
ilPropertyFormGUI $form = null
 
ilExAssignment $ass
 
int $giver_id = 0
 
int $peer_id = 0
 

Additional Inherited Members

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

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilExcCriteriaRating::__construct ( )

Constructor.

Reimplemented from ilExcCriteria.

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

38 {
39 global $DIC;
40
42 $this->tpl = $DIC->ui()->mainTemplate();
43 $this->request = $DIC->exercise()->internal()->gui()->request();
44 $this->http = $DIC->http();
45 }
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

Member Function Documentation

◆ addToPeerReviewForm()

ilExcCriteriaRating::addToPeerReviewForm (   $a_value = null)

Reimplemented from ilExcCriteria.

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

55 : void
56 {
58 $ilCtrl = $this->ctrl;
59
60 $tpl->addJavaScript("assets/js/ilExcPeerReview.js");
61 $tpl->addOnLoadCode("il.ExcPeerReview.setAjax('" .
62 $ilCtrl->getLinkTargetByClass("ilExPeerReviewGUI", "updateCritAjax", "", true, false) .
63 "')");
64
65 $field_id = "prccc_rating_" . $this->getId();
66
67 $input = new ilCustomInputGUI($this->getTitle(), $field_id);
68 $input->setInfo($this->getDescription());
69 $input->setRequired($this->isRequired());
70 $input->setHtml($this->renderWidget());
71 $this->form->addItem($input);
72
73 // #16993 - making form checkInput() work
74 if ($this->hasValue("")) {
75 $input->setSkipRequiredCheck(true);
76 }
77
78 $this->form_item = $input;
79 }
This class represents a custom property in a property form.
renderWidget(bool $a_read_only=false)
ilGlobalTemplateInterface $tpl
addJavaScript(string $a_js_file, bool $a_add_version_parameter=true, int $a_batch=2)
Add a javascript file that should be included in the header.
addOnLoadCode(string $a_code, int $a_batch=2)
Add on load code.
form( $class_path, string $cmd, string $submit_caption="")

References ilExcCriteria\$ctrl, $tpl, ILIAS\UICore\GlobalTemplate\addJavaScript(), ILIAS\UICore\GlobalTemplate\addOnLoadCode(), ILIAS\Repository\form(), 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 159 of file class.ilExcCriteriaRating.php.

159 : string
160 {
161 return $this->renderWidget(true);
162 }

References renderWidget().

+ Here is the call graph for this function:

◆ getRatingSubType()

ilExcCriteriaRating::getRatingSubType ( )
protected

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

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

References ilExcCriteria\getId().

+ Here is the call graph for this function:

◆ getType()

ilExcCriteriaRating::getType ( )

Reimplemented from ilExcCriteria.

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

47 : string
48 {
49 return "rating";
50 }

◆ hasValue()

ilExcCriteriaRating::hasValue (   $a_value)

Reimplemented from ilExcCriteria.

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

148 : bool
149 {
151 $this->ass->getId(),
152 "ass",
153 $this->peer_id,
154 $this->getRatingSubType(),
155 $this->giver_id
156 );
157 }
static getRatingForUserAndObject(int $a_obj_id, string $a_obj_type, int $a_sub_obj_id, string $a_sub_obj_type, int $a_user_id, ?int $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 112 of file class.ilExcCriteriaRating.php.

112 : void
113 {
114 // see updateFromAjax()
115 }

◆ renderWidget()

ilExcCriteriaRating::renderWidget ( bool  $a_read_only = false)
protected

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

88 : string
89 {
90 $rating = new ilRatingGUI();
91 $rating->setObject(
92 $this->ass->getId(),
93 "ass",
94 $this->peer_id,
95 $this->getRatingSubType()
96 );
97 $rating->setUserId($this->giver_id);
98
99 $ajax_id = $this->getId()
100 ?: "rating";
101
102 if (!$a_read_only) {
103 $html = '<div class="crit_widget" data-crit-id="' . $ajax_id . '">' .
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 return $html;
110 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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

164 : void
165 {
167 $this->ass->getId(),
168 "ass",
169 $this->peer_id,
170 $this->getRatingSubType(),
171 $this->giver_id
172 );
173 }
static resetRatingForUserAndObject(int $a_obj_id, string $a_obj_type, int $a_sub_obj_id, string $a_sub_obj_type, int $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 117 of file class.ilExcCriteriaRating.php.

117 : string
118 {
119 // save rating
121 $this->ass->getId(),
122 "ass",
123 $this->peer_id,
124 $this->getRatingSubType(),
125 $this->giver_id,
126 $this->request->getRatingValue()
127 );
128
129 // render current rating
130 return $this->renderWidget();
131 }
static writeRatingForUserAndObject(int $a_obj_id, string $a_obj_type, ?int $a_sub_obj_id, ?string $a_sub_obj_type, int $a_user_id, int $a_rating, int $a_category_id=0)
Write rating for a user and an object.

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

+ Here is the call graph for this function:

◆ validate()

ilExcCriteriaRating::validate (   $a_value)

Reimplemented from ilExcCriteria.

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

133 : bool
134 {
136
137 if ($this->isRequired()) {
138 if (!$this->hasValue($a_value)) {
139 if ($this->form) {
140 $this->form->getItemByPostVar("prccc_rating_" . $this->getId())->setAlert($lng->txt("msg_input_is_required"));
141 }
142 return false;
143 }
144 }
145 return true;
146 }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...

References ilExcCriteria\$lng, ILIAS\Repository\form(), ilExcCriteria\getId(), hasValue(), ilExcCriteria\isRequired(), and ilLanguage\txt().

+ Here is the call graph for this function:

Field Documentation

◆ $form_item

ilCustomInputGUI ilExcCriteriaRating::$form_item
protected

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

◆ $http

ILIAS HTTP Services ilExcCriteriaRating::$http
protected

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

◆ $request

GUIRequest ilExcCriteriaRating::$request
protected

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

◆ $tpl

ilGlobalTemplateInterface ilExcCriteriaRating::$tpl
protected

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

Referenced by addToPeerReviewForm().


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