예제 #1
0
 /**
  * Override split() to remove all child rows and this element from the cellmap
  *
  * @param Frame $child
  * @param bool $force_pagebreak
  *
  * @return void
  */
 function split(Frame $child = null, $force_pagebreak = false)
 {
     if (is_null($child)) {
         parent::split();
         return;
     }
     // Remove child & all subsequent rows from the cellmap
     $cellmap = $this->get_parent()->get_cellmap();
     $iter = $child;
     while ($iter) {
         $cellmap->remove_row($iter);
         $iter = $iter->get_next_sibling();
     }
     // If we are splitting at the first child remove the
     // table-row-group from the cellmap as well
     if ($child === $this->get_first_child()) {
         $cellmap->remove_row_group($this);
         parent::split();
         return;
     }
     $cellmap->update_row_group($this, $child->get_prev_sibling());
     parent::split($child);
 }
예제 #2
0
 /**
  * split the table at $row.  $row and all subsequent rows will be
  * added to the clone.  This method is overidden in order to remove
  * frames from the cellmap properly.
  *
  * @param Frame $child
  * @param bool $force_pagebreak
  *
  * @return void
  */
 public function split(Frame $child = null, $force_pagebreak = false)
 {
     if (is_null($child)) {
         parent::split();
         return;
     }
     // If $child is a header or if it is the first non-header row, do
     // not duplicate headers, simply move the table to the next page.
     if (count($this->_headers) && !in_array($child, $this->_headers, true) && !in_array($child->get_prev_sibling(), $this->_headers, true)) {
         $first_header = null;
         // Insert copies of the table headers before $child
         foreach ($this->_headers as $header) {
             $new_header = $header->deep_copy();
             if (is_null($first_header)) {
                 $first_header = $new_header;
             }
             $this->insert_child_before($new_header, $child);
         }
         parent::split($first_header);
     } elseif (in_array($child->get_style()->display, self::$ROW_GROUPS)) {
         // Individual rows should have already been handled
         parent::split($child);
     } else {
         $iter = $child;
         while ($iter) {
             $this->_cellmap->remove_row($iter);
             $iter = $iter->get_next_sibling();
         }
         parent::split($child);
     }
 }