Exemplo n.º 1
0
 public function load(ObjectManager $manager)
 {
     $names = array('programmazione base', 'programmazione avanzata', 'algoritmi base', 'algoritmi avanzati', 'matematica base', 'matematica avanzata', 'algoritmi di ordinamento 1', 'strutture dati base', 'fisica base', 'grafica base', 'grafica avanzata', 'geometria base', 'manipolazione oggetti geometrici', 'fisica nelle immagini', 'illuminazione e shading', 'nozioni di algoritmi', 'algoritmi di ordinamento 2', 'nozioni di basi di dati', 'basi di dati base', 'strutture dati avanzate', 'concorrenza', 'basi di dati avanzate', 'nozioni di algebra', 'matrici', 'spazi vettoriali', 'teoria dei gruppi base', 'teoria dei gruppi avanzata', 'nozioni di programmazione', 'ricorsione', 'gestione della memoria', 'gestione dei file', 'basic knowledge', 'Modellazione base', 'Modellazione avanzata', 'Oggetti geometrici complessi');
     $descriptions = array('Nozioni di algoritmica, strutture condizionali, cicli, funzioni', 'Nozioni di ricorsione, allocazione della memoria, programmazione concorrente', 'Nozioni di algoritmica, iterazione, ricorsione, ordinamento', 'Analisi tempo e spazio di algoritmi, calcolo della complessità', 'Studio di funzioni, serie aritmetiche e geometriche', 'Derivate, integrali, derivate parziali, integrali doppi', 'Bubblesort, Quicksort, Mergesort, Radixsort con relative complessità', 'Array, liste, alberi binari, matrici ed operazioni relative', 'Nozioni di vettori, spostamenti di oggetti nel piano e nello spazio, calcolo di forze', 'Nozioni di pixel, colore, luce, trasparenza, riflessione', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'Analisi e rendering di soggetti animati', 'Analisi e rendering di oggetti reali critici', 'Analisi e rendering di forme complesse');
     for ($i = 0; $i < count($names); $i++) {
         $skill = new Skill();
         $skill->setName($names[$i]);
         $skill->setDescription($descriptions[$i]);
         $manager->persist($skill);
         $manager->flush();
     }
 }
Exemplo n.º 2
0
 public function load(ObjectManager $manager)
 {
     $em = $this->container->get('doctrine')->getManager('default');
     /*
      * CORSO - STUDENTE
      */
     $courses = $em->createQuery('SELECT c FROM sociaLecompsSuperBundle:Course c')->getResult();
     $students = $em->createQuery('SELECT s FROM sociaLecompsSuperBundle:Student s')->getResult();
     $i = 0;
     for ($j = 0; $j < count($courses); $j++) {
         $course = $courses[$j];
         $s = array($students[$i], $students[++$i]);
         $course->setSubscribedStudents($s);
         $em->persist($course);
         $i++;
     }
     $manager->flush();
     /*
      * CORSO - LEZIONE
      */
     $lessons = $em->createQuery('SELECT l FROM sociaLecompsSuperBundle:Lesson l')->getResult();
     $courses = $em->createQuery('SELECT c FROM sociaLecompsSuperBundle:Course c')->getResult();
     $i = 0;
     $c = 1;
     for ($j = 0; $j < count($lessons); $j++) {
         $lesson = $lessons[$j];
         $course = array($courses[$i]);
         $lesson->setCourses($course);
         $em->persist($lesson);
         if ($i == 0) {
             if ($c == 8) {
                 $i++;
                 $c = 1;
             } else {
                 $c++;
             }
         } else {
             if ($c == 5) {
                 $i++;
                 $c = 1;
             } else {
                 $c++;
             }
         }
     }
     $manager->flush();
     /*
      * LEZIONE - SKILLS (sia AK che RK)
      */
     $lessons = $em->createQuery('SELECT l FROM sociaLecompsSuperBundle:Lesson l')->getResult();
     $skills = $em->createQuery('SELECT s FROM sociaLecompsSuperBundle:Skill s')->getResult();
     for ($j = 0; $j < count($lessons); $j++) {
         switch ($j) {
             case 0:
                 $lessons[0]->setAcquiredSkills(array($skills[9]));
                 break;
             case 1:
                 //$lessons[1]->setRequiredSkills(array($skills[11], $skills[9]));
                 $lessons[1]->setRequiredSkills(array($skills[9]));
                 $lessons[1]->setAcquiredSkills(array($skills[12]));
                 break;
             case 2:
                 $lessons[2]->setRequiredSkills(array($skills[9]));
                 $lessons[2]->setAcquiredSkills(array($skills[14]));
                 break;
             case 3:
                 //$lessons[3]->setRequiredSkills(array($skills[8], $skills[9]));
                 $lessons[3]->setRequiredSkills(array($skills[9]));
                 $lessons[3]->setAcquiredSkills(array($skills[13]));
                 break;
             case 4:
                 //$lessons[4]->setRequiredSkills(array($skills[9], $skills[2]));
                 $lessons[4]->setRequiredSkills(array($skills[9]));
                 $lessons[4]->setAcquiredSkills(array($skills[10]));
                 break;
                 // added from here
             // added from here
             case 5:
                 $lessons[5]->setRequiredSkills(array($skills[10]));
                 $lessons[5]->setAcquiredSkills(array($skills[34]));
                 break;
             case 6:
                 $lessons[6]->setRequiredSkills(array($skills[10]));
                 $lessons[6]->setAcquiredSkills(array($skills[32]));
                 break;
             case 7:
                 $lessons[7]->setRequiredSkills(array($skills[32]));
                 $lessons[7]->setAcquiredSkills(array($skills[33]));
                 break;
                 // to here
             // to here
             case 8:
                 $lessons[8]->setAcquiredSkills(array($skills[15]));
                 break;
             case 9:
                 $lessons[9]->setRequiredSkills(array($skills[15]));
                 $lessons[9]->setAcquiredSkills(array($skills[2]));
                 break;
             case 10:
                 $lessons[10]->setRequiredSkills(array($skills[2]));
                 $lessons[10]->setAcquiredSkills(array($skills[6]));
                 break;
             case 11:
                 $lessons[11]->setRequiredSkills(array($skills[6], $skills[2]));
                 $lessons[11]->setAcquiredSkills(array($skills[16]));
                 break;
             case 12:
                 $lessons[12]->setRequiredSkills(array($skills[2]));
                 $lessons[12]->setAcquiredSkills(array($skills[7]));
                 break;
             case 13:
                 $lessons[13]->setAcquiredSkills(array($skills[17]));
                 break;
             case 14:
                 $lessons[14]->setRequiredSkills(array($skills[17]));
                 $lessons[14]->setAcquiredSkills(array($skills[19]));
                 break;
             case 15:
                 $lessons[15]->setRequiredSkills(array($skills[7]));
                 $lessons[15]->setAcquiredSkills(array($skills[19]));
                 break;
             case 16:
                 $lessons[16]->setRequiredSkills(array($skills[18]));
                 $lessons[16]->setAcquiredSkills(array($skills[20]));
                 break;
             case 17:
                 $lessons[17]->setRequiredSkills(array($skills[18], $skills[20]));
                 $lessons[17]->setAcquiredSkills(array($skills[21]));
                 break;
             case 18:
                 $lessons[18]->setRequiredSkills(array($skills[4]));
                 $lessons[18]->setAcquiredSkills(array($skills[22]));
                 break;
             case 19:
                 $lessons[19]->setRequiredSkills(array($skills[4]));
                 $lessons[19]->setAcquiredSkills(array($skills[23]));
                 break;
             case 20:
                 $lessons[20]->setRequiredSkills(array($skills[4], $skills[23]));
                 $lessons[20]->setAcquiredSkills(array($skills[24]));
                 break;
             case 21:
                 $lessons[21]->setRequiredSkills(array($skills[22]));
                 $lessons[21]->setAcquiredSkills(array($skills[25]));
                 break;
             case 22:
                 $lessons[22]->setRequiredSkills(array($skills[4], $skills[22]));
                 $lessons[22]->setAcquiredSkills(array($skills[27]));
                 break;
             case 23:
                 $lessons[23]->setAcquiredSkills(array($skills[27]));
                 break;
             case 24:
                 $lessons[24]->setRequiredSkills(array($skills[27]));
                 $lessons[24]->setAcquiredSkills(array($skills[0], $skills[7]));
                 break;
             case 25:
                 $lessons[25]->setRequiredSkills(array($skills[27]));
                 $lessons[25]->setAcquiredSkills(array($skills[28]));
                 break;
             case 26:
                 $lessons[26]->setRequiredSkills(array($skills[0], $skills[7], $skills[27], $skills[28]));
                 $lessons[26]->setAcquiredSkills(array($skills[29]));
                 break;
             case 27:
                 $lessons[27]->setRequiredSkills(array($skills[27]));
                 $lessons[27]->setAcquiredSkills(array($skills[30]));
                 break;
         }
     }
     $manager->flush();
     /*
      * COGNITIVE STATE (STUDENT - SKILL)
      */
     $cognitiveState = new CognitiveState();
     $cognitiveState->setAcquisitionDate(new \DateTime());
     $cognitiveState->setCertainty(5);
     $cognitiveState->setLastUpdateDate(new \DateTime());
     $cognitiveState->setNumPositiveInc(0);
     $students = $em->getRepository('sociaLecompsSuperBundle:Student');
     $student = $students->findBy(array('lastName' => 'Orange'));
     $skills = $em->getRepository('sociaLecompsSuperBundle:Skill');
     $skill = $skills->findBy(array('name' => 'grafica base'));
     $singleSkill = $skill[0];
     $singleStudent = $student[0];
     $cognitiveState->setStudent($singleStudent);
     $cognitiveState->setSkill($singleSkill);
     $manager->persist($cognitiveState);
     $manager->persist($singleSkill);
     $manager->persist($singleStudent);
     $manager->flush();
     $students = $em->getRepository('sociaLecompsSuperBundle:Student')->findAll();
     $genericSkill = new Skill();
     $genericSkill->setName('generic knowledge');
     $genericSkill->setDescription('base knowledge for each student');
     $manager->persist($genericSkill);
     $manager->flush();
     for ($i = 0; $i < count($students); $i++) {
         $cognitiveState = new CognitiveState();
         $cognitiveState->setAcquisitionDate(new \DateTime());
         $cognitiveState->setCertainty($i + 1);
         $cognitiveState->setLastUpdateDate(new \DateTime());
         $cognitiveState->setNumPositiveInc(0);
         $cognitiveState->setStudent($students[$i]);
         $cognitiveState->setSkill($genericSkill);
         $manager->persist($cognitiveState);
         $manager->flush();
     }
 }
 /**
  * {@inheritDoc}
  */
 public function setDescription($description)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setDescription', array($description));
     return parent::setDescription($description);
 }