<?php

namespace Site\BackendBundle\Admin;

use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;


class DataAdmin extends Admin
{
    protected function configureListFields(ListMapper $listMapper)
    {
        $listMapper
            ->addIdentifier('id')
            ->add('idcategory')
            ->add('iduser')
            ->addIdentifier('nameeng', null, array('label' => 'Name'))
            ->add('web')
            ->add('filename', 'url', array('url' => ''))
            ->add('type')
            ->add('size')
            ->add('message', null, array('label' => 'Description'))
            ->add('metadata', null, array('label' => 'Metadata / Tags'))
            ->add('views')
            ->addIdentifier('accepted', null, array('label' => 'Accepted / Not Accepted'))
        ;
    }

    protected function configureDatagridFilters(DatagridMapper $datagridMapper)
    {
        $datagridMapper
            ->add('idcategory', null, array('label' => 'Id Category'))
            ->add('iduser', null, array('label' => 'Id User'))
            ->add('nameeng', null, array('label' => 'Name'))
            ->add('type')
            ->add('metadata', null, array('label' => 'Metadata / Tags'))
            ->add('accepted', null, array('label' => 'Accepted / Not Accepted'))
        ;
    }

    protected function configureFormFields(FormMapper $formMapper)
    {
        $formMapper
            ->add('idcategory', null, array('label' => 'Id Category'))
            ->add('iduser', null, array('label' => 'Id User'))
            ->add('nameeng', null, array('label' => 'Name'))
            ->add('web', null, array('required' => false))
            ->add('type')
            ->add('size')
            ->add('message', null, array('label' => 'Description'))
            ->add('metadata', null, array('required' => false,'label' => 'Metadata / Tags'))
            ->add('views')
            ->add('accepted', null, array('required' => false,'label' => 'Accepted / Not Accepted'))
        ;
    }
}
?>