Esempio n. 1
0
 /**
  * 
  */
 public function import($data, Event $event)
 {
     $csv = Reader::createFromString(trim($data));
     $csv->setDelimiter(';');
     // get startgroups at first
     $groups = new Map();
     foreach ($csv->fetchColumn(0) as $name) {
         if (!$groups->has($name)) {
             $startgroup = $this->getStartgroup($name);
             $startgroup->setEvent($event);
             $groups->set($name, $startgroup);
         }
     }
     $id = 0;
     foreach ($csv as $row) {
         $id++;
         $routine = $this->getRoutine($id);
         $group = $groups->get($row[0]);
         $judges = (count($row) - 1) / 3;
         for ($j = 1; $j <= $judges; $j++) {
             $score = new PerformanceScore();
             $score->setRoutine($routine);
             $score->setJudge($group->getPerformanceJudge($j));
             $score->setExecution($row[($j - 1) * 3 + 1]);
             $score->setChoreography($row[($j - 1) * 3 + 2]);
             $score->setMusicAndTiming($row[($j - 1) * 3 + 3]);
             $score->setTotal($row[($j - 1) * 3 + 1] + $row[($j - 1) * 3 + 2] + $row[($j - 1) * 3 + 3]);
             $routine->addPerformanceScore($score);
         }
         $group->addRoutine($routine);
         $group->save();
     }
     $event->save();
 }
Esempio n. 2
0
 /**
  * @param ChildPerformanceScore $performanceScore The ChildPerformanceScore object to add.
  */
 protected function doAddPerformanceScore(ChildPerformanceScore $performanceScore)
 {
     $this->collPerformanceScores[] = $performanceScore;
     $performanceScore->setRoutine($this);
 }