function updatePeerReviewCommentsObject()
 {
     global $ilCtrl, $ilUser, $tpl;
     if (!$this->ass || !$this->ass->getPeerReview() || !$this->ass->getDeadline() || $this->ass->getDeadline() - time() > 0 || !sizeof($_POST["pc"]) || !$ilCtrl->isAsynch()) {
         exit;
     }
     $rating_peer_id = $_POST["rating_peer_id"];
     $giver_id = $ilUser->getId();
     // save rating
     include_once './Services/Rating/classes/class.ilRating.php';
     ilRating::writeRatingForUserAndObject($this->ass->getId(), "ass", $rating_peer_id, "peer", $giver_id, $_POST["rating"]);
     // save comments
     foreach ($_POST["pc"] as $peer_id => $value) {
         if ($peer_id) {
             $this->ass->updatePeerReviewComment($peer_id, $value);
         }
     }
     // render current rating
     $ilCtrl->setParameter($this->parent_obj, "peer_id", $rating_peer_id);
     include_once './Services/Rating/classes/class.ilRatingGUI.php';
     $rating = new ilRatingGUI();
     $rating->setObject($this->ass->getId(), "ass", $rating_peer_id, "peer");
     $rating->setUserId($giver_id);
     if (!$_REQUEST["ssrtg"]) {
         echo $rating->getHTML(false, true, "il.ExcPeerReview.saveComments(" . $rating_peer_id . ", %rating%)");
     } else {
         echo '<div id="rtr_widget">' . $rating->getHTML(false, true, "il.ExcPeerReview.saveSingleRating(" . $rating_peer_id . ", %rating%)") . '</div>';
     }
     echo $tpl->getOnLoadCodeForAsynch();
     exit;
 }
 /**
  * Save Rating
  */
 function saveRating()
 {
     if (!is_array($_REQUEST["rating"])) {
         ilRating::writeRatingForUserAndObject($this->obj_id, $this->obj_type, $this->sub_obj_id, $this->sub_obj_type, $this->getUserId(), ilUtil::stripSlashes($_GET["rating"]));
     } else {
         foreach ($_POST["rating"] as $cat_id => $rating) {
             ilRating::writeRatingForUserAndObject($this->obj_id, $this->obj_type, $this->sub_obj_id, $this->sub_obj_type, $this->getUserId(), $rating, $cat_id);
         }
     }
 }
 function updatePageRating()
 {
     global $ilUser;
     $pg_id = $_GET["pgid"];
     if (!$this->ctrl->isAsynch() || !$pg_id) {
         exit;
     }
     include_once './Services/Rating/classes/class.ilRating.php';
     $rating = (int) $_POST["rating"];
     if ($rating) {
         ilRating::writeRatingForUserAndObject($this->lm->getId(), "lm", $pg_id, "lm", $ilUser->getId(), $_POST["rating"]);
     } else {
         ilRating::resetRatingForUserAndObject($this->lm->getId(), "lm", $pg_id, "lm", $ilUser->getId());
     }
     include_once './Services/Rating/classes/class.ilRatingGUI.php';
     $rating = new ilRatingGUI();
     $rating->setObject($this->lm->getId(), "lm", $pg_id, "lm", $ilUser->getId());
     $rating->setYourRatingText($this->lng->txt("lm_rate_page"));
     echo $rating->getHtml(true, true, "il.LearningModule.saveRating(%rating%);");
     echo $this->tpl->getOnLoadCodeForAsynch();
     exit;
 }
Beispiel #4
0
 /**
  * Save Rating
  */
 function saveRating()
 {
     global $ilCtrl;
     if (!is_array($_REQUEST["rating"])) {
         $rating = (int) ilUtil::stripSlashes($_GET["rating"]);
         if (!$rating) {
             $this->resetUserRating();
         } else {
             ilRating::writeRatingForUserAndObject($this->obj_id, $this->obj_type, $this->sub_obj_id, $this->sub_obj_type, $this->getUserId(), $rating);
         }
     } else {
         foreach ($_POST["rating"] as $cat_id => $rating) {
             ilRating::writeRatingForUserAndObject($this->obj_id, $this->obj_type, $this->sub_obj_id, $this->sub_obj_type, $this->getUserId(), $rating, $cat_id);
         }
     }
     if ($this->update_callback) {
         call_user_func($this->update_callback, $this->obj_id, $this->obj_type, $this->sub_obj_id, $this->sub_obj_type);
     }
     if ($ilCtrl->isAsynch()) {
         exit;
     }
 }