parent
bee8b85880
commit
e87f25fbb3
@ -0,0 +1,94 @@ |
||||
<?php |
||||
|
||||
namespace ChamiloLMS\InstallerBundle\Form\Type\Setup; |
||||
|
||||
use Symfony\Component\Form\AbstractType; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
use Symfony\Component\Validator\Constraints as Assert; |
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface; |
||||
|
||||
class AdminType extends AbstractType |
||||
{ |
||||
protected $dataClass; |
||||
|
||||
public function __construct($dataClass) |
||||
{ |
||||
$this->dataClass = $dataClass; |
||||
} |
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options) |
||||
{ |
||||
$builder |
||||
->add( |
||||
'username', |
||||
'text', |
||||
array( |
||||
'label' => 'form.setup.admin.username', |
||||
) |
||||
) |
||||
->add( |
||||
'plainPassword', |
||||
'repeated', |
||||
array( |
||||
'type' => 'password', |
||||
'invalid_message' => 'The password fields must match.', |
||||
'first_options' => array('label' => 'form.setup.admin.password'), |
||||
'second_options' => array('label' => 'form.setup.admin.password_re'), |
||||
) |
||||
) |
||||
->add( |
||||
'email', |
||||
'email', |
||||
array( |
||||
'label' => 'form.setup.admin.email', |
||||
) |
||||
) |
||||
->add( |
||||
'firstName', |
||||
'text', |
||||
array( |
||||
'label' => 'form.setup.admin.firstname', |
||||
) |
||||
) |
||||
->add( |
||||
'lastName', |
||||
'text', |
||||
array( |
||||
'label' => 'form.setup.admin.lastname', |
||||
) |
||||
) |
||||
->add( |
||||
'phone', |
||||
'text', |
||||
array( |
||||
'label' => 'form.setup.admin.phone', |
||||
) |
||||
); |
||||
/* |
||||
->add( |
||||
'loadFixtures', |
||||
'checkbox', |
||||
array( |
||||
'label' => 'form.setup.load_fixtures', |
||||
'required' => false, |
||||
'mapped' => false, |
||||
) |
||||
);*/ |
||||
} |
||||
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver) |
||||
{ |
||||
$resolver->setDefaults( |
||||
array( |
||||
'data_class' => $this->dataClass, |
||||
'validation_groups' => array('Registration', 'Default'), |
||||
) |
||||
); |
||||
} |
||||
|
||||
|
||||
public function getName() |
||||
{ |
||||
return 'chamilo_installer_setup_admin'; |
||||
} |
||||
} |
@ -0,0 +1,91 @@ |
||||
<?php |
||||
|
||||
namespace ChamiloLMS\InstallerBundle\Form\Type\Setup; |
||||
|
||||
use Symfony\Component\Form\AbstractType; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
use Symfony\Component\Validator\Constraints as Assert; |
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface; |
||||
|
||||
class PortalType extends AbstractType |
||||
{ |
||||
public function buildForm(FormBuilderInterface $builder, array $options) |
||||
{ |
||||
$builder |
||||
->add( |
||||
'portal_name', |
||||
'text', |
||||
array( |
||||
'label' => 'form.setup.portal.portal_name', |
||||
'mapped' => false, |
||||
'constraints' => array( |
||||
new Assert\NotBlank(), |
||||
new Assert\Length(array('max' => 15)) |
||||
), |
||||
) |
||||
) |
||||
->add( |
||||
'company_title', |
||||
'text', |
||||
array( |
||||
'label' => 'form.setup.portal.company_title', |
||||
'mapped' => false, |
||||
'required' => false, |
||||
) |
||||
) |
||||
->add( |
||||
'company_url', |
||||
'url', |
||||
array( |
||||
'label' => 'form.setup.portal.company_url', |
||||
'mapped' => false, |
||||
'required' => false, |
||||
) |
||||
) |
||||
->add( |
||||
'allow_self_registration', |
||||
'choice', |
||||
array( |
||||
'label' => 'form.setup.portal.allow_self_registration', |
||||
'mapped' => false, |
||||
'required' => false, |
||||
'preferred_choices' => array(), |
||||
'choices' => array( |
||||
'1' => 'Yes', |
||||
'0' => 'No', |
||||
), |
||||
) |
||||
) |
||||
->add( |
||||
'allow_self_registration_as_trainer', |
||||
'choice', |
||||
array( |
||||
'label' => 'form.setup.portal.allow_self_registration_as_trainer', |
||||
'mapped' => false, |
||||
'required' => false, |
||||
'preferred_choices' => array(), |
||||
'choices' => array( |
||||
'1' => 'Yes', |
||||
'0' => 'No', |
||||
), |
||||
) |
||||
); |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
public function setDefaultOptions(OptionsResolverInterface $resolver) |
||||
{ |
||||
$resolver->setDefaults(array( |
||||
'allow_self_registration_as_trainer' => '1', |
||||
'allow_self_registration' => 'No' |
||||
) |
||||
); |
||||
} |
||||
|
||||
public function getName() |
||||
{ |
||||
return 'chamilo_installer_setup_portal'; |
||||
} |
||||
} |
@ -0,0 +1,22 @@ |
||||
<?php |
||||
|
||||
namespace ChamiloLMS\InstallerBundle\Process; |
||||
|
||||
use Symfony\Component\Process\PhpExecutableFinder as BasePhpExecutableFinder; |
||||
|
||||
class PhpExecutableFinder extends BasePhpExecutableFinder |
||||
{ |
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
public function find() |
||||
{ |
||||
if ($php = getenv('CHAMILO_PHP_PATH')) { |
||||
if (is_executable($php)) { |
||||
return $php; |
||||
} |
||||
} |
||||
|
||||
return parent::find(); |
||||
} |
||||
} |
Loading…
Reference in new issue