parent
14bfd63c2c
commit
b5b8ae735f
@ -0,0 +1,92 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Form; |
||||
|
||||
use Symfony\Component\Form\AbstractType; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface; |
||||
use Entity; |
||||
|
||||
class BranchType extends AbstractType |
||||
{ |
||||
/** |
||||
* Builds the form |
||||
* For form type details see: |
||||
* http://symfony.com/doc/current/reference/forms/types.html |
||||
* |
||||
* @param FormBuilderInterface $builder |
||||
* @param array $options |
||||
*/ |
||||
public function buildForm(FormBuilderInterface $builder, array $options) |
||||
{ |
||||
$builderData = $builder->getData(); |
||||
|
||||
$parentIdDisabled = false; |
||||
if (!empty($builderData)) { |
||||
$parentIdDisabled = true; |
||||
} |
||||
|
||||
$builder |
||||
->add('branch_name', 'text') |
||||
->add( |
||||
'branch_type', |
||||
'choice', |
||||
array( |
||||
'choices' => array( |
||||
'remote_child', |
||||
'local_child', |
||||
'local_parent', |
||||
'remote_parent', |
||||
), |
||||
) |
||||
) |
||||
//->add('parent_id', 'choice', array('choices'=> array(), 'required' => false)) |
||||
->add( |
||||
'parent_id', |
||||
'text', |
||||
array('required' => false, 'disabled' => $parentIdDisabled) |
||||
) |
||||
//->add('parent_id', 'choice', array('choices'=> array(1 => 'jjaa',2=>'ddd'), 'required' => false)) |
||||
->add('branch_ip', 'text') |
||||
->add('latitude', 'text') |
||||
->add('longitude', 'text') |
||||
->add('dwn_speed', 'text') |
||||
->add('up_speed', 'text') |
||||
->add('longitude', 'text') |
||||
->add('delay', 'text') |
||||
->add('admin_mail', 'email') |
||||
->add('admin_name', 'text') |
||||
->add('admin_phone', 'text', array('required' => false)) |
||||
->add( |
||||
'last_sync_trans_date', |
||||
'datetime', |
||||
array( |
||||
'data' => new \DateTime(), |
||||
) |
||||
) |
||||
->add('last_sync_type', 'text') |
||||
->add('last_sync_trans_id', 'text') |
||||
->add('ssl_pub_key', 'text') |
||||
->add('last_sync_trans_id', 'text') |
||||
->add('access_url_id', 'text') |
||||
->add('submit', 'submit'); |
||||
|
||||
|
||||
} |
||||
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver) |
||||
{ |
||||
$resolver->setDefaults( |
||||
array( |
||||
'data_class' => 'Chamilo\CoreBundle\Entity\BranchSync', |
||||
) |
||||
); |
||||
} |
||||
|
||||
public function getName() |
||||
{ |
||||
return 'branch'; |
||||
} |
||||
} |
||||
|
@ -0,0 +1,57 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Form; |
||||
|
||||
use Symfony\Component\Form\AbstractType; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface; |
||||
use Entity; |
||||
use Symfony\Component\Validator\Constraints as Assert; |
||||
|
||||
class CourseHomeToolType extends AbstractType |
||||
{ |
||||
/** |
||||
* @param FormBuilderInterface $builder |
||||
* @param array $options |
||||
*/ |
||||
public function buildForm(FormBuilderInterface $builder, array $options) |
||||
{ |
||||
$builder->add('name', 'text'); |
||||
$builder->add('link', 'text'); |
||||
$builder->add( |
||||
'custom_icon', |
||||
'file', |
||||
array('required' => false, 'data_class' => null) |
||||
); |
||||
$builder->add( |
||||
'target', |
||||
'choice', |
||||
array('choices' => array('_self', '_blank')) |
||||
); |
||||
$builder->add( |
||||
'visibility', |
||||
'choice', |
||||
array('choices' => array('1', '0')) |
||||
); |
||||
$builder->add('c_id', 'hidden'); |
||||
$builder->add('session_id', 'hidden'); |
||||
|
||||
$builder->add('description', 'textarea'); |
||||
$builder->add('submit', 'submit'); |
||||
} |
||||
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver) |
||||
{ |
||||
$resolver->setDefaults( |
||||
array( |
||||
'data_class' => 'Chamilo\CourseBundle\Entity\CTool', |
||||
) |
||||
); |
||||
} |
||||
|
||||
public function getName() |
||||
{ |
||||
return 'courseHomeTool'; |
||||
} |
||||
} |
@ -0,0 +1,74 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Form; |
||||
|
||||
use Symfony\Component\Form\AbstractType; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface; |
||||
use Chamilo\CoreBundle\Entity\CurriculumCategory; |
||||
|
||||
class CurriculumCategoryType extends AbstractType |
||||
{ |
||||
public function buildForm(FormBuilderInterface $builder, array $options) |
||||
{ |
||||
/** @var CurriculumCategory $entity */ |
||||
$entity = $builder->getData(); |
||||
|
||||
$builder->add('title', 'text'); |
||||
$builder->add('max_score', 'text'); |
||||
$builder->add('min_chars', 'text'); |
||||
$builder->add('min_chars', 'text'); |
||||
|
||||
$builder->add('c_id', 'hidden'); |
||||
$builder->add('session_id', 'hidden'); |
||||
|
||||
$course = $entity->getCourse(); |
||||
$session = $entity->getSession(); |
||||
|
||||
$builder->add( |
||||
'parent', |
||||
'entity', |
||||
array( |
||||
'class' => 'Entity\CurriculumCategory', |
||||
'query_builder' => function ($repository) use ( |
||||
$entity, |
||||
$course, |
||||
$session |
||||
) { |
||||
|
||||
$qb = $repository->createQueryBuilder('c') |
||||
->where('c.cId = :id') |
||||
->orderBy('c.title', 'ASC'); |
||||
$parameters = array('id' => $course->getId()); |
||||
|
||||
if (!empty($session)) { |
||||
$qb->andWhere('c.sessionId = :session_id'); |
||||
$parameters['session_id'] = $session->getId(); |
||||
} |
||||
$qb->setParameters($parameters); |
||||
|
||||
return $qb; |
||||
}, |
||||
'property' => 'title', |
||||
'required' => false, |
||||
) |
||||
); |
||||
|
||||
$builder->add('submit', 'submit'); |
||||
} |
||||
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver) |
||||
{ |
||||
$resolver->setDefaults( |
||||
array( |
||||
'data_class' => 'Chamilo\CoreBundle\Entity\CurriculumCategory', |
||||
) |
||||
); |
||||
} |
||||
|
||||
public function getName() |
||||
{ |
||||
return 'curriculumCategory'; |
||||
} |
||||
} |
@ -0,0 +1,60 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Form; |
||||
|
||||
use Symfony\Component\Form\AbstractType; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface; |
||||
use Entity; |
||||
|
||||
/** |
||||
* Class CurriculumItemRelUserCollectionType |
||||
* @package Chamilo\CoreBundle\Form |
||||
*/ |
||||
class CurriculumItemRelUserCollectionType extends AbstractType |
||||
{ |
||||
public $itemId; |
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options) |
||||
{ |
||||
$builder->add( |
||||
'userItems', |
||||
'collection', |
||||
array( |
||||
'type' => new CurriculumItemRelUserType($this->itemId), |
||||
'allow_add' => true, |
||||
'allow_delete' => true, |
||||
'by_reference' => false, |
||||
'prototype' => true, |
||||
'prototype_name' => '__name__', |
||||
'options' => array(// options on the rendered CurriculumItemRelUserType |
||||
), |
||||
'label' => ' ', |
||||
) |
||||
); |
||||
|
||||
// Save button per item |
||||
//$builder->add('submit', 'submit', array('attr' => array('class' => 'btn btn-success', 'onclick' => 'save(this);'))); |
||||
} |
||||
|
||||
public function __construct($itemId = null) |
||||
{ |
||||
$this->itemId = $itemId; |
||||
} |
||||
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver) |
||||
{ |
||||
$resolver->setDefaults( |
||||
array( |
||||
'data_class' => 'Chamilo\CoreBundle\Entity\CurriculumItem', |
||||
) |
||||
); |
||||
} |
||||
|
||||
|
||||
public function getName() |
||||
{ |
||||
return 'CurriculumItemRelUserCollection'; |
||||
} |
||||
} |
@ -0,0 +1,51 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Form; |
||||
|
||||
use Symfony\Component\Form\AbstractType; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface; |
||||
use Entity; |
||||
|
||||
/** |
||||
* Class CurriculumItemRelUserType |
||||
* @package Chamilo\CoreBundle\Form |
||||
*/ |
||||
class CurriculumItemRelUserType extends AbstractType |
||||
{ |
||||
public $itemId; |
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options) |
||||
{ |
||||
$builder->add( |
||||
'description', |
||||
'text', |
||||
array('label' => ' ', 'attr' => array('class' => 'span7')) |
||||
); |
||||
$builder->add( |
||||
'item_id', |
||||
'hidden', |
||||
array('attr' => array('value' => $this->itemId)) |
||||
); |
||||
} |
||||
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver) |
||||
{ |
||||
$resolver->setDefaults( |
||||
array( |
||||
'data_class' => 'Chamilo\CoreBundle\Entity\CurriculumItemRelUser', |
||||
) |
||||
); |
||||
} |
||||
|
||||
public function getName() |
||||
{ |
||||
return 'curriculumItemRelUser'; |
||||
} |
||||
|
||||
public function __construct($itemId = null) |
||||
{ |
||||
$this->itemId = $itemId; |
||||
} |
||||
} |
@ -0,0 +1,54 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Form; |
||||
|
||||
use Symfony\Component\Form\AbstractType; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface; |
||||
use Entity; |
||||
|
||||
class CurriculumItemType extends AbstractType |
||||
{ |
||||
public function buildForm(FormBuilderInterface $builder, array $options) |
||||
{ |
||||
//$builderData = $builder->getData(); |
||||
/*$parentIdDisabled = false; |
||||
if (!empty($builderData)) { |
||||
$parentIdDisabled = true; |
||||
}*/ |
||||
|
||||
$builder->add('title', 'textarea'); |
||||
$builder->add('score', 'text'); |
||||
$builder->add('max_repeat', 'text'); |
||||
|
||||
$builder->add( |
||||
'category', |
||||
'entity', |
||||
array( |
||||
'class' => 'Entity\CurriculumCategory', |
||||
'query_builder' => function ($repository) { |
||||
return $repository->createQueryBuilder('p') |
||||
->orderBy('p.title', 'ASC'); |
||||
}, |
||||
'property' => 'title', |
||||
'required' => false, |
||||
) |
||||
); |
||||
$builder->add('submit', 'submit'); |
||||
} |
||||
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver) |
||||
{ |
||||
$resolver->setDefaults( |
||||
array( |
||||
'data_class' => 'Entity\CurriculumItem', |
||||
) |
||||
); |
||||
} |
||||
|
||||
public function getName() |
||||
{ |
||||
return 'curriculumItem'; |
||||
} |
||||
} |
@ -0,0 +1,75 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Form; |
||||
|
||||
use Symfony\Component\Form\AbstractType; |
||||
use Symfony\Component\Form\FormEvents; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface; |
||||
use Entity; |
||||
use Doctrine\ORM\EntityRepository; |
||||
|
||||
class JuryMembersType extends AbstractType |
||||
{ |
||||
public function buildForm(FormBuilderInterface $builder, array $options) |
||||
{ |
||||
$builder->add( |
||||
'role', |
||||
'entity', |
||||
array( |
||||
'class' => 'Entity\Role', |
||||
'property' => 'name', |
||||
'query_builder' => |
||||
function (EntityRepository $er) { |
||||
return $er->createQueryBuilder('u') |
||||
->where('u.role LIKE :role') |
||||
->setParameter(':role', 'ROLE_JURY%') |
||||
->orderBy('u.name', 'DESC'); |
||||
}, |
||||
) |
||||
); |
||||
|
||||
$builder->add('user_id', 'choice', array('label' => 'User')); |
||||
$builder->add('jury_id', 'hidden'); |
||||
$builder->add('submit', 'submit'); |
||||
|
||||
$factory = $builder->getFormFactory(); |
||||
|
||||
// Fixes issue with the ajax select, waiting this workaround until symfony add ajax search into the core |
||||
$builder->addEventListener( |
||||
FormEvents::PRE_SUBMIT, |
||||
function ($event) use ($factory, $builder) { |
||||
$form = $event->getForm(); |
||||
$case = $event->getData(); |
||||
$id = $case['user_id'][0]; |
||||
|
||||
if ($case) { |
||||
$form->remove('user_id'); |
||||
$form->add( |
||||
$factory->createNamed( |
||||
'user_id', |
||||
'hidden', |
||||
$id, |
||||
array('auto_initialize' => false) |
||||
) |
||||
); |
||||
} |
||||
} |
||||
); |
||||
} |
||||
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver) |
||||
{ |
||||
$resolver->setDefaults( |
||||
array( |
||||
'data_class' => 'Chamilo\CoreBundle\Entity\JuryMembers', |
||||
) |
||||
); |
||||
} |
||||
|
||||
public function getName() |
||||
{ |
||||
return 'jury_user'; |
||||
} |
||||
} |
@ -0,0 +1,71 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Form; |
||||
|
||||
use Symfony\Component\Form\AbstractType; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface; |
||||
use DOctrine\ORM\EntityRepository; |
||||
use Entity; |
||||
|
||||
class JuryType extends AbstractType |
||||
{ |
||||
public function buildForm(FormBuilderInterface $builder, array $options) |
||||
{ |
||||
$builder->add('name', 'text'); |
||||
$builder->add( |
||||
'opening_date', |
||||
'datetime', |
||||
array( |
||||
'data' => new \DateTime(), |
||||
) |
||||
); |
||||
|
||||
$builder->add( |
||||
'closure_date', |
||||
'datetime', |
||||
array( |
||||
'data' => new \DateTime(), |
||||
) |
||||
); |
||||
|
||||
$builder->add( |
||||
'branch', |
||||
'entity', |
||||
array( |
||||
'class' => 'Entity\BranchSync', |
||||
'property' => 'branchName', |
||||
'query_builder' => |
||||
function (EntityRepository $er) { |
||||
return $er->createQueryBuilder('u') |
||||
//->where('u.role LIKE :role') |
||||
//->setParameter(':role', 'ROLE_JURY%') |
||||
->orderBy('u.branchName', 'DESC'); |
||||
}, |
||||
) |
||||
); |
||||
|
||||
$builder->add('opening_user_id', 'text'); |
||||
$builder->add('closure_user_id', 'text'); |
||||
$builder->add('exercise_id', 'text'); |
||||
|
||||
//$builder->add('users', 'collection', array('type' => new JuryType())); |
||||
|
||||
$builder->add('submit', 'submit'); |
||||
} |
||||
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver) |
||||
{ |
||||
$resolver->setDefaults( |
||||
array( |
||||
'data_class' => 'Chamilo\CoreBundle\Entity\Jury', |
||||
) |
||||
); |
||||
} |
||||
|
||||
public function getName() |
||||
{ |
||||
return 'jury'; |
||||
} |
||||
} |
@ -0,0 +1,33 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Form; |
||||
|
||||
use Symfony\Component\Form\AbstractType; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface; |
||||
use Entity; |
||||
|
||||
class JuryUserType extends AbstractType |
||||
{ |
||||
public function buildForm(FormBuilderInterface $builder, array $options) |
||||
{ |
||||
$builder->add('role_id'); |
||||
|
||||
$builder->add('submit', 'submit'); |
||||
} |
||||
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver) |
||||
{ |
||||
$resolver->setDefaults( |
||||
array( |
||||
'data_class' => 'Chamilo\CoreBundle\Entity\Jury', |
||||
) |
||||
); |
||||
} |
||||
|
||||
public function getName() |
||||
{ |
||||
return 'jury_user'; |
||||
} |
||||
} |
@ -0,0 +1,46 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Form; |
||||
|
||||
use Symfony\Component\Form\AbstractType; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface; |
||||
use Entity; |
||||
|
||||
class QuestionScoreNameType extends AbstractType |
||||
{ |
||||
public function buildForm(FormBuilderInterface $builder, array $options) |
||||
{ |
||||
$builder->add('name', 'text'); |
||||
$builder->add('description', 'textarea'); |
||||
$builder->add('score', 'text'); |
||||
$builder->add( |
||||
'questionScore', |
||||
'entity', |
||||
array( |
||||
'class' => 'Entity\QuestionScore', |
||||
'query_builder' => function ($repository) { |
||||
return $repository->createQueryBuilder('p') |
||||
->orderBy('p.id', 'ASC'); |
||||
}, |
||||
'property' => 'name', |
||||
) |
||||
); |
||||
$builder->add('submit', 'submit'); |
||||
} |
||||
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver) |
||||
{ |
||||
$resolver->setDefaults( |
||||
array( |
||||
'data_class' => 'Chamilo\CoreBundle\Entity\QuestionScoreName', |
||||
) |
||||
); |
||||
} |
||||
|
||||
public function getName() |
||||
{ |
||||
return 'questionScoreName'; |
||||
} |
||||
} |
@ -0,0 +1,32 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Form; |
||||
|
||||
use Symfony\Component\Form\AbstractType; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface; |
||||
use Entity; |
||||
|
||||
class QuestionScoreType extends AbstractType |
||||
{ |
||||
public function buildForm(FormBuilderInterface $builder, array $options) |
||||
{ |
||||
$builder->add('name', 'text'); |
||||
$builder->add('submit', 'submit'); |
||||
} |
||||
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver) |
||||
{ |
||||
$resolver->setDefaults( |
||||
array( |
||||
'data_class' => 'Chamilo\CoreBundle\Entity\QuestionScore', |
||||
) |
||||
); |
||||
} |
||||
|
||||
public function getName() |
||||
{ |
||||
return 'questionScore'; |
||||
} |
||||
} |
@ -0,0 +1,45 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Form; |
||||
|
||||
use Symfony\Component\Form\AbstractType; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface; |
||||
use Entity; |
||||
|
||||
class SessionPathType extends AbstractType |
||||
{ |
||||
/** |
||||
* Builds the form |
||||
* For form type details see: |
||||
* http://symfony.com/doc/current/reference/forms/types.html |
||||
* |
||||
* @param FormBuilderInterface $builder |
||||
* @param array $options |
||||
*/ |
||||
public function buildForm(FormBuilderInterface $builder, array $options) |
||||
{ |
||||
|
||||
$builder |
||||
->add('name', 'text') |
||||
->add('description', 'text') |
||||
->add('submit', 'submit'); |
||||
|
||||
} |
||||
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver) |
||||
{ |
||||
$resolver->setDefaults( |
||||
array( |
||||
'data_class' => 'Chamilo\CoreBundle\Entity\SessionPath', |
||||
) |
||||
); |
||||
} |
||||
|
||||
public function getName() |
||||
{ |
||||
return 'sessionPath'; |
||||
} |
||||
} |
||||
|
@ -0,0 +1,114 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Form; |
||||
|
||||
use Symfony\Component\Form\AbstractType; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface; |
||||
use Doctrine\ORM\EntityRepository; |
||||
use Entity; |
||||
|
||||
class SessionTreeType extends AbstractType |
||||
{ |
||||
/** |
||||
* @inheritdoc |
||||
*/ |
||||
public function buildForm(FormBuilderInterface $builder, array $options) |
||||
{ |
||||
$builder->add( |
||||
'type', |
||||
'choice', |
||||
array('choices' => array('1', '2', '3', '4')) |
||||
); |
||||
|
||||
$builder->add( |
||||
'sessionPath', |
||||
'entity', |
||||
array( |
||||
'class' => 'Entity\SessionPath', |
||||
'property' => 'name', |
||||
'query_builder' => |
||||
function (EntityRepository $er) { |
||||
return $er->createQueryBuilder('u') |
||||
->orderBy('u.name', 'DESC'); |
||||
}, |
||||
) |
||||
); |
||||
|
||||
|
||||
$builder->add( |
||||
'tool', |
||||
'entity', |
||||
array( |
||||
'class' => 'Entity\Tool', |
||||
'property' => 'name', |
||||
'query_builder' => |
||||
function (EntityRepository $er) { |
||||
return $er->createQueryBuilder('u') |
||||
->orderBy('u.name', 'DESC'); |
||||
}, |
||||
) |
||||
); |
||||
|
||||
$builder->add( |
||||
'tool', |
||||
'entity', |
||||
array( |
||||
'class' => 'Entity\Tool', |
||||
'property' => 'name', |
||||
'query_builder' => |
||||
function (EntityRepository $er) { |
||||
return $er->createQueryBuilder('u') |
||||
->orderBy('u.name', 'DESC'); |
||||
}, |
||||
) |
||||
); |
||||
|
||||
$builder->add( |
||||
'session', |
||||
'entity', |
||||
array( |
||||
'class' => 'Entity\Session', |
||||
'property' => 'name', |
||||
'query_builder' => |
||||
function (EntityRepository $er) { |
||||
return $er->createQueryBuilder('u') |
||||
->orderBy('u.name', 'DESC'); |
||||
}, |
||||
) |
||||
); |
||||
|
||||
$builder->add( |
||||
'course', |
||||
'entity', |
||||
array( |
||||
'class' => 'Entity\Course', |
||||
'property' => 'title', |
||||
'query_builder' => |
||||
function (EntityRepository $er) { |
||||
return $er->createQueryBuilder('u') |
||||
->orderBy('u.title', 'DESC'); |
||||
}, |
||||
) |
||||
); |
||||
$builder |
||||
->add('submit', 'submit'); |
||||
|
||||
} |
||||
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver) |
||||
{ |
||||
$resolver->setDefaults( |
||||
array( |
||||
'data_class' => 'Chamilo\CoreBundle\Entity\SessionTree', |
||||
) |
||||
); |
||||
} |
||||
|
||||
public function getName() |
||||
{ |
||||
return 'sessionPath'; |
||||
} |
||||
} |
||||
|
@ -0,0 +1,87 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Form; |
||||
|
||||
use Symfony\Component\Form\AbstractType; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface; |
||||
use Chamilo\CoreBundle\Entity\Session; |
||||
|
||||
class SessionType extends AbstractType |
||||
{ |
||||
/** |
||||
* @inheritdoc |
||||
*/ |
||||
public function buildForm(FormBuilderInterface $builder, array $options) |
||||
{ |
||||
$builderData = $builder->getData(); |
||||
$builder |
||||
->add('name', 'text') |
||||
->add( |
||||
'general_coach', |
||||
'entity', |
||||
array( |
||||
'class' => 'ChamiloUserBundle:User', |
||||
'property' => 'username', |
||||
) |
||||
) |
||||
->add( |
||||
'session_admin_id', |
||||
'entity', |
||||
array( |
||||
'class' => 'ChamiloUserBundle:User', |
||||
'property' => 'username', |
||||
) |
||||
) |
||||
->add( |
||||
'visibility', |
||||
'choice', |
||||
array('choices' => Session::getStatusList()) |
||||
) |
||||
->add( |
||||
'session_category_id', |
||||
'entity', |
||||
array( |
||||
'class' => 'ChamiloCoreBundle:SessionCategory', |
||||
'property' => 'name', |
||||
) |
||||
) |
||||
->add( |
||||
'promotion_id', |
||||
'entity', |
||||
array( |
||||
'class' => 'ChamiloCoreBundle:Promotion', |
||||
'property' => 'name', |
||||
) |
||||
) |
||||
->add('display_start_date', 'sonata_type_datetime_picker') |
||||
->add('display_end_date', 'sonata_type_datetime_picker') |
||||
->add('access_start_date', 'sonata_type_datetime_picker') |
||||
->add('access_end_date', 'sonata_type_datetime_picker') |
||||
->add('coach_access_start_date', 'sonata_type_datetime_picker') |
||||
->add('coach_access_end_date', 'sonata_type_datetime_picker') |
||||
->add('save', 'submit', array('label' => 'Update')); |
||||
} |
||||
|
||||
/** |
||||
* @param OptionsResolverInterface $resolver |
||||
*/ |
||||
public function setDefaultOptions(OptionsResolverInterface $resolver) |
||||
{ |
||||
$resolver->setDefaults( |
||||
array( |
||||
'data_class' => 'Chamilo\CoreBundle\Entity\Session', |
||||
) |
||||
); |
||||
} |
||||
|
||||
/** |
||||
* @return string |
||||
*/ |
||||
public function getName() |
||||
{ |
||||
return 'session'; |
||||
} |
||||
} |
||||
|
@ -0,0 +1,88 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Form\type; |
||||
|
||||
use Symfony\Component\Form\AbstractType; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
use Symfony\Component\OptionsResolver\OptionsResolver; |
||||
use Chamilo\CoreBundle\Entity\Course; |
||||
|
||||
/** |
||||
* Class CourseType |
||||
* @package Chamilo\CoreBundle\Form\type |
||||
*/ |
||||
class CourseType extends AbstractType |
||||
{ |
||||
/** |
||||
* @inheritdoc |
||||
*/ |
||||
public function buildForm(FormBuilderInterface $builder, array $options) |
||||
{ |
||||
// @todo as a service to load the preferred_choices |
||||
$builder |
||||
->add('title', 'text') |
||||
//->add('code', 'text') |
||||
->add( |
||||
'course_language', |
||||
'locale', |
||||
array('preferred_choices' => array('en', 'fr', 'es')) |
||||
) |
||||
->add( |
||||
'visibility', |
||||
'choice', |
||||
array('choices' => Course::getStatusList()) |
||||
) |
||||
->add('department_name', 'text', array('required' => false)) |
||||
->add('department_url', 'url', array('required' => false)) |
||||
//->add('disk_quota', 'text') |
||||
->add( |
||||
'expiration_date', |
||||
'sonata_type_datetime_picker', |
||||
array('required' => false) |
||||
) |
||||
/* ->add('general_coach', 'entity', array( |
||||
'class' => 'ChamiloUserBundle:User', |
||||
'property' => 'username', |
||||
)) |
||||
->add('session_admin_id', 'entity', array( |
||||
'class' => 'ChamiloUserBundle:User', |
||||
'property' => 'username', |
||||
)) |
||||
->add('visibility', 'choice', |
||||
array('choices' => Session::getStatusList()) |
||||
) |
||||
->add('session_category_id', 'entity', array( |
||||
'class' => 'ChamiloCoreBundle:SessionCategory', |
||||
'property' => 'name', |
||||
)) |
||||
->add('promotion_id', 'entity', array( |
||||
'class' => 'ChamiloCoreBundle:Promotion', |
||||
'property' => 'name', |
||||
))*/ |
||||
/* |
||||
->add('coach_access_end_date', 'sonata_type_datetime_picker')*/ |
||||
|
||||
->add('save', 'submit', array('label' => 'Update')); |
||||
} |
||||
|
||||
/** |
||||
* @param OptionsResolver $resolver |
||||
*/ |
||||
public function configureOptions(OptionsResolver $resolver) |
||||
{ |
||||
$resolver->setDefaults( |
||||
array( |
||||
'data_class' => 'Chamilo\CoreBundle\Entity\Course', |
||||
) |
||||
); |
||||
} |
||||
|
||||
/** |
||||
* @return string |
||||
*/ |
||||
public function getName() |
||||
{ |
||||
return 'course'; |
||||
} |
||||
} |
@ -0,0 +1,46 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Form\Type; |
||||
|
||||
use Symfony\Component\Form\AbstractType; |
||||
use Symfony\Component\OptionsResolver\OptionsResolver; |
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; |
||||
|
||||
/** |
||||
* Class YesNoType |
||||
* @package Chamilo\CoreBundle\Form\Type |
||||
*/ |
||||
class YesNoType extends AbstractType |
||||
{ |
||||
/** |
||||
* @param OptionsResolver $resolver |
||||
*/ |
||||
public function configureOptions(OptionsResolver $resolver) |
||||
{ |
||||
$resolver->setDefaults( |
||||
array( |
||||
'choices' => array( |
||||
'Yes' => 'true', |
||||
'No' => 'false', |
||||
), |
||||
) |
||||
); |
||||
} |
||||
|
||||
/** |
||||
* @inheritdoc |
||||
*/ |
||||
public function getParent() |
||||
{ |
||||
return ChoiceType::class; |
||||
} |
||||
|
||||
/** |
||||
* @return string |
||||
*/ |
||||
public function getName() |
||||
{ |
||||
return 'yes_no'; |
||||
} |
||||
} |
Loading…
Reference in new issue