diff --git a/src/Chamilo/ContactBundle/Admin/CategoryAdmin.php b/src/Chamilo/ContactBundle/Admin/CategoryAdmin.php index 41e45c8491..e2c4bcdfcc 100644 --- a/src/Chamilo/ContactBundle/Admin/CategoryAdmin.php +++ b/src/Chamilo/ContactBundle/Admin/CategoryAdmin.php @@ -3,7 +3,7 @@ namespace Chamilo\ContactBundle\Admin; -use Sonata\AdminBundle\Admin\Admin; +use Sonata\AdminBundle\Admin\AbstractAdmin; use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Form\FormMapper; use Sonata\AdminBundle\Datagrid\DatagridMapper; @@ -12,7 +12,7 @@ use Sonata\AdminBundle\Datagrid\DatagridMapper; * Class UserAdmin * @package Chamilo\ContactBundle\Admin */ -class CategoryAdmin extends Admin +class CategoryAdmin extends AbstractAdmin { /** * @param ListMapper $listMapper @@ -21,8 +21,9 @@ class CategoryAdmin extends Admin { $listMapper //->add('headline', null, array('identifier' => true)) - ->add('name', null, array('identifier' => true)) - ->add('email') + //->add('name', null, array('identifier' => true)) + ->add('translations', null, array('identifier' => true)) + ->add('email', null, array('identifier' => true)) ; } @@ -32,7 +33,8 @@ class CategoryAdmin extends Admin protected function configureFormFields(FormMapper $formMapper) { $formMapper - ->add('name') + //->add('name') + ->add('translations', 'a2lix_translations', array()) ->add('email') ; } @@ -43,8 +45,8 @@ class CategoryAdmin extends Admin protected function configureDatagridFilters(DatagridMapper $datagridMapper) { $datagridMapper - ->add('name') - ->add('email') + ->add('translations', null, array('identifier' => true)) + ->add('email', null, array('identifier' => true)) ; } } diff --git a/src/Chamilo/ContactBundle/ChamiloContactBundle.php b/src/Chamilo/ContactBundle/ChamiloContactBundle.php index db379cf472..ed922556bc 100644 --- a/src/Chamilo/ContactBundle/ChamiloContactBundle.php +++ b/src/Chamilo/ContactBundle/ChamiloContactBundle.php @@ -4,6 +4,7 @@ namespace Chamilo\ContactBundle; use Symfony\Component\HttpKernel\Bundle\Bundle; +use Symfony\Component\DependencyInjection\ContainerBuilder; /** * Class ChamiloContactBundle @@ -12,4 +13,4 @@ use Symfony\Component\HttpKernel\Bundle\Bundle; class ChamiloContactBundle extends Bundle { -} \ No newline at end of file +} diff --git a/src/Chamilo/ContactBundle/Controller/ContactController.php b/src/Chamilo/ContactBundle/Controller/ContactController.php index beb64d3f2b..8408e1f93f 100644 --- a/src/Chamilo/ContactBundle/Controller/ContactController.php +++ b/src/Chamilo/ContactBundle/Controller/ContactController.php @@ -5,7 +5,8 @@ namespace Chamilo\ContactBundle\Controller; use Chamilo\ContactBundle\Entity\Category; use Chamilo\ContactBundle\Form\Type\ContactType; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; +//use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; +use Symfony\Component\Routing\Annotation\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -38,8 +39,7 @@ class ContactController extends Controller $data = [ 'firstname' => $user->getFirstname(), 'lastname' => $user->getFirstname(), - 'email' => $user->getEmail(), - + 'email' => $user->getEmail() ]; } @@ -75,8 +75,8 @@ class ContactController extends Controller $this->get('mailer')->send($message); $this->addFlash( - 'success', - 'Your email has been sent! Thanks!' + 'success', + $this->get('translator')->trans('Your email has been sent! Thanks!') ); return $this->redirect($this->generateUrl('contact')); diff --git a/src/Chamilo/ContactBundle/Entity/Category.php b/src/Chamilo/ContactBundle/Entity/Category.php index 1f3cd06bb1..09282f6a4f 100644 --- a/src/Chamilo/ContactBundle/Entity/Category.php +++ b/src/Chamilo/ContactBundle/Entity/Category.php @@ -4,19 +4,20 @@ namespace Chamilo\ContactBundle\Entity; use Doctrine\ORM\Mapping as ORM; +use Knp\DoctrineBehaviors\Model as ORMBehaviors; /** * Class Category * * @ORM\Entity - * @ORM\Table( - * name="contact_category" - * ) + * @ORM\Table(name="contact_category") * * @package Chamilo\FaqBundle\Entity */ class Category { + use ORMBehaviors\Translatable\Translatable; + /** * @var integer * @@ -26,12 +27,6 @@ class Category */ protected $id; - /** - * @var string - * @ORM\Column(name="name", type="string", nullable=false) - */ - protected $name; - /** * @var string * @ORM\Column(name="email", type="string") @@ -39,6 +34,16 @@ class Category protected $email; /** + * @param $method + * @param $arguments + * @return mixed + */ + public function __call($method, $arguments) + { + return $this->proxyCurrentLocaleTranslation($method, $arguments); + } + + /** * @return string */ public function __toString() @@ -49,36 +54,37 @@ class Category /** * @return string */ - public function getName() + public function getEmail() { - return $this->name; + return $this->email; } /** - * @param string $name + * @param string $email * @return Category */ - public function setName($name) + public function setEmail($email) { - $this->name = $name; + $this->email = $email; return $this; } /** - * @return string + * @return int */ - public function getEmail() + public function getId() { - return $this->email; + return $this->id; } /** - * @param string $email + * @param int $id * @return Category */ - public function setEmail($email) + public function setId($id) { - $this->email = $email; + $this->id = $id; + return $this; } } diff --git a/src/Chamilo/ContactBundle/Entity/Contact.php b/src/Chamilo/ContactBundle/Entity/Contact.php index 8eec75a07d..0d4f441913 100644 --- a/src/Chamilo/ContactBundle/Entity/Contact.php +++ b/src/Chamilo/ContactBundle/Entity/Contact.php @@ -8,6 +8,4 @@ use Doctrine\ORM\Mapping as ORM; class Contact { - - } diff --git a/src/Chamilo/ContactBundle/Form/Type/ContactType.php b/src/Chamilo/ContactBundle/Form/Type/ContactType.php index fe63101f4d..12f53ce0ae 100644 --- a/src/Chamilo/ContactBundle/Form/Type/ContactType.php +++ b/src/Chamilo/ContactBundle/Form/Type/ContactType.php @@ -50,11 +50,11 @@ class ContactType extends AbstractType new NotBlank(array('message' => 'Category should not be blank.')) ), 'firstname' => array( - new NotBlank(array('message' => 'firstname should not be blank.')), + new NotBlank(array('message' => 'Firstname should not be blank.')), new Length(array('min' => 2)) ), 'lastname' => array( - new NotBlank(array('message' => 'lastname should not be blank.')), + new NotBlank(array('message' => 'Lastname should not be blank.')), new Length(array('min' => 2)) ), 'email' => array( diff --git a/src/Chamilo/ContactBundle/Resources/views/contact.html.twig b/src/Chamilo/ContactBundle/Resources/views/contact.html.twig index 5e099820f4..801a377137 100644 --- a/src/Chamilo/ContactBundle/Resources/views/contact.html.twig +++ b/src/Chamilo/ContactBundle/Resources/views/contact.html.twig @@ -1,11 +1,11 @@ -{{ 'You had a new message from %url%' | trans({'%url%': url(app.request.attributes.get('_route'))} ) }} +{{ 'You had a new message from %url%' | trans({'%url%': url(app.request.attributes.get('_route'))} ) }} {{ 'Firstname' | trans }} : {{ firstname }} -{{ 'Lirstname' | trans }} : {{ lastname }} +{{ 'Lastname' | trans }} : {{ lastname }} Email: {{ email }} IP: {{ ip }} {{ 'Subject' | trans }} : {{ subject }} {{ 'Message' | trans }} : -{{ message|raw }} \ No newline at end of file +{{ message|raw }} diff --git a/src/Chamilo/ContactBundle/Resources/views/index.html.twig b/src/Chamilo/ContactBundle/Resources/views/index.html.twig index 1e0438d799..417a9a532b 100644 --- a/src/Chamilo/ContactBundle/Resources/views/index.html.twig +++ b/src/Chamilo/ContactBundle/Resources/views/index.html.twig @@ -1,9 +1,10 @@ -{% extends '@ChamiloCore/layout_one_col.html.twig' %} +{% extends "@ChamiloTheme/Layout/base-layout.html.twig" %} -{% block content %} +{% block chamilo_content %}
-