Example #1
0
 /**
  * Save grading
  */
 function saveGradingObject()
 {
     global $ilCtrl, $lng;
     $this->checkPermission("write");
     $users = is_array($_POST["user_id"]) ? $_POST["user_id"] : array();
     include_once "./Modules/Wiki/classes/class.ilWikiContributor.php";
     include_once "./Services/Tracking/classes/class.ilLPMarks.php";
     $saved = false;
     foreach ($users as $user_id) {
         if ($user_id != "") {
             $marks_obj = new ilLPMarks($this->object->getId(), $user_id);
             $new_mark = ilUtil::stripSlashes($_POST['mark'][$user_id]);
             $new_comment = ilUtil::stripSlashes($_POST['lcomment'][$user_id]);
             $new_status = ilUtil::stripSlashes($_POST["status"][$user_id]);
             if ($marks_obj->getMark() != $new_mark || $marks_obj->getComment() != $new_comment || ilWikiContributor::_lookupStatus($this->object->getId(), $user_id) != $new_status) {
                 ilWikiContributor::_writeStatus($this->object->getId(), $user_id, $new_status);
                 $marks_obj->setMark($new_mark);
                 $marks_obj->setComment($new_comment);
                 $marks_obj->update();
                 $saved = true;
             }
         }
     }
     if ($saved) {
         ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
     }
     $ilCtrl->redirect($this, "listContributors");
 }
 /**
  * Standard Version of Fill Row. Most likely to
  * be overwritten by derived class.
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl, $lng;
     include_once "./Services/Tracking/classes/class.ilLPMarks.php";
     include_once "./Modules/Wiki/classes/class.ilWikiContributor.php";
     if (ilObject::_exists($a_set["user_id"])) {
         arsort($a_set["pages"]);
         // pages
         foreach ($a_set["pages"] as $page_id => $cnt) {
             if ($page_id > 0) {
                 include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
                 $title = ilWikiPage::lookupTitle($page_id);
                 $this->tpl->setCurrentBlock("page");
                 $this->tpl->setVariable("PAGE", $title);
                 $this->tpl->setVariable("CNT", $cnt);
                 $this->tpl->parseCurrentBlock();
             }
         }
         $this->tpl->setVariable("TXT_LINKED_USER", $user["lastname"] . ", " . $user["firstname"] . " [" . $login . "]");
         // profile link
         //$ilCtrl->setParameterByClass("ilpublicuserprofilegui", "user", $a_set["user"]);
         //$ilCtrl->setParameterByClass("ilpublicuserprofilegui", "back_url",
         //	rawurlencode($ilCtrl->getLinkTarget($this->getParentObject(), $this->getParentCmd())));
         //$this->tpl->setVariable("USER_LINK",
         //	$ilCtrl->getLinkTargetByClass("ilpublicuserprofilegui", "getHTML"));
         $img = ilObjUser::_getPersonalPicturePath($a_set["user_id"], "xsmall");
         $this->tpl->setVariable("IMG_USER", $img);
         $this->tpl->setVariable("TXT_NAME", $a_set["lastname"] . ", " . $a_set["firstname"]);
         $this->tpl->setVariable("USER_ID", $a_set["user_id"]);
         // comment for learner
         $this->tpl->setVariable("TXT_LCOMMENT", $lng->txt("wiki_comment_for_learner"));
         $this->tpl->setVariable("NAME_LCOMMENT", "lcomment[" . $a_set["user_id"] . "]");
         $lpcomment = ilLPMarks::_lookupComment($a_set["user_id"], $this->parent_obj->object->getId());
         $this->tpl->setVariable("VAL_LCOMMENT", ilUtil::prepareFormOutput($lpcomment));
         // status
         //$status = ilExerciseMembers::_lookupStatus($this->object->getId(), $member_id);
         $status = ilWikiContributor::_lookupStatus($this->parent_obj->object->getId(), $a_set["user_id"]);
         $this->tpl->setVariable("SEL_" . $status, ' selected="selected" ');
         $this->tpl->setVariable("TXT_NOTGRADED", $lng->txt("wiki_notgraded"));
         $this->tpl->setVariable("TXT_PASSED", $lng->txt("wiki_passed"));
         $this->tpl->setVariable("TXT_FAILED", $lng->txt("wiki_failed"));
         $this->tpl->setVariable("VAL_NOTGRADED", ilWikiContributor::STATUS_NOT_GRADED);
         $this->tpl->setVariable("VAL_PASSED", ilWikiContributor::STATUS_PASSED);
         $this->tpl->setVariable("VAL_FAILED", ilWikiContributor::STATUS_FAILED);
         if (($sd = ilWikiContributor::_lookupStatusTime($this->parent_obj->object->getId(), $a_set["user_id"])) > 0) {
             $this->tpl->setCurrentBlock("status_date");
             $this->tpl->setVariable("TXT_LAST_CHANGE", $lng->txt("last_change"));
             $this->tpl->setVariable("VAL_STATUS_DATE", ilDatePresentation::formatDate(new ilDateTime($sd, IL_CAL_DATETIME)));
             $this->tpl->parseCurrentBlock();
         }
         switch ($status) {
             case ilWikiContributor::STATUS_PASSED:
                 $pic = "scorm/passed.png";
                 break;
             case ilWikiContributor::STATUS_FAILED:
                 $pic = "scorm/failed.png";
                 break;
             default:
                 $pic = "scorm/not_attempted.png";
                 break;
         }
         $this->tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic));
         $this->tpl->setVariable("ALT_STATUS", $lng->txt("wiki_" . $status));
         // mark
         $this->tpl->setVariable("TXT_MARK", $lng->txt("wiki_mark"));
         $this->tpl->setVariable("NAME_MARK", "mark[" . $a_set["user_id"] . "]");
         $mark = ilLPMarks::_lookupMark($a_set["user_id"], $this->parent_obj->object->getId());
         $this->tpl->setVariable("VAL_MARK", ilUtil::prepareFormOutput($mark));
     }
 }