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


PHP Table_Frame_Decorator::get_style方法代码示例

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


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

示例1: _calculate_height

 protected function _calculate_height()
 {
     $style = $this->_frame->get_style();
     $height = $style->height;
     $cellmap = $this->_frame->get_cellmap();
     $cellmap->assign_frame_heights();
     $rows = $cellmap->get_rows();
     // Determine our content height
     $content_height = 0;
     foreach ($rows as $r) {
         $content_height += $r["height"];
     }
     $cb = $this->_frame->get_containing_block();
     if (!($style->overflow === "visible" || $style->overflow === "hidden" && $height === "auto")) {
         // Only handle min/max height if the height is independent of the frame's content
         $min_height = $style->min_height;
         $max_height = $style->max_height;
         if (isset($cb["h"])) {
             $min_height = $style->length_in_pt($min_height, $cb["h"]);
             $max_height = $style->length_in_pt($max_height, $cb["h"]);
         } else {
             if (isset($cb["w"])) {
                 if (mb_strpos($min_height, "%") !== false) {
                     $min_height = 0;
                 } else {
                     $min_height = $style->length_in_pt($min_height, $cb["w"]);
                 }
                 if (mb_strpos($max_height, "%") !== false) {
                     $max_height = "none";
                 } else {
                     $max_height = $style->length_in_pt($max_height, $cb["w"]);
                 }
             }
         }
         if ($max_height !== "none" && $min_height > $max_height) {
             list($max_height, $min_height) = array($min_height, $max_height);
         }
         if ($max_height !== "none" && $height > $max_height) {
             $height = $max_height;
         }
         if ($height < $min_height) {
             $height = $min_height;
         }
     } else {
         // Use the content height or the height value, whichever is greater
         if ($height !== "auto") {
             $height = $style->length_in_pt($height, $cb["h"]);
             if ($height <= $content_height) {
                 $height = $content_height;
             } else {
                 $cellmap->set_frame_heights($height, $content_height);
             }
         } else {
             $height = $content_height;
         }
     }
     return $height;
 }
开发者ID:BozzaCoon,项目名称:SPHERE-Framework,代码行数:58,代码来源:table_frame_reflower.cls.php

示例2: array

 function get_min_max_width()
 {
     if (!is_null($this->_min_max_cache)) {
         return $this->_min_max_cache;
     }
     $style = $this->_frame->get_style();
     $this->_frame->normalise();
     // Add the cells to the cellmap (this will calcluate column widths as
     // frames are added)
     $this->_frame->get_cellmap()->add_frame($this->_frame);
     // Find the min/max width of the table and sort the columns into
     // absolute/percent/auto arrays
     $this->_state = array();
     $this->_state["min_width"] = 0;
     $this->_state["max_width"] = 0;
     $this->_state["percent_used"] = 0;
     $this->_state["absolute_used"] = 0;
     $this->_state["auto_min"] = 0;
     $this->_state["absolute"] = array();
     $this->_state["percent"] = array();
     $this->_state["auto"] = array();
     $columns =& $this->_frame->get_cellmap()->get_columns();
     foreach (array_keys($columns) as $i) {
         $this->_state["min_width"] += $columns[$i]["min-width"];
         $this->_state["max_width"] += $columns[$i]["max-width"];
         if ($columns[$i]["absolute"] > 0) {
             $this->_state["absolute"][] = $i;
             $this->_state["absolute_used"] += $columns[$i]["absolute"];
         } else {
             if ($columns[$i]["percent"] > 0) {
                 $this->_state["percent"][] = $i;
                 $this->_state["percent_used"] += $columns[$i]["percent"];
             } else {
                 $this->_state["auto"][] = $i;
                 $this->_state["auto_min"] += $columns[$i]["min-width"];
             }
         }
     }
     // Account for margins & padding
     $dims = array($style->border_left_width, $style->border_right_width, $style->padding_left, $style->padding_right, $style->margin_left, $style->margin_right);
     if ($style->border_collapse !== "collapse") {
         list($dims[]) = $style->border_spacing;
     }
     $delta = $style->length_in_pt($dims, $this->_frame->get_containing_block("w"));
     $this->_state["min_width"] += $delta;
     $this->_state["max_width"] += $delta;
     return $this->_min_max_cache = array($this->_state["min_width"], $this->_state["max_width"], "min" => $this->_state["min_width"], "max" => $this->_state["max_width"]);
 }
开发者ID:darshanmodi2010,项目名称:dompdf,代码行数:48,代码来源:table_frame_reflower.cls.php

示例3: foreach

 function add_frame(Frame $frame)
 {
     $style = $frame->get_style();
     $display = $style->display;
     $collapse = $this->_table->get_style()->border_collapse == "collapse";
     // Recursively add the frames within tables, table-row-groups and table-rows
     if ($display == "table-row" || $display == "table" || $display == "inline-table" || in_array($display, Table_Frame_Decorator::$ROW_GROUPS)) {
         $start_row = $this->__row;
         foreach ($frame->get_children() as $child) {
             $this->add_frame($child);
         }
         if ($display == "table-row") {
             $this->add_row();
         }
         $num_rows = $this->__row - $start_row - 1;
         $key = $frame->get_id();
         // Row groups always span across the entire table
         $this->_frames[$key]["columns"] = range(0, max(0, $this->_num_cols - 1));
         $this->_frames[$key]["rows"] = range($start_row, max(0, $this->__row - 1));
         $this->_frames[$key]["frame"] = $frame;
         if ($display != "table-row" && $collapse) {
             $bp = $style->get_border_properties();
             // Resolve the borders
             for ($i = 0; $i < $num_rows + 1; $i++) {
                 $this->_resolve_border($start_row + $i, 0, "vertical", $bp["left"]);
                 $this->_resolve_border($start_row + $i, $this->_num_cols, "vertical", $bp["right"]);
             }
             for ($j = 0; $j < $this->_num_cols; $j++) {
                 $this->_resolve_border($start_row, $j, "horizontal", $bp["top"]);
                 $this->_resolve_border($this->__row, $j, "horizontal", $bp["bottom"]);
             }
         }
         return;
     }
     // Determine where this cell is going
     $colspan = $frame->get_node()->getAttribute("colspan");
     $rowspan = $frame->get_node()->getAttribute("rowspan");
     if (!$colspan) {
         $colspan = 1;
         $frame->get_node()->setAttribute("colspan", 1);
     }
     if (!$rowspan) {
         $rowspan = 1;
         $frame->get_node()->setAttribute("rowspan", 1);
     }
     $key = $frame->get_id();
     $bp = $style->get_border_properties();
     // Add the frame to the cellmap
     $max_left = $max_right = 0;
     // Find the next available column (fix by Ciro Mondueri)
     $ac = $this->__col;
     while (isset($this->_cells[$this->__row][$ac])) {
         $ac++;
     }
     $this->__col = $ac;
     // Rows:
     for ($i = 0; $i < $rowspan; $i++) {
         $row = $this->__row + $i;
         $this->_frames[$key]["rows"][] = $row;
         for ($j = 0; $j < $colspan; $j++) {
             $this->_cells[$row][$this->__col + $j] = $frame;
         }
         if ($collapse) {
             // Resolve vertical borders
             $max_left = max($max_left, $this->_resolve_border($row, $this->__col, "vertical", $bp["left"]));
             $max_right = max($max_right, $this->_resolve_border($row, $this->__col + $colspan, "vertical", $bp["right"]));
         }
     }
     $max_top = $max_bottom = 0;
     // Columns:
     for ($j = 0; $j < $colspan; $j++) {
         $col = $this->__col + $j;
         $this->_frames[$key]["columns"][] = $col;
         if ($collapse) {
             // Resolve horizontal borders
             $max_top = max($max_top, $this->_resolve_border($this->__row, $col, "horizontal", $bp["top"]));
             $max_bottom = max($max_bottom, $this->_resolve_border($this->__row + $rowspan, $col, "horizontal", $bp["bottom"]));
         }
     }
     $this->_frames[$key]["frame"] = $frame;
     // Handle seperated border model
     if (!$collapse) {
         list($h, $v) = $this->_table->get_style()->border_spacing;
         // Border spacing is effectively a margin between cells
         $v = $style->length_in_pt($v) / 2;
         $h = $style->length_in_pt($h) / 2;
         $style->margin = "{$v} {$h}";
         // The additional 1/2 width gets added to the table proper
     } else {
         // Drop the frame's actual border
         $style->border_left_width = $max_left / 2;
         $style->border_right_width = $max_right / 2;
         $style->border_top_width = $max_top / 2;
         $style->border_bottom_width = $max_bottom / 2;
         $style->margin = "none";
     }
     // Resolve the frame's width
     list($frame_min, $frame_max) = $frame->get_min_max_width();
     $width = $style->width;
     if (is_percent($width)) {
//.........这里部分代码省略.........
开发者ID:NeCkEr,项目名称:CRUDGrid,代码行数:101,代码来源:cellmap.cls.php


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