/**
  * Import relevant properties from given exercise
  *
  * @param ilObjExercise $a_test
  * @return object
  */
 public static function createFromExercise(ilObjExercise $a_exercise, $a_user_id)
 {
     global $lng;
     $lng->loadLanguageModule("exercise");
     $newObj = new self();
     $newObj->setTitle($a_exercise->getTitle());
     $newObj->setDescription($a_exercise->getDescription());
     include_once "Services/Tracking/classes/class.ilLPMarks.php";
     $lp_marks = new ilLPMarks($a_exercise->getId(), $a_user_id);
     $newObj->setProperty("issued_on", new ilDate($lp_marks->getStatusChanged(), IL_CAL_DATETIME));
     // create certificate
     include_once "Services/Certificate/classes/class.ilCertificate.php";
     include_once "Modules/Exercise/classes/class.ilExerciseCertificateAdapter.php";
     $certificate = new ilCertificate(new ilExerciseCertificateAdapter($a_exercise));
     $certificate = $certificate->outCertificate(array("user_id" => $a_user_id), false);
     // save pdf file
     if ($certificate) {
         // we need the object id for storing the certificate file
         $newObj->create();
         $path = self::initStorage($newObj->getId(), "certificate");
         $file_name = "exc_" . $a_exercise->getId() . "_" . $a_user_id . ".pdf";
         if (file_put_contents($path . $file_name, $certificate)) {
             $newObj->setProperty("file", $file_name);
             $newObj->update();
             return $newObj;
         }
         // file creation failed, so remove to object, too
         $newObj->delete();
     }
     // remove if certificate works
     $newObj->create();
     return $newObj;
 }
 /**
  * Import relevant properties from given learning module
  *
  * @param ilObjSAHSLearningModule $a_lm
  * @return object
  */
 public static function createFromSCORMLM(ilObjSAHSLearningModule $a_lm, $a_user_id)
 {
     global $lng;
     $lng->loadLanguageModule("sahs");
     $newObj = new self();
     $newObj->setTitle($a_lm->getTitle());
     $newObj->setDescription($a_lm->getDescription());
     include_once "Services/Tracking/classes/class.ilLPMarks.php";
     $lp_marks = new ilLPMarks($a_lm->getId(), $a_user_id);
     $newObj->setProperty("issued_on", new ilDate($lp_marks->getStatusChanged(), IL_CAL_DATETIME));
     // create certificate
     if (!stristr(get_class($a_lm), "2004")) {
         $last_access = ilObjSCORMLearningModule::_lookupLastAccess($a_lm->getId(), $a_user_id);
     } else {
         $last_access = ilObjSCORM2004LearningModule::_lookupLastAccess($a_lm->getId(), $a_user_id);
     }
     $params = array("user_data" => ilObjUser::_lookupFields($a_user_id), "last_access" => $last_access);
     include_once "Services/Certificate/classes/class.ilCertificate.php";
     include_once "Modules/ScormAicc/classes/class.ilSCORMCertificateAdapter.php";
     $certificate = new ilCertificate(new ilSCORMCertificateAdapter($a_lm));
     $certificate = $certificate->outCertificate($params, false);
     // save pdf file
     if ($certificate) {
         // we need the object id for storing the certificate file
         $newObj->create();
         $path = self::initStorage($newObj->getId(), "certificate");
         $file_name = "sahs_" . $a_lm->getId() . "_" . $a_user_id . ".pdf";
         if (file_put_contents($path . $file_name, $certificate)) {
             $newObj->setProperty("file", $file_name);
             $newObj->update();
             return $newObj;
         }
         // file creation failed, so remove to object, too
         $newObj->delete();
     }
 }
 /**
  * Exports grades as excel
  */
 function exportGradesExcel()
 {
     include_once "./Modules/Exercise/classes/class.ilExAssignment.php";
     $ass_data = ilExAssignment::getAssignmentDataOfExercise($this->getId());
     include_once "./Services/Excel/classes/class.ilExcelWriterAdapter.php";
     $excelfile = ilUtil::ilTempnam();
     $adapter = new ilExcelWriterAdapter($excelfile, FALSE);
     $workbook = $adapter->getWorkbook();
     $workbook->setVersion(8);
     // Use Excel97/2000 Format
     include_once "./Services/Excel/classes/class.ilExcelUtils.php";
     //
     // status
     //
     $mainworksheet = $workbook->addWorksheet();
     // header row
     $mainworksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("name")));
     $cnt = 1;
     foreach ($ass_data as $ass) {
         $mainworksheet->writeString(0, $cnt, $cnt);
         $cnt++;
     }
     $mainworksheet->writeString(0, $cnt, ilExcelUtils::_convert_text($this->lng->txt("exc_total_exc")));
     // data rows
     $this->mem_obj = new ilExerciseMembers($this);
     $getmems = $this->mem_obj->getMembers();
     $mems = array();
     foreach ($getmems as $user_id) {
         $mems[$user_id] = ilObjUser::_lookupName($user_id);
     }
     $mems = ilUtil::sortArray($mems, "lastname", "asc", false, true);
     $data = array();
     $row_cnt = 1;
     foreach ($mems as $user_id => $d) {
         $col_cnt = 1;
         // name
         $mainworksheet->writeString($row_cnt, 0, ilExcelUtils::_convert_text($d["lastname"] . ", " . $d["firstname"] . " [" . $d["login"] . "]"));
         reset($ass_data);
         foreach ($ass_data as $ass) {
             $status = ilExAssignment::lookupStatusOfUser($ass["id"], $user_id);
             $mainworksheet->writeString($row_cnt, $col_cnt, ilExcelUtils::_convert_text($this->lng->txt("exc_" . $status)));
             $col_cnt++;
         }
         // total status
         $status = ilExerciseMembers::_lookupStatus($this->getId(), $user_id);
         $mainworksheet->writeString($row_cnt, $col_cnt, ilExcelUtils::_convert_text($this->lng->txt("exc_" . $status)));
         $row_cnt++;
     }
     //
     // mark
     //
     $worksheet2 = $workbook->addWorksheet();
     // header row
     $worksheet2->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("name")));
     $cnt = 1;
     foreach ($ass_data as $ass) {
         $worksheet2->writeString(0, $cnt, $cnt);
         $cnt++;
     }
     $worksheet2->writeString(0, $cnt, ilExcelUtils::_convert_text($this->lng->txt("exc_total_exc")));
     // data rows
     $data = array();
     $row_cnt = 1;
     reset($mems);
     foreach ($mems as $user_id => $d) {
         $col_cnt = 1;
         $d = ilObjUser::_lookupName($user_id);
         // name
         $worksheet2->writeString($row_cnt, 0, ilExcelUtils::_convert_text($d["lastname"] . ", " . $d["firstname"] . " [" . $d["login"] . "]"));
         reset($ass_data);
         foreach ($ass_data as $ass) {
             $worksheet2->writeString($row_cnt, $col_cnt, ilExcelUtils::_convert_text(ilExAssignment::lookupMarkOfUser($ass["id"], $user_id)));
             $col_cnt++;
         }
         // total mark
         include_once 'Services/Tracking/classes/class.ilLPMarks.php';
         $worksheet2->writeString($row_cnt, $col_cnt, ilExcelUtils::_convert_text(ilLPMarks::_lookupMark($user_id, $this->getId())));
         $row_cnt++;
     }
     $workbook->close();
     $exc_name = ilUtil::getASCIIFilename(preg_replace("/\\s/", "_", $this->getTitle()));
     ilUtil::deliverFile($excelfile, $exc_name . ".xls", "application/vnd.ms-excel");
 }
 /**
  * Prepare For a Regrade of a Rubric
  * @param $obj_id
  * @param $usr_id
  * @return bool
  */
 public static function _prepareForRegrade($obj_id, $usr_id)
 {
     global $ilDB, $ilUser;
     $delete_date = date("Y-m-d H:i:s");
     //try and set deleted on any criteria in rubric_data table where deleted is not null.
     $affected_rows = $ilDB->manipulate("UPDATE rubric_data d INNER JOIN rubric r on d.rubric_id = r.rubric_id SET d.deleted =\r\n                                            " . $ilDB->quote($delete_date, "timestamp") . " WHERE d.deleted IS NULL AND d.usr_id = " . $ilDB->quote($usr_id, "integer") . " AND r.obj_id = " . $ilDB->quote($obj_id, "integer"));
     if ($affected_rows > 0) {
         //there was a mark prior, we should proceed with preparing things for a regrade.
         include_once 'Services/Tracking/classes/class.ilLPMarks.php';
         include_once "./Modules/Exercise/classes/class.ilExAssignment.php";
         include_once "./Services/Tracking/classes/class.ilLPStatus.php";
         //grab everything from ut_lp_marks for the users obj_id and usr_id, that way we can save it for our own use.
         $marks = new ilLPMarks($obj_id, $usr_id);
         $status = ilLPStatus::_lookupStatus($obj_id, $usr_id);
         $completed = $marks->getCompleted();
         $mark = $marks->getMark();
         $comments = $marks->getComment();
         //Save the UT LP marks for this object. We're using Delete Date for the Create Date so we can inner join to the delete up above so we have a
         //record of all marks.
         $id = $ilDB->nextID('rubric_grade_hist');
         $ilDB->manipulateF("INSERT INTO rubric_grade_hist(rubric_history_id,rubric_id,obj_id,usr_id,status,mark,completed,comments,owner,create_date,last_update) VALUES " . " (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)", array("integer", "integer", "integer", "integer", "integer", "float", "integer", "text", "integer", "date", "date"), array($id, self::_lookupRubricId($obj_id), $obj_id, $usr_id, $status, $mark, $completed, $comments, $ilUser->getId(), $delete_date, $delete_date));
         //now that a record is saved delete it from marks, status and exercise.
         $marks->_deleteForUsers($obj_id, array($usr_id));
         ilLPStatus::writeStatus($obj_id, $usr_id, ilLPStatus::LP_STATUS_IN_PROGRESS_NUM);
         //Remove from Ex Assignment
         $ass_id = array_shift(ilExAssignment::getAssignmentDataOfExercise($obj_id));
         $assignment = new ilExAssignment($ass_id['id']);
         $assignment->updateMarkOfUser($ass_id['id'], $usr_id, '');
         $assignment->updateStatusOfUser($ass_id['id'], $usr_id, 'notgraded');
         return true;
     } else {
         //there were no marks to begin with OR this was already marked for regrade, so go no further.
         return false;
     }
 }
 /**
  * Returns an array containing all variables and values which can be exchanged in the certificate
  * The values should be calculated from real data. The $params parameter array should contain all
  * necessary information to calculate the values.
  *
  * @param array $params An array of parameters to calculate the certificate parameter values
  * @return array The certificate variables
  */
 public function getCertificateVariablesForPresentation($params = array())
 {
     global $lng;
     $user_id = $params["user_id"];
     include_once 'Services/Tracking/classes/class.ilLPMarks.php';
     $mark = ilLPMarks::_lookupMark($user_id, $this->object->getId());
     include_once 'Modules/Exercise/classes/class.ilExerciseMembers.php';
     $status = ilExerciseMembers::_lookupStatus($this->object->getId(), $user_id);
     $user_data = ilObjUser::_lookupFields($user_id);
     $completion_date = $this->getUserCompletionDate($user_id);
     $vars = $this->getBaseVariablesForPresentation($user_data, null, $completion_date);
     $vars["RESULT_PASSED"] = ilUtil::prepareFormOutput($lng->txt("exc_" . $status));
     $vars["RESULT_MARK"] = ilUtil::prepareFormOutput($mark);
     $vars["EXERCISE_TITLE"] = ilUtil::prepareFormOutput($this->object->getTitle());
     foreach ($vars as $id => $caption) {
         $insert_tags["[" . $id . "]"] = $caption;
     }
     return $insert_tags;
 }
 function __updateUser($user_id, $obj_id)
 {
     $form = $this->initEditUserForm($user_id, $obj_id);
     if ($form->checkInput()) {
         include_once 'Services/Tracking/classes/class.ilLPMarks.php';
         $marks = new ilLPMarks($obj_id, $user_id);
         $marks->setMark($form->getInput("mark"));
         $marks->setComment($form->getInput("comment"));
         $do_lp = false;
         // status/completed is optional
         $status = $form->getItemByPostVar("completed");
         if (is_object($status)) {
             if ($marks->getCompleted() != $form->getInput("completed")) {
                 $marks->setCompleted($form->getInput("completed"));
                 $do_lp = true;
             }
         }
         $marks->update();
         // #11600
         if ($do_lp) {
             include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php";
             ilLPStatusWrapper::_updateStatus($obj_id, $user_id);
         }
     }
 }
 /**
  * Fill table row
  */
 protected function fillRow($d)
 {
     global $lng, $ilCtrl;
     $user_id = $d["user_id"];
     foreach ($this->ass_data as $ass) {
         // grade
         $this->tpl->setCurrentBlock("grade");
         $status = ilExAssignment::lookupStatusOfUser($ass["id"], $user_id);
         $this->tpl->setVariable("SEL_" . strtoupper($status), ' selected="selected" ');
         $this->tpl->setVariable("TXT_NOTGRADED", $lng->txt("exc_notgraded"));
         $this->tpl->setVariable("TXT_PASSED", $lng->txt("exc_passed"));
         $this->tpl->setVariable("TXT_FAILED", $lng->txt("exc_failed"));
         switch ($status) {
             case "passed":
                 $pic = "scorm/passed.svg";
                 break;
             case "failed":
                 $pic = "scorm/failed.svg";
                 break;
             default:
                 $pic = "scorm/not_attempted.svg";
                 break;
         }
         $this->tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic));
         $this->tpl->setVariable("ALT_STATUS", $lng->txt("exc_" . $status));
         // mark
         $mark = ilExAssignment::lookupMarkOfUser($ass["id"], $user_id);
         $this->tpl->setVariable("VAL_ONLY_MARK", $mark);
         $this->tpl->parseCurrentBlock();
     }
     // exercise total
     // mark input
     $this->tpl->setCurrentBlock("mark_input");
     $this->tpl->setVariable("TXT_MARK", $lng->txt("exc_mark"));
     $this->tpl->setVariable("NAME_MARK", "mark[" . $user_id . "]");
     include_once 'Services/Tracking/classes/class.ilLPMarks.php';
     $mark = ilLPMarks::_lookupMark($user_id, $this->exc_id);
     $this->tpl->setVariable("VAL_MARK", ilUtil::prepareFormOutput($mark));
     $this->tpl->parseCurrentBlock();
     $this->tpl->setCurrentBlock("grade");
     $status = ilExerciseMembers::_lookupStatus($this->exc_id, $user_id);
     $this->tpl->setVariable("SEL_" . strtoupper($status), ' selected="selected" ');
     switch ($status) {
         case "passed":
             $pic = "scorm/passed.svg";
             break;
         case "failed":
             $pic = "scorm/failed.svg";
             break;
         default:
             $pic = "scorm/not_attempted.svg";
             break;
     }
     $this->tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic));
     $this->tpl->setVariable("ALT_STATUS", $lng->txt("exc_" . $status));
     // mark
     /*$this->tpl->setVariable("TXT_MARK", $lng->txt("exc_mark"));
     		$this->tpl->setVariable("NAME_MARK",
     			"mark[".$d["id"]."]");
     		$mark = ilExAssignment::lookupMarkOfUser($ass["id"], $user_id);
     		$this->tpl->setVariable("VAL_MARK",
     			ilUtil::prepareFormOutput($mark));*/
     $this->tpl->parseCurrentBlock();
     // name
     $this->tpl->setVariable("TXT_NAME", $d["lastname"] . ", " . $d["firstname"] . " [" . $d["login"] . "]");
     $this->tpl->setVariable("VAL_ID", $user_id);
     $ilCtrl->setParameter($this->parent_obj, "part_id", $user_id);
     $this->tpl->setVariable("LINK_NAME", $ilCtrl->getLinkTarget($this->parent_obj, "showParticipant"));
     // comment
     $this->tpl->setVariable("ID_COMMENT", $user_id);
     $c = ilLPMarks::_lookupComment($user_id, $this->exc_id);
     $this->tpl->setVariable("VAL_COMMENT", ilUtil::prepareFormOutput($c));
 }
 /**
  * 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));
     }
 }
Example #9
0
 /**
  * Test LP marks 
  * @param
  * @return
  */
 public function testLPMarks()
 {
     include_once './Services/Tracking/classes/class.ilLPMarks.php';
     include_once './Services/Tracking/classes/class.ilLPStatusFactory.php';
     $marks = new ilLPMarks(999, 888);
     $marks->setMark('Gut');
     $marks->setComment('Weiter so');
     $marks->setCompleted(true);
     $marks->update();
     $marks = new ilLPMarks(999, 888);
     $mark = $marks->getMark();
     $this->assertEquals($mark, 'Gut');
     $comment = ilLPMarks::_lookupComment(888, 999);
     $this->assertEquals($comment, 'Weiter so');
     $class = ilLPStatusFactory::_getClassById(999, ilLPObjSettings::LP_MODE_MANUAL);
     $completed = $class::_getCompleted(999);
     $this->assertEquals(array(888), $completed);
     ilLPMarks::deleteObject(999);
 }
 function __updateUser($user_id, $obj_id)
 {
     global $ilUser;
     include_once 'Services/Tracking/classes/class.ilLPMarks.php';
     $marks = new ilLPMarks($obj_id, $user_id);
     $marks->setMark(ilUtil::stripSlashes($_POST['mark']));
     $marks->setComment(ilUtil::stripSlashes($_POST['comment']));
     $do_lp = false;
     if ($marks->getCompleted() != (bool) $_POST['completed']) {
         $marks->setCompleted((bool) $_POST['completed']);
         $do_lp = true;
     }
     $marks->update();
     // #11600
     if ($do_lp) {
         include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php";
         ilLPStatusWrapper::_updateStatus($obj_id, $user_id);
     }
 }
Example #11
0
 /**
  * sync course status and lp status 
  *  
  * @param int $a_member_id
  * @param bool $a_has_passed
  */
 protected function updateLPFromStatus($a_member_id, $a_has_passed)
 {
     global $ilUser;
     include_once "Services/Tracking/classes/class.ilObjUserTracking.php";
     if (ilObjUserTracking::_enabledLearningProgress() && $this->object->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP) {
         include_once './Services/Object/classes/class.ilObjectLP.php';
         $olp = ilObjectLP::getInstance($this->object->getId());
         if ($olp->getCurrentMode() == ilLPObjSettings::LP_MODE_MANUAL_BY_TUTOR) {
             include_once 'Services/Tracking/classes/class.ilLPMarks.php';
             $marks = new ilLPMarks($this->object->getId(), $a_member_id);
             // only if status has changed
             if ($marks->getCompleted() != $a_has_passed) {
                 $marks->setCompleted($a_has_passed);
                 $marks->update();
                 include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php";
                 ilLPStatusWrapper::_updateStatus($this->object->getId(), $a_member_id, null, false, true);
             }
         }
     }
 }
Example #12
0
 public final function handleDelete()
 {
     include_once "Services/Tracking/classes/class.ilLPMarks.php";
     ilLPMarks::deleteObject($this->obj_id);
     include_once "Services/Tracking/classes/class.ilChangeEvent.php";
     ilChangeEvent::_delete($this->obj_id);
     $collection = $this->getCollectionInstance();
     if ($collection) {
         $collection->delete();
     }
     $this->updateParentCollections();
 }
Example #13
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");
 }
 function __read()
 {
     global $ilDB;
     include_once "Services/Tracking/classes/class.ilLPMarks.php";
     $query = "SELECT * FROM event_participants " . "WHERE event_id = " . $ilDB->quote($this->getEventId()) . " ";
     $res = $this->db->query($query);
     while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
         $this->participants[$row->usr_id]['usr_id'] = $row->usr_id;
         $this->participants[$row->usr_id]['registered'] = $row->registered;
         $this->participants[$row->usr_id]['participated'] = $row->participated;
         /*
         $this->participants[$row->usr_id]['mark'] = $row->mark;
         $this->participants[$row->usr_id]['comment'] = $row->e_comment;
         */
         $lp_mark = new ilLPMarks($this->getEventId(), $row->usr_id);
         $this->participants[$row->usr_id]['mark'] = $lp_mark->getMark();
         $this->participants[$row->usr_id]['comment'] = $lp_mark->getComment();
         if ($row->registered) {
             $this->registered[] = $row->usr_id;
         }
         if ($row->participated) {
             $this->participated[] = $row->usr_id;
         }
     }
 }
 function __updateUser($user_id, $obj_id)
 {
     include_once 'Services/Tracking/classes/class.ilLPMarks.php';
     $marks = new ilLPMarks($obj_id, $user_id);
     $marks->setMark(ilUtil::stripSlashes($_POST['mark']));
     $marks->setComment(ilUtil::stripSlashes($_POST['comment']));
     $marks->setCompleted((bool) $_POST['completed']);
     $marks->update();
     include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php";
     ilLPStatusWrapper::_updateStatus($obj_id, $user_id);
 }
 function saveProgress()
 {
     global $ilUser;
     include_once 'Services/Tracking/classes/class.ilLPMarks.php';
     $lp_marks = new ilLPMarks($this->gui_object->object->getId(), $ilUser->getId());
     $lp_marks->setCompleted((bool) $_POST['lp_edit']);
     $lp_marks->update();
     require_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php';
     ilLPStatusWrapper::_updateStatus($this->gui_object->object->getId(), $ilUser->getId());
     $this->lng->loadLanguageModule('trac');
     ilUtil::sendSuccess($this->lng->txt('trac_updated_status'), true);
     $this->ctrl->redirect($this, "");
     // #14993
     // $this->showSummary();
 }
 public function setLearningProgress($a_ref_id, $a_user)
 {
     include_once './Services/Tracking/classes/class.ilLPMarks.php';
     $marks = new ilLPMarks($this->ref_id, $this->user_id);
     $marks->setMark($this->params["event_integer"]);
     $marks->setComment($this->params["event_text"]);
     if ($this->isNewEntry($a_ref_id, $a_user)) {
         $marks->__add();
     } else {
         $marks->update();
     }
 }
Example #18
0
 /**
  * Save grades
  */
 function saveGradesObject()
 {
     global $ilCtrl, $lng;
     $this->checkPermission("write");
     include_once 'Services/Tracking/classes/class.ilLPMarks.php';
     if (is_array($_POST["lcomment"])) {
         foreach ($_POST["lcomment"] as $k => $v) {
             $marks_obj = new ilLPMarks($this->object->getId(), (int) $k);
             $marks_obj->setComment(ilUtil::stripSlashes($v));
             $marks_obj->setMark(ilUtil::stripSlashes($_POST["mark"][$k]));
             $marks_obj->update();
         }
     }
     ilUtil::sendSuccess($lng->txt("exc_msg_saved_grades"), true);
     $ilCtrl->redirect($this, "showGradesOverview");
 }
 /**
  * sync course status and lp status 
  *  
  * @param int $a_member_id
  * @param bool $a_has_passed
  */
 protected function updateLPFromStatus($a_member_id, $a_has_passed)
 {
     include_once "Services/Tracking/classes/class.ilObjUserTracking.php";
     if (ilObjUserTracking::_enabledLearningProgress() && $this->object->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP) {
         include_once './Services/Tracking/classes/class.ilLPObjSettings.php';
         $lp_settings = new ilLPObjSettings($this->object->getId());
         if ($lp_settings->getMode() == LP_MODE_MANUAL_BY_TUTOR) {
             include_once 'Services/Tracking/classes/class.ilLPMarks.php';
             $marks = new ilLPMarks($this->object->getId(), $a_member_id);
             $marks->setCompleted($a_has_passed);
             $marks->update();
             include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php";
             ilLPStatusWrapper::_updateStatus($this->object->getId(), $a_member_id, null, false, true);
         }
     }
 }