public function removeTestResultsByUserIds($userIds)
 {
     global $ilDB, $lng;
     require_once 'Modules/Test/classes/class.ilTestParticipantData.php';
     $participantData = new ilTestParticipantData($ilDB, $lng);
     $participantData->setUserIds($userIds);
     $participantData->load($this->getTestId());
     $IN_userIds = $ilDB->in('usr_id', $participantData->getUserIds(), false, 'integer');
     $ilDB->manipulateF("DELETE FROM usr_pref WHERE {$IN_userIds} AND keyword = %s", array('text'), array("tst_password_" . $this->getTestId()));
     if (count($participantData->getActiveIds())) {
         $this->removeTestResultsByActiveIds($participantData->getActiveIds());
     }
 }
 /**
  * Deletes the selected user data for the test object
  *
  * Deletes the selected user data for the test object
  *
  * @access	public
  */
 function confirmDeleteSelectedUserDataObject()
 {
     global $ilDB, $lng;
     require_once 'Modules/Test/classes/class.ilTestParticipantData.php';
     $participantData = new ilTestParticipantData($ilDB, $lng);
     if ($this->object->getFixedParticipants()) {
         $participantData->setUserIds($_POST["chbUser"]);
     } else {
         $participantData->setActiveIds($_POST["chbUser"]);
     }
     $participantData->load($this->object->getTestId());
     $this->object->removeTestResults($participantData);
     ilUtil::sendSuccess($this->lng->txt("tst_selected_user_data_deleted"), true);
     $this->ctrl->redirect($this, "participants");
 }
Beispiel #3
0
 /**
  * Deletes the selected user data for the test object
  *
  * Deletes the selected user data for the test object
  *
  * @access    public
  */
 function confirmDeleteSelectedUserDataObject()
 {
     global $ilDB, $lng;
     require_once 'Modules/Test/classes/class.ilTestParticipantData.php';
     $participantData = new ilTestParticipantData($ilDB, $lng);
     if ($this->object->getFixedParticipants()) {
         $participantData->setUserIds($_POST["chbUser"]);
     } else {
         $participantData->setActiveIds($_POST["chbUser"]);
     }
     $participantData->load($this->object->getTestId());
     /* @var ilTestLP $testLP */
     require_once 'Services/Object/classes/class.ilObjectLP.php';
     $testLP = ilObjectLP::getInstance($this->object->getId());
     $testLP->resetLPDataForUserIds($participantData->getUserIds(), false);
     $this->object->removeTestActives($participantData->getActiveIds());
     #$this->object->removeSelectedTestResults($active_ids);
     // Update lp status
     #include_once './Services/Tracking/classes/class.ilLPStatusWrapper.php';
     #ilLPStatusWrapper::_refreshStatus($this->object->getId());
     ilUtil::sendSuccess($this->lng->txt("tst_selected_user_data_deleted"), true);
     $this->ctrl->redirect($this, "participants");
 }
 /**
  * Returns (request cached) information if a specific user has finished at least one test pass
  *
  * @param integer $user_id obj_id of the user
  * @param integer $a_obj_id obj_id of the test
  * @return bool
  */
 public static function hasFinished($a_user_id, $a_obj_id)
 {
     if (!isset(self::$hasFinishedCache["{$a_user_id}:{$a_obj_id}"])) {
         require_once 'Modules/Test/classes/class.ilTestParticipantData.php';
         require_once 'Modules/Test/classes/class.ilTestSessionFactory.php';
         require_once 'Modules/Test/classes/class.ilTestPassesSelector.php';
         global $ilDB, $lng;
         $testOBJ = ilObjectFactory::getInstanceByObjId($a_obj_id);
         $partData = new ilTestParticipantData($ilDB, $lng);
         $partData->setUserIds(array($a_user_id));
         $partData->load($testOBJ->getTestId());
         $activeId = $partData->getActiveIdByUserId($a_user_id);
         $testSessionFactory = new ilTestSessionFactory($testOBJ);
         $testSession = $testSessionFactory->getSession($activeId);
         $testPassesSelector = new ilTestPassesSelector($ilDB, $testOBJ);
         $testPassesSelector->setActiveId($activeId);
         $testPassesSelector->setLastFinishedPass($testSession->getLastFinishedPass());
         self::$hasFinishedCache["{$a_user_id}:{$a_obj_id}"] = count($testPassesSelector->getClosedPasses());
     }
     return self::$hasFinishedCache["{$a_user_id}:{$a_obj_id}"];
 }