Example #1
0
 public function getScorm12ScoTrackingByUserAndSco(User $user, Scorm12Sco $sco)
 {
     return $this->scorm12ScoTrackingRepo->findOneBy(['user' => $user->getId(), 'sco' => $sco->getId()]);
 }
Example #2
0
 /**
  * Initializes parameters of the SCO defined in children nodes.
  *
  * @param Scorm12Sco $sco
  * @param \DOMNode   $item
  */
 private function findNodeParams(Scorm12Sco $sco, \DOMNode $item)
 {
     while (!is_null($item)) {
         switch ($item->nodeName) {
             case 'title':
                 $sco->setTitle($item->nodeValue);
                 break;
             case 'adlcp:masteryscore':
                 $sco->setMasteryScore($item->nodeValue);
                 break;
             case 'adlcp:maxtimeallowed':
                 $sco->setMaxTimeAllowed($item->nodeValue);
                 break;
             case 'adlcp:timelimitaction':
                 $action = strtolower($item->nodeValue);
                 if ($action === 'exit,message' || $action === 'exit,no message' || $action === 'continue,message' || $action === 'continue,no message') {
                     $sco->setTimeLimitAction($action);
                 }
                 break;
             case 'adlcp:datafromlms':
                 $sco->setLaunchData($item->nodeValue);
                 break;
             case 'adlcp:prerequisites':
                 $sco->setPrerequisites($item->nodeValue);
                 break;
         }
         $item = $item->nextSibling;
     }
 }
 /**
  * Copy given sco and its children.
  *
  * @param Scorm12Sco      $sco
  * @param Scorm12Resource $resource
  * @param Scorm12Sco      $scoParent
  */
 private function copySco(Scorm12Sco $sco, Scorm12Resource $resource, Scorm12Sco $scoParent = null)
 {
     $scoCopy = new Scorm12Sco();
     $scoCopy->setScormResource($resource);
     $scoCopy->setScoParent($scoParent);
     $scoCopy->setEntryUrl($sco->getEntryUrl());
     $scoCopy->setIdentifier($sco->getIdentifier());
     $scoCopy->setIsBlock($sco->getIsBlock());
     $scoCopy->setLaunchData($sco->getLaunchData());
     $scoCopy->setMasteryScore($sco->getMasteryScore());
     $scoCopy->setMaxTimeAllowed($sco->getMaxTimeAllowed());
     $scoCopy->setParameters($sco->getParameters());
     $scoCopy->setPrerequisites($sco->getPrerequisites());
     $scoCopy->setTimeLimitAction($sco->getTimeLimitAction());
     $scoCopy->setTitle($sco->getTitle());
     $scoCopy->setVisible($sco->isVisible());
     $this->om->persist($scoCopy);
     foreach ($sco->getScoChildren() as $scoChild) {
         $this->copySco($scoChild, $resource, $scoCopy);
     }
 }
 /**
  * Log given datas as result of a Scorm resource.
  */
 private function logScorm12ScoResult(Scorm12Sco $sco, User $user, $credit, $exitMode, $lessonMode, $lessonStatus, $scoreMax, $scoreMin, $scoreRaw, $sessionTimeInHundredth, $suspendData, $totalTimeInHundredth, $bestScore, $bestStatus)
 {
     $scormResource = $sco->getScormResource();
     $details = [];
     $details['scoId'] = $sco->getId();
     $details['credit'] = $credit;
     $details['exitMode'] = $exitMode;
     $details['lessonMode'] = $lessonMode;
     $details['lessonStatus'] = $lessonStatus;
     $details['scoreMax'] = $scoreMax;
     $details['scoreMin'] = $scoreMin;
     $details['scoreRaw'] = $scoreRaw;
     $details['sessionTime'] = $sessionTimeInHundredth;
     $details['suspendData'] = $suspendData;
     $details['totalTime'] = $totalTimeInHundredth;
     $details['totalTime'] = $totalTimeInHundredth;
     $details['bestScore'] = $bestScore;
     $details['bestStatus'] = $bestStatus;
     if (!empty($scoreMax) && $scoreMax > 0) {
         $details['result'] = $scoreRaw;
         $details['resultMax'] = $scoreMax;
     }
     $event = new LogScorm12ResultEvent($scormResource, $user, $details);
     $this->eventDispatcher->dispatch('log', $event);
 }