Exemple #1
0
 function buildViewer($template_id, $album_id)
 {
     $this->template_id = $template_id;
     $this->album_id = $album_id;
     $this->setupDir();
     $templates = new Templates();
     $this->template = $templates->fetchRow('id=' . $template_id);
     if (!$this->template->data) {
         throw new BuilderException('Template not uploaded');
     }
     $this->writeResources();
     $images = $this->imageList();
     foreach ($images as $image) {
         $this->logger->info("building {$image->title}");
         $this->current_image = $image;
         $this->buildPage();
     }
     symlink($this->build_dir . '/1.html', $this->build_dir . '/index.html');
     $this->setBuildTime();
 }
 function saveData($id)
 {
     if (is_uploaded_file($_FILES['file']['tmp_name'])) {
         $templates = new Templates();
         $template = $templates->fetchRow('id = ' . $id);
         $template->data = join('', file($_FILES['file']['tmp_name']));
         $template->save();
         $this->resourcesToDb($this->findResources($template->data), $id);
     }
 }