Compile Pagination
@param $param
@return string
195616
protected static function compilePaging($param)
    {
        $parameters = self::parseParameters($param);
        $result = '';
        if (!empty($parameters['template']))
            $result .= "\$this->pagination->setTemplate(\$this->render('{$parameters['template']}'));\n?>";
        $link = 'null';
        if (!empty($parameters['link'])) {
            if ('$' != $parameters['link']{0})
                $parameters['link'] = '\'' . $parameters['link'] . '\'';
            $link = $parameters['link'];
        }
        $page = !empty($parameters['page']) ? $parameters['page'] : 'null';
        $total = !empty($parameters['total']) ? $parameters['total'] : 'null';
        $size = !empty($parameters['size']) ? $parameters['size'] : 'null';
        $result .= "<?php echo \$this->pagination->render({$link}, {$page}, {$total}, {$size});\n?>";

        return $result;
    }
983318
protected function _buildDataAttrs(array $param = array())
    {
        $return = '';
        foreach ($param as $data => $val) {
            $dKey = 'data-' . trim($data);

            if (is_object($val)) {
                $val = (array) $val;
            }

            if (is_array($val)) {
                $val = str_replace('"', '\'', json_encode($val));
                $return .= $this->_buildAttr($dKey, $val);
                continue;
            }

            $return .= $this->_buildAttr($dKey, $val);
        }

        return $return;
    }
305757
public function build(): Pagination
    {
        return new Pagination(
            $this->items_per_page,
            $this->items_count,
            $this->current_page,
            $this->pages_range
        );
    }
542053
public static function maker( $param, $param2 = null )
	{
		if ( !is_null( $param2 ) )
		{
			return static::create( $param, $param2 );
		}
		
		$param = explode( ' ', $param );
		
		$element = array_shift( $param );
		
		return static::create( $element, implode( ' ', $param ) );
	}
1042877
public function top($param){
       $this->resetSelet("top $param")->disposeSelectSQL();
       $this->initialize();
       return $this->bindSql()->all();
   }
1222160
public static function parse($param) {
        if (!is_array($param) && !is_object($param)) {
            $compare = trim(strtolower($param));
            if (in_array($compare, array('yes', 'true', 'on', '1'))) {
                return true;
            }
            if (in_array($compare, array('no', 'false', 'off', '0'))) {
                return false;
            }
        }
        return $param;
    }
667859
public function compile()
	{
		if ($this->multiArticle)
		{
			$objArticles = \ArticleModel::findMultipleByIds(\StringUtil::deserialize($this->data->multiArticle));

			// Return if there are no pages
			if ($objArticles === null)
			{
				return;
			}

			$arrArticles = array();

			// Sort the array keys according to the given order
			if ($this->data->orderArticle != '')
			{
				$tmp = \StringUtil::deserialize($this->data->orderArticle);

				if (!empty($tmp) && is_array($tmp))
				{
					$arrArticles = array_map(function () {}, array_flip($tmp));
				}
			}

			// Add the items to the pre-sorted array
			while ($objArticles->next())
			{
				$arrArticles[$objArticles->id] = $objArticles->row();
			}

			$arrArticles = array_values(array_filter($arrArticles));
			
			$this->writeToTemplate($arrArticles);

			}
		else
		{
			if (($objArticle = \ArticleModel::findById($this->data->singleArticle)) !== null)
			{
				$this->writeToTemplate($objArticle->row());
			}
		}
	}
221895
public static function load($param)
    {
        if (!($node = self::loadById($param))) {
            $node = self::loadByPath($param);
        }

        return $node;
    }
823214
public function compile()
	{
		if ($this->multiPage)
		{
			$objPages = \PageModel::findMultipleByIds(\StringUtil::deserialize($this->data->multiPage));

			// Return if there are no pages
			if ($objPages === null)
			{
				return;
			}

			$arrPages = array();

			// Sort the array keys according to the given order
			if ($this->data->orderPage != '')
			{
				$tmp = \StringUtil::deserialize($this->data->orderPage);

				if (!empty($tmp) && is_array($tmp))
				{
					$arrPages = array_map(function () {}, array_flip($tmp));
				}
			}

			// Add the items to the pre-sorted array
			while ($objPages->next())
			{
				$arrPages[$objPages->id] = $objPages->row();
			}

			$arrPages = array_values(array_filter($arrPages));
			
			$this->writeToTemplate($arrPages);
		}
		else
		{
			if (($objPage = \PageModel::findById($this->data->singlePage)) !== null)
			{
                $this->writeToTemplate($objPage->row());
            }
		}
	}
434180
public static function paramFilter($param) {
        if (empty($param)) {
            $param = '';
        }

        if (is_array($param)) {
            foreach ($param as $key => $value) {
                $param[$key] = String::urlSafetyFilter($value);
            }
        }

        if (is_string($param)) {
            $param = String::urlSafetyFilter($param);
        }

        return $param;
    }
359539
protected function getParamDefaultLocal($param)
    {
        $param = $this->getParameter($param);
        if (!is_null($param))
            return $param;

        return $this->getLocal($param);
    }
192054
protected function getPaginationQueryBuilder($params)
    {
        $filter = $this->getService('FilterManager')->get('PaginationQuery/Applications');
        $qb = $filter->filter($params, $this->createQueryBuilder());
        
        return $qb;
    }
999899
public function afficheFaireUnDon($params = array())
    {
        $html = "";
    
        $t = new Template('modules/archi/templates/');
        $t->set_filenames(array('faireUnDon'=>'staticFaireUnDon.tpl'));
        $t->assign_vars(
            array(
                "lang"=>LANG
            )
        );
        
        
        
        
        

        
        ob_start();
        $t->pparse('faireUnDon');
        $html .= ob_get_contents();
        ob_end_clean();
    
        return $html;
    }
349684
public function getParam($param)
    {
        if (!is_string($param)) {
            throw new \Erebot\InvalidValueException('Bad parameter name');
        }
        if (!isset($this->params[$param])) {
            throw new \Erebot\NotFoundException('No such parameter');
        }
        return $this->params[$param];
    }
1349176
protected function _tag_open_WRITE($param)
    {
        $fill = ($this->parsingCss->value['background']['color'] !== null && $this->parsingCss->value['background']['image'] === null);
        if (in_array($this->parsingCss->value['id_tag'], array('fieldset', 'legend', 'div', 'table', 'tr', 'td', 'th'))) {
            $fill = false;
        }

        // get the text to write
        $txt = $param['txt'];

        if ($this->_isAfterFloat) {
            $txt = ltrim($txt);
            $this->_isAfterFloat = false;
        }

        $txt = str_replace('[[page_nb]]', $this->pdf->getMyAliasNbPages(), $txt);
        $txt = str_replace('[[page_cu]]', $this->pdf->getMyNumPage($this->_page), $txt);

        if ($this->parsingCss->value['text-transform'] !== 'none') {
            if ($this->parsingCss->value['text-transform'] === 'capitalize') {
                $txt = mb_convert_case($txt, MB_CASE_TITLE, $this->_encoding);
            } elseif ($this->parsingCss->value['text-transform'] === 'uppercase') {
                $txt = mb_convert_case($txt, MB_CASE_UPPER, $this->_encoding);
            } elseif ($this->parsingCss->value['text-transform'] === 'lowercase') {
                $txt = mb_convert_case($txt, MB_CASE_LOWER, $this->_encoding);
            }
        }

        // size of the text
        $h  = 1.08*$this->parsingCss->value['font-size'];
        $dh = $h*$this->parsingCss->value['mini-decal'];
        $lh = $this->parsingCss->getLineHeight();

        // identify the align
        $align = 'L';
        if ($this->parsingCss->value['text-align'] === 'li_right') {
            $w = $this->parsingCss->value['width'];
            $align = 'R';
        }

        // calculate the width of each words, and of all the sentence
        $w = 0;
        $words = explode(' ', $txt);
        foreach ($words as $k => $word) {
            $words[$k] = array($word, $this->pdf->GetStringWidth($word));
            $w+= $words[$k][1];
        }
        $space = $this->pdf->GetStringWidth(' ');
        $w+= $space*(count($words)-1);

        // position in the text
        $currPos = 0;

        // the bigger width of the text, after automatic break line
        $maxX = 0;

        // position of the text
        $x = $this->pdf->GetX();
        $y = $this->pdf->GetY();
        $dy = $this->_getElementY($lh);

        // margins
        list($left, $right) = $this->_getMargins($y);

        // number of lines after automatic break line
        $nb = 0;

        // while we have words, and the text does not fit on the line => we cut the sentence
        while ($x+$w>$right && $x<$right+$space && count($words)) {
            // adding words 1 by 1 to fit on the line
            $i=0;
            $old = array('', 0);
            $str = $words[0];
            $add = false;
            while (($x+$str[1])<$right) {
                $i++;
                $add = true;

                array_shift($words);
                $old = $str;

                if (!count($words)) {
                    break;
                }
                $str[0].= ' '.$words[0][0];
                $str[1]+= $space+$words[0][1];
            }
            $str = $old;

            // if nothing fits on the line, and if the first word does not fit on the line => the word is too long, we put it
            if ($i == 0 && (($left+$words[0][1])>=$right)) {
                $str = $words[0];
                array_shift($words);
                $i++;
                $add = true;
            }
            $currPos+= ($currPos ? 1 : 0)+strlen($str[0]);

            // write the extract sentence that fit on the page
            $wc = ($align === 'L' ? $str[1] : $this->parsingCss->value['width']);
            if ($right - $left<$wc) {
                $wc = $right - $left;
            }

            if (strlen($str[0])) {
                $this->pdf->SetXY($this->pdf->GetX(), $y+$dh+$dy);
                $this->pdf->Cell($wc, $h, $str[0], 0, 0, $align, $fill, $this->_isInLink);
                $this->pdf->SetXY($this->pdf->GetX(), $y);
            }
            $this->_maxH = max($this->_maxH, $lh);

            // max width
            $maxX = max($maxX, $this->pdf->GetX());

            // new position and new width for the "while"
            $w-= $str[1];
            $y = $this->pdf->GetY();
            $x = $this->pdf->GetX();
            $dy = $this->_getElementY($lh);

            // if we have again words to write
            if (count($words)) {
                // remove the space at the end
                if ($add) {
                    $w-= $space;
                }

                // if we don't add any word, and if the first word is empty => useless space to skip
                if (!$add && $words[0][0] === '') {
                    array_shift($words);
                }

                // if it is just to calculate for one line => adding the number of words
                if ($this->_isForOneLine) {
                    $this->_maxE+= $i;
                    $this->_maxX = max($this->_maxX, $maxX);
                    return null;
                }

                // automatic line break
                $this->_tag_open_BR(array('style' => ''), $currPos);

                // new position
                $y = $this->pdf->GetY();
                $x = $this->pdf->GetX();
                $dy = $this->_getElementY($lh);

                // if the next line does  not fit on the page => new page
                if ($y + $h>=$this->pdf->getH() - $this->pdf->getbMargin()) {
                    if (!$this->_isInOverflow && !$this->_isInFooter) {
                        $this->_setNewPage(null, '', null, $currPos);
                        $y = $this->pdf->GetY();
                        $x = $this->pdf->GetX();
                        $dy = $this->_getElementY($lh);
                    }
                }

                // if more than X line => error
                $nb++;
                if ($nb > $this->_sentenceMaxLines) {
                    $txt = '';
                    foreach ($words as $k => $word) {
                        $txt.= ($k ? ' ' : '').$word[0];
                    }
                    $e = new LongSentenceException(
                        'The current sentence takes more than '.$this->_sentenceMaxLines.' lines is the current box'
                    );
                    $e->setSentence($txt);
                    $e->setWidthBox($right-$left);
                    $e->setLength($w);
                    throw $e;
                }

                // new margins for the new line
                list($left, $right) = $this->_getMargins($y);
            }
        }

        // if we have words after automatic cut, it is because they fit on the line => we write the text
        if (count($words)) {
            $txt = '';
            foreach ($words as $k => $word) {
                $txt.= ($k ? ' ' : '').$word[0];
            }
            $w+= $this->pdf->getWordSpacing()*(count($words));
            $this->pdf->SetXY($this->pdf->GetX(), $y+$dh+$dy);
            $this->pdf->Cell(($align === 'L' ? $w : $this->parsingCss->value['width']), $h, $txt, 0, 0, $align, $fill, $this->_isInLink);
            $this->pdf->SetXY($this->pdf->GetX(), $y);
            $this->_maxH = max($this->_maxH, $lh);
            $this->_maxE+= count($words);
        }

        $maxX = max($maxX, $this->pdf->GetX());
        $maxY = $this->pdf->GetY()+$h;

        $this->_maxX = max($this->_maxX, $maxX);
        $this->_maxY = max($this->_maxY, $maxY);

        return true;
    }
1264437
private function page($num)
    {
        if ($num == 1) {
            return $this->page->url('delete', $this->url, $this->get);
        }

        return $this->page->url('add', $this->url, $this->get, $num.'of'.$this->total);
    }
365010
public function getPaginatorCursor($params)
    {
        $filter = $this->getService('filterManager')->get('Jobs/PaginationQuery');
        /* @var $filter \Core\Repository\Filter\AbstractPaginationQuery  */
        $qb = $filter->filter($params, $this->createQueryBuilder());
        return $qb->getQuery()->execute();
    }