ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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

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

25 {
26 global $lng;
27
28 $lng->loadLanguageModule("rating");
29 }
global $lng
Definition: privfeed.php:40

References $lng.

Member Function Documentation

◆ enableCategories()

ilRatingGUI::enableCategories (   $a_value)

Toggle categories status.

Parameters
bool$a_value

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

129 {
130 $this->enable_categories = (bool)$a_value;
131 }

◆ executeCommand()

& ilRatingGUI::executeCommand ( )

execute command

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

35 {
36 global $ilCtrl;
37
38 $next_class = $ilCtrl->getNextClass($this);
39 $cmd = $ilCtrl->getCmd();
40
41 switch($next_class)
42 {
43 case "ilratingcategorygui":
44 include_once("./Services/Rating/classes/class.ilRatingCategoryGUI.php");
45 $gui = new ilRatingCategoryGUI($this->obj_id, $this->export_callback, $this->export_subobj_title);
46 $ilCtrl->forwardCommand($gui);
47 break;
48
49 default:
50 return $this->$cmd();
51 break;
52 }
53 }
Class ilRatingCategoryGUI.
global $ilCtrl
Definition: ilias.php:18
$cmd
Definition: sahs_server.php:35

References $cmd, 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 {
574 $categories = ilRatingCategory::getAllForObject($this->obj_id);
575 }
576
577 $may_rate = ($this->getUserId() != ANONYMOUS_USER_ID);
578
579 $ttpl = new ilTemplate("tpl.rating_block.html", true, true, "Services/Rating");
580
581 $ttpl->setVariable("TITLE", $a_title);
582
583 $ttpl->setVariable("RATING_DETAILS",
584 $this->renderDetails("rtsb_", $may_rate, $categories, null, true));
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 427 of file class.ilRatingGUI.php.

428 {
429 global $lng;
430
431 $unique_id = $this->id;
432 if($a_additional_id)
433 {
434 $unique_id .= "_".$a_additional_id;
435 }
436
437 $categories = array();
438 if($this->enable_categories)
439 {
440 $categories = ilRatingCategory::getAllForObject($this->obj_id);
441 }
442
443 $may_rate = ($this->getUserId() != ANONYMOUS_USER_ID);
444 if($may_rate && !$a_may_rate)
445 {
446 $may_rate = false;
447 }
448
449 $has_overlay = false;
450 if($may_rate || $categories)
451 {
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 {
461 $user_rating = round(ilRating::getRatingForUserAndObject($this->obj_id, $this->obj_type,
462 $this->sub_obj_id, $this->sub_obj_type, $this->getUserId()));
463 }
464
465 // (1) overall rating
466 if($a_show_overall)
467 {
468 $rating = ilRating::getOverallRatingForObject($this->obj_id, $this->obj_type,
469 $this->sub_obj_id, $this->sub_obj_type);
470 }
471 else
472 {
473 $rating = array("avg"=>$user_rating);
474 }
475
476 for($i = 1; $i <= 5; $i++)
477 {
478 if ($a_show_overall &&
479 $i == $user_rating)
480 {
481 $ttpl->setCurrentBlock("rating_mark");
482 $ttpl->setVariable("SRC_MARK",
483 ilUtil::getImagePath("icon_rate_marker.svg"));
484 $ttpl->parseCurrentBlock();
485 }
486
487 $ttpl->setCurrentBlock("rating_icon");
488 if ($rating["avg"] >= $i)
489 {
490 $ttpl->setVariable("SRC_ICON",
491 ilUtil::getImagePath("icon_rate_on.svg"));
492 }
493 else if ($rating["avg"] + 1 <= $i)
494 {
495 $ttpl->setVariable("SRC_ICON",
496 ilUtil::getImagePath("icon_rate_off.svg"));
497 }
498 else
499 {
500 $nr = round(($rating["avg"] + 1 - $i) * 10);
501 $ttpl->setVariable("SRC_ICON",
502 ilUtil::getImagePath("icon_rate_$nr.svg"));
503 }
504 $ttpl->setVariable("ALT_ICON", "(".$i."/5)");
505 $ttpl->parseCurrentBlock();
506 }
507 $ttpl->setCurrentBlock("rating_icon");
508
509 if($a_show_overall)
510 {
511 if ($rating["cnt"] == 0)
512 {
513 $tt = $lng->txt("rat_not_rated_yet");
514 }
515 else if ($rating["cnt"] == 1)
516 {
517 $tt = $lng->txt("rat_one_rating");
518 }
519 else
520 {
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 {
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 {
537 include_once("./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
538 $ov = new ilOverlayGUI($unique_id);
539 $ov->setTrigger("tr_".$unique_id, "click", "tr_".$unique_id);
540 $ov->add();
541
542 $ttpl->setCurrentBlock("act_rat_start");
543 $ttpl->setVariable("ID", $unique_id);
544 $ttpl->parseCurrentBlock();
545
546 $ttpl->touchBlock("act_rat_end");
547 }
548
549 $ttpl->parseCurrentBlock();
550
551
552 // (2) user rating
553
554 if($has_overlay)
555 {
556 $ttpl->setVariable("RATING_DETAILS",
557 $this->renderDetails("rtov_", $may_rate, $categories, $a_onclick));
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 }
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)

References $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 661 of file class.ilRatingGUI.php.

662 {
663 return $this->getHTML(true, $a_may_rate,
664 "il.Object.saveRatingFromListGUI(".$a_ref_id.", '".$a_ajax_hash."', %rating%);",
665 $_parent_ref_id);
666 }
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 98 of file class.ilRatingGUI.php.

99 {
100 return $this->userid;
101 }

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

119 {
120 return $this->your_rating_text;
121 }

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

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

References $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 640 of file class.ilRatingGUI.php.

641 {
642 ilRating::resetRatingForUserAndObject($this->obj_id, $this->obj_type,
643 $this->sub_obj_id, $this->sub_obj_type, $this->getUserId());
644 }
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 {
594 global $ilCtrl;
595
596 if(!is_array($_REQUEST["rating"]))
597 {
598 $rating = (int)ilUtil::stripSlashes($_GET["rating"]);
599 if(!$rating)
600 {
601 $this->resetUserRating();
602 }
603 else
604 {
605 ilRating::writeRatingForUserAndObject($this->obj_id, $this->obj_type,
606 $this->sub_obj_id, $this->sub_obj_type, $this->getUserId(),
607 $rating);
608 }
609 }
610 else
611 {
612 foreach($_POST["rating"] as $cat_id => $rating)
613 {
614 ilRating::writeRatingForUserAndObject($this->obj_id, $this->obj_type,
615 $this->sub_obj_id, $this->sub_obj_type, $this->getUserId(),
616 $rating, $cat_id);
617 }
618 }
619
620 if($this->update_callback)
621 {
622 call_user_func($this->update_callback, $this->obj_id, $this->obj_type,
623 $this->sub_obj_id, $this->sub_obj_type);
624 }
625
626 if($ilCtrl->isAsynch())
627 {
628 exit();
629 }
630 }
$_GET["client_id"]
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
$_POST['username']
Definition: cron.php:12
exit
Definition: login.php:54
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7

References $_GET, $_POST, $_REQUEST, $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 138 of file class.ilRatingGUI.php.

139 {
140 $this->ctrl_path = $a_value;
141 }

◆ setExportCallback()

ilRatingGUI::setExportCallback (   $a_callback,
  $a_subobj_title 
)

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

647 {
648 $this->export_callback = $a_callback;
649 $this->export_subobj_title = $a_subobj_title;
650 }

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

64 {
65 global $ilUser;
66
67 // db-column is defined as not null, el stupido
68 if(!trim($a_sub_obj_type))
69 {
70 $a_sub_obj_type = "-";
71 }
72
73 $this->obj_id = $a_obj_id;
74 $this->obj_type = $a_obj_type;
75 $this->sub_obj_id = $a_sub_obj_id;
76 $this->sub_obj_type = $a_sub_obj_type;
77 $this->id = "rtg_".$this->obj_id."_".$this->obj_type."_".$this->sub_obj_id."_".
78 $this->sub_obj_type;
79
80 $this->setUserId($ilUser->getId());
81 }
setUserId($a_userid)
Set User ID.
global $ilUser
Definition: imgupload.php:15

References $ilUser, and setUserId().

+ Here is the call graph for this function:

◆ setUpdateCallback()

ilRatingGUI::setUpdateCallback (   $a_callback)

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

633 {
634 $this->update_callback = $a_callback;
635 }

◆ setUserId()

ilRatingGUI::setUserId (   $a_userid)

Set User ID.

Parameters
int$a_useridUser ID

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

89 {
90 $this->userid = $a_userid;
91 }

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

109 {
110 $this->your_rating_text = $a_val;
111 }

Field Documentation

◆ $ctrl_path

ilRatingGUI::$ctrl_path
protected

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

◆ $export_callback

ilRatingGUI::$export_callback
protected

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

◆ $export_subobj_title

ilRatingGUI::$export_subobj_title
protected

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

◆ $id

ilRatingGUI::$id = "rtg_"
protected

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

Referenced by getHTML().


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