tag : A
mode : OPEN

@param  array $param
@return boolean
427209
protected function _tag_open_A($param)
    {
        $this->_isInLink = str_replace('&amp;', '&', isset($param['href']) ? $param['href'] : '');

        if (isset($param['name'])) {
            $name =     $param['name'];
            if (!isset($this->_lstAnchor[$name])) {
                $this->_lstAnchor[$name] = array($this->pdf->AddLink(), false);
            }

            if (!$this->_lstAnchor[$name][1]) {
                $this->_lstAnchor[$name][1] = true;
                $this->pdf->SetLink($this->_lstAnchor[$name][0], -1, -1);
            }
        }

        if (preg_match('/^#([^#]+)$/isU', $this->_isInLink, $match)) {
            $name = $match[1];
            if (!isset($this->_lstAnchor[$name])) {
                $this->_lstAnchor[$name] = array($this->pdf->AddLink(), false);
            }

            $this->_isInLink = $this->_lstAnchor[$name][0];
        }

        $this->parsingCss->save();
        $this->parsingCss->value['font-underline'] = true;
        $this->parsingCss->value['color'] = array(20, 20, 250);
        $this->parsingCss->analyse('a', $param);
        $this->parsingCss->setPosition();
        $this->parsingCss->fontSet();

        return true;
    }
174999
protected function _tag_open_BARCODE($param)
    {
        if (!isset($param['type'])) {
            $param['type'] = 'C39';
        }
        if (!isset($param['value'])) {
            $param['value']    = 0;
        }
        if (!isset($param['label'])) {
            $param['label']    = 'label';
        }
        if (!isset($param['style']['color'])) {
            $param['style']['color'] = '#000000';
        }

        $param['type'] = strtoupper($param['type']);
        if (!isset($param['dimension'])) {
            $param['dimension'] = '1D';
        }

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

        $x = $this->pdf->GetX();
        $y = $this->pdf->GetY();
        $w = $this->parsingCss->value['width'];
        if (!$w) {
            $w = $this->cssConverter->convertToMM('50mm');
        }
        $h = $this->parsingCss->value['height'];
        if (!$h) {
            $h = $this->cssConverter->convertToMM('10mm');
        }
        $txt = ($param['label'] !== 'none' ? $this->parsingCss->value['font-size'] : false);
        $c = $this->parsingCss->value['color'];
        $infos = $this->pdf->myBarcode($param['value'], $param['type'], $x, $y, $w, $h, $txt, $c, $param['dimension']);

        $this->_maxX = max($this->_maxX, $x+$infos[0]);
        $this->_maxY = max($this->_maxY, $y+$infos[1]);
        $this->_maxH = max($this->_maxH, $infos[1]);
        $this->_maxE++;

        $this->pdf->SetXY($x+$infos[0], $y);

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

        return true;
    }
471941
protected function _tag_open_INPUT($param)
    {
        if (!isset($param['name'])) {
            $param['name']  = 'champs_pdf_'.(count($this->_lstField)+1);
        }
        if (!isset($param['value'])) {
            $param['value'] = '';
        }
        if (!isset($param['type'])) {
            $param['type']  = 'text';
        }

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

        // the type must be valid
        if (!in_array($param['type'], array('text', 'checkbox', 'radio', 'hidden', 'submit', 'reset', 'button'))) {
            $param['type'] = 'text';
        }

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

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

        $name = $param['name'];

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

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

        switch ($param['type']) {
            case 'checkbox':
                $w = 4;
                $h = $w;
                if ($h<$f) {
                    $y+= ($f-$h)*0.5;
                }
                $checked = (isset($param['checked']) && $param['checked'] === 'checked');
                $this->pdf->CheckBox($name, $w, $checked, $prop, array(), ($param['value'] ? $param['value'] : 'Yes'), $x, $y);
                break;

            case 'radio':
                $w = 4;
                $h = $w;
                if ($h<$f) {
                    $y+= ($f-$h)*0.5;
                }
                $checked = (isset($param['checked']) && $param['checked'] === 'checked');
                $this->pdf->RadioButton($name, $w, $prop, array(), ($param['value'] ? $param['value'] : 'On'), $checked, $x, $y);
                break;

            case 'hidden':
                $w = 0;
                $h = 0;
                $prop['value'] = $param['value'];
                $this->pdf->TextField($name, $w, $h, $prop, array(), $x, $y);
                break;

            case 'text':
                $w = $this->parsingCss->value['width'];
                if (!$w) {
                    $w = 40;
                }
                $h = $f*1.3;
                $prop['value'] = $param['value'];
                $this->pdf->TextField($name, $w, $h, $prop, array(), $x, $y);
                break;

            case 'submit':
                $w = $this->parsingCss->value['width'];
                if (!$w) {
                    $w = 40;
                }
                $h = $this->parsingCss->value['height'];
                if (!$h) {
                    $h = $f*1.3;
                }
                $action = array('S'=>'SubmitForm', 'F'=>$this->_isInForm, 'Flags'=>array('ExportFormat'));
                $this->pdf->Button($name, $w, $h, $param['value'], $action, $prop, array(), $x, $y);
                break;

            case 'reset':
                $w = $this->parsingCss->value['width'];
                if (!$w) {
                    $w = 40;
                }
                $h = $this->parsingCss->value['height'];
                if (!$h) {
                    $h = $f*1.3;
                }
                $action = array('S'=>'ResetForm');
                $this->pdf->Button($name, $w, $h, $param['value'], $action, $prop, array(), $x, $y);
                break;

            case 'button':
                $w = $this->parsingCss->value['width'];
                if (!$w) {
                    $w = 40;
                }
                $h = $this->parsingCss->value['height'];
                if (!$h) {
                    $h = $f*1.3;
                }
                $action = isset($param['onclick']) ? $param['onclick'] : '';
                $this->pdf->Button($name, $w, $h, $param['value'], $action, $prop, array(), $x, $y);
                break;

            default:
                $w = 0;
                $h = 0;
                break;
        }

        $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);

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

        return true;
    }
221895
public static function load($param)
    {
        if (!($node = self::loadById($param))) {
            $node = self::loadByPath($param);
        }

        return $node;
    }
69294
protected function _tag_close_H1($param)
    {
        if ($this->_isForOneLine) {
            return false;
        }

        $this->_maxH+= $this->parsingCss->value['margin']['b'];
        $h = max($this->_maxH, $this->parsingCss->getLineHeight());

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

        $this->_makeBreakLine($h);
        $this->_maxH = 0;

        $this->_maxY = max($this->_maxY, $this->pdf->GetY());

        return true;
    }
885692
public static function open($params = array()) {

        if( !is_array($params) )
        {
            throw new \InvalidArgumentException("Arguments is not a Array". print_r($params, true));
        }
        $o = '<form';
        $o .= (isset($params['id'])) ? " id='{$params['id']}'" : '';
        $o .= (isset($params['name'])) ? " name='{$params['name']}'" : '';
        $o .= (isset($params['class'])) ? " class='{$params['class']}'" : '';
        $o .= (isset($params['onsubmit'])) ? " onsubmit='{$params['onsubmit']}'" : '';
        $o .= (isset($params['method'])) ? " method='{$params['method']}'" : ' method="get"';
        $o .= (isset($params['action'])) ? " action='{$params['action']}'" : '';
        $o .= (isset($params['files'])) ? " enctype='multipart/form-data'" : '';
        $o .= (isset($params['style'])) ? " style='{$params['style']}'" : '';
        $o .= (isset($params['role'])) ? " role='{$params['role']}'" : '';
        $o .= (isset($params['autocomplete'])) ? " autocomplete='{$params['autocomplete']}'" : '';
        $o .= '>';
        return $o . "\n";
    }
1129567
public function getParam(string $param)
    {
        if (! empty($this->match['params'][$param])) {
            return $this->match['params'][$param];
        }
    }
217631
public function get($param = '')
    {

        if (empty($param)) return false;

        if (!is_array($param) || !property_exists($this->engineVarList, $param)) return false;

        return $this->engineVarList->$param;
    }
702969
public function open($mode="c") {
		$this->mode = $mode;
		$this->file = fopen($this->filepath, $mode);
		if($this->file === false) {
			$this->mode = null;
			$this->file = null;
			$this->open = false;
			throw new \Exception("Unable to open file {$this->filepath}");
		}
		$this->open = true;
		return true;
	}
356781
public function open($file, $mode)
    {
        if (!empty(trim($file)) && !empty(trim($mode))) {
            $this->resource = fopen($file, $this->modes[$mode]);
            $this->file = $file;

            return $this;
        }

        return false;
    }
1132175
public function setList(array $param)
    {

        if (!is_array($param)) return false;

        foreach ($param as $key => $value) {
            if (!$key) continue;
            $this->engineVarList->$key = $value;
        }

        return $this;
    }
237841
protected function _tag_close_PAGE($param)
    {
        if ($this->_isForOneLine) {
            return false;
        }

        $this->_maxH = 0;

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

        if (!is_null($this->debug)) {
            $this->debug->addStep('PAGE '.$this->_page, false);
        }

        return true;
    }
751514
protected function _tag_close_PAGE_FOOTER_SUB($param)
    {
        if ($this->_isForOneLine) {
            return false;
        }

        $this->parsingCss->load();

        $this->parsingCss->value                = $this->_subSTATES['s'];
        $this->parsingCss->table                = $this->_subSTATES['t'];
        $this->_pageMarges                 = $this->_subSTATES['mp'];
        $this->_margeLeft                = $this->_subSTATES['ml'];
        $this->_margeRight                = $this->_subSTATES['mr'];
        $this->_margeTop                    = $this->_subSTATES['mt'];
        $this->_margeBottom                = $this->_subSTATES['mb'];
        $this->pdf->SetMargins($this->_margeLeft, $this->_margeTop, $this->_margeRight);
        $this->pdf->SetAutoPageBreak(false, $this->_margeBottom);
        $this->pdf->SetXY($this->_subSTATES['x'], $this->_subSTATES['y']);

        $this->parsingCss->fontSet();
        $this->_maxH = 0;

        return true;
    }
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;
    }
1127537
protected function _tag_open_HR($param)
    {
        if ($this->_isForOneLine) {
            return false;
        }
        $oldAlign = $this->parsingCss->value['text-align'];
        $this->parsingCss->value['text-align'] = 'left';

        if ($this->_maxH) {
            $this->_tag_open_BR($param);
        }

        $fontSize = $this->parsingCss->value['font-size'];
        $this->parsingCss->value['font-size']=$fontSize*0.5;
        $this->_tag_open_BR($param);
        $this->parsingCss->value['font-size']=$fontSize;

        $param['style']['width'] = '100%';

        $this->parsingCss->save();
        $this->parsingCss->value['height']=$this->cssConverter->convertToMM('1mm');

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

        $h = $this->parsingCss->value['height'];
        if ($h) {
            $h-= $this->parsingCss->value['border']['t']['width']+$this->parsingCss->value['border']['b']['width'];
        }
        if ($h<=0) {
            $h = $this->parsingCss->value['border']['t']['width']+$this->parsingCss->value['border']['b']['width'];
        }

        $this->_drawRectangle($this->pdf->GetX(), $this->pdf->GetY(), $this->parsingCss->value['width'], $h, $this->parsingCss->value['border'], 0, 0, $this->parsingCss->value['background']);
        $this->_maxH = $h;

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

        $this->parsingCss->value['font-size'] = 0;
        $this->_tag_open_BR($param);

        $this->parsingCss->value['font-size']=$fontSize*0.5;
        $this->_tag_open_BR($param);
        $this->parsingCss->value['font-size']=$fontSize;

        $this->parsingCss->value['text-align'] = $oldAlign;
        $this->_setNewPositionForNewLine();

        return true;
    }
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;
    }
106361
protected function _tag_open_COL($param)
    {
        $span = isset($param['span']) ? $param['span'] : 1;
        for ($k=0; $k<$span; $k++) {
            self::$_tables[$param['num']]['cols'][] = $param;
        }

        return true;
    }