コード例 #1
0
ファイル: ToolChain.php プロジェクト: jloguercio/chamilo-lms
 /**
  * @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);
     }
 }
コード例 #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()));
 }
コード例 #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()));
 }
コード例 #4
0
 /**
  * @inheritdoc
  */
 protected function configureFormFields(FormMapper $formMapper)
 {
     $formMapper->add('tool')->add('role', 'choice', array('choices' => ToolResourceRights::getDefaultRoles()))->add('mask', 'choice', array('choices' => ToolResourceRights::getMaskList()));
 }
コード例 #5
0
ファイル: Tool.php プロジェクト: ragebat/chamilo-lms
 /**
  * @param ToolResourceRights $toolResourceRight
  * @return $this
  */
 public function addToolResourceRights(ToolResourceRights $toolResourceRight)
 {
     $toolResourceRight->setTool($this);
     $this->toolResourceRights[] = $toolResourceRight;
     return $this;
 }