/** * For an shared interaction whith me, know if it's linked with response and if I can modify it. * * * @param Doctrine EntityManager $em * @param \UJM\ExoBundle\Entity\Share $shared * * @return array */ public function getActionShared($shared) { $em = $this->doctrine->getEntityManager(); $question = $shared->getQuestion(); $sharedWithMe[$shared->getQuestion()->getId()] = $question; $shareRight[$question->getId()] = $shared->getAllowToModify(); $response = $em->getRepository('UJMExoBundle:Response')->findOneByQuestion($question); if ($question) { $questionWithResponse[$question->getId()] = 1; } else { $questionWithResponse[$question->getId()] = 0; } $actionsS[0] = $sharedWithMe; $actionsS[1] = $shareRight; $actionsS[2] = $questionWithResponse; return $actionsS; }
/** * For an shared interaction whith me, know if it's linked with response and if I can modify it * * @access public * * @param Doctrine EntityManager $em * @param \UJM\ExoBundle\Entity\Share $shared * * @return array */ public function getActionShared($em, $shared) { $inter = $em->getRepository('UJMExoBundle:Interaction')->findOneBy(array('question' => $shared->getQuestion()->getId())); $sharedWithMe[$shared->getQuestion()->getId()] = $inter; $shareRight[$inter->getId()] = $shared->getAllowToModify(); $response = $em->getRepository('UJMExoBundle:Response')->findBy(array('interaction' => $inter->getId())); if (count($response) > 0) { $questionWithResponse[$inter->getId()] = 1; } else { $questionWithResponse[$inter->getId()] = 0; } $actionsS[0] = $sharedWithMe; $actionsS[1] = $shareRight; $actionsS[2] = $questionWithResponse; return $actionsS; }