ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
class.ilRatingGUI.php
Go to the documentation of this file.
1 <?php
2 
26 {
27  protected ilLanguage $lng;
28  protected ilCtrl $ctrl;
29  protected ilObjUser $user;
30  protected string $id = "rtg_";
31  protected $export_callback;
32  protected string $export_subobj_title = "";
33  protected array $ctrl_path = [];
34  protected bool $enable_categories = false;
35  protected string $your_rating_text = "";
36  protected \ILIAS\DI\UIServices $ui;
37 
38  protected int $obj_id;
39  protected string $obj_type;
40  protected ?int $sub_obj_id;
41  protected ?string $sub_obj_type;
42  protected int $userid;
43  protected $update_callback = null;
44  protected ?array $requested_ratings = null;
45  protected int $requested_rating;
46 
47  public function __construct()
48  {
49  global $DIC;
50 
51  $this->lng = $DIC->language();
52  $this->ctrl = $DIC->ctrl();
53  $this->user = $DIC->user();
54  $lng = $DIC->language();
55 
56  $this->ui = $DIC->ui();
57 
58  $params = $DIC->http()->request()->getQueryParams();
59  $body = $DIC->http()->request()->getParsedBody();
60 
61  if (isset($body["rating"]) && is_array($body["rating"])) {
62  $this->requested_ratings = ($body["rating"] ?? null);
63  }
64  $this->requested_rating = (int) ($params["rating"] ?? 0);
65 
66  $lng->loadLanguageModule("rating");
67  }
68 
72  public function executeCommand(): void
73  {
74  $ilCtrl = $this->ctrl;
75 
76  $next_class = $ilCtrl->getNextClass($this);
77  $cmd = $ilCtrl->getCmd();
78 
79  switch ($next_class) {
80  case "ilratingcategorygui":
81  $gui = new ilRatingCategoryGUI($this->obj_id, $this->export_callback, $this->export_subobj_title);
82  $ilCtrl->forwardCommand($gui);
83  break;
84 
85  default:
86  $this->$cmd();
87  break;
88  }
89  }
90 
99  public function setObject(
100  int $a_obj_id,
101  string $a_obj_type,
102  ?int $a_sub_obj_id = 0,
103  ?string $a_sub_obj_type = ""
104  ): void {
105  $ilUser = $this->user;
106 
107  if (!trim((string) $a_sub_obj_type)) {
108  $a_sub_obj_type = "-";
109  }
110 
111  $this->obj_id = $a_obj_id;
112  $this->obj_type = $a_obj_type;
113  $this->sub_obj_id = $a_sub_obj_id;
114  $this->sub_obj_type = $a_sub_obj_type;
115  $this->id = "rtg_" . $this->obj_id . "_" . $this->obj_type . "_" . $this->sub_obj_id . "_" .
117 
118  $this->setUserId($ilUser->getId());
119  }
120 
121  public function setUserId(int $a_userid): void
122  {
123  $this->userid = $a_userid;
124  }
125 
126  public function getUserId(): int
127  {
128  return $this->userid;
129  }
130 
131  public function setYourRatingText(string $a_val): void
132  {
133  $this->your_rating_text = $a_val;
134  }
135 
136  public function getYourRatingText(): string
137  {
139  }
140 
141  public function enableCategories(bool $a_value): void
142  {
143  $this->enable_categories = $a_value;
144  }
145 
146  public function setCtrlPath(array $a_value): void
147  {
148  $this->ctrl_path = $a_value;
149  }
150 
151  // Render rating details
152  protected function renderDetails(
153  string $a_js_id,
154  bool $a_may_rate,
155  array $a_categories = null,
156  string $a_onclick = null,
157  bool $a_average = false,
158  bool $add_tooltip = false
159  ): string {
160  $lng = $this->lng;
161  $ilCtrl = $this->ctrl;
162  $f = $this->ui->factory();
163  $r = $this->ui->renderer();
164 
165  $ttpl = new ilTemplate("tpl.rating_details.html", true, true, "components/ILIAS/Rating");
166 
167  $rate_text = null;
168  if ($this->getYourRatingText() != "#") {
169  $rate_text = ($this->getYourRatingText() != "")
170  ? $this->getYourRatingText()
171  : $lng->txt("rating_your_rating");
172  }
173 
174  // no categories: 1 simple rating (link)
175  if (!$a_categories) {
176  if ($a_may_rate) {
178  $this->obj_id,
179  $this->obj_type,
180  $this->sub_obj_id,
181  $this->sub_obj_type,
182  $this->getUserId(),
183  0
184  );
185  $overall_rating = [
186  "avg" => 0,
187  "cnt" => 0
188  ];
189  if ($a_average) {
190  $overall_rating = ilRating::getOverallRatingForObject(
191  $this->obj_id,
192  $this->obj_type,
193  $this->sub_obj_id,
194  $this->sub_obj_type
195  );
196  }
197 
198  // user rating links
199  for ($i = 1; $i <= 5; $i++) {
200  $star_tpl = new ilTemplate("tpl.rating_star.html", true, true, "components/ILIAS/Rating");
201  if ($a_average &&
202  $i == $rating) {
203  $star_tpl->setCurrentBlock("rating_mark_simple");
204  $star_tpl->setVariable(
205  "SRC_MARK_SIMPLE",
206  ilUtil::getImagePath("standard/icon_rate_marker.svg")
207  );
208  $star_tpl->parseCurrentBlock();
209  }
210 
211  $ttpl->setCurrentBlock("rating_link_simple");
212  if (stristr((string) $a_onclick, "%rating%")) {
213  $url_save = "#";
214  } else {
215  $ilCtrl->setParameter($this, "rating", $i);
216  if (!$this->ctrl_path) {
217  $url_save = $ilCtrl->getLinkTarget($this, "saveRating");
218  } else {
219  $url_save = $ilCtrl->getLinkTargetByClass($this->ctrl_path, "saveRating");
220  }
221  }
222  $b = $this->ui->factory()->button()->shy("###star###", $url_save);
223 
224  if ($a_onclick) {
225  $onclick = str_replace("%rating%", $i, $a_onclick);
226  $b = $b->withOnLoadCode(function ($id) use ($onclick) {
227  return
228  "$('#" . $id . "').click(function() { $onclick; return false;});";
229  });
230  }
231 
232  if ($a_average) {
233  $ref_rating = $overall_rating["avg"];
234  } else {
235  $ref_rating = $rating;
236  }
237 
238  if ($ref_rating >= $i) {
239  $star_tpl->setVariable(
240  "SRC_ICON",
241  ilUtil::getImagePath("standard/icon_rate_on.svg")
242  );
243  } else {
244  $star_tpl->setVariable(
245  "SRC_ICON",
246  ilUtil::getImagePath("standard/icon_rate_off.svg")
247  );
248  }
249  $star_tpl->setVariable(
250  "ALT_ICON",
251  sprintf($lng->txt("rating_rate_x_of_5"), $i)
252  );
253 
254  if ($add_tooltip) {
255  $topics = $this->getTooltipTopics(
256  (int) ($overall_rating["cnt"] ?? 0),
257  (float) ($overall_rating["avg"] ?? 0),
258  (int) ($rating ?? 0)
259  );
260  $b = $b->withHelpTopics(...$f->helpTopics(...$topics));
261  }
262 
263  $star_html = $this->ui->renderer()->render($b);
264  $star_html = str_replace("###star###", $star_tpl->get(), $star_html);
265 
266  $ttpl->setVariable("STAR_BUTTON", $star_html);
267 
268  $ttpl->parseCurrentBlock();
269  }
270 
271  // remove
272  if ($rating) {
273  $ttpl->setCurrentBlock("rating_simple_del_bl");
274  $ttpl->setVariable("CAPTION_RATING_DEL", $lng->txt("rating_remove"));
275 
276  if (stristr((string) $a_onclick, "%rating%")) {
277  $url_save = "#";
278  } else {
279  $ilCtrl->setParameter($this, "rating", 0);
280  if (!$this->ctrl_path) {
281  $url_save = $ilCtrl->getLinkTarget($this, "saveRating");
282  } else {
283  $url_save = $ilCtrl->getLinkTargetByClass($this->ctrl_path, "saveRating");
284  }
285  }
286  $ttpl->setVariable("HREF_RATING_DEL", $url_save);
287 
288  if ($a_onclick) {
289  $onclick = str_replace("%rating%", 0, $a_onclick);
290  $ttpl->setVariable("ONCLICK_RATING_DEL", ' onclick="' . $onclick . '"');
291  }
292 
293  $ttpl->parseCurrentBlock();
294  }
295 
296  if ($rate_text) {
297  $ttpl->setCurrentBlock("rating_simple_title");
298  $ttpl->setVariable("TXT_RATING_SIMPLE", $rate_text);
299  $ttpl->parseCurrentBlock();
300  }
301 
302  if ($a_average &&
303  $overall_rating["cnt"]) {
304  $ttpl->setCurrentBlock("number_votes_simple");
305  $ttpl->setVariable("NUMBER_VOTES_SIMPLE", $overall_rating["cnt"]);
306  $ttpl->parseCurrentBlock();
307  }
308 
309  // user rating text
310  $ttpl->setCurrentBlock("user_rating_simple");
311  $ttpl->parseCurrentBlock();
312  }
313  }
314  // categories: overall & user (form)
315  else {
316  $has_user_rating = false;
317  $overall_rating = [
318  "avg" => 0,
319  "cnt" => 0
320  ];
321  foreach ($a_categories as $category) {
322  $user_rating = round(ilRating::getRatingForUserAndObject(
323  $this->obj_id,
324  $this->obj_type,
325  $this->sub_obj_id,
326  $this->sub_obj_type,
327  $this->getUserId(),
328  $category["id"]
329  ));
330 
331  $overall_rating = ilRating::getOverallRatingForObject(
332  $this->obj_id,
333  $this->obj_type,
334  $this->sub_obj_id,
335  $this->sub_obj_type,
336  $category["id"]
337  );
338 
339  for ($i = 1; $i <= 5; $i++) {
340  $star_tpl = new ilTemplate("tpl.js_rating_star.html", true, true, "components/ILIAS/Rating");
341  if ($a_may_rate && $i == $user_rating) {
342  $has_user_rating = true;
343 
344  $star_tpl->setCurrentBlock("rating_mark");
345  $star_tpl->setVariable(
346  "SRC_MARK",
347  ilUtil::getImagePath("standard/icon_rate_marker.svg")
348  );
349  $star_tpl->parseCurrentBlock();
350  }
351 
352  $ttpl->setCurrentBlock("user_rating_icon");
353  if ($overall_rating["avg"] >= $i) {
354  $star_tpl->setVariable(
355  "SRC_ICON",
356  ilUtil::getImagePath("standard/icon_rate_on.svg")
357  );
358  $star_tpl->setVariable('RATING_FRACTION', 10);
359  } elseif ($overall_rating["avg"] + 1 <= $i) {
360  $star_tpl->setVariable(
361  "SRC_ICON",
362  ilUtil::getImagePath("standard/icon_rate_off.svg")
363  );
364  $star_tpl->setVariable('RATING_FRACTION', 0);
365  } else {
366  $nr = round(($overall_rating["avg"] + 1 - $i) * 10);
367  $star_tpl->setVariable(
368  "SRC_ICON",
369  ilUtil::getImagePath("standard/icon_rate_$nr.svg")
370  );
371  $star_tpl->setVariable("RATING_FRACTION", $nr);
372  }
373  $star_tpl->setVariable(
374  "ALT_ICON",
375  sprintf($lng->txt("rating_rate_x_of_5"), $i)
376  );
377 
378  $b = $f->button()->shy("###star###", "#");
379  if ($a_may_rate) {
380  $ttpl->setVariable("HREF_RATING", "il.Rating.setValue(" . $category["id"] . "," . $i . ", '" . $a_js_id . "')");
381  $star_tpl->setVariable("CATEGORY_ID", $category["id"]);
382  $star_tpl->setVariable("ICON_VALUE", $i);
383  $star_tpl->setVariable("JS_ID", $a_js_id);
384  $b = $b->withOnLoadCode(function ($id) use ($category, $i, $a_js_id) {
385  return
386  "$('#" . $id . "').click(function() { il.Rating.setValue(" . $category["id"] . "," . $i . ", '" . $a_js_id . "'); return false;});";
387  });
388 
389  /*
390  $ttpl->setVariable("ICON_MOUSEACTION", " onmouseover=\"il.Rating.toggleIcon(this," . $i . ")\"" .
391  " onmouseout=\"il.Rating.toggleIcon(this," . $i . ",1)\"");*/
392  }
393  if ($add_tooltip) {
394  $topics = $this->getTooltipTopics(
395  (int) ($overall_rating["cnt"] ?? 0),
396  (float) ($overall_rating["avg"] ?? 0),
397  (int) ($user_rating ?? 0)
398  );
399  $b = $b->withHelpTopics(...$f->helpTopics(...$topics));
400  }
401  $button_html = $r->render($b);
402  $button_html = str_replace("###star###", $star_tpl->get(), $button_html);
403  $ttpl->setVariable("RATE_BUTTON", $button_html);
404  $ttpl->parseCurrentBlock();
405  }
406 
407  if ($a_may_rate) {
408  $ttpl->setCurrentBlock("user_rating_category_column");
409  $ttpl->setVariable("JS_ID", $a_js_id);
410  $ttpl->setVariable("CATEGORY_ID", $category["id"]);
411  $ttpl->setVariable("CATEGORY_VALUE", $user_rating);
412  $ttpl->parseCurrentBlock();
413  }
414 
415 
416  // category title
417  $ttpl->setCurrentBlock("user_rating_category");
418  $ttpl->setVariable("TXT_RATING_CATEGORY", $category["title"]);
419  $ttpl->parseCurrentBlock();
420  }
421 
422  if ($overall_rating["cnt"] > 0) {
423  $ttpl->setCurrentBlock("votes_number_bl");
424  $ttpl->setVariable("NUMBER_VOTES", sprintf($lng->txt("rating_number_votes"), $overall_rating["cnt"]));
425  $ttpl->parseCurrentBlock();
426  }
427 
428  if ($a_may_rate) {
429  // remove
430  if ($has_user_rating) {
431  $ttpl->setCurrentBlock("user_rating_categories_del_bl");
432  $ttpl->setVariable("CAPTION_RATING_DEL_CAT", $lng->txt("rating_remove"));
433 
434  $ilCtrl->setParameter($this, "rating", 0);
435  if (!$this->ctrl_path) {
436  $url_save = $ilCtrl->getLinkTarget($this, "resetUserRating");
437  } else {
438  $url_save = $ilCtrl->getLinkTargetByClass($this->ctrl_path, "resetUserRating");
439  }
440  $ttpl->setVariable("HREF_RATING_DEL_CAT", $url_save);
441 
442  $ttpl->parseCurrentBlock();
443  }
444 
445  if (!$this->ctrl_path) {
446  $url_form = $ilCtrl->getFormAction($this, "saveRating");
447  } else {
448  $url_form = $ilCtrl->getFormActionByClass($this->ctrl_path, "saveRating");
449  }
450  $ttpl->setVariable("FORM_ACTION", $url_form);
451  $ttpl->setVariable("TXT_SUBMIT", $lng->txt("rating_overlay_submit"));
452  $ttpl->setVariable("CMD_SUBMIT", "saveRating");
453  $ttpl->touchBlock("user_rating_categories_form_out");
454  }
455  }
456 
457  return $ttpl->get();
458  }
459 
460  // Get HTML for rating of an object (and a user)
461  public function getHTML(
462  bool $a_show_overall = true,
463  bool $a_may_rate = true,
464  string $a_onclick = null,
465  string $a_additional_id = null
466  ): string {
467  $f = $this->ui->factory();
468  $r = $this->ui->renderer();
469  $lng = $this->lng;
470  $unique_id = $this->id;
471  if ($a_additional_id) {
472  $unique_id .= "_" . $a_additional_id;
473  }
474 
475  $categories = array();
476  if ($this->enable_categories) {
477  $categories = ilRatingCategory::getAllForObject($this->obj_id);
478  }
479 
480  $may_rate = ($this->getUserId() != ANONYMOUS_USER_ID);
481  if ($may_rate && !$a_may_rate) {
482  $may_rate = false;
483  }
484 
485  $has_overlay = false;
486  if ($may_rate || $categories) {
487  $has_overlay = true;
488  }
489 
490  $ttpl = new ilTemplate("tpl.rating_input.html", true, true, "components/ILIAS/Rating");
491 
492  // user rating
493  $user_rating = 0;
494  if ($may_rate || !$a_show_overall) {
495  $user_rating = round(ilRating::getRatingForUserAndObject(
496  $this->obj_id,
497  $this->obj_type,
498  $this->sub_obj_id,
499  $this->sub_obj_type,
500  $this->getUserId()
501  ));
502  }
503 
504  // (1) overall rating
505  if ($a_show_overall) {
507  $this->obj_id,
508  $this->obj_type,
509  $this->sub_obj_id,
510  $this->sub_obj_type
511  );
512  } else {
513  $rating = array("avg" => $user_rating);
514  }
515 
516  for ($i = 1; $i <= 5; $i++) {
517  if ($a_show_overall &&
518  $i == $user_rating) {
519  $ttpl->setCurrentBlock("rating_mark");
520  $ttpl->setVariable(
521  "SRC_MARK",
522  ilUtil::getImagePath("standard/icon_rate_marker.svg")
523  );
524  $ttpl->parseCurrentBlock();
525  }
526 
527  $ttpl->setCurrentBlock("rating_icon");
528  if ($rating["avg"] >= $i) {
529  $ttpl->setVariable(
530  "SRC_ICON",
531  ilUtil::getImagePath("standard/icon_rate_on.svg")
532  );
533  } elseif ($rating["avg"] + 1 <= $i) {
534  $ttpl->setVariable(
535  "SRC_ICON",
536  ilUtil::getImagePath("standard/icon_rate_off.svg")
537  );
538  } else {
539  $nr = round(($rating["avg"] + 1 - $i) * 10);
540  $ttpl->setVariable(
541  "SRC_ICON",
542  ilUtil::getImagePath("standard/icon_rate_$nr.svg")
543  );
544  }
545  $ttpl->setVariable("ALT_ICON", "");
546  $ttpl->parseCurrentBlock();
547  }
548  $ttpl->setCurrentBlock("rating_icon");
549 
550  if ($a_show_overall) {
551  if ($rating["cnt"] > 0) {
552  $ttpl->setCurrentBlock("rat_nr");
553  $ttpl->setVariable("RT_NR", $rating["cnt"]);
554  $ttpl->parseCurrentBlock();
555  }
556  }
557 
558  // add overlay (trigger)
559  if ($has_overlay) {
560  $ttpl->setCurrentBlock("act_rat_start");
561  $ttpl->setVariable("ID", $unique_id);
562  $ttpl->setVariable("TXT_OPEN_DIALOG", $lng->txt("rating_open_dialog"));
563  $ttpl->parseCurrentBlock();
564 
565  $ttpl->touchBlock("act_rat_end");
566  }
567 
568  $ttpl->parseCurrentBlock();
569 
570 
571  // (2) user rating
572 
573  $ttpl->setVariable("TTID", $unique_id);
574  $rating_html = $ttpl->get();
575 
576  $tt_topics = $this->getTooltipTopics(
577  (int) ($rating["cnt"] ?? 0),
578  (float) ($rating["avg"] ?? 0),
579  (int) ($user_rating ?? 0)
580  );
581 
582 
583  $button = $f->button()->shy('###button###', '#')
584  ->withOnLoadCode(function (string $id): string {
585  return "document.getElementById('$id').classList.add('ilRating');";
586  });
587  if ($has_overlay) {
588  $ttpl->setVariable(
589  "RATING_DETAILS",
590  $this->renderDetails("rtov_", $may_rate, $categories, $a_onclick)
591  );
592 
593  $popover = $f->popover()->standard(
594  $f->legacy($this->renderDetails("rtov_", $may_rate, $categories, $a_onclick))
595  );
596  $button = $button->withOnClick($popover->getShowSignal());
597  $button = $button->withHelpTopics(
598  ...$f->helpTopics(...$tt_topics)
599  );
600  $elements = [$popover, $button];
601  } else {
602  /*$button = $button->withOnLoadCode(function ($id) {
603  return "";
604  });*/
605  $button = $button->withHelpTopics(
606  ...$f->helpTopics(...$tt_topics)
607  );
608  $elements = [$button];
609  }
610  $html = $r->render($elements);
611  $html = str_replace("###button###", $rating_html, $html);
612 
613  return $html;
614  }
615 
616  protected function getTooltipTopics(
617  int $cnt = 0,
618  float $avg = 0,
619  int $user = 0
620  ): array {
621  $topics = [];
622  $lng = $this->lng;
623 
624  if ($cnt == 0) {
625  $topics[] = $lng->txt("rat_not_rated_yet");
626  } else {
627  if ($cnt == 1) {
628  $topics[] = $lng->txt("rat_one_rating");
629  } else {
630  $topics[] = sprintf($lng->txt("rat_nr_ratings"), $cnt);
631  }
632  $topics[] = $lng->txt("rating_avg_rating") . ": " . round($avg, 1);
633  }
634 
635  if ($user > 0) {
636  $topics[] = $lng->txt("rating_personal_rating") . ": " . $user;
637  }
638  return $topics;
639  }
640 
641  public function getBlockHTML(string $a_title): string
642  {
643  $ui = $this->ui;
644 
645  $categories = array();
646  if ($this->enable_categories) {
647  $categories = ilRatingCategory::getAllForObject($this->obj_id);
648  }
649 
650  $may_rate = ($this->getUserId() != ANONYMOUS_USER_ID);
651 
652 
653  $panel = $ui->factory()->panel()->secondary()->legacy(
654  $a_title,
655  $ui->factory()->legacy(
656  $this->renderDetails("rtsb_", $may_rate, $categories, null, true, true)
657  )
658  );
659 
660  return $ui->renderer()->render($panel);
661  }
662 
666  public function saveRating(): void
667  {
668  $ilCtrl = $this->ctrl;
669 
670  if (!is_array($this->requested_ratings)) {
671  $rating = $this->requested_rating;
672  if ($rating == 0) {
673  $this->resetUserRating();
674  } else {
676  $this->obj_id,
677  $this->obj_type,
678  $this->sub_obj_id,
679  $this->sub_obj_type,
680  $this->getUserId(),
681  $rating
682  );
683  }
684  } else {
685  foreach ($this->requested_ratings as $cat_id => $rating) {
687  $this->obj_id,
688  $this->obj_type,
689  $this->sub_obj_id,
690  $this->sub_obj_type,
691  $this->getUserId(),
692  $rating,
693  $cat_id
694  );
695  }
696  }
697 
698  if ($this->update_callback) {
699  call_user_func(
700  $this->update_callback,
701  $this->obj_id,
702  $this->obj_type,
703  $this->sub_obj_id,
704  $this->sub_obj_type
705  );
706  }
707 
708  if ($ilCtrl->isAsynch()) {
709  exit();
710  }
711  }
712 
713  public function setUpdateCallback($a_callback): void
714  {
715  $this->update_callback = $a_callback;
716  }
717 
718  public function resetUserRating(): void
719  {
721  $this->obj_id,
722  $this->obj_type,
723  (int) $this->sub_obj_id,
724  $this->sub_obj_type,
725  $this->getUserId()
726  );
727  }
728 
729  public function setExportCallback($a_callback, string $a_subobj_title): void
730  {
731  $this->export_callback = $a_callback;
732  $this->export_subobj_title = $a_subobj_title;
733  }
734 
735  // Build list gui property for object
736  public function getListGUIProperty(
737  int $a_ref_id,
738  bool $a_may_rate,
739  string $a_ajax_hash,
740  int $parent_ref_id
741  ): string {
742  return $this->getHTML(
743  true,
744  $a_may_rate,
745  "il.Object.saveRatingFromListGUI(" . $a_ref_id . ", '" . $a_ajax_hash . "', %rating%);",
746  $parent_ref_id
747  );
748  }
749 }
ILIAS DI UIServices $ui
setExportCallback($a_callback, string $a_subobj_title)
const ANONYMOUS_USER_ID
Definition: constants.php:27
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...
setUpdateCallback($a_callback)
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31
renderDetails(string $a_js_id, bool $a_may_rate, array $a_categories=null, string $a_onclick=null, bool $a_average=false, bool $add_tooltip=false)
ilLanguage $lng
setObject(int $a_obj_id, string $a_obj_type, ?int $a_sub_obj_id=0, ?string $a_sub_obj_type="")
Set Object.
loadLanguageModule(string $a_module)
Load language module.
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.
getBlockHTML(string $a_title)
string $export_subobj_title
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.
setCtrlPath(array $a_value)
getNextClass($a_gui_class=null)
Class ilRatingCategoryGUI.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
saveRating()
Save Rating.
array $requested_ratings
getTooltipTopics(int $cnt=0, float $avg=0, int $user=0)
setUserId(int $a_userid)
static getAllForObject(int $a_parent_obj_id)
global $DIC
Definition: shib_login.php:25
getHTML(bool $a_show_overall=true, bool $a_may_rate=true, string $a_onclick=null, string $a_additional_id=null)
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
enableCategories(bool $a_value)
setYourRatingText(string $a_val)
getListGUIProperty(int $a_ref_id, bool $a_may_rate, string $a_ajax_hash, int $parent_ref_id)
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.
string $your_rating_text
executeCommand()
execute command
static getOverallRatingForObject(int $a_obj_id, string $a_obj_type, int $a_sub_obj_id=null, string $a_sub_obj_type=null, int $a_category_id=null)
Get overall rating for an object.
$r