public function write() { $grb = new GroupRepositoryBuilder($this->siteContainer); $this->outFolder->addFileContents('group', 'index.html', $this->twigHelper->getTwig()->render('grouplist/index.html.twig', array_merge($this->baseViewParameters, array('groups' => $grb->fetchAll())))); $grb = new GroupRepositoryBuilder($this->siteContainer); foreach ($grb->fetchAll() as $group) { $erb = new EventRepositoryBuilder($this->siteContainer); $erb->setGroup($group); $erb->setAfterNow(); $this->outFolder->addFileContents('group' . DIRECTORY_SEPARATOR . $group->getSlug(), 'index.html', $this->twigHelper->getTwig()->render('group/index.html.twig', array_merge($this->baseViewParameters, array('group' => $group, 'events' => $grb->fetchAll())))); } }
public function write() { $crbAll = new CountryRepositoryBuilder($this->siteContainer); $crbEvents = new CountryRepositoryBuilder($this->siteContainer); $crbEvents->setHasEventsOnly(true); $this->outFolder->addFileContents('country', 'index.html', $this->twigHelper->getTwig()->render('countrylist/index.html.twig', array_merge($this->baseViewParameters, array('countries' => $crbEvents->fetchAll())))); foreach ($crbAll->fetchAll() as $country) { $erb = new EventRepositoryBuilder($this->siteContainer); $erb->setCountry($country); $erb->setAfterNow(); $arb = new AreaRepositoryBuilder($this->siteContainer); $arb->setCountry($country); $arb->setNoParentArea(true); $this->outFolder->addFileContents('country' . DIRECTORY_SEPARATOR . strtoupper($country->getTwoCharCode()), 'index.html', $this->twigHelper->getTwig()->render('country/index.html.twig', array_merge($this->baseViewParameters, array('country' => $country, 'events' => $erb->fetchAll(), 'areas' => $arb->fetchAll())))); } }
function write($outDir) { $twigHelper = new TwigHelper($this->siteContainer['site']); $twig = $twigHelper->getTwig(); $outFolder = new OutFolder($outDir); // General Data $data = array('config' => $this->siteContainer['site']->getConfig()); $erb = new EventRepositoryBuilder($this->siteContainer); $erb->setAfterNow(); $erb->fetchAll(); $this->siteContainer['log']->info('Writing Index pages'); // Index $outFolder->addFileContents('', 'index.html', $twig->render('index.html.twig', array_merge($data, array('events' => $erb->fetchAll())))); // Event pages $this->siteContainer['log']->info('Writing Event pages'); $outFolder->addFileContents('event', 'index.html', $twig->render('eventlist/index.html.twig', array_merge($data, array('events' => $erb->fetchAll())))); $erb = new EventRepositoryBuilder($this->siteContainer); $outFolder->addFileContents('event', 'all.html', $twig->render('eventlist/all.html.twig', array_merge($data, array('events' => $erb->fetchAll())))); $erb = new EventRepositoryBuilder($this->siteContainer); foreach ($erb->fetchAll() as $event) { $grb = new GroupRepositoryBuilder($this->siteContainer); $grb->setEvent($event); $outFolder->addFileContents('event' . DIRECTORY_SEPARATOR . $event->getSlug(), 'index.html', $twig->render('event/index.html.twig', array_merge($data, array('event' => $event, 'groups' => $grb->fetchAll())))); } // Country pages $this->siteContainer['log']->info('Writing Country pages'); $x = new CountryWriteComponent($this->siteContainer, $outFolder, $twigHelper); $x->write(); // Group pages $this->siteContainer['log']->info('Writing Group pages'); $x = new GroupWriteComponent($this->siteContainer, $outFolder, $twigHelper); $x->write(); // Area pages $this->siteContainer['log']->info('Writing Area pages'); $x = new AreaWriteComponent($this->siteContainer, $outFolder, $twigHelper); $x->write(); // all ical $this->siteContainer['log']->info('Writing iCalendar API pages'); $x = new AllEventsICalendarComponent($this->siteContainer, $outFolder, $twigHelper); $x->write(); // CSS $lesscss = $this->siteContainer['lesscss']; $lesscss->setVariables(array('colourMain' => '#0DA20D', 'colourDarker1' => '#007900', 'colourDarker2' => '#004300', 'colourLighter1' => '#36C036', 'colourLighter2' => '#72DA72', 'colourBackgroundOutsidePage' => '#B7CFB7', 'listDataItemsMarginTopBottom' => '5px', 'listDataItemsMarginLeftRightNarrowScreen' => '5px', 'listDataItemsMarginLeftRightWideScreen' => '50px', 'narrowScreensMakeTwoColumnsIntoOneBoundary' => '750px', 'narrowScreensMakeEverythingHorizontalIntoVerticalBoundary' => '500px')); $outFolder->addFileContents('css', 'main.css', $lesscss->compileFile(APP_ROOT_DIR . 'theme' . DIRECTORY_SEPARATOR . 'overthewall' . DIRECTORY_SEPARATOR . 'css' . DIRECTORY_SEPARATOR . 'main.less')); }