|
@@ -3,10 +3,12 @@
|
|
|
namespace CablemodemBundle\Admin;
|
|
|
|
|
|
use Base\AdminBundle\Admin\BaseAdmin;
|
|
|
+use TemplateBundle\Entity\Template;
|
|
|
use Sonata\AdminBundle\Datagrid\DatagridMapper;
|
|
|
use Sonata\AdminBundle\Datagrid\ListMapper;
|
|
|
use Sonata\AdminBundle\Form\FormMapper;
|
|
|
use Sonata\AdminBundle\Show\ShowMapper;
|
|
|
+use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
|
|
|
|
|
class ProfileAdmin extends BaseAdmin
|
|
|
{
|
|
@@ -37,6 +39,7 @@ class ProfileAdmin extends BaseAdmin
|
|
|
->add('filtroUpload')
|
|
|
->add('filtroDownload')
|
|
|
->add('maxCpe')
|
|
|
+ ->add('template')
|
|
|
->add('_action', null, array(
|
|
|
'actions' => array(
|
|
|
'show' => array(),
|
|
@@ -52,13 +55,36 @@ class ProfileAdmin extends BaseAdmin
|
|
|
*/
|
|
|
protected function configureFormFields(FormMapper $formMapper)
|
|
|
{
|
|
|
+ $templates = $this->getRepository(Template::class)->findAll();
|
|
|
+ if (count($templates)) {
|
|
|
+ $templates = array_map(function($template) {
|
|
|
+ return $template->getName();
|
|
|
+ }, $templates);
|
|
|
+ }
|
|
|
+
|
|
|
$formMapper
|
|
|
->add('name')
|
|
|
- ->add('downstream',null,array('help' => $this->trans('help.profile_downstream'), 'attr' => array('placeholder' => $this->trans('help.profile_value_default'))))
|
|
|
- ->add('upstream',null,array('help' => $this->trans('help.profile_downstream'), 'attr' => array('placeholder' => $this->trans('help.profile_value_default'))))
|
|
|
+ ->add('downstream',null,array(
|
|
|
+ 'help' => $this->trans('help.profile_downstream'),
|
|
|
+ 'attr' => array(
|
|
|
+ 'placeholder' => $this->trans('help.profile_value_default')
|
|
|
+ )))
|
|
|
+ ->add('upstream', null, array(
|
|
|
+ 'help' => $this->trans('help.profile_downstream'),
|
|
|
+ 'attr' => array(
|
|
|
+ 'placeholder' => $this->trans('help.profile_value_default')
|
|
|
+ )))
|
|
|
->add('filtroUpload')
|
|
|
->add('filtroDownload')
|
|
|
->add('maxCpe')
|
|
|
+ ->add('template', ChoiceType::class, [
|
|
|
+ 'required' => false,
|
|
|
+ 'choices' => array_combine($templates, $templates),
|
|
|
+ 'preferred_choices' => [
|
|
|
+ 'template_docsis.tpl',
|
|
|
+ ],
|
|
|
+ 'help' => $this->trans('help.profile_template')
|
|
|
+ ])
|
|
|
;
|
|
|
}
|
|
|
|
|
@@ -74,6 +100,7 @@ class ProfileAdmin extends BaseAdmin
|
|
|
->add('filtroUpload')
|
|
|
->add('filtroDownload')
|
|
|
->add('maxCpe')
|
|
|
+ ->add('template')
|
|
|
;
|
|
|
}
|
|
|
}
|