tag : TABLE
mode : OPEN

@param  array $param
@return boolean
509173
protected function _tag_open_TABLE($param, $other = 'table')
    {
        if ($this->_maxH) {
            if ($this->_isForOneLine) {
                return false;
            }
            $this->_tag_open_BR(array());
        }

        if ($this->_isForOneLine) {
            $this->_maxX = $this->pdf->getW() - $this->pdf->getlMargin() - $this->pdf->getrMargin();
            return false;
        }

        $this->_maxH = 0;

        $alignObject = isset($param['align']) ? strtolower($param['align']) : 'left';
        if (isset($param['align'])) {
            unset($param['align']);
        }
        if (!in_array($alignObject, array('left', 'center', 'right'))) {
            $alignObject = 'left';
        }

        $this->parsingCss->save();
        $this->parsingCss->analyse($other, $param);
        $this->parsingCss->setPosition();
        $this->parsingCss->fontSet();

        if ($this->parsingCss->value['margin-auto']) {
            $alignObject = 'center';
        }

        // collapse table ?
        $collapse = false;
        if ($other === 'table') {
            $collapse = isset($this->parsingCss->value['border']['collapse']) ? $this->parsingCss->value['border']['collapse'] : false;
        }

        // if collapse => no borders for the table, only for TD
        if ($collapse) {
            $param['style']['border'] = 'none';
            $param['cellspacing'] = 0;
            $none = $this->parsingCss->readBorder('none');
            $this->parsingCss->value['border']['t'] = $none;
            $this->parsingCss->value['border']['r'] = $none;
            $this->parsingCss->value['border']['b'] = $none;
            $this->parsingCss->value['border']['l'] = $none;
        }

        // if we are in a SUB html => prepare the properties of the table
        if ($this->_subPart) {
            if (!is_null($this->debug)) {
                $this->debug->addStep('Table '.$param['num'], true);
            }
            self::$_tables[$param['num']] = array();
            self::$_tables[$param['num']]['border']          = isset($param['border']) ? $this->parsingCss->readBorder($param['border']) : null;
            self::$_tables[$param['num']]['cellpadding']     = $this->cssConverter->convertToMM(isset($param['cellpadding']) ? $param['cellpadding'] : '1px');
            self::$_tables[$param['num']]['cellspacing']     = $this->cssConverter->convertToMM(isset($param['cellspacing']) ? $param['cellspacing'] : '2px');
            self::$_tables[$param['num']]['cases']           = array();          // properties of each TR/TD
            self::$_tables[$param['num']]['corr']            = array();          // link between TR/TD and colspan/rowspan
            self::$_tables[$param['num']]['corr_x']          = 0;                // position in 'cases'
            self::$_tables[$param['num']]['corr_y']          = 0;                // position in 'cases'
            self::$_tables[$param['num']]['td_curr']         = 0;                // current column
            self::$_tables[$param['num']]['tr_curr']         = 0;                // current row
            self::$_tables[$param['num']]['curr_x']          = $this->pdf->GetX();
            self::$_tables[$param['num']]['curr_y']          = $this->pdf->GetY();
            self::$_tables[$param['num']]['width']           = 0;                // global width
            self::$_tables[$param['num']]['height']          = 0;                // global height
            self::$_tables[$param['num']]['align']           = $alignObject;
            self::$_tables[$param['num']]['marge']           = array();
            self::$_tables[$param['num']]['marge']['t']      = $this->parsingCss->value['padding']['t']+$this->parsingCss->value['border']['t']['width']+self::$_tables[$param['num']]['cellspacing']*0.5;
            self::$_tables[$param['num']]['marge']['r']      = $this->parsingCss->value['padding']['r']+$this->parsingCss->value['border']['r']['width']+self::$_tables[$param['num']]['cellspacing']*0.5;
            self::$_tables[$param['num']]['marge']['b']      = $this->parsingCss->value['padding']['b']+$this->parsingCss->value['border']['b']['width']+self::$_tables[$param['num']]['cellspacing']*0.5;
            self::$_tables[$param['num']]['marge']['l']      = $this->parsingCss->value['padding']['l']+$this->parsingCss->value['border']['l']['width']+self::$_tables[$param['num']]['cellspacing']*0.5;
            self::$_tables[$param['num']]['page']            = 0;                // number of pages
            self::$_tables[$param['num']]['new_page']        = true;             // flag : new page for the current TR
            self::$_tables[$param['num']]['style_value']     = null;             // CSS style of the table
            self::$_tables[$param['num']]['thead']           = array();          // properties on the thead
            self::$_tables[$param['num']]['tfoot']           = array();          // properties on the tfoot
            self::$_tables[$param['num']]['thead']['tr']     = array();          // list of the TRs in the thead
            self::$_tables[$param['num']]['tfoot']['tr']     = array();          // list of the TRs in the tfoot
            self::$_tables[$param['num']]['thead']['height']    = 0;             // thead height
            self::$_tables[$param['num']]['tfoot']['height']    = 0;             // tfoot height
            self::$_tables[$param['num']]['thead']['code'] = array();            // HTML content of the thead
            self::$_tables[$param['num']]['tfoot']['code'] = array();            // HTML content of the tfoot
            self::$_tables[$param['num']]['cols']        = array();              // properties of the COLs

            $this->_saveMargin($this->pdf->getlMargin(), $this->pdf->gettMargin(), $this->pdf->getrMargin());

            $this->parsingCss->value['width']-= self::$_tables[$param['num']]['marge']['l'] + self::$_tables[$param['num']]['marge']['r'];
        } else {
            // we start from the first page and the first page of the table
            self::$_tables[$param['num']]['page'] = 0;
            self::$_tables[$param['num']]['td_curr']    = 0;
            self::$_tables[$param['num']]['tr_curr']    = 0;
            self::$_tables[$param['num']]['td_x']        = self::$_tables[$param['num']]['marge']['l']+self::$_tables[$param['num']]['curr_x'];
            self::$_tables[$param['num']]['td_y']        = self::$_tables[$param['num']]['marge']['t']+self::$_tables[$param['num']]['curr_y'];

            // draw the borders/background of the first page/part of the table
            $this->_drawRectangle(
                self::$_tables[$param['num']]['curr_x'],
                self::$_tables[$param['num']]['curr_y'],
                self::$_tables[$param['num']]['width'],
                isset(self::$_tables[$param['num']]['height'][0]) ? self::$_tables[$param['num']]['height'][0] : null,
                $this->parsingCss->value['border'],
                $this->parsingCss->value['padding'],
                0,
                $this->parsingCss->value['background']
            );

            self::$_tables[$param['num']]['style_value'] = $this->parsingCss->value;
        }

        return true;
    }
172054
protected function checkParam($param, $type)
    {
        $type = $this->getTypeRegexp($type);

        return (bool) preg_match("#^{$type}$#", $param);
    }
399786
protected function _tag_open_TEXTAREA($param)
    {
        if (!isset($param['name'])) {
            $param['name'] = 'champs_pdf_'.(count($this->_lstField)+1);
        }

        $param['name'] = strtolower($param['name']);

        if (isset($this->_lstField[$param['name']])) {
            $this->_lstField[$param['name']]++;
        } else {
            $this->_lstField[$param['name']] = 1;
        }

        $this->parsingCss->save();
        $this->parsingCss->analyse('textarea', $param);
        $this->parsingCss->setPosition();
        $this->parsingCss->fontSet();

        $x = $this->pdf->GetX();
        $y = $this->pdf->GetY();
        $fx = 0.65*$this->parsingCss->value['font-size'];
        $fy = 1.08*$this->parsingCss->value['font-size'];

        // extract the content the textarea : value
        $level = $this->parsingHtml->getLevel($this->_parsePos);
        $this->_parsePos+= count($level);

        // automatic size, from cols and rows properties
        $w = $fx*(isset($param['cols']) ? $param['cols'] : 22)+1;
        $h = $fy*1.07*(isset($param['rows']) ? $param['rows'] : 3)+3;

        $prop = $this->parsingCss->getFormStyle();

        $prop['multiline'] = true;
        $prop['value'] = $level[0]->getParam('txt', '');

        $this->pdf->TextField($param['name'], $w, $h, $prop, array(), $x, $y);

        $this->_maxX = max($this->_maxX, $x+$w);
        $this->_maxY = max($this->_maxY, $y+$h);
        $this->_maxH = max($this->_maxH, $h);
        $this->_maxE++;
        $this->pdf->SetX($x+$w);

        return true;
    }
149887
public function all($param = true){
        $this->isAr = true;
        if($this->isPretreatment){
            self::$Pre = $this->bindSql();
            if(!$param) return self::$Pre->queryString;
            return $this->dbh->pall(self::$Pre);
        }
        $bind = $this->bindSql();
        if(!$param) return $this->PrintSQL();
        $this->initialize();
        return  $bind->all();
    }
133198
protected function _tag_open_TH($param)
    {
        if ($this->_isForOneLine) {
            return false;
        }

        $this->parsingCss->save();
        $this->parsingCss->value['font-bold'] = true;

        $this->_tag_open_TD($param, 'th');

        return true;
    }
125421
public function one($param = true){
        $this->isAr = true;
        if($this->isPretreatment){
            self::$Pre = $this->bindSql();
            if(!$param) return self::$Pre->queryString;
            return $this->dbh->pone($this->bindSql());
        }
        $bind = $this->bindSql();
        if(!$param) return $this->PrintSQL();
        $this->initialize();
        return $bind->one();
    }
851951
protected function _tag_close_THEAD_SUB($param)
    {
        if ($this->_isForOneLine) {
            return false;
        }

        $this->parsingCss->load();
        $this->parsingCss->fontSet();

        return true;
    }
1126116
protected function _tag_open_UL($param, $other = 'ul')
    {
        if ($this->_isForOneLine) {
            return false;
        }

        if (!in_array($this->_previousCall, array('_tag_close_P', '_tag_close_UL'))) {
            if ($this->_maxH) {
                $this->_tag_open_BR(array());
            }
            if (!count($this->_defList)) {
                $this->_tag_open_BR(array());
            }
        }

        if (!isset($param['style']['width'])) {
            $param['allwidth'] = true;
        }
        $param['cellspacing'] = 0;

        // a list is like a table
        $this->_tag_open_TABLE($param, $other);

        // add a level of list
        $start = (isset($this->parsingCss->value['start']) ? $this->parsingCss->value['start'] : null);
        $this->_listeAddLevel($other, $this->parsingCss->value['list-style-type'], $this->parsingCss->value['list-style-image'], $start);

        return true;
    }
83806
protected function _tag_open_DIV($param, $other = 'div')
    {
        if ($this->_isForOneLine) {
            return false;
        }

        if (!is_null($this->debug)) {
            $this->debug->addStep(strtoupper($other), true);
        }

        $this->parsingCss->save();
        $this->parsingCss->analyse($other, $param);
        $this->parsingCss->fontSet();

        // for fieldset and legend
        if (in_array($other, array('fieldset', 'legend'))) {
            if (isset($param['moveTop'])) {
                $this->parsingCss->value['margin']['t']    += $param['moveTop'];
            }
            if (isset($param['moveLeft'])) {
                $this->parsingCss->value['margin']['l']    += $param['moveLeft'];
            }
            if (isset($param['moveDown'])) {
                $this->parsingCss->value['margin']['b']    += $param['moveDown'];
            }
        }

        $alignObject = null;
        if ($this->parsingCss->value['margin-auto']) {
            $alignObject = 'center';
        }

        $marge = array();
        $marge['l'] = $this->parsingCss->value['border']['l']['width'] + $this->parsingCss->value['padding']['l']+0.03;
        $marge['r'] = $this->parsingCss->value['border']['r']['width'] + $this->parsingCss->value['padding']['r']+0.03;
        $marge['t'] = $this->parsingCss->value['border']['t']['width'] + $this->parsingCss->value['padding']['t']+0.03;
        $marge['b'] = $this->parsingCss->value['border']['b']['width'] + $this->parsingCss->value['padding']['b']+0.03;

        // extract the content of the div
        $level = $this->parsingHtml->getLevel($this->_parsePos);

        // create a sub Html2Pdf to get the dimensions of the content of the div
        $w = 0;
        $h = 0;
        if (count($level)) {
            $sub = $this->createSubHTML();
            $sub->parsingHtml->code = $level;
            $sub->_makeHTMLcode();
            $w = $sub->_maxX;
            $h = $sub->_maxY;
            $this->_destroySubHTML($sub);
        }
        $wReel = $w;
        $hReel = $h;

        $w+= $marge['l']+$marge['r']+0.001;
        $h+= $marge['t']+$marge['b']+0.001;

        if ($this->parsingCss->value['overflow'] === 'hidden') {
            $overW = max($w, $this->parsingCss->value['width']);
            $overH = max($h, $this->parsingCss->value['height']);
            $overflow = true;
            $this->parsingCss->value['old_maxX'] = $this->_maxX;
            $this->parsingCss->value['old_maxY'] = $this->_maxY;
            $this->parsingCss->value['old_maxH'] = $this->_maxH;
            $this->parsingCss->value['old_overflow'] = $this->_isInOverflow;
            $this->_isInOverflow = true;
        } else {
            $overW = null;
            $overH = null;
            $overflow = false;
            $this->parsingCss->value['width']  = max($w, $this->parsingCss->value['width']);
            $this->parsingCss->value['height'] = max($h, $this->parsingCss->value['height']);
        }

        switch ($this->parsingCss->value['rotate']) {
            case 90:
                $tmp = $overH;
                $overH = $overW;
                $overW = $tmp;
                $tmp = $hReel;
                $hReel = $wReel;
                $wReel = $tmp;
                unset($tmp);
                $w = $this->parsingCss->value['height'];
                $h = $this->parsingCss->value['width'];
                $tX =-$h;
                $tY = 0;
                break;

            case 180:
                $w = $this->parsingCss->value['width'];
                $h = $this->parsingCss->value['height'];
                $tX = -$w;
                $tY = -$h;
                break;

            case 270:
                $tmp = $overH;
                $overH = $overW;
                $overW = $tmp;
                $tmp = $hReel;
                $hReel = $wReel;
                $wReel = $tmp;
                unset($tmp);
                $w = $this->parsingCss->value['height'];
                $h = $this->parsingCss->value['width'];
                $tX = 0;
                $tY =-$w;
                break;

            default:
                $w = $this->parsingCss->value['width'];
                $h = $this->parsingCss->value['height'];
                $tX = 0;
                $tY = 0;
                break;
        }

        $maxW = ($this->pdf->getW() - $this->pdf->getlMargin()-$this->pdf->getrMargin());
        $maxH = ($this->pdf->getH() - $this->pdf->gettMargin()-$this->pdf->getbMargin());
        $maxX = ($this->pdf->getW() - $this->pdf->getrMargin());
        $maxY = ($this->pdf->getH() - $this->pdf->getbMargin());
        $endX = ($this->pdf->GetX() + $w);
        $endY = ($this->pdf->GetY() + $h);

        $w = round($w, 6);
        $h = round($h, 6);
        $maxW = round($maxW, 6);
        $maxH = round($maxH, 6);
        $maxX = round($maxX, 6);
        $maxY = round($maxY, 6);
        $endX = round($endX, 6);
        $endY = round($endY, 6);

        if ($this->parsingCss->value['page-break-before'] == "always") {
            $this->_setNewPage();
        }

        if (!$this->parsingCss->value['position']) {
            if ($w < $maxW && $endX >= $maxX) {
                $this->_tag_open_BR(array());
            }

            if ($h < $maxH && $endY >= $maxY && !$this->_isInOverflow) {
                $this->_setNewPage();
            }

            $old = $this->parsingCss->getOldValues();
            $parentWidth = $old['width'] ? $old['width'] : $this->pdf->getW() - $this->pdf->getlMargin() - $this->pdf->getrMargin();

            if ($parentWidth>$w) {
                if ($alignObject === 'center') {
                    $this->pdf->SetX($this->pdf->GetX() + ($parentWidth-$w)*0.5);
                } elseif ($alignObject === 'right') {
                    $this->pdf->SetX($this->pdf->GetX() + $parentWidth-$w);
                }
            }

            $this->parsingCss->setPosition();
        } else {
            $old = $this->parsingCss->getOldValues();
            $parentWidth = $old['width'] ? $old['width'] : $this->pdf->getW() - $this->pdf->getlMargin() - $this->pdf->getrMargin();

            if ($parentWidth>$w) {
                if ($alignObject === 'center') {
                    $this->pdf->SetX($this->pdf->GetX() + ($parentWidth-$w)*0.5);
                } elseif ($alignObject === 'right') {
                    $this->pdf->SetX($this->pdf->GetX() + $parentWidth-$w);
                }
            }

            $this->parsingCss->setPosition();
            $this->_saveMax();
            $this->_maxX = 0;
            $this->_maxY = 0;
            $this->_maxH = 0;
            $this->_maxE = 0;
        }

        if ($this->parsingCss->value['rotate']) {
            $this->pdf->startTransform();
            $this->pdf->setRotation($this->parsingCss->value['rotate']);
            $this->pdf->setTranslate($tX, $tY);
        }

        $this->_drawRectangle(
            $this->parsingCss->value['x'],
            $this->parsingCss->value['y'],
            $this->parsingCss->value['width'],
            $this->parsingCss->value['height'],
            $this->parsingCss->value['border'],
            $this->parsingCss->value['padding'],
            0,
            $this->parsingCss->value['background']
        );

        $marge = array();
        $marge['l'] = $this->parsingCss->value['border']['l']['width'] + $this->parsingCss->value['padding']['l']+0.03;
        $marge['r'] = $this->parsingCss->value['border']['r']['width'] + $this->parsingCss->value['padding']['r']+0.03;
        $marge['t'] = $this->parsingCss->value['border']['t']['width'] + $this->parsingCss->value['padding']['t']+0.03;
        $marge['b'] = $this->parsingCss->value['border']['b']['width'] + $this->parsingCss->value['padding']['b']+0.03;

        $this->parsingCss->value['width'] -= $marge['l']+$marge['r'];
        $this->parsingCss->value['height']-= $marge['t']+$marge['b'];

        $xCorr = 0;
        $yCorr = 0;
        if (!$this->_subPart && !$this->_isSubPart) {
            switch ($this->parsingCss->value['text-align']) {
                case 'right':
                    $xCorr = ($this->parsingCss->value['width']-$wReel);
                    break;
                case 'center':
                    $xCorr = ($this->parsingCss->value['width']-$wReel)*0.5;
                    break;
            }
            if ($xCorr>0) {
                $xCorr=0;
            }
            switch ($this->parsingCss->value['vertical-align']) {
                case 'bottom':
                    $yCorr = ($this->parsingCss->value['height']-$hReel);
                    break;
                case 'middle':
                    $yCorr = ($this->parsingCss->value['height']-$hReel)*0.5;
                    break;
            }
        }

        if ($overflow) {
            $overW-= $marge['l']+$marge['r'];
            $overH-= $marge['t']+$marge['b'];
            $this->pdf->clippingPathStart(
                $this->parsingCss->value['x']+$marge['l'],
                $this->parsingCss->value['y']+$marge['t'],
                $this->parsingCss->value['width'],
                $this->parsingCss->value['height']
            );

            $this->parsingCss->value['x']+= $xCorr;

            // marges from the dimension of the content
            $mL = $this->parsingCss->value['x']+$marge['l'];
            $mR = $this->pdf->getW() - $mL - $overW;
        } else {
            // marges from the dimension of the div
            $mL = $this->parsingCss->value['x']+$marge['l'];
            $mR = $this->pdf->getW() - $mL - $this->parsingCss->value['width'];
        }

        $x = $this->parsingCss->value['x']+$marge['l'];
        $y = $this->parsingCss->value['y']+$marge['t']+$yCorr;
        $this->_saveMargin($mL, 0, $mR);
        $this->pdf->SetXY($x, $y);

        $this->_setNewPositionForNewLine();

        return true;
    }
1372174
final protected function getValueFromArray(string $param)
  {
    $value = null;

    preg_match_all(self::$regEx['array'], $param, $args);
    $array = Fixtures::get($args['var'][0]);
    if (array_key_exists($args['key'][0], $array)) {
        $value = $array[$args['key'][0]];
    }
    return $value;
  }
884663
public static function get($param)
    {
        if (isset(self::$db_params[$param])) {
            return self::$db_params[$param];
        }
        return false;
    }
752799
protected function _tag_open_FORM($param)
    {
        $this->parsingCss->save();
        $this->parsingCss->analyse('form', $param);
        $this->parsingCss->setPosition();
        $this->parsingCss->fontSet();

        $this->pdf->setFormDefaultProp(
            array(
                'lineWidth'=>1,
                'borderStyle'=>'solid',
                'fillColor'=>array(220, 220, 255),
                'strokeColor'=>array(128, 128, 200)
            )
        );

        $this->_isInForm = isset($param['action']) ? $param['action'] : '';

        return true;
    }
261170
public function load($param = null)
    {
        // if there already has been a config set it means it already
        // has been loaded so why bother retrying ! this is not a dynamic language !
        $configSet = $this->get('config_set');
        if (count((array) $configSet) > 0) return true;

        // if the config set already exists don't parse it
        if (empty($configSet) && !($configSet = $this->_getConfigSet())) {
            // set default config set for the default execution
            $configSet = [
                realpath("{$this->config_path}/" . (string)self::HIERACHY_PLACEHOLDER . (string)self::CONFIG_DELIMITER . (string)self::FILE_EXTENSION)
            ];
            $this->set('config_set', $configSet);
        }

        /**
         * create the total config parameter array and merge it recursive
         */
        try {
            if (empty($configSet) || !is_readable($configSet[0])) {
                throw new ConfigException("No default config file declared {$this->config_path}/" . self::HIERACHY_PLACEHOLDER . (string)self::CONFIG_DELIMITER . (string)self::FILE_EXTENSION);
            }

            $configParser = new \chilimatic\lib\config\configfile\Parser();
            // first insert point
            $node = null;
            foreach ($configSet as $config) {
                /**
                 * get the key for the config node
                 */
                $key = explode('/', $config);
                $key = substr(array_pop($key), 0, -4);

                $node = new Node($this->mainNode, $key, $config, 'self');
                $this->lastNewNode = $node;
                // add the config node
                $this->mainNode->addChild($node);

                unset($key);
                $configParser->parse($this->getConfigFileContent($config), $node);
            }

        } catch (ConfigException $e) {
            throw $e;
        }

        return true;
    }
939323
public function requestPdo($request, $param = null)
    {
        $this->result = $this->tableGateway->requestPdo($request, $param);

        return $this->result;
    }
407913
protected function _tag_close_TABLE($param)
    {
        if ($this->_isForOneLine) {
            return false;
        }

        $this->_maxH = 0;

        // if we are in a sub HTML
        if ($this->_subPart) {
            // calculate the size of each case
            $this->_calculateTableCellSize(self::$_tables[$param['num']]['cases'], self::$_tables[$param['num']]['corr']);

            // calculate the height of the thead and the tfoot
            $lst = array('thead', 'tfoot');
            foreach ($lst as $mode) {
                self::$_tables[$param['num']][$mode]['height'] = 0;
                foreach (self::$_tables[$param['num']][$mode]['tr'] as $tr) {
                    // hauteur de la ligne tr
                    $h = 0;
                    $nbTrs = count(self::$_tables[$param['num']]['cases'][$tr]);
                    for ($i=0; $i<$nbTrs; $i++) {
                        if (self::$_tables[$param['num']]['cases'][$tr][$i]['rowspan'] == 1) {
                            $h = max($h, self::$_tables[$param['num']]['cases'][$tr][$i]['h']);
                        }
                    }
                    self::$_tables[$param['num']][$mode]['height']+= $h;
                }
            }

            // calculate the width of the table
            self::$_tables[$param['num']]['width'] = self::$_tables[$param['num']]['marge']['l'] + self::$_tables[$param['num']]['marge']['r'];
            if (isset(self::$_tables[$param['num']]['cases'][0])) {
                foreach (self::$_tables[$param['num']]['cases'][0] as $case) {
                    self::$_tables[$param['num']]['width']+= $case['w'];
                }
            }

            // X position of the table
            $old = $this->parsingCss->getOldValues();
            $parentWidth = $old['width'] ? $old['width'] : $this->pdf->getW() - $this->pdf->getlMargin() - $this->pdf->getrMargin();
            $x = self::$_tables[$param['num']]['curr_x'];
            $w = self::$_tables[$param['num']]['width'];
            if ($parentWidth>$w) {
                if (self::$_tables[$param['num']]['align'] === 'center') {
                    $x = $x + ($parentWidth-$w)*0.5;
                } elseif (self::$_tables[$param['num']]['align'] === 'right') {
                    $x = $x + $parentWidth-$w;
                }

                self::$_tables[$param['num']]['curr_x'] = $x;
            }

            // calculate the height of the table
            self::$_tables[$param['num']]['height'] = array();

            // minimum of the height because of margins, and of the thead and tfoot height
            $h0 = self::$_tables[$param['num']]['marge']['t'] + self::$_tables[$param['num']]['marge']['b'];
            $h0+= self::$_tables[$param['num']]['thead']['height'] + self::$_tables[$param['num']]['tfoot']['height'];

            // max height of the page
            $max = $this->pdf->getH() - $this->pdf->getbMargin();

            // current position on the page
            $y = self::$_tables[$param['num']]['curr_y'];
            $height = $h0;

            // we get the height of each line
            $nbCases = count(self::$_tables[$param['num']]['cases']);
            for ($k=0; $k<$nbCases; $k++) {

                // if it is a TR of the thead or of the tfoot => skip
                if (in_array($k, self::$_tables[$param['num']]['thead']['tr'])) {
                    continue;
                }
                if (in_array($k, self::$_tables[$param['num']]['tfoot']['tr'])) {
                    continue;
                }

                // height of the line
                $th = 0;
                $h = 0;
                $nbCasesK = count(self::$_tables[$param['num']]['cases'][$k]);
                for ($i=0; $i<$nbCasesK; $i++) {
                    $h = max($h, self::$_tables[$param['num']]['cases'][$k][$i]['h']);

                    if (self::$_tables[$param['num']]['cases'][$k][$i]['rowspan'] == 1) {
                        $th = max($th, self::$_tables[$param['num']]['cases'][$k][$i]['h']);
                    }
                }

                // if the row does not fit on the page => new page
                if ($y+$h+$height>$max) {
                    if ($height == $h0) {
                        $height = null;
                    }
                    self::$_tables[$param['num']]['height'][] = $height;
                    $height = $h0;
                    $y = $this->_margeTop;
                }
                $height+= $th;
            }

            // if ther is a height at the end, add it
            if ($height !=$h0 || $k == 0) {
                self::$_tables[$param['num']]['height'][] = $height;
            }
        } else {
            // if we have tfoot, draw it
            if (count(self::$_tables[$param['num']]['tfoot']['code'])) {
                $tmpTR = self::$_tables[$param['num']]['tr_curr'];
                $tmpTD = self::$_tables[$param['num']]['td_curr'];
                $oldParsePos = $this->_parsePos;
                $oldParseCode = $this->parsingHtml->code;

                self::$_tables[$param['num']]['tr_curr'] = self::$_tables[$param['num']]['tfoot']['tr'][0];
                self::$_tables[$param['num']]['td_curr'] = 0;
                $this->_parsePos = 0;
                $this->parsingHtml->code = self::$_tables[$param['num']]['tfoot']['code'];
                $this->_isInTfoot = true;
                $this->_makeHTMLcode();
                $this->_isInTfoot = false;

                $this->_parsePos =     $oldParsePos;
                $this->parsingHtml->code = $oldParseCode;
                self::$_tables[$param['num']]['tr_curr'] = $tmpTR;
                self::$_tables[$param['num']]['td_curr'] = $tmpTD;
            }

            // get the positions of the end of the table
            $x = self::$_tables[$param['num']]['curr_x'] + self::$_tables[$param['num']]['width'];
            if (count(self::$_tables[$param['num']]['height'])>1) {
                $y = $this->_margeTop+self::$_tables[$param['num']]['height'][count(self::$_tables[$param['num']]['height'])-1];
            } elseif (count(self::$_tables[$param['num']]['height']) == 1) {
                $y = self::$_tables[$param['num']]['curr_y']+self::$_tables[$param['num']]['height'][count(self::$_tables[$param['num']]['height'])-1];
            } else {
                $y = self::$_tables[$param['num']]['curr_y'];
            }

            $y+= $this->parsingCss->value['margin']['b'];

            $this->_maxX = max($this->_maxX, $x);
            $this->_maxY = max($this->_maxY, $y);

            $this->pdf->SetXY($this->pdf->getlMargin(), $y);

            $this->_loadMargin();

            if (!is_null($this->debug)) {
                $this->debug->addStep('Table '.$param['num'], false);
            }
        }

        $this->parsingCss->load();
        $this->parsingCss->fontSet();


        return true;
    }
703697
protected function _tag_open_BR($param, $curr = null)
    {
        if ($this->_isForOneLine) {
            return false;
        }

        $h = max($this->_maxH, $this->parsingCss->getLineHeight());

        if ($this->_maxH == 0) {
            $this->_maxY = max($this->_maxY, $this->pdf->GetY()+$h);
        }

        $this->_makeBreakLine($h, $curr);

        $this->_maxH = 0;
        $this->_maxE = 0;

        return true;
    }
546754
public static function load($param) {
        global $DB;
        if (is_object($param)) {
            $event = new calendar_event($param);
        } else {
            $event = $DB->get_record('event', array('id' => (int)$param), '*', MUST_EXIST);
            $event = new calendar_event($event);
        }
        return $event;
    }