예제 #1
0
 function test_loadFile()
 {
     try {
         Layout::loadFile('nonexistent.tlf');
         $this->fail();
     } catch (Exception\StandardException $e) {
         $this->assertEquals('Layout File Not Found', $e->getSubject());
     }
     $layout = Layout::loadFile($this->dataLayoutFile('empty.tlf'));
     $this->assertInstanceOf('Thinreports\\Layout', $layout);
     $layout = Layout::loadFile($this->dataLayoutFile('all_items'));
     $this->assertInstanceOf('Thinreports\\Layout', $layout);
     $this->assertCount(9, $layout->getItemFormats());
 }
예제 #2
0
 /**
  * @param array $options {
  *      @option boolean "count" optional
  * }
  * @return Page\Page
  *
  * Usage example:
  *
  *  $page->addPage();
  *  $page->addPage(array('count' => false));
  */
 public function addPage()
 {
     $args = func_get_args();
     $layout = $this->layout;
     $options = null;
     if (isset($args) && array_key_exists('0', $args)) {
         if (is_string($args[0])) {
             $layout = Layout::loadFile($args[0]);
         } else {
             if (is_array($args[0])) {
                 $options = $args[0];
             }
         }
     } else {
         if (isset($args) && array_key_exists('1', $args)) {
             $options = $args[1];
         }
     }
     $options = $this->pageOptionValues($options);
     $page_number = $this->getNextPageNumber($options['count']);
     $new_page = new Page\Page($this, $layout, $page_number, $options['count']);
     $this->pages[] = $new_page;
     return $new_page;
 }
예제 #3
0
 /**
  * @param string $layout_filename
  */
 public function __construct($layout_filename)
 {
     $this->layout = Layout::loadFile($layout_filename);
 }
예제 #4
0
 /**
  * @access private
  *
  * @param string $layout_filename
  * @return Layout
  */
 public function buildLayout($layout_filename)
 {
     if (!array_key_exists($layout_filename, $this->layouts)) {
         $this->layouts[$layout_filename] = Layout::loadFile($layout_filename);
     }
     return $this->layouts[$layout_filename];
 }