⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 table.php

📁 完美的在线教育系统
💻 PHP
📖 第 1 页 / 共 2 页
字号:
     */    function setColType($col, $type)    {        $this->_tbody->setColType($col, $type);    }    /**     * Sets the cell attributes for an existing cell.     *     * If the given indices do not exist and autoGrow is true then the given     * row and/or col is automatically added.  If autoGrow is false then an     * error is returned.     * @param    int        $row         Row index     * @param    int        $col         Column index     * @param    mixed      $attributes  Associative array or string of table row attributes     * @access   public     * @throws   PEAR_Error     */    function setCellAttributes($row, $col, $attributes)    {        $ret = $this->_tbody->setCellAttributes($row, $col, $attributes);        if (PEAR::isError($ret)) {            return $ret;        }    }    /**     * Updates the cell attributes passed but leaves other existing attributes in tact     * @param    int     $row         Row index     * @param    int     $col         Column index     * @param    mixed   $attributes  Associative array or string of table row attributes     * @access   public     */    function updateCellAttributes($row, $col, $attributes)    {        $ret = $this->_tbody->updateCellAttributes($row, $col, $attributes);        if (PEAR::isError($ret)) {            return $ret;        }    }    /**     * Returns the attributes for a given cell     * @param    int     $row         Row index     * @param    int     $col         Column index     * @return   array     * @access   public     */    function getCellAttributes($row, $col)    {        return $this->_tbody->getCellAttributes($row, $col);    }    /**     * Sets the cell contents for an existing cell     *     * If the given indices do not exist and autoGrow is true then the given     * row and/or col is automatically added.  If autoGrow is false then an     * error is returned.     * @param    int      $row        Row index     * @param    int      $col        Column index     * @param    mixed    $contents   May contain html or any object with a toHTML method;     *                                if it is an array (with strings and/or objects), $col     *                                will be used as start offset and the array elements     *                                will be set to this and the following columns in $row     * @param    string   $type       (optional) Cell type either 'TH' or 'TD'     * @access   public     * @throws   PEAR_Error     */    function setCellContents($row, $col, $contents, $type = 'TD')    {        $ret = $this->_tbody->setCellContents($row, $col, $contents, $type);        if (PEAR::isError($ret)) {            return $ret;        }    }    /**     * Returns the cell contents for an existing cell     * @param    int        $row    Row index     * @param    int        $col    Column index     * @access   public     * @return   mixed     */    function getCellContents($row, $col)    {        return $this->_tbody->getCellContents($row, $col);    }    /**     * Sets the contents of a header cell     * @param    int     $row     * @param    int     $col     * @param    mixed   $contents     * @param    mixed  $attributes Associative array or string of table row attributes     * @access   public     */    function setHeaderContents($row, $col, $contents, $attributes = null)    {        $this->_tbody->setHeaderContents($row, $col, $contents, $attributes);    }    /**     * Adds a table row and returns the row identifier     * @param    array    $contents   (optional) Must be a indexed array of valid cell contents     * @param    mixed    $attributes (optional) Associative array or string of table row attributes     *                                This can also be an array of attributes, in which case the attributes     *                                will be repeated in a loop.     * @param    string   $type       (optional) Cell type either 'th' or 'td'     * @param    bool     $inTR           false if attributes are to be applied in TD tags     *                                    true if attributes are to be applied in TR tag     * @return   int     * @access   public     */    function addRow($contents = null, $attributes = null, $type = 'td', $inTR = false)    {        $ret = $this->_tbody->addRow($contents, $attributes, $type, $inTR);        return $ret;    }    /**     * Sets the row attributes for an existing row     * @param    int      $row            Row index     * @param    mixed    $attributes     Associative array or string of table row attributes     *                                    This can also be an array of attributes, in which case the attributes     *                                    will be repeated in a loop.     * @param    bool     $inTR           false if attributes are to be applied in TD tags     *                                    true if attributes are to be applied in TR tag     * @access   public     * @throws   PEAR_Error     */    function setRowAttributes($row, $attributes, $inTR = false)    {        $ret = $this->_tbody->setRowAttributes($row, $attributes, $inTR);        if (PEAR::isError($ret)) {            return $ret;        }    }    /**     * Updates the row attributes for an existing row     * @param    int      $row            Row index     * @param    mixed    $attributes     Associative array or string of table row attributes     * @param    bool     $inTR           false if attributes are to be applied in TD tags     *                                    true if attributes are to be applied in TR tag     * @access   public     * @throws   PEAR_Error     */    function updateRowAttributes($row, $attributes = null, $inTR = false)    {        $ret = $this->_tbody->updateRowAttributes($row, $attributes, $inTR);        if (PEAR::isError($ret)) {            return $ret;        }    }    /**     * Returns the attributes for a given row as contained in the TR tag     * @param    int     $row         Row index     * @return   array     * @access   public     */    function getRowAttributes($row)    {        return $this->_tbody->getRowAttributes($row);    }    /**     * Alternates the row attributes starting at $start     * @param    int      $start          Row index of row in which alternating begins     * @param    mixed    $attributes1    Associative array or string of table row attributes     * @param    mixed    $attributes2    Associative array or string of table row attributes     * @param    bool     $inTR           false if attributes are to be applied in TD tags     *                                    true if attributes are to be applied in TR tag     * @access   public     */    function altRowAttributes($start, $attributes1, $attributes2, $inTR = false)    {        $this->_tbody->altRowAttributes($start, $attributes1, $attributes2, $inTR);    }    /**     * Adds a table column and returns the column identifier     * @param    array    $contents   (optional) Must be a indexed array of valid cell contents     * @param    mixed    $attributes (optional) Associative array or string of table row attributes     * @param    string   $type       (optional) Cell type either 'th' or 'td'     * @return   int     * @access   public     */    function addCol($contents = null, $attributes = null, $type = 'td')    {        return $this->_tbody->addCol($contents, $attributes, $type);    }    /**     * Sets the column attributes for an existing column     * @param    int      $col            Column index     * @param    mixed    $attributes     (optional) Associative array or string of table row attributes     * @access   public     */    function setColAttributes($col, $attributes = null)    {        $this->_tbody->setColAttributes($col, $attributes);    }    /**     * Updates the column attributes for an existing column     * @param    int      $col            Column index     * @param    mixed    $attributes     (optional) Associative array or string of table row attributes     * @access   public     */    function updateColAttributes($col, $attributes = null)    {        $this->_tbody->updateColAttributes($col, $attributes);    }    /**     * Sets the attributes for all cells     * @param    mixed    $attributes        (optional) Associative array or string of table row attributes     * @access   public     */    function setAllAttributes($attributes = null)    {        $this->_tbody->setAllAttributes($attributes);    }    /**     * Updates the attributes for all cells     * @param    mixed    $attributes        (optional) Associative array or string of table row attributes     * @access   public     */    function updateAllAttributes($attributes = null)    {        $this->_tbody->updateAllAttributes($attributes);    }    /**     * Returns the table structure as HTML     * @access  public     * @return  string     */    function toHtml()    {        $strHtml = '';        $tabs = $this->_getTabs();        $tab = $this->_getTab();        $lnEnd = $this->_getLineEnd();        if ($this->_comment) {            $strHtml .= $tabs . "<!-- $this->_comment -->" . $lnEnd;        }        $strHtml .=            $tabs . '<table' . $this->_getAttrString($this->_attributes) . '>' . $lnEnd;        if (!empty($this->_caption)) {            $attr = $this->_caption['attr'];            $contents = $this->_caption['contents'];            $strHtml .= $tabs . $tab . '<caption' . $this->_getAttrString($attr) . '>';            if (is_array($contents)) {                $contents = implode(', ', $contents);            }            $strHtml .= $contents;            $strHtml .= '</caption>' . $lnEnd;        }        if (!empty($this->_colgroup)) {            foreach ($this->_colgroup as $g => $col) {                $attr = $this->_colgroup[$g]['attr'];                $contents = $this->_colgroup[$g]['contents'];                $strHtml .= $tabs . $tab . '<colgroup' . $this->_getAttrString($attr) . '>';                if (!empty($contents)) {                    $strHtml .= $lnEnd;                    if (!is_array($contents)) {                        $contents = array($contents);                    }                    foreach ($contents as $a => $colAttr) {                        $attr = $this->_parseAttributes($colAttr);                        $strHtml .= $tabs . $tab . $tab . '<col' . $this->_getAttrString($attr) . '>' . $lnEnd;                    }                    $strHtml .= $tabs . $tab;                }                $strHtml .= '</colgroup>' . $lnEnd;            }        }        if ($this->_useTGroups) {            $tHeadColCount = 0;            if ($this->_thead !== null) {                $tHeadColCount = $this->_thead->getColCount();            }            $tFootColCount = 0;            if ($this->_tfoot !== null) {                $tFootColCount = $this->_tfoot->getColCount();            }            $tBodyColCount = 0;            if ($this->_tbody !== null) {                $tBodyColCount = $this->_tbody->getColCount();            }            $maxColCount = max($tHeadColCount, $tFootColCount, $tBodyColCount);            if ($this->_thead !== null) {                $this->_thead->setColCount($maxColCount);                if ($this->_thead->getRowCount() > 0) {                    $strHtml .= $tabs . $tab . '<thead>' . $lnEnd;                    $strHtml .= $this->_thead->toHtml($tabs, $tab);                    $strHtml .= $tabs . $tab . '</thead>' . $lnEnd;                }            }            if ($this->_tfoot !== null) {                $this->_tfoot->setColCount($maxColCount);                if ($this->_tfoot->getRowCount() > 0) {                    $strHtml .= $tabs . $tab . '<tfoot>' . $lnEnd;                    $strHtml .= $this->_tfoot->toHtml($tabs, $tab);                    $strHtml .= $tabs . $tab . '</tfoot>' . $lnEnd;                }            }            if ($this->_tbody !== null) {                $this->_tbody->setColCount($maxColCount);                if ($this->_tbody->getRowCount() > 0) {                    $strHtml .= $tabs . $tab . '<tbody>' . $lnEnd;                    $strHtml .= $this->_tbody->toHtml($tabs, $tab);                    $strHtml .= $tabs . $tab . '</tbody>' . $lnEnd;                }            }        } else {            $strHtml .= $this->_tbody->toHtml($tabs, $tab);        }        $strHtml .= $tabs . '</table>' . $lnEnd;        return $strHtml;    }}?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -