Exemplo n.º 1
0
 public function NavigationLink($direction)
 {
     switch ($direction) {
         case 'next':
             $sort = 'Sort:GreaterThan';
             break;
         case 'prev':
             $sort = 'Sort:LessThan';
             break;
         default:
             return false;
     }
     $page = BlogPage::get()->filter(array('ParentID' => $this->ParentID, $sort => $this->Sort))->sort('Sort ASC')->first();
     return $page;
 }
Exemplo n.º 2
0
 public function run($request)
 {
     $this->removeInitialPages();
     $this->deleteAll(BlogPage::get());
     // $this->deleteAll(ContactPage::get());
     $pages = ['Home' => new HomePage(), 'Blog' => new BlogPage()];
     // $homepage = HomePage::get()->first();
     // $homepage->IntroText = "WELL CRAFTED INTRO";
     // $homepage->PromoText = "PARTNERSHIP PROMOTION";
     // $introImg = new Image();
     // $imgFile = 'themes/Default/assets/images/doof.jpg';
     // var_dump($imgFile);
     // $introImg->Filename = $imgFile;
     // $introImg->Title = 'Intro background image';
     // $introImg->write();
     // $homepage->IntroImageID = $introImg->ID;
     foreach ($pages as $name => $class) {
         $this->findOrCreatePage($name, $class);
     }
 }
Exemplo n.º 3
0
 public function run($request)
 {
     $this->deleteAll(ArticlePage::get());
     $faker = Faker\Factory::create();
     $blogPage = BlogPage::get()->first();
     $img = new Image();
     $imgFile = 'themes/Helix/assets/images/doof.jpg';
     // var_dump($imgFile);
     $img->Filename = $imgFile;
     $img->Title = 'Template image';
     $img->write();
     for ($articles = 0; $articles < 20; $articles++) {
         $articlePage = new ArticlePage();
         $articlePage->Title = "Article " . $articles;
         $articlePage->Content = $faker->text(400);
         // $articlePage->summarySize = rand(1,3);
         $articlePage->summarySize = 1;
         $articlePage->SummaryImageID = $img->ID;
         $articlePage->setParent($blogPage);
         $articlePage->write();
         $articlePage->publish("Stage", "Live");
         $articlePage->flushCache();
     }
 }
Exemplo n.º 4
0
 public function LatestNews($count)
 {
     return BlogPage::get()->filter('ParentID', '18')->sort('Created', 'ASC')->limit($count);
 }