Ejemplo n.º 1
0
 /**
  * Process answer
  */
 function processAnswer()
 {
     global $ilUser, $ilDB, $lng, $ilPluginAdmin, $ilLog;
     parent::processAnswer();
     //
     // Send notifications to authors that want to be informed on blocked users
     //
     $parent_id = ilPageObject::lookupParentId((int) $_GET["page_id"], "lm");
     // is restriction mode set?
     include_once "./Modules/LearningModule/classes/class.ilObjContentObject.php";
     if (ilObjContentObject::_lookupRestrictForwardNavigation($parent_id)) {
         // check if user is blocked
         $id = ilUtil::stripSlashes($_POST["id"]);
         include_once "./Services/COPage/classes/class.ilPageQuestionProcessor.php";
         $as = ilPageQuestionProcessor::getAnswerStatus($id, $ilUser->getId());
         // get question information
         include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionList.php";
         $qlist = new ilAssQuestionList($ilDB, $lng, $ilPluginAdmin);
         $qlist->setParentObjId(0);
         $qlist->addFieldFilter("question_id", array($id));
         $qlist->load();
         $qdata = $qlist->getQuestionDataArray();
         // has the user been blocked?
         if ($as["try"] >= $qdata[$as["qst_id"]]["nr_of_tries"] && $qdata[$as["qst_id"]]["nr_of_tries"] > 0 && !$as["passed"]) {
             include_once "./Services/Notification/classes/class.ilNotification.php";
             $users = ilNotification::getNotificationsForObject(ilNotification::TYPE_LM_BLOCKED_USERS, $parent_id);
             if (count($users) > 0) {
                 include_once "./Modules/LearningModule/classes/class.ilLMMailNotification.php";
                 $not = new ilLMMailNotification();
                 $not->setType(ilLMMailNotification::TYPE_USER_BLOCKED);
                 $not->setQuestionId($id);
                 $not->setRefId((int) $_GET["ref_id"]);
                 $not->setRecipients($users);
                 $not->send();
             }
         }
     }
 }