Esempio n. 1
0
 public function getScorm2004ScoTrackingByUserAndSco(User $user, Scorm2004Sco $sco)
 {
     return $this->scorm2004ScoTrackingRepo->findOneBy(['user' => $user->getId(), 'sco' => $sco->getId()]);
 }
Esempio n. 2
0
 /**
  * Initializes parameters of the SCO defined in children nodes.
  *
  * @param Scorm2004Sco $sco
  * @param \DOMNode     $item
  */
 private function findNodeParams(Scorm2004Sco $sco, \DOMNode $item)
 {
     while (!is_null($item)) {
         switch ($item->nodeName) {
             case 'title':
                 $sco->setTitle($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:completionThreshold':
                 $sco->setCompletionThreshold($item->nodeName);
                 break;
             case 'imsss:attemptAbsoluteDurationLimit':
                 $sco->setMaxTimeAllowed($item->nodeName);
                 break;
             case 'imsss:minNormalizedMeasure':
                 $sco->setScaledPassingScore($item->nodeName);
                 break;
         }
         $item = $item->nextSibling;
     }
 }
 /**
  * Copy given sco and its children.
  *
  * @param Scorm2004Sco      $sco
  * @param Scorm2004Resource $resource
  * @param Scorm2004Sco      $scoParent
  */
 private function copySco(Scorm2004Sco $sco, Scorm2004Resource $resource, Scorm2004Sco $scoParent = null)
 {
     $scoCopy = new Scorm2004Sco();
     $scoCopy->setScormResource($resource);
     $scoCopy->setScoParent($scoParent);
     $scoCopy->setEntryUrl($sco->getEntryUrl());
     $scoCopy->setIdentifier($sco->getIdentifier());
     $scoCopy->setIsBlock($sco->getIsBlock());
     $scoCopy->setLaunchData($sco->getLaunchData());
     $scoCopy->setParameters($sco->getParameters());
     $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);
     }
 }
Esempio n. 4
0
 /**
  * Logs given datas as result of a Scorm resource.
  */
 private function logScorm2004ScoResult(Scorm2004Sco $sco, User $user, array $details)
 {
     $scormResource = $sco->getScormResource();
     if (isset($details['cmi.score.max']) && isset($details['cmi.score.raw']) && !empty($details['cmi.score.max']) && !is_null($details['cmi.score.raw']) && $details['cmi.score.max'] > 0) {
         $details['result'] = $details['cmi.score.raw'];
         $details['resultMax'] = $details['cmi.score.max'];
     }
     $event = new LogScorm2004ResultEvent($scormResource, $user, $details);
     $this->eventDispatcher->dispatch('log', $event);
 }