Esempio n. 1
0
 /**
  * @param ObjectManager $manager
  */
 public function createTools(ObjectManager $manager)
 {
     $tools = $this->getTools();
     $toolResourceRight = new ToolResourceRights();
     $toolResourceRight->setRole('ROLE_TEACHER')->setMask(ResourceNodeVoter::getEditorMask());
     $toolResourceRightReader = new ToolResourceRights();
     $toolResourceRightReader->setRole('ROLE_STUDENT')->setMask(ResourceNodeVoter::getReaderMask());
     /** @var BaseTool $tool */
     foreach ($tools as $tool) {
         $toolEntity = new Tool();
         $toolEntity->setName($tool->getName())->setImage($tool->getImage())->setDescription($tool->getName() . ' - description')->addToolResourceRights($toolResourceRight)->addToolResourceRights($toolResourceRightReader);
         $manager->persist($toolEntity);
     }
 }
Esempio n. 2
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('role', 'choice', array('choices' => ToolResourceRights::getDefaultRoles()))->add('mask', 'choice', array('choices' => ToolResourceRights::getMaskList()));
 }
Esempio n. 3
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('sharing', 'choice', array('choices' => array('everyone' => 'Everyone', 'course' => 'Course', 'user' => 'User', 'group' => 'Group'), 'attr' => array('class' => 'sharing_options')))->add('search', 'hidden', array('attr' => array('class' => 'extra_hidden')))->add('role', 'choice', array('choices' => ToolResourceRights::getDefaultRoles()))->add('mask', 'choice', array('choices' => ToolResourceRights::getMaskList()));
 }
 /**
  * @inheritdoc
  */
 protected function configureFormFields(FormMapper $formMapper)
 {
     $formMapper->add('tool')->add('role', 'choice', array('choices' => ToolResourceRights::getDefaultRoles()))->add('mask', 'choice', array('choices' => ToolResourceRights::getMaskList()));
 }
Esempio n. 5
0
 /**
  * @param ToolResourceRights $toolResourceRight
  * @return $this
  */
 public function addToolResourceRights(ToolResourceRights $toolResourceRight)
 {
     $toolResourceRight->setTool($this);
     $this->toolResourceRights[] = $toolResourceRight;
     return $this;
 }