ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 146 of file class.ilRatingGUI.php.

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

◆ 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 569 of file class.ilRatingGUI.php.

570 {
571 $categories = array();
572 if ($this->enable_categories) {
573 $categories = ilRatingCategory::getAllForObject($this->obj_id);
574 }
575
576 $may_rate = ($this->getUserId() != ANONYMOUS_USER_ID);
577
578 $ttpl = new ilTemplate("tpl.rating_block.html", true, true, "Services/Rating");
579
580 $ttpl->setVariable("TITLE", $a_title);
581
582 $ttpl->setVariable(
583 "RATING_DETAILS",
584 $this->renderDetails("rtsb_", $may_rate, $categories, null, true)
585 );
586
587 return $ttpl->get();
588 }
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 432 of file class.ilRatingGUI.php.

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

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 674 of file class.ilRatingGUI.php.

675 {
676 return $this->getHTML(
677 true,
678 $a_may_rate,
679 "il.Object.saveRatingFromListGUI(" . $a_ref_id . ", '" . $a_ajax_hash . "', %rating%);",
680 $_parent_ref_id
681 );
682 }
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 116 of file class.ilRatingGUI.php.

117 {
118 return $this->userid;
119 }
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 136 of file class.ilRatingGUI.php.

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

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 171 of file class.ilRatingGUI.php.

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

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

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 648 of file class.ilRatingGUI.php.

649 {
651 $this->obj_id,
652 $this->obj_type,
653 $this->sub_obj_id,
654 $this->sub_obj_type,
655 $this->getUserId()
656 );
657 }
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 593 of file class.ilRatingGUI.php.

594 {
596
597 if (!is_array($_REQUEST["rating"])) {
598 $rating = (int) ilUtil::stripSlashes($_GET["rating"]);
599 if (!$rating) {
600 $this->resetUserRating();
601 } else {
603 $this->obj_id,
604 $this->obj_type,
605 $this->sub_obj_id,
606 $this->sub_obj_type,
607 $this->getUserId(),
608 $rating
609 );
610 }
611 } else {
612 foreach ($_POST["rating"] as $cat_id => $rating) {
614 $this->obj_id,
615 $this->obj_type,
616 $this->sub_obj_id,
617 $this->sub_obj_type,
618 $this->getUserId(),
619 $rating,
620 $cat_id
621 );
622 }
623 }
624
625 if ($this->update_callback) {
626 call_user_func(
627 $this->update_callback,
628 $this->obj_id,
629 $this->obj_type,
630 $this->sub_obj_id,
631 $this->sub_obj_type
632 );
633 }
634
635 if ($ilCtrl->isAsynch()) {
636 exit();
637 }
638 }
$_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 156 of file class.ilRatingGUI.php.

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

◆ setExportCallback()

ilRatingGUI::setExportCallback (   $a_callback,
  $a_subobj_title 
)

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

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

◆ 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 // db-column is defined as not null, el stupido
87 if (!trim($a_sub_obj_type)) {
88 $a_sub_obj_type = "-";
89 }
90
91 $this->obj_id = $a_obj_id;
92 $this->obj_type = $a_obj_type;
93 $this->sub_obj_id = $a_sub_obj_id;
94 $this->sub_obj_type = $a_sub_obj_type;
95 $this->id = "rtg_" . $this->obj_id . "_" . $this->obj_type . "_" . $this->sub_obj_id . "_" .
96 $this->sub_obj_type;
97
98 $this->setUserId($ilUser->getId());
99 }
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 640 of file class.ilRatingGUI.php.

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

◆ setUserId()

ilRatingGUI::setUserId (   $a_userid)

Set User ID.

Parameters
int$a_useridUser ID

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

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

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 126 of file class.ilRatingGUI.php.

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

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: