Esempio n. 1
0
 public function load(ObjectManager $manager)
 {
     $repository = $manager->getRepository('Claroline\\CoreBundle\\Entity\\ContentTranslation');
     //mails
     $frTitle = 'Inscription à %platform_name%';
     $frContent = "<div>Votre nom d'utilisateur est %username%</div></br>";
     $frContent .= "<div>Votre mot de passe est %password%</div>";
     $frContent .= "<div>%validation_mail%</div>";
     $enTitle = 'Registration to %platform_name%';
     $enContent = "<div>You username is %username%</div></br>";
     $enContent .= "<div>Your password is %password%</div>";
     $enContent .= "<div>%validation_mail%</div>";
     $type = 'claro_mail_registration';
     $content = new Content();
     $content->setTitle($enTitle);
     $content->setContent($enContent);
     $content->setType($type);
     $repository->translate($content, 'title', 'fr', $frTitle);
     $repository->translate($content, 'content', 'fr', $frContent);
     $manager->persist($content);
     //layout
     $frLayout = '<div></div>%content%<div></hr>Powered by %platform_name%</div>';
     $enLayout = '<div></div>%content%<div></hr>Powered by %platform_name%</div>';
     $layout = new Content();
     $layout->setContent($enLayout);
     $layout->setType('claro_mail_layout');
     $repository->translate($layout, 'content', 'fr', $frLayout);
     $manager->persist($layout);
     $manager->flush();
 }
 /**
  * {@inheritdoc}
  */
 public function load(ObjectManager $om)
 {
     $contentTransRepo = $om->getRepository('Claroline\\CoreBundle\\Entity\\ContentTranslation');
     $frTitle = 'Confirmation de votre inscription';
     $frContent = '<div>Vous avez bien été inscrit au cours %course% pour la session %session% du %start_date% au %end_date%.</div>';
     $enTitle = 'Registration confirmation';
     $enContent = '<div>You have been registered to course %course% in session %session% from %start_date% to %end_date%.</div>';
     $content = new Content();
     $content->setTitle($enTitle);
     $content->setContent($enContent);
     $content->setType('claro_cursusbundle_mail_confirmation');
     $contentTransRepo->translate($content, 'title', 'fr', $frTitle);
     $contentTransRepo->translate($content, 'content', 'fr', $frContent);
     $om->persist($content);
     $om->flush();
 }
Esempio n. 3
0
 private function createConfirmationMail()
 {
     $this->log('Creating confirmation email...');
     $content = $this->contentManager->getContent(array('type' => 'claro_cursusbundle_mail_confirmation'));
     if (is_null($content)) {
         $contentTransRepo = $this->om->getRepository('Claroline\\CoreBundle\\Entity\\ContentTranslation');
         $frTitle = 'Confirmation de votre inscription';
         $frContent = "<div>Vous avez bien été inscrit au cours %course% pour la session %session% du %start_date% au %end_date%.</div>";
         $enTitle = 'Registration confirmation';
         $enContent = "<div>You have been registered to course %course% in session %session% from %start_date% to %end_date%.</div>";
         $content = new Content();
         $content->setTitle($enTitle);
         $content->setContent($enContent);
         $content->setType('claro_cursusbundle_mail_confirmation');
         $contentTransRepo->translate($content, 'title', 'fr', $frTitle);
         $contentTransRepo->translate($content, 'content', 'fr', $frContent);
         $this->om->persist($content);
         $this->om->flush();
     }
 }
Esempio n. 4
0
 /**
  * Update a content translation.
  *
  * @param Content $content     A content entity
  * @param array   $translation array('content' => 'foo', 'title' => 'foo')
  * @param string  $locale      A string with a locale value as 'en' or 'fr'
  * @param bool    $reset       A boolean in case of you whant to reset the values of the translation
  */
 private function updateTranslation(Content $content, $translation, $locale = 'en', $reset = false)
 {
     if (isset($translation['title'])) {
         $content->setTitle($reset ? null : $translation['title']);
     }
     if (isset($translation['content'])) {
         $content->setContent($reset ? null : $translation['content']);
     }
     $content->setTranslatableLocale($locale);
     $content->setModified();
     $this->manager->persist($content);
     $this->manager->flush();
 }
Esempio n. 5
0
 private function insertDefaultMails()
 {
     $this->log('Adding default mails...');
     $repository = $this->om->getRepository('Claroline\\CoreBundle\\Entity\\ContentTranslation');
     //mails
     $frTitle = 'Inscription à %platform_name%';
     $frContent = "<div>Votre nom d'utilisateur est %username%</div></br>";
     $frContent .= "<div>Votre mot de passe est %password%</div>";
     $enTitle = 'Registration to %platform_name%';
     $enContent = "<div>You username is %username%</div></br>";
     $enContent .= "<div>Your password is %password%</div>";
     $type = 'claro_mail_registration';
     $content = new Content();
     $content->setTitle($enTitle);
     $content->setContent($enContent);
     $content->setType($type);
     $repository->translate($content, 'title', 'fr', $frTitle);
     $repository->translate($content, 'content', 'fr', $frContent);
     $this->om->persist($content);
     //layout
     $frLayout = '<div></div>%content%<div></hr>Powered by %platform_name%</div>';
     $enLayout = '<div></div>%content%<div></hr>Powered by %platform_name%</div>';
     $layout = new Content();
     $layout->setContent($enLayout);
     $layout->setType('claro_mail_layout');
     $repository->translate($layout, 'content', 'fr', $frLayout);
     $this->om->persist($layout);
     $this->om->flush();
 }