/**
  * 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);
     }
 }
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;
     }
 }