Example #1
0
 /**
  * @inheritdoc
  */
 public function upManual()
 {
     // Adds the static page
     if (Page::findOne(['name' => 'Static page']) === NULL) {
         $page = new Page();
         $page->name = 'Static page';
         $page->parameters = json_encode([['class' => StaticPlugin::className()]]);
         $page->save();
     } else {
         $page = Page::findOne(['name' => 'Static page']);
     }
     // Adds the static page plugin
     // used in the static pages
     if (Plugin::findOne(['namespace' => StaticPlugin::className()]) === NULL) {
         $plugin = new Plugin();
         $plugin->namespace = StaticPlugin::className();
         $plugin->private = TRUE;
         $plugin->save();
     }
     // Adds the basic Page Sections
     $oneColSection = PageSections::findOne(['name' => 'One column']);
     if (is_null($oneColSection)) {
         $section = new PageSections();
         $section->name = 'One column';
         $section->cols = 1;
         $section->cols_sizes = '12';
         $section->save();
     } else {
         $section = $oneColSection;
     }
     // Adds the Static Page Design
     if (PageReference::findOne(['page_id' => $page->id, 'reference_id' => NULL]) === NULL) {
         $pageReference = new PageReference();
         $pageReference->page_id = $page->id;
         $pageReference->save();
         $pageDesign = new PageDesign();
         $pageDesign->page_reference_id = $pageReference->id;
         $pageDesign->section_id = $section->id;
         $pageDesign->plugins = json_encode([[$plugin->id]]);
         $pageDesign->save();
     }
 }