Esempio n. 1
0
	public function evolveAction()
	{
		$melodyAId = $this->getRequest()->getParam('a');
		$melodyBId = $this->getRequest()->getParam('b');
		$species = $this->_manager->getSpecies();
		$this->view->species = $species;
		$this->view->allSpecies = $this->_manager->getSpeciesTable()->findAll();;

		if ($melodyAId && $melodyBId) {
			$melodyA = $this->_manager->getMelody($melodyAId);
			$melodyB = $this->_manager->getMelody($melodyBId);
	
			list ($newA, $newB) = $this->_manager->vote($melodyA, $melodyB);
		} elseif ($melodyAId) {
    	    $newA = $this->_manager->getMelody($melodyAId);
    	    $newB = $this->_manager->getMelodyB($species, $melodyAId);
            $this->view->singleMelodyLink = true;
		} else {
			list ($newA, $newB) = $this->_manager->getPair($species);
		}
		
		$this->view->melodyA = $newA;
		$this->view->melodyB = $newB;
    	$this->view->melodyAfilename = $newA->getAudioFilename();
        $this->view->melodyBfilename = $newB->getAudioFilename();
    	$this->view->evolving = true;
	}