/** * Implements the abstract method. * * * @param \UJM\ExoBundle\Entity\InteractionMatching $originalInterMatching * * Return boolean */ public function processUpdate($originalInterMatching) { $originalLabel = []; $originalProposal = []; $originalHints = []; //create an array of currente Label of the database foreach ($originalInterMatching->getLabels() as $label) { $originalLabel[] = $label; } foreach ($originalInterMatching->getProposals() as $proposal) { $originalProposal[] = $proposal; } foreach ($originalInterMatching->getQuestion()->getHints() as $hints) { $originalHints[] = $hints; } if ($this->request->getMethod() == 'POST') { $this->form->handleRequest($this->request); // Uses the default category if no category selected $this->checkCategory(); if ($this->form->isValid()) { $this->onSuccessUpdate($this->form->getData(), $originalLabel, $originalProposal, $originalHints); return true; } } return false; }
/** * Implements the abstract method * * @access public * * @param \UJM\ExoBundle\Entity\InteractionMatching $originalInterMatching * * Return boolean */ public function processUpdate($originalInterMatching) { $originalLabel = array(); $originalProposal = array(); $originalHints = array(); //create an array of currente Label of the database foreach ($originalInterMatching->getLabels() as $label) { $originalLabel[] = $label; } foreach ($originalInterMatching->getProposals() as $proposal) { $originalProposal[] = $proposal; } foreach ($originalInterMatching->getInteraction()->getHints() as $hints) { $originalHints[] = $hints; } if ($this->request->getMethod() == 'POST') { $this->form->handleRequest($this->request); if ($this->form->isValid()) { $this->onSuccessUpdate($this->form->getData(), $originalLabel, $originalProposal, $originalHints); return TRUE; } } return FALSE; }
/** * init array of rights responses indexed by labelId. * * * @param \UJM\ExoBundle\Entity\InteractionMatching $interMatching * * @return mixed[] */ public function initTabRightResponse($interMatching) { $tabRightResponse = array(); //array of rights responses indexed by labelId foreach ($interMatching->getProposals() as $proposal) { $associateLabel = $proposal->getAssociatedLabel(); if ($associateLabel != null) { foreach ($associateLabel as $associatedLabel) { $index = $associatedLabel->getId(); if (isset($tabRightResponse[$index])) { $tabRightResponse[$index] .= '-' . $proposal->getId(); } else { $tabRightResponse[$index] = $proposal->getId(); } } } } //add in $tabRightResponse label empty foreach ($interMatching->getLabels() as $label) { if (!isset($tabRightResponse[$label->getId()])) { $tabRightResponse[$label->getId()] = null; } } return $tabRightResponse; }