Example #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $homepage = $this->create('Accueil', 'home', "Description de la page d'accueil", 1);
     $homepage->themepartials()->attach(Themepartial::all());
     $this->attachMapWidget($homepage);
 }
Example #2
0
 /**
  * Attach default theme partials.
  *
  * @param Page     $page
  * @param Template $template
  *
  * @return void
  */
 protected function attachDefaultPartials(Page $page, Template $template)
 {
     $skeleton = Formatter::make($template->skeleton, Formatter::JSON);
     $xmlTemplate = @simplexml_load_string($skeleton->toXml(), 'SimpleXMLElement', LIBXML_NOWARNING);
     if ($xmlTemplate) {
         $partialsList = (string) $xmlTemplate->attributes->partials;
         if ($partialsList) {
             $partials = explode(',', $partialsList);
             foreach ($partials as $partial) {
                 $partialModel = Themepartial::whereName($partial)->first();
                 if ($partialModel) {
                     $page->themepartials()->attach($partialModel);
                 }
             }
         }
     }
 }
Example #3
0
 protected function isThemePartial($partial)
 {
     return Themepartial::whereName($partial)->first();
 }
Example #4
0
 protected function attachPaymentCancelledWidgets($paymentCancelled)
 {
     $paymentCancelled->themepartials()->attach(Themepartial::all());
     $config = ['type' => 'code', 'content' => '<div class="panel panel-default">' . PHP_EOL . '   <div class="panel-body">' . PHP_EOL . '     <h1>' . trans('frontend.payment.error.title') . '</h1>' . PHP_EOL . '         <br /><br />' . PHP_EOL . '     <p>' . trans('frontend.payment.error.content') . '</p>' . PHP_EOL . '   </div>' . PHP_EOL . '</div>'];
     $this->attachWidget($paymentCancelled, 'content', 'ZEDx', 'Editor', $config);
 }
Example #5
0
 /**
  * Save theme partials.
  *
  * @return void
  */
 public function saveThemePartials()
 {
     $ids = [];
     $manifest = $this->getManifest();
     $partials = isset($manifest['partials']) ? $manifest['partials'] : [];
     foreach ($partials as $partial) {
         $ids[] = Themepartial::firstOrCreate(['name' => $partial['file'], 'title' => $partial['title']])->id;
     }
     $partialsToRemove = Themepartial::whereNotIn('id', $ids)->get();
     foreach ($partialsToRemove as $partial) {
         $partial->delete();
     }
 }