当前位置: 首页>>代码示例>>PHP>>正文


PHP Table_Frame_Decorator::find_parent_table方法代码示例

本文整理汇总了PHP中Table_Frame_Decorator::find_parent_table方法的典型用法代码示例。如果您正苦于以下问题:PHP Table_Frame_Decorator::find_parent_table方法的具体用法?PHP Table_Frame_Decorator::find_parent_table怎么用?PHP Table_Frame_Decorator::find_parent_table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Table_Frame_Decorator的用法示例。


在下文中一共展示了Table_Frame_Decorator::find_parent_table方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: reflow

 function reflow()
 {
     $page = $this->_frame->get_root();
     $style = $this->_frame->get_style();
     // Our width is equal to the width of our parent table
     $table = Table_Frame_Decorator::find_parent_table($this->_frame);
     $cb = $this->_frame->get_containing_block();
     foreach ($this->_frame->get_children() as $child) {
         // Bail if the page is full
         if ($page->is_full()) {
             break;
         }
         $child->set_containing_block($cb["x"], $cb["y"], $cb["w"], $cb["h"]);
         $child->reflow();
         // Check if a split has occured
         $page->check_page_break($child);
     }
     $cellmap = $table->get_cellmap();
     $style->width = $cellmap->get_frame_width($this->_frame);
     $style->height = $cellmap->get_frame_height($this->_frame);
     $this->_frame->set_position($cellmap->get_frame_position($this->_frame));
     if ($table->get_style()->border_collapse === "collapse") {
         // Unset our borders because our cells are now using them
         $style->border_style = "none";
     }
 }
开发者ID:automatweb,项目名称:automatweb_dev,代码行数:26,代码来源:table_row_group_frame_reflower.cls.php

示例2: reflow

 function reflow()
 {
     $page = $this->_frame->get_root();
     if ($page->is_full()) {
         return;
     }
     $this->_frame->position();
     $style = $this->_frame->get_style();
     $cb = $this->_frame->get_containing_block();
     foreach ($this->_frame->get_children() as $child) {
         if ($page->is_full()) {
             return;
         }
         $child->set_containing_block($cb);
         $child->reflow();
     }
     if ($page->is_full()) {
         return;
     }
     $table = Table_Frame_Decorator::find_parent_table($this->_frame);
     $cellmap = $table->get_cellmap();
     $style->width = $cellmap->get_frame_width($this->_frame);
     $style->height = $cellmap->get_frame_height($this->_frame);
     $this->_frame->set_position($cellmap->get_frame_position($this->_frame));
 }
开发者ID:sgrove,项目名称:cothinker,代码行数:25,代码来源:table_row_frame_reflower.cls.php

示例3: reflow

 function reflow(Frame_Decorator $block = null)
 {
     $page = $this->_frame->get_root();
     $style = $this->_frame->get_style();
     $table = Table_Frame_Decorator::find_parent_table($this->_frame);
     $cb = $this->_frame->get_containing_block();
     foreach ($this->_frame->get_children() as $child) {
         if ($page->is_full()) {
             return;
         }
         $child->set_containing_block($cb["x"], $cb["y"], $cb["w"], $cb["h"]);
         $child->reflow();
         $page->check_page_break($child);
     }
     if ($page->is_full()) {
         return;
     }
     $cellmap = $table->get_cellmap();
     $style->width = $cellmap->get_frame_width($this->_frame);
     $style->height = $cellmap->get_frame_height($this->_frame);
     $this->_frame->set_position($cellmap->get_frame_position($this->_frame));
     if ($table->get_style()->border_collapse === "collapse") {
         $style->border_style = "none";
     }
 }
开发者ID:EfncoPlugins,项目名称:web-portal-lite-client-portal-secure-file-sharing-private-messaging,代码行数:25,代码来源:table_row_group_frame_reflower.cls.php

示例4: position

  function position() {

    $table = Table_Frame_Decorator::find_parent_table($this->_frame);
    $cellmap = $table->get_cellmap();
    $this->_frame->set_position($cellmap->get_frame_position($this->_frame));

  }
开发者ID:hendrosteven,项目名称:f3-template,代码行数:7,代码来源:table_cell_positioner.cls.php

示例5: reflow

 function reflow(Block_Frame_Decorator $block = null)
 {
     $style = $this->_frame->get_style();
     $table = Table_Frame_Decorator::find_parent_table($this->_frame);
     //print_r($table);exit;
     $cellmap = $table->get_cellmap();
     list($x, $y) = $cellmap->get_frame_position($this->_frame);
     $this->_frame->set_position($x, $y);
     $cells = $cellmap->get_spanned_cells($this->_frame);
     $w = 0;
     foreach ($cells["columns"] as $i) {
         $col = $cellmap->get_column($i);
         $w += $col["used-width"];
     }
     //FIXME?
     $h = $this->_frame->get_containing_block("h");
     $left_space = $style->length_in_pt(array($style->margin_left, $style->padding_left, $style->border_left_width), $w);
     $right_space = $style->length_in_pt(array($style->padding_right, $style->margin_right, $style->border_right_width), $w);
     $top_space = $style->length_in_pt(array($style->margin_top, $style->padding_top, $style->border_top_width), $h);
     $bottom_space = $style->length_in_pt(array($style->margin_bottom, $style->padding_bottom, $style->border_bottom_width), $h);
     $style->width = $cb_w = $w - $left_space - $right_space;
     $content_x = $x + $left_space;
     $content_y = $line_y = $y + $top_space;
     // Adjust the first line based on the text-indent property
     $indent = $style->length_in_pt($style->text_indent, $w);
     $this->_frame->increase_line_width($indent);
     $page = $this->_frame->get_root();
     // Set the y position of the first line in the cell
     $line_box = $this->_frame->get_current_line_box();
     $line_box->y = $line_y;
     // Set the containing blocks and reflow each child
     foreach ($this->_frame->get_children() as $child) {
         if ($page->is_full()) {
             break;
         }
         $child->set_containing_block($content_x, $content_y, $cb_w, $h);
         $this->process_clear($child);
         $child->reflow($this->_frame);
         $this->process_float($child, $x + $left_space, $w - $right_space - $left_space);
     }
     // Determine our height
     $style_height = $style->length_in_pt($style->height, $h);
     $this->_frame->set_content_height($this->_calculate_content_height());
     $height = max($style_height, $this->_frame->get_content_height());
     // Let the cellmap know our height
     $cell_height = $height / count($cells["rows"]);
     if ($style_height <= $height) {
         $cell_height += $top_space + $bottom_space;
     }
     foreach ($cells["rows"] as $i) {
         $cellmap->set_row_height($i, $cell_height);
     }
     $style->height = $height;
     $this->_text_align();
     $this->vertical_align();
 }
开发者ID:ArunPrasaath,项目名称:bs,代码行数:56,代码来源:table_cell_frame_reflower.cls.php

示例6: normalise

 function normalise()
 {
     $p = Table_Frame_Decorator::find_parent_table($this);
     $erroneous_frames = array();
     foreach ($this->get_children() as $child) {
         $display = $child->get_style()->display;
         if ($display !== "table-cell") {
             $erroneous_frames[] = $child;
         }
     }
     foreach ($erroneous_frames as $frame) {
         $p->move_after($frame);
     }
 }
开发者ID:EfncoPlugins,项目名称:web-portal-lite-client-portal-secure-file-sharing-private-messaging,代码行数:14,代码来源:table_row_frame_decorator.cls.php

示例7: reflow

 function reflow(Frame_Decorator $block = null)
 {
     $style = $this->_frame->get_style();
     $table = Table_Frame_Decorator::find_parent_table($this->_frame);
     $cellmap = $table->get_cellmap();
     list($x, $y) = $cellmap->get_frame_position($this->_frame);
     $this->_frame->set_position($x, $y);
     $cells = $cellmap->get_spanned_cells($this->_frame);
     $w = 0;
     foreach ($cells["columns"] as $i) {
         $col = $cellmap->get_column($i);
         $w += $col["used-width"];
     }
     $h = $this->_frame->get_containing_block("h");
     $left_space = $style->length_in_pt(array($style->margin_left, $style->padding_left, $style->border_left_width), $w);
     $right_space = $style->length_in_pt(array($style->padding_right, $style->margin_right, $style->border_right_width), $w);
     $top_space = $style->length_in_pt(array($style->margin_top, $style->padding_top, $style->border_top_width), $h);
     $bottom_space = $style->length_in_pt(array($style->margin_bottom, $style->padding_bottom, $style->border_bottom_width), $h);
     $style->width = $cb_w = $w - $left_space - $right_space;
     $content_x = $x + $left_space;
     $content_y = $line_y = $y + $top_space;
     $indent = $style->length_in_pt($style->text_indent, $w);
     $this->_frame->increase_line_width($indent);
     $page = $this->_frame->get_root();
     $this->_frame->set_current_line($line_y);
     foreach ($this->_frame->get_children() as $child) {
         if ($page->is_full()) {
             break;
         }
         $child->set_containing_block($content_x, $content_y, $cb_w, $h);
         $child->reflow($this->_frame);
         $this->process_float($child, $x + $left_space, $w - $right_space - $left_space);
     }
     $style_height = $style->length_in_pt($style->height, $h);
     $this->_frame->set_content_height($this->_calculate_content_height());
     $height = max($style_height, $this->_frame->get_content_height());
     $cell_height = $height / count($cells["rows"]);
     if ($style_height <= $height) {
         $cell_height += $top_space + $bottom_space;
     }
     foreach ($cells["rows"] as $i) {
         $cellmap->set_row_height($i, $cell_height);
     }
     $style->height = $height;
     $this->_text_align();
     $this->vertical_align();
 }
开发者ID:EfncoPlugins,项目名称:web-portal-lite-client-portal-secure-file-sharing-private-messaging,代码行数:47,代码来源:table_cell_frame_reflower.cls.php

示例8: normalise

  /**
   * Remove all non table-cell frames from this row and move them after
   * the table.
   */
  function normalise() {

    // Find our table parent
    $p = Table_Frame_Decorator::find_parent_table($this);

    $erroneous_frames = array();
    foreach ($this->get_children() as $child) {
      $display = $child->get_style()->display;

      if ( $display !== "table-cell" )
        $erroneous_frames[] = $child;
    }

    //  dump the extra nodes after the table.
    foreach ($erroneous_frames as $frame)
      $p->move_after($frame);
  }
开发者ID:hendrosteven,项目名称:f3-template,代码行数:21,代码来源:table_row_frame_decorator.cls.php

示例9: reflow

 function reflow()
 {
     $style = $this->_frame->get_style();
     $table = Table_Frame_Decorator::find_parent_table($this->_frame);
     $cellmap = $table->get_cellmap();
     list($x, $y) = $cellmap->get_frame_position($this->_frame);
     $this->_frame->set_position($x, $y);
     $cells = $cellmap->get_spanned_cells($this->_frame);
     $w = 0;
     foreach ($cells["columns"] as $i) {
         $col = $cellmap->get_column($i);
         $w += $col["used-width"];
     }
     //FIXME?
     $h = $this->_frame->get_containing_block("h");
     $left_space = $style->length_in_pt(array($style->margin_left, $style->padding_left, $style->border_left_width), $w);
     $right_space = $style->length_in_pt(array($style->padding_right, $style->margin_right, $style->border_right_width), $w);
     $top_space = $style->length_in_pt(array($style->margin_top, $style->padding_top, $style->border_top_width), $w);
     $bottom_space = $style->length_in_pt(array($style->margin_bottom, $style->padding_bottom, $style->border_bottom_width), $w);
     $style->width = $cb_w = $w - $left_space - $right_space;
     $content_x = $x + $left_space;
     $content_y = $line_y = $y + $top_space;
     // Adjust the first line based on the text-indent property
     $indent = $style->length_in_pt($style->text_indent, $w);
     $this->_frame->increase_line_width($indent);
     // Set the y position of the first line in the cell
     $this->_frame->set_current_line($line_y);
     // Set the containing blocks and reflow each child
     foreach ($this->_frame->get_children() as $child) {
         $child->set_containing_block($content_x, $content_y, $cb_w, $h);
         $child->reflow();
         $this->_frame->add_frame_to_line($child);
     }
     // Determine our height
     $height = $style->length_in_pt($style->height, $w);
     $this->_frame->set_content_height($this->_calculate_content_height());
     $height = max($height, $this->_frame->get_content_height());
     // Let the cellmap know our height
     $cell_height = $height / count($cells["rows"]) + $top_space + $bottom_space;
     foreach ($cells["rows"] as $i) {
         $cellmap->set_row_height($i, $cell_height);
     }
     // FIXME: where should this go?
     $this->_text_align();
 }
开发者ID:andrewroth,项目名称:c4c_intranet,代码行数:45,代码来源:table_cell_frame_reflower.cls.php

示例10: reflow

 function reflow()
 {
     $style = $this->_frame->get_style();
     // Our width is equal to the width of our parent table
     $table = Table_Frame_Decorator::find_parent_table($this->_frame);
     $cb = $this->_frame->get_containing_block();
     foreach ($this->_frame->get_children() as $child) {
         $child->set_containing_block($cb["x"], $cb["y"], $cb["w"], $cb["h"]);
         $child->reflow();
     }
     $cellmap = $table->get_cellmap();
     $style->width = $cellmap->get_frame_width($this->_frame);
     $style->height = $cellmap->get_frame_height($this->_frame);
     $this->_frame->set_position($cellmap->get_frame_position($this->_frame));
     if ($table->get_style()->border_collapse === "collapse") {
         // Unset our borders because our cells are now using them
         $style->border_style = "none";
     }
 }
开发者ID:andrewroth,项目名称:c4c_intranet,代码行数:19,代码来源:table_row_group_frame_reflower.cls.php

示例11: _page_break_allowed


//.........这里部分代码省略.........
         // page_break_inside property.
         $parent = $frame->get_parent();
         if ($prev && $parent && $parent->get_style()->page_break_inside === "avoid") {
             dompdf_debug("page-break", "parent inside: avoid");
             return false;
         }
         // To prevent cascading page breaks when a top-level element has
         // page-break-inside: avoid, ensure that at least one frame is
         // on the page before splitting.
         if ($parent->get_node()->nodeName === "body" && !$prev) {
             // We are the body's first child
             dompdf_debug("page-break", "Body's first child.");
             return false;
         }
         // If the frame is the first block-level frame, use the value from
         // $frame's parent instead.
         if (!$prev && $parent) {
             return $this->_page_break_allowed($parent);
         }
         dompdf_debug("page-break", "block: break allowed");
         return true;
     } else {
         if (in_array($display, Style::$INLINE_TYPES)) {
             // Avoid breaks within table-cells
             if ($this->_in_table) {
                 dompdf_debug("page-break", "In table: " . $this->_in_table);
                 return false;
             }
             // Rule C
             $block_parent = $frame->find_block_parent();
             if (count($block_parent->get_line_boxes()) < $frame->get_style()->orphans) {
                 dompdf_debug("page-break", "orphans");
                 return false;
             }
             // FIXME: Checking widows is tricky without having laid out the
             // remaining line boxes.  Just ignore it for now...
             // Rule D
             $p = $block_parent;
             while ($p) {
                 if ($p->get_style()->page_break_inside === "avoid") {
                     dompdf_debug("page-break", "parent->inside: avoid");
                     return false;
                 }
                 $p = $p->find_block_parent();
             }
             // To prevent cascading page breaks when a top-level element has
             // page-break-inside: avoid, ensure that at least one frame with
             // some content is on the page before splitting.
             $prev = $frame->get_prev_sibling();
             while ($prev && ($prev->is_text_node() && trim($prev->get_node()->nodeValue) == "")) {
                 $prev = $prev->get_prev_sibling();
             }
             if ($block_parent->get_node()->nodeName === "body" && !$prev) {
                 // We are the body's first child
                 dompdf_debug("page-break", "Body's first child.");
                 return false;
             }
             // Skip breaks on empty text nodes
             if ($frame->is_text_node() && $frame->get_node()->nodeValue == "") {
                 return false;
             }
             dompdf_debug("page-break", "inline: break allowed");
             return true;
             // Table-rows
         } else {
             if ($display === "table-row") {
                 // Simply check if the parent table's page_break_inside property is
                 // not 'avoid'
                 $p = Table_Frame_Decorator::find_parent_table($frame);
                 while ($p) {
                     if ($p->get_style()->page_break_inside === "avoid") {
                         dompdf_debug("page-break", "parent->inside: avoid");
                         return false;
                     }
                     $p = $p->find_block_parent();
                 }
                 // Avoid breaking after the first row of a table
                 if ($p && $p->get_first_child() === $frame) {
                     dompdf_debug("page-break", "table: first-row");
                     return false;
                 }
                 // If this is a nested table, prevent the page from breaking
                 if ($this->_in_table > 1) {
                     dompdf_debug("page-break", "table: nested table");
                     return false;
                 }
                 dompdf_debug("page-break", "table-row/row-groups: break allowed");
                 return true;
             } else {
                 if (in_array($display, Table_Frame_Decorator::$ROW_GROUPS)) {
                     // Disallow breaks at row-groups: only split at row boundaries
                     return false;
                 } else {
                     dompdf_debug("page-break", "? " . $frame->get_style()->display . "");
                     return false;
                 }
             }
         }
     }
 }
开发者ID:rogeriocc,项目名称:fabrik,代码行数:101,代码来源:page_frame_decorator.cls.php

示例12: render

 function render(Frame $frame)
 {
     $style = $frame->get_style();
     if (trim($frame->get_node()->nodeValue) === "" && $style->empty_cells === "hide") {
         return;
     }
     $this->_set_opacity($frame->get_opacity($style->opacity));
     list($x, $y, $w, $h) = $frame->get_border_box();
     // Draw our background, border and content
     if (($bg = $style->background_color) !== "transparent") {
         $this->_canvas->filled_rectangle($x, $y, $w, $h, $bg);
     }
     if (($url = $style->background_image) && $url !== "none") {
         $this->_background_image($url, $x, $y, $w, $h, $style);
     }
     $table = Table_Frame_Decorator::find_parent_table($frame);
     if ($table->get_style()->border_collapse !== "collapse") {
         $this->_render_border($frame);
         $this->_render_outline($frame);
         return;
     }
     // The collapsed case is slightly complicated...
     // @todo Add support for outlines here
     $cellmap = $table->get_cellmap();
     $cells = $cellmap->get_spanned_cells($frame);
     $num_rows = $cellmap->get_num_rows();
     $num_cols = $cellmap->get_num_cols();
     // Determine the top row spanned by this cell
     $i = $cells["rows"][0];
     $top_row = $cellmap->get_row($i);
     // Determine if this cell borders on the bottom of the table.  If so,
     // then we draw its bottom border.  Otherwise the next row down will
     // draw its top border instead.
     if (in_array($num_rows - 1, $cells["rows"])) {
         $draw_bottom = true;
         $bottom_row = $cellmap->get_row($num_rows - 1);
     } else {
         $draw_bottom = false;
     }
     // Draw the horizontal borders
     foreach ($cells["columns"] as $j) {
         $bp = $cellmap->get_border_properties($i, $j);
         $y = $top_row["y"] - $bp["top"]["width"] / 2;
         $col = $cellmap->get_column($j);
         $x = $col["x"] - $bp["left"]["width"] / 2;
         $w = $col["used-width"] + ($bp["left"]["width"] + $bp["right"]["width"]) / 2;
         if ($bp["top"]["style"] !== "none" && $bp["top"]["width"] > 0) {
             $widths = array($bp["top"]["width"], $bp["right"]["width"], $bp["bottom"]["width"], $bp["left"]["width"]);
             $method = "_border_" . $bp["top"]["style"];
             $this->{$method}($x, $y, $w, $bp["top"]["color"], $widths, "top", "square");
         }
         if ($draw_bottom) {
             $bp = $cellmap->get_border_properties($num_rows - 1, $j);
             if ($bp["bottom"]["style"] === "none" || $bp["bottom"]["width"] <= 0) {
                 continue;
             }
             $y = $bottom_row["y"] + $bottom_row["height"] + $bp["bottom"]["width"] / 2;
             $widths = array($bp["top"]["width"], $bp["right"]["width"], $bp["bottom"]["width"], $bp["left"]["width"]);
             $method = "_border_" . $bp["bottom"]["style"];
             $this->{$method}($x, $y, $w, $bp["bottom"]["color"], $widths, "bottom", "square");
         }
     }
     $j = $cells["columns"][0];
     $left_col = $cellmap->get_column($j);
     if (in_array($num_cols - 1, $cells["columns"])) {
         $draw_right = true;
         $right_col = $cellmap->get_column($num_cols - 1);
     } else {
         $draw_right = false;
     }
     // Draw the vertical borders
     foreach ($cells["rows"] as $i) {
         $bp = $cellmap->get_border_properties($i, $j);
         $x = $left_col["x"] - $bp["left"]["width"] / 2;
         $row = $cellmap->get_row($i);
         $y = $row["y"] - $bp["top"]["width"] / 2;
         $h = $row["height"] + ($bp["top"]["width"] + $bp["bottom"]["width"]) / 2;
         if ($bp["left"]["style"] !== "none" && $bp["left"]["width"] > 0) {
             $widths = array($bp["top"]["width"], $bp["right"]["width"], $bp["bottom"]["width"], $bp["left"]["width"]);
             $method = "_border_" . $bp["left"]["style"];
             $this->{$method}($x, $y, $h, $bp["left"]["color"], $widths, "left", "square");
         }
         if ($draw_right) {
             $bp = $cellmap->get_border_properties($i, $num_cols - 1);
             if ($bp["right"]["style"] === "none" || $bp["right"]["width"] <= 0) {
                 continue;
             }
             $x = $right_col["x"] + $right_col["used-width"] + $bp["right"]["width"] / 2;
             $widths = array($bp["top"]["width"], $bp["right"]["width"], $bp["bottom"]["width"], $bp["left"]["width"]);
             $method = "_border_" . $bp["right"]["style"];
             $this->{$method}($x, $y, $h, $bp["right"]["color"], $widths, "right", "square");
         }
     }
 }
开发者ID:skyosev,项目名称:OpenCart-Overclocked,代码行数:94,代码来源:table_cell_renderer.cls.php

示例13: _page_break_allowed


//.........这里部分代码省略.........
         // Does the previous element allow a page break after?
         if ($prev && $prev->get_style()->page_break_after == "avoid") {
             //        echo "after: avoid\n";
             return false;
         }
         // If both $prev & $frame have the same parent, check the parent's
         // page_break_inside property.
         $parent = $frame->get_parent();
         if ($prev && $parent && $parent->get_style()->page_break_inside == "avoid") {
             //          echo "parent inside: avoid\n";
             return false;
         }
         // To prevent cascading page breaks when a top-level element has
         // page-break-inside: avoid, ensure that at least one frame is
         // on the page before splitting.
         if ($parent->get_node()->nodeName == "body" && !$prev) {
             // We are the body's first child
             //          echo "Body's first child.\n";
             return false;
         }
         // If the frame is the first block-level frame, use the value from
         // $frame's parent instead.
         if (!$prev && $parent) {
             return $this->_page_break_allowed($parent);
         }
         //       echo "block: break allowed\n";
         return true;
     } else {
         if (in_array($display, Style::$INLINE_TYPES)) {
             // Avoid breaks within table-cells
             if ($this->_in_table) {
                 //          echo "In table: " . $this->_in_table ."\n";
                 return false;
             }
             // Rule C
             $block_parent = $frame->find_block_parent();
             if (count($block_parent->get_lines()) < $frame->get_style()->orphans) {
                 //          echo "orphans\n";
                 return false;
             }
             // FIXME: Checking widows is tricky without having laid out the
             // remaining line boxes.  Just ignore it for now...
             // Rule D
             if ($block_parent->get_style()->page_break_inside == "avoid") {
                 //          echo "parent->inside: avoid\n";
                 return false;
             }
             // To prevent cascading page breaks when a top-level element has
             // page-break-inside: avoid, ensure that at least one frame with
             // some content is on the page before splitting.
             $prev = $frame->get_prev_sibling();
             while ($prev && ($prev->get_node()->nodeName == "#text" && trim($prev->get_node()->nodeValue) == "")) {
                 $prev = $prev->get_prev_sibling();
             }
             if ($block_parent->get_node()->nodeName == "body" && !$prev) {
                 // We are the body's first child
                 //          echo "Body's first child.\n";
                 return false;
             }
             // Skip breaks on empty text nodes
             if ($frame->get_node()->nodeName == "#text" && $frame->get_node()->nodeValue == "") {
                 return false;
             }
             //       echo "inline: break allowed\n";
             return true;
             // Table-rows
         } else {
             if ($display == "table-row") {
                 // Simply check if the parent table's page_break_inside property is
                 // not 'avoid'
                 $p = Table_Frame_Decorator::find_parent_table($frame);
                 if ($p->get_style()->page_break_inside == "avoid") {
                     //          echo "table: page-break-inside: avoid\n";
                     return false;
                 }
                 // Check the table's parent element
                 $table_parent = $p->get_parent();
                 if ($table_parent->get_style()->page_break_inside == "avoid") {
                     //          echo "table->parent: page-break-inside: avoid\n";
                     return false;
                 }
                 // Avoid breaking after the first row of a table
                 if ($p->get_first_child() === $frame) {
                     //         echo "table: first-row\n";
                     return false;
                 }
                 //       echo "table-row/row-groups: break allowed\n";
                 return true;
             } else {
                 if (in_array($display, Table_Frame_Decorator::$ROW_GROUPS)) {
                     // Disallow breaks at row-groups: only split at row boundaries
                     return false;
                 } else {
                     //       echo "? " . $frame->get_style()->display . "\n";
                     return false;
                 }
             }
         }
     }
 }
开发者ID:agashish,项目名称:test_new,代码行数:101,代码来源:page_frame_decorator.cls.php

示例14: _page_break_allowed

 protected function _page_break_allowed(Frame $frame)
 {
     $block_types = array("block", "list-item", "table", "-dompdf-image");
     dompdf_debug("page-break", "_page_break_allowed(" . $frame->get_node()->nodeName . ")");
     $display = $frame->get_style()->display;
     if (in_array($display, $block_types)) {
         if ($this->_in_table) {
             dompdf_debug("page-break", "In table: " . $this->_in_table);
             return false;
         }
         if ($frame->get_style()->page_break_before === "avoid") {
             dompdf_debug("page-break", "before: avoid");
             return false;
         }
         $prev = $frame->get_prev_sibling();
         while ($prev && !in_array($prev->get_style()->display, $block_types)) {
             $prev = $prev->get_prev_sibling();
         }
         if ($prev && $prev->get_style()->page_break_after === "avoid") {
             dompdf_debug("page-break", "after: avoid");
             return false;
         }
         $parent = $frame->get_parent();
         if ($prev && $parent && $parent->get_style()->page_break_inside === "avoid") {
             dompdf_debug("page-break", "parent inside: avoid");
             return false;
         }
         if ($parent->get_node()->nodeName === "body" && !$prev) {
             dompdf_debug("page-break", "Body's first child.");
             return false;
         }
         if (!$prev && $parent) {
             return $this->_page_break_allowed($parent);
         }
         dompdf_debug("page-break", "block: break allowed");
         return true;
     } else {
         if (in_array($display, Style::$INLINE_TYPES)) {
             if ($this->_in_table) {
                 dompdf_debug("page-break", "In table: " . $this->_in_table);
                 return false;
             }
             $block_parent = $frame->find_block_parent();
             if (count($block_parent->get_line_boxes()) < $frame->get_style()->orphans) {
                 dompdf_debug("page-break", "orphans");
                 return false;
             }
             $p = $block_parent;
             while ($p) {
                 if ($p->get_style()->page_break_inside === "avoid") {
                     dompdf_debug("page-break", "parent->inside: avoid");
                     return false;
                 }
                 $p = $p->find_block_parent();
             }
             $prev = $frame->get_prev_sibling();
             while ($prev && ($prev->is_text_node() && trim($prev->get_node()->nodeValue) == "")) {
                 $prev = $prev->get_prev_sibling();
             }
             if ($block_parent->get_node()->nodeName === "body" && !$prev) {
                 dompdf_debug("page-break", "Body's first child.");
                 return false;
             }
             if ($frame->is_text_node() && $frame->get_node()->nodeValue == "") {
                 return false;
             }
             dompdf_debug("page-break", "inline: break allowed");
             return true;
         } else {
             if ($display === "table-row") {
                 $p = Table_Frame_Decorator::find_parent_table($frame);
                 while ($p) {
                     if ($p->get_style()->page_break_inside === "avoid") {
                         dompdf_debug("page-break", "parent->inside: avoid");
                         return false;
                     }
                     $p = $p->find_block_parent();
                 }
                 if ($p && $p->get_first_child() === $frame) {
                     dompdf_debug("page-break", "table: first-row");
                     return false;
                 }
                 if ($this->_in_table > 1) {
                     dompdf_debug("page-break", "table: nested table");
                     return false;
                 }
                 dompdf_debug("page-break", "table-row/row-groups: break allowed");
                 return true;
             } else {
                 if (in_array($display, Table_Frame_Decorator::$ROW_GROUPS)) {
                     return false;
                 } else {
                     dompdf_debug("page-break", "? " . $frame->get_style()->display . "");
                     return false;
                 }
             }
         }
     }
 }
开发者ID:EfncoPlugins,项目名称:web-portal-lite-client-portal-secure-file-sharing-private-messaging,代码行数:99,代码来源:page_frame_decorator.cls.php


注:本文中的Table_Frame_Decorator::find_parent_table方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。