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(); }
/** * Create a new content. * * @param string $translatedContent array('en' => array('content' => 'foo', 'title' => 'foo')) * @param string $type A type of content * * @return integer The id of the new content. */ public function createContent(array $translatedContent, $type = null) { $content = new Content(); $content->setType($type); $locale = $this->request->getSession()->get('_locale'); $this->updateContent($content, $this->setDefault($this->setDefault($translatedContent, 'title', $locale), 'content', $locale)); return $content->getId(); }
/** * {@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(); }
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(); } }
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(); }