ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilRatingGUI Class Reference

Class ilRatingGUI. More...

+ Collaboration diagram for ilRatingGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 execute command More...
 
 setObject ($a_obj_id, $a_obj_type, $a_sub_obj_id=0, $a_sub_obj_type="")
 Set Object. More...
 
 setUserId ($a_userid)
 Set User ID. More...
 
 getUserId ()
 Get User ID. More...
 
 setYourRatingText ($a_val)
 Set "Your Rating" text. More...
 
 getYourRatingText ()
 Get "Your Rating" text. More...
 
 enableCategories ($a_value)
 Toggle categories status. More...
 
 setCtrlPath (array $a_value)
 ilCtrl path More...
 
 getHTML ($a_show_overall=true, $a_may_rate=true, $a_onclick=null, $a_additional_id=null)
 Get HTML for rating of an object (and a user) More...
 
 getBlockHTML ($a_title)
 
 saveRating ()
 Save Rating. More...
 
 setUpdateCallback ($a_callback)
 
 resetUserRating ()
 Reset Rating. More...
 
 setExportCallback ($a_callback, $a_subobj_title)
 
 getListGUIProperty ($a_ref_id, $a_may_rate, $a_ajax_hash, $_parent_ref_id)
 Build list gui property for object. More...
 

Protected Member Functions

 renderDetails ($a_js_id, $a_may_rate, array $a_categories=null, $a_onclick=null, $a_average=false)
 Render rating details. More...
 

Protected Attributes

 $lng
 
 $ctrl
 
 $user
 
 $id = "rtg_"
 
 $export_callback
 
 $export_subobj_title
 
 $ctrl_path
 

Detailed Description

Class ilRatingGUI.

User interface class for rating.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

@ilCtrl_Calls ilRatingGUI: ilRatingCategoryGUI

Definition at line 17 of file class.ilRatingGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilRatingGUI::__construct ( )

Definition at line 39 of file class.ilRatingGUI.php.

40 {
41 global $DIC;
42
43 $this->lng = $DIC->language();
44 $this->ctrl = $DIC->ctrl();
45 $this->user = $DIC->user();
46 $lng = $DIC->language();
47
48 $lng->loadLanguageModule("rating");
49 }
user()
Definition: user.php:4
global $DIC
Definition: saml.php:7

References $DIC, $lng, and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ enableCategories()

ilRatingGUI::enableCategories (   $a_value)

Toggle categories status.

Parameters
bool$a_value

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

146 {
147 $this->enable_categories = (bool) $a_value;
148 }

◆ executeCommand()

ilRatingGUI::executeCommand ( )

execute command

Definition at line 54 of file class.ilRatingGUI.php.

55 {
57
58 $next_class = $ilCtrl->getNextClass($this);
59 $cmd = $ilCtrl->getCmd();
60
61 switch ($next_class) {
62 case "ilratingcategorygui":
63 include_once("./Services/Rating/classes/class.ilRatingCategoryGUI.php");
64 $gui = new ilRatingCategoryGUI($this->obj_id, $this->export_callback, $this->export_subobj_title);
65 $ilCtrl->forwardCommand($gui);
66 break;
67
68 default:
69 return $this->$cmd();
70 break;
71 }
72 }
Class ilRatingCategoryGUI.
global $ilCtrl
Definition: ilias.php:18

References $ctrl, and $ilCtrl.

◆ getBlockHTML()

ilRatingGUI::getBlockHTML (   $a_title)

Definition at line 568 of file class.ilRatingGUI.php.

569 {
570 $categories = array();
571 if ($this->enable_categories) {
572 $categories = ilRatingCategory::getAllForObject($this->obj_id);
573 }
574
575 $may_rate = ($this->getUserId() != ANONYMOUS_USER_ID);
576
577 $ttpl = new ilTemplate("tpl.rating_block.html", true, true, "Services/Rating");
578
579 $ttpl->setVariable("TITLE", $a_title);
580
581 $ttpl->setVariable(
582 "RATING_DETAILS",
583 $this->renderDetails("rtsb_", $may_rate, $categories, null, true)
584 );
585
586 return $ttpl->get();
587 }
static getAllForObject($a_parent_obj_id)
Get all categories for object.
renderDetails($a_js_id, $a_may_rate, array $a_categories=null, $a_onclick=null, $a_average=false)
Render rating details.
getUserId()
Get User ID.
special template class to simplify handling of ITX/PEAR

References ilRatingCategory\getAllForObject(), getUserId(), and renderDetails().

+ Here is the call graph for this function:

◆ getHTML()

ilRatingGUI::getHTML (   $a_show_overall = true,
  $a_may_rate = true,
  $a_onclick = null,
  $a_additional_id = null 
)

Get HTML for rating of an object (and a user)

Parameters
bool$a_show_overall
bool$a_may_rate
string$a_onclick
string$a_additional_id
Returns
string

Definition at line 431 of file class.ilRatingGUI.php.

432 {
434
435 $unique_id = $this->id;
436 if ($a_additional_id) {
437 $unique_id .= "_" . $a_additional_id;
438 }
439
440 $categories = array();
441 if ($this->enable_categories) {
442 $categories = ilRatingCategory::getAllForObject($this->obj_id);
443 }
444
445 $may_rate = ($this->getUserId() != ANONYMOUS_USER_ID);
446 if ($may_rate && !$a_may_rate) {
447 $may_rate = false;
448 }
449
450 $has_overlay = false;
451 if ($may_rate || $categories) {
452 $has_overlay = true;
453 }
454
455 $ttpl = new ilTemplate("tpl.rating_input.html", true, true, "Services/Rating");
456
457 // user rating
458 $user_rating = 0;
459 if ($may_rate || !$a_show_overall) {
460 $user_rating = round(ilRating::getRatingForUserAndObject(
461 $this->obj_id,
462 $this->obj_type,
463 $this->sub_obj_id,
464 $this->sub_obj_type,
465 $this->getUserId()
466 ));
467 }
468
469 // (1) overall rating
470 if ($a_show_overall) {
472 $this->obj_id,
473 $this->obj_type,
474 $this->sub_obj_id,
475 $this->sub_obj_type
476 );
477 } else {
478 $rating = array("avg" => $user_rating);
479 }
480
481 for ($i = 1; $i <= 5; $i++) {
482 if ($a_show_overall &&
483 $i == $user_rating) {
484 $ttpl->setCurrentBlock("rating_mark");
485 $ttpl->setVariable(
486 "SRC_MARK",
487 ilUtil::getImagePath("icon_rate_marker.svg")
488 );
489 $ttpl->parseCurrentBlock();
490 }
491
492 $ttpl->setCurrentBlock("rating_icon");
493 if ($rating["avg"] >= $i) {
494 $ttpl->setVariable(
495 "SRC_ICON",
496 ilUtil::getImagePath("icon_rate_on.svg")
497 );
498 } elseif ($rating["avg"] + 1 <= $i) {
499 $ttpl->setVariable(
500 "SRC_ICON",
501 ilUtil::getImagePath("icon_rate_off.svg")
502 );
503 } else {
504 $nr = round(($rating["avg"] + 1 - $i) * 10);
505 $ttpl->setVariable(
506 "SRC_ICON",
507 ilUtil::getImagePath("icon_rate_$nr.svg")
508 );
509 }
510 $ttpl->setVariable("ALT_ICON", "(" . $i . "/5)");
511 $ttpl->parseCurrentBlock();
512 }
513 $ttpl->setCurrentBlock("rating_icon");
514
515 if ($a_show_overall) {
516 if ($rating["cnt"] == 0) {
517 $tt = $lng->txt("rat_not_rated_yet");
518 } elseif ($rating["cnt"] == 1) {
519 $tt = $lng->txt("rat_one_rating");
520 } else {
521 $tt = sprintf($lng->txt("rat_nr_ratings"), $rating["cnt"]);
522 }
523 include_once("./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
524 ilTooltipGUI::addTooltip($unique_id . "_tt", $tt);
525
526 if ($rating["cnt"] > 0) {
527 $ttpl->setCurrentBlock("rat_nr");
528 $ttpl->setVariable("RT_NR", $rating["cnt"]);
529 $ttpl->parseCurrentBlock();
530 }
531 }
532
533 // add overlay (trigger)
534 if ($has_overlay) {
535 include_once("./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
536 $ov = new ilOverlayGUI($unique_id);
537 $ov->setTrigger("tr_" . $unique_id, "click", "tr_" . $unique_id);
538 $ov->add();
539
540 $ttpl->setCurrentBlock("act_rat_start");
541 $ttpl->setVariable("ID", $unique_id);
542 $ttpl->parseCurrentBlock();
543
544 $ttpl->touchBlock("act_rat_end");
545 }
546
547 $ttpl->parseCurrentBlock();
548
549
550 // (2) user rating
551
552 if ($has_overlay) {
553 $ttpl->setVariable(
554 "RATING_DETAILS",
555 $this->renderDetails("rtov_", $may_rate, $categories, $a_onclick)
556 );
557
558 $ttpl->setCurrentBlock("user_rating");
559 $ttpl->setVariable("ID", $unique_id);
560 $ttpl->parseCurrentBlock();
561 }
562
563 $ttpl->setVariable("TTID", $unique_id);
564
565 return $ttpl->get();
566 }
This is a utility class for the yui overlays.
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.
static getOverallRatingForObject($a_obj_id, $a_obj_type, $a_sub_obj_id=null, $a_sub_obj_type=null, $a_category_id=null)
Get overall rating for an object.
static addTooltip( $a_el_id, $a_text, $a_container="", $a_my="bottom center", $a_at="top center", $a_use_htmlspecialchars=true)
Adds a tooltip to an HTML element.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$i
Definition: disco.tpl.php:19

References $i, $id, $lng, ilTooltipGUI\addTooltip(), ilRatingCategory\getAllForObject(), ilUtil\getImagePath(), ilRating\getOverallRatingForObject(), ilRating\getRatingForUserAndObject(), getUserId(), and renderDetails().

Referenced by getListGUIProperty().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getListGUIProperty()

ilRatingGUI::getListGUIProperty (   $a_ref_id,
  $a_may_rate,
  $a_ajax_hash,
  $_parent_ref_id 
)

Build list gui property for object.

Parameters
int$a_ref_id
bool$a_may_rate
string$a_ajax_hash
int$_parent_ref_id
Returns
string

Definition at line 673 of file class.ilRatingGUI.php.

674 {
675 return $this->getHTML(
676 true,
677 $a_may_rate,
678 "il.Object.saveRatingFromListGUI(" . $a_ref_id . ", '" . $a_ajax_hash . "', %rating%);",
679 $_parent_ref_id
680 );
681 }
getHTML($a_show_overall=true, $a_may_rate=true, $a_onclick=null, $a_additional_id=null)
Get HTML for rating of an object (and a user)

References getHTML().

+ Here is the call graph for this function:

◆ getUserId()

ilRatingGUI::getUserId ( )

Get User ID.

Returns
int User ID

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

116 {
117 return $this->userid;
118 }
if(empty($userids)) $userid

References $userid.

Referenced by getBlockHTML(), getHTML(), renderDetails(), resetUserRating(), and saveRating().

+ Here is the caller graph for this function:

◆ getYourRatingText()

ilRatingGUI::getYourRatingText ( )

Get "Your Rating" text.

Returns
string text

Definition at line 135 of file class.ilRatingGUI.php.

136 {
137 return $this->your_rating_text;
138 }

Referenced by renderDetails().

+ Here is the caller graph for this function:

◆ renderDetails()

ilRatingGUI::renderDetails (   $a_js_id,
  $a_may_rate,
array  $a_categories = null,
  $a_onclick = null,
  $a_average = false 
)
protected

Render rating details.

Parameters
string$a_js_id
bool$a_may_rate
array$a_categories
bool$a_onclick
bool$a_average
Returns
string

Definition at line 170 of file class.ilRatingGUI.php.

171 {
174
175 $ttpl = new ilTemplate("tpl.rating_details.html", true, true, "Services/Rating");
176
177 $rate_text = null;
178 if ($this->getYourRatingText() != "#") {
179 $rate_text = ($this->getYourRatingText() != "")
180 ? $this->getYourRatingText()
181 : $lng->txt("rating_your_rating");
182 }
183
184 // no categories: 1 simple rating (link)
185 if (!$a_categories) {
186 if ($a_may_rate) {
188 $this->obj_id,
189 $this->obj_type,
190 $this->sub_obj_id,
191 $this->sub_obj_type,
192 $this->getUserId(),
193 0
194 );
195
196 if ((bool) $a_average) {
197 $overall_rating = ilRating::getOverallRatingForObject(
198 $this->obj_id,
199 $this->obj_type,
200 $this->sub_obj_id,
201 $this->sub_obj_type
202 );
203 }
204
205 // user rating links
206 for ($i = 1; $i <= 5; $i++) {
207 if ((bool) $a_average &&
208 $i == $rating) {
209 $ttpl->setCurrentBlock("rating_mark_simple");
210 $ttpl->setVariable(
211 "SRC_MARK_SIMPLE",
212 ilUtil::getImagePath("icon_rate_marker.svg")
213 );
214 $ttpl->parseCurrentBlock();
215 }
216
217 $ttpl->setCurrentBlock("rating_link_simple");
218 if (stristr($a_onclick, "%rating%")) {
219 $url_save = "#";
220 } else {
221 $ilCtrl->setParameter($this, "rating", $i);
222 if (!$this->ctrl_path) {
223 $url_save = $ilCtrl->getLinkTarget($this, "saveRating");
224 } else {
225 $url_save = $ilCtrl->getLinkTargetByClass($this->ctrl_path, "saveRating");
226 }
227 }
228 $ttpl->setVariable("HREF_RATING", $url_save);
229
230 if ($a_onclick) {
231 $onclick = str_replace("%rating%", $i, $a_onclick);
232 $ttpl->setVariable("ONCLICK_RATING", ' onclick="' . $onclick . '"');
233 }
234
235 if ((bool) $a_average) {
236 $ref_rating = $overall_rating["avg"];
237 } else {
238 $ref_rating = $rating;
239 }
240
241 if ($ref_rating >= $i) {
242 $ttpl->setVariable(
243 "SRC_ICON",
244 ilUtil::getImagePath("icon_rate_on.svg")
245 );
246 } else {
247 $ttpl->setVariable(
248 "SRC_ICON",
249 ilUtil::getImagePath("icon_rate_off.svg")
250 );
251 }
252 $ttpl->setVariable("ALT_ICON", "(" . $i . "/5)");
253 $ttpl->parseCurrentBlock();
254 }
255
256 // remove
257 if ($rating) {
258 $ttpl->setCurrentBlock("rating_simple_del_bl");
259 $ttpl->setVariable("CAPTION_RATING_DEL", $lng->txt("rating_remove"));
260
261 if (stristr($a_onclick, "%rating%")) {
262 $url_save = "#";
263 } else {
264 $ilCtrl->setParameter($this, "rating", 0);
265 if (!$this->ctrl_path) {
266 $url_save = $ilCtrl->getLinkTarget($this, "saveRating");
267 } else {
268 $url_save = $ilCtrl->getLinkTargetByClass($this->ctrl_path, "saveRating");
269 }
270 }
271 $ttpl->setVariable("HREF_RATING_DEL", $url_save);
272
273 if ($a_onclick) {
274 $onclick = str_replace("%rating%", 0, $a_onclick);
275 $ttpl->setVariable("ONCLICK_RATING_DEL", ' onclick="' . $onclick . '"');
276 }
277
278 $ttpl->parseCurrentBlock();
279 }
280
281 if ($rate_text) {
282 $ttpl->setCurrentBlock("rating_simple_title");
283 $ttpl->setVariable("TXT_RATING_SIMPLE", $rate_text);
284 $ttpl->parseCurrentBlock();
285 }
286
287 // user rating text
288 $ttpl->setCurrentBlock("user_rating_simple");
289
290 if ((bool) $a_average &&
291 $overall_rating["cnt"]) {
292 $ttpl->setVariable("NUMBER_VOTES_SIMPLE", $overall_rating["cnt"]);
293 }
294
295 $ttpl->parseCurrentBlock();
296 }
297 }
298 // categories: overall & user (form)
299 else {
300 $has_user_rating = false;
301 foreach ($a_categories as $category) {
302 $user_rating = round(ilRating::getRatingForUserAndObject(
303 $this->obj_id,
304 $this->obj_type,
305 $this->sub_obj_id,
306 $this->sub_obj_type,
307 $this->getUserId(),
308 $category["id"]
309 ));
310
311 $overall_rating = ilRating::getOverallRatingForObject(
312 $this->obj_id,
313 $this->obj_type,
314 $this->sub_obj_id,
315 $this->sub_obj_type,
316 $category["id"]
317 );
318
319 for ($i = 1; $i <= 5; $i++) {
320 if ($a_may_rate && $i == $user_rating) {
321 $has_user_rating = true;
322
323 $ttpl->setCurrentBlock("rating_mark");
324 $ttpl->setVariable(
325 "SRC_MARK",
326 ilUtil::getImagePath("icon_rate_marker.svg")
327 );
328 $ttpl->parseCurrentBlock();
329 }
330
331 $ttpl->setCurrentBlock("user_rating_icon");
332 if ($overall_rating["avg"] >= $i) {
333 $ttpl->setVariable(
334 "SRC_ICON",
335 ilUtil::getImagePath("icon_rate_on.svg")
336 );
337 } elseif ($overall_rating["avg"] + 1 <= $i) {
338 $ttpl->setVariable(
339 "SRC_ICON",
340 ilUtil::getImagePath("icon_rate_off.svg")
341 );
342 } else {
343 $nr = round(($overall_rating["avg"] + 1 - $i) * 10);
344 $ttpl->setVariable(
345 "SRC_ICON",
346 ilUtil::getImagePath("icon_rate_$nr.svg")
347 );
348 }
349 $ttpl->setVariable("ALT_ICON", "(" . $i . "/5)");
350
351 if ($a_may_rate) {
352 $ttpl->setVariable("HREF_RATING", "il.Rating.setValue(" . $category["id"] . "," . $i . ", '" . $a_js_id . "')");
353 $ttpl->setVariable("CATEGORY_ID", $category["id"]);
354 $ttpl->setVariable("ICON_VALUE", $i);
355 $ttpl->setVariable("JS_ID", $a_js_id);
356 $ttpl->setVariable("ICON_MOUSEACTION", " onmouseover=\"il.Rating.toggleIcon(this," . $i . ")\"" .
357 " onmouseout=\"il.Rating.toggleIcon(this," . $i . ",1)\"");
358 }
359
360 $ttpl->parseCurrentBlock();
361 }
362
363 if ($a_may_rate) {
364 $ttpl->setCurrentBlock("user_rating_category_column");
365 $ttpl->setVariable("JS_ID", $a_js_id);
366 $ttpl->setVariable("CATEGORY_ID", $category["id"]);
367 $ttpl->setVariable("CATEGORY_VALUE", $user_rating);
368 $ttpl->parseCurrentBlock();
369 }
370
371 // category title
372 $ttpl->setCurrentBlock("user_rating_category");
373 $ttpl->setVariable("TXT_RATING_CATEGORY", $category["title"]);
374 $ttpl->parseCurrentBlock();
375 }
376
377 if ($overall_rating["cnt"]) {
378 $ttpl->setCurrentBlock("votes_number_bl");
379 $ttpl->setVariable("NUMBER_VOTES", sprintf($lng->txt("rating_number_votes"), $overall_rating["cnt"]));
380 $ttpl->parseCurrentBlock();
381 }
382
383 if ($a_may_rate) {
384 // remove
385 if ($has_user_rating) {
386 $ttpl->setCurrentBlock("user_rating_categories_del_bl");
387 $ttpl->setVariable("CAPTION_RATING_DEL_CAT", $lng->txt("rating_remove"));
388
389 $ilCtrl->setParameter($this, "rating", 0);
390 if (!$this->ctrl_path) {
391 $url_save = $ilCtrl->getLinkTarget($this, "resetUserRating");
392 } else {
393 $url_save = $ilCtrl->getLinkTargetByClass($this->ctrl_path, "resetUserRating");
394 }
395 $ttpl->setVariable("HREF_RATING_DEL_CAT", $url_save);
396
397 $ttpl->parseCurrentBlock();
398 }
399
400 if (!$this->ctrl_path) {
401 $url_form = $ilCtrl->getFormAction($this, "saveRating");
402 } else {
403 $url_form = $ilCtrl->getFormActionByClass($this->ctrl_path, "saveRating");
404 }
405 $ttpl->setVariable("FORM_ACTION", $url_form);
406 $ttpl->setVariable("TXT_SUBMIT", $lng->txt("rating_overlay_submit"));
407 $ttpl->setVariable("CMD_SUBMIT", "saveRating");
408 $ttpl->touchBlock("user_rating_categories_form_out");
409
410 // overall / user title
411 /*
412 $ttpl->setCurrentBlock("user_rating_categories");
413 $ttpl->setVariable("TXT_RATING_OVERALL", $lng->txt("rating_overlay_title_overall"));
414 $ttpl->parseCurrentBlock();
415 */
416 }
417 }
418
419 return $ttpl->get();
420 }
getYourRatingText()
Get "Your Rating" text.

References $ctrl, $i, $ilCtrl, $lng, ilUtil\getImagePath(), ilRating\getOverallRatingForObject(), ilRating\getRatingForUserAndObject(), getUserId(), and getYourRatingText().

Referenced by getBlockHTML(), and getHTML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetUserRating()

ilRatingGUI::resetUserRating ( )

Reset Rating.

Definition at line 647 of file class.ilRatingGUI.php.

648 {
650 $this->obj_id,
651 $this->obj_type,
652 $this->sub_obj_id,
653 $this->sub_obj_type,
654 $this->getUserId()
655 );
656 }
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 getUserId(), and ilRating\resetRatingForUserAndObject().

Referenced by saveRating().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveRating()

ilRatingGUI::saveRating ( )

Save Rating.

Definition at line 592 of file class.ilRatingGUI.php.

593 {
595
596 if (!is_array($_REQUEST["rating"])) {
597 $rating = (int) ilUtil::stripSlashes($_GET["rating"]);
598 if (!$rating) {
599 $this->resetUserRating();
600 } else {
602 $this->obj_id,
603 $this->obj_type,
604 $this->sub_obj_id,
605 $this->sub_obj_type,
606 $this->getUserId(),
607 $rating
608 );
609 }
610 } else {
611 foreach ($_POST["rating"] as $cat_id => $rating) {
613 $this->obj_id,
614 $this->obj_type,
615 $this->sub_obj_id,
616 $this->sub_obj_type,
617 $this->getUserId(),
618 $rating,
619 $cat_id
620 );
621 }
622 }
623
624 if ($this->update_callback) {
625 call_user_func(
626 $this->update_callback,
627 $this->obj_id,
628 $this->obj_type,
629 $this->sub_obj_id,
630 $this->sub_obj_type
631 );
632 }
633
634 if ($ilCtrl->isAsynch()) {
635 exit();
636 }
637 }
exit
Definition: backend.php:16
$_GET["client_id"]
$_POST["username"]
resetUserRating()
Reset Rating.
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.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

References $_GET, $_POST, $ctrl, $ilCtrl, exit, getUserId(), resetUserRating(), ilUtil\stripSlashes(), and ilRating\writeRatingForUserAndObject().

+ Here is the call graph for this function:

◆ setCtrlPath()

ilRatingGUI::setCtrlPath ( array  $a_value)

ilCtrl path

Parameters
array$a_value

Definition at line 155 of file class.ilRatingGUI.php.

156 {
157 $this->ctrl_path = $a_value;
158 }

◆ setExportCallback()

ilRatingGUI::setExportCallback (   $a_callback,
  $a_subobj_title 
)

Definition at line 658 of file class.ilRatingGUI.php.

659 {
660 $this->export_callback = $a_callback;
661 $this->export_subobj_title = $a_subobj_title;
662 }

◆ setObject()

ilRatingGUI::setObject (   $a_obj_id,
  $a_obj_type,
  $a_sub_obj_id = 0,
  $a_sub_obj_type = "" 
)

Set Object.

Parameters
int$a_obj_idObject ID
string$a_obj_typeObject Type
int$a_sub_obj_idSubobject ID
string$a_sub_obj_typeSubobject Type

Definition at line 82 of file class.ilRatingGUI.php.

83 {
85
86 if (!trim($a_sub_obj_type)) {
87 $a_sub_obj_type = "-";
88 }
89
90 $this->obj_id = $a_obj_id;
91 $this->obj_type = $a_obj_type;
92 $this->sub_obj_id = $a_sub_obj_id;
93 $this->sub_obj_type = $a_sub_obj_type;
94 $this->id = "rtg_" . $this->obj_id . "_" . $this->obj_type . "_" . $this->sub_obj_id . "_" .
95 $this->sub_obj_type;
96
97 $this->setUserId($ilUser->getId());
98 }
setUserId($a_userid)
Set User ID.
$ilUser
Definition: imgupload.php:18

References $ilUser, $user, and setUserId().

+ Here is the call graph for this function:

◆ setUpdateCallback()

ilRatingGUI::setUpdateCallback (   $a_callback)

Definition at line 639 of file class.ilRatingGUI.php.

640 {
641 $this->update_callback = $a_callback;
642 }

◆ setUserId()

ilRatingGUI::setUserId (   $a_userid)

Set User ID.

Parameters
int$a_useridUser ID

Definition at line 105 of file class.ilRatingGUI.php.

106 {
107 $this->userid = $a_userid;
108 }

Referenced by setObject().

+ Here is the caller graph for this function:

◆ setYourRatingText()

ilRatingGUI::setYourRatingText (   $a_val)

Set "Your Rating" text.

Parameters
string$a_valtext

Definition at line 125 of file class.ilRatingGUI.php.

126 {
127 $this->your_rating_text = $a_val;
128 }

Field Documentation

◆ $ctrl

ilRatingGUI::$ctrl
protected

Definition at line 27 of file class.ilRatingGUI.php.

Referenced by executeCommand(), renderDetails(), and saveRating().

◆ $ctrl_path

ilRatingGUI::$ctrl_path
protected

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

◆ $export_callback

ilRatingGUI::$export_callback
protected

Definition at line 35 of file class.ilRatingGUI.php.

◆ $export_subobj_title

ilRatingGUI::$export_subobj_title
protected

Definition at line 36 of file class.ilRatingGUI.php.

◆ $id

ilRatingGUI::$id = "rtg_"
protected

Definition at line 34 of file class.ilRatingGUI.php.

Referenced by getHTML().

◆ $lng

ilRatingGUI::$lng
protected

Definition at line 22 of file class.ilRatingGUI.php.

Referenced by __construct(), getHTML(), and renderDetails().

◆ $user

ilRatingGUI::$user
protected

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

Referenced by setObject().


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