예제 #1
0
 /**
  * Returns HTML version of create call
  * @param <AbstractObject> $instance of class serviced
  * @param <boolean> $created
  * @return Template 
  */
 protected function createToHtml($id)
 {
     // get template
     $template = new Template(Configuration::get('base_dir') . DS . 'templates' . DS . 'base.html');
     $template->replace('base_url', Configuration::get('base_url'));
     // options: created or not
     if ($id) {
         // make title
         $title = 'Invoice #' . $id . ' Created Successfully';
         $template->replace('title', $title);
         // make body
         $body = '<a href="' . $this->getLink() . '">List All</a> ';
         $body .= '<a href="' . $this->getLink() . '/' . $id . '/view">View</a> ';
         $body .= '<a href="' . $this->getLink() . '/' . $id . '/edit">Edit</a> ';
         $body .= '<a href="' . $this->getLink() . '/' . $id . '/delete">Delete</a>';
         $template->replace('content', $body);
     } else {
         // make title
         $title = 'New ' . Routing::getName();
         $template->replace('title', $title);
         $action = $this->getLink() . '/new/create';
         $template->replaceFromPHPFile('content', Configuration::get('base_dir') . DS . 'templates' . DS . 'invoice-create.php', array('action' => $action));
     }
     // return
     return $template;
 }