Esempio n. 1
0
 private function recursiveObjectives($objectives, $parent, $structure)
 {
     foreach ($objectives as $obj) {
         $data = $obj;
         //$data['parent'] = $parent;
         $objective = $this->currRepo->objectiveOfCode($data['code']);
         //if not already exists in database
         if (!$objective) {
             $objective = Objective::register(new Name($data['name']), $data['code'], $structure);
             if ($parent) {
                 $parent->addChild($objective);
                 $objective->setParent($parent);
             }
             $this->manager->persist($objective);
             $structure->addObjective($objective);
             if (isset($data['level'])) {
                 $o_levels = str_split($data['level']);
                 //find group
                 $i = 0;
                 foreach ($this->cur_classlevels as $grouplevel) {
                     $group = $this->groupRepo->groupOfName($grouplevel);
                     $obj_level = ObjectiveControlLevel::register($group, $objective, $o_levels[$i++]);
                     $this->manager->merge($obj_level);
                 }
             }
         }
         if (isset($data['obj'])) {
             $this->recursiveObjectives($data['obj'], $objective, $structure);
         }
     }
     //$this->manager->persist($structure);
     if ($parent) {
         $this->manager->persist($parent);
     }
 }
Esempio n. 2
0
 public function createWebsites()
 {
     $websites = [['n' => 'Rekenmeeseter', 'u' => 'www.rekenmeester.be', 'o' => ['WIS G1', 'WIS G1.a'], 't' => ['optellen', 'aftrekken']], ['n' => 'Google', 'u' => 'www.google.be', 'o' => ['WIS G7', 'WIS G9', 'WIS G9.e'], 't' => ['optellen', 'Sinterklaas']]];
     foreach ($websites as $awebsite) {
         $website = Website::register(new Name($awebsite['n']), new URL($awebsite['u']));
         foreach ($awebsite['t'] as $atag) {
             $tag = $this->tagRepo->tagOfName(new TagName($atag));
             $website->addTag($tag);
         }
         foreach ($awebsite['o'] as $aobjective) {
             $objective = $this->currRepo->objectiveOfCode($aobjective);
             $website->addObjective($objective);
         }
         $this->manager->persist($website);
         $this->websiteRepo->add($website);
     }
 }
 /**
  * @test
  * @group currrepo
  */
 public function should_return_null_when_no_structure_found()
 {
     $n_maths = new Name('wiskunde');
     $course = $this->courseRepo->courseOfName($n_maths);
     $curr = $this->currRepo->curriculumOfCourse($course);
     $n_struc = new Name('chapter 2');
     $structure = $this->currRepo->structure($curr, null, $n_struc->toString(), 'chapter');
     $this->assertNull($structure);
 }
Esempio n. 4
0
 /**
  * @param $data
  * @param $website
  */
 private function syncObjectives($data, $website)
 {
     $website->clearObjectives();
     if (isset($data['objectives'])) {
         foreach ($data['objectives'] as $objective) {
             $o = $this->curriculumRepository->objectiveOfId($objective['id']);
             $website->addObjective($o);
         }
     }
 }
Esempio n. 5
0
 public function objectivesOfCurriculum($courseName)
 {
     $course = $this->courseRepo->courseOfName(new Name($courseName));
     $curriculum = $this->currRepo->curriculumOfCourse($course);
     return $this->currRepo->objectivesOfCurriculum($curriculum);
 }