| | 1 | <?php |
|---|
| | 2 | /** |
|---|
| | 3 | * @package jelix |
|---|
| | 4 | * @subpackage jtpl_plugin |
|---|
| | 5 | * @author Lepeltier kévin |
|---|
| | 6 | * @copyright 2008 Lepeltier kévin |
|---|
| | 7 | * @link http://www.jelix.org |
|---|
| | 8 | * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html |
|---|
| | 9 | */ |
|---|
| | 10 | |
|---|
| | 11 | /** |
|---|
| | 12 | * Adds the path followed by the user |
|---|
| | 13 | * |
|---|
| | 14 | * {ariane 5, '>>'} |
|---|
| | 15 | * |
|---|
| | 16 | * <ol id="ariane"> |
|---|
| | 17 | * <li value="3" class="first"><a href="./?module=main&action=page&page=home">Home</a> >> </li> |
|---|
| | 18 | * <li><a href="./?module=main&action=page&page=product">Product</a> >> </li> |
|---|
| | 19 | * <li><a href="./?module=main&action=page&page=home">Home</a> >> </li> |
|---|
| | 20 | * <li class="end"><a href="./?module=main&action=page&page=contact">Contact</a></li> |
|---|
| | 21 | * </ol> |
|---|
| | 22 | * |
|---|
| | 23 | * Rendering example : |
|---|
| | 24 | * |
|---|
| | 25 | * Home >> Product >> Home >> Contact |
|---|
| | 26 | * ¯¯¯¯ ¯¯¯¯¯¯¯ ¯¯¯¯ |
|---|
| | 27 | */ |
|---|
| | 28 | |
|---|
| | 29 | /** |
|---|
| | 30 | * ariane plugin : write the Ariane Wire : Shows the travels of the user |
|---|
| | 31 | * |
|---|
| | 32 | * @param jTpl $tpl template engine |
|---|
| | 33 | * @param array $nb the number of items displayed by the plugin |
|---|
| | 34 | * @param string $separator Symbol separating items |
|---|
| | 35 | */ |
|---|
| | 36 | function jtpl_function_html_ariane($tpl, $nb=null, $separator = '') { |
|---|
| | 37 | |
|---|
| | 38 | if( isset($_SESSION['HISTORY']) ) { |
|---|
| | 39 | |
|---|
| | 40 | echo '<ol class="history">'; |
|---|
| | 41 | |
|---|
| | 42 | $leng = count($_SESSION['HISTORY']); |
|---|
| | 43 | $nb = ($nb !== null)? count($_SESSION['HISTORY'])-$nb:0; |
|---|
| | 44 | $nb = ($nb < 0)? 0:$nb; |
|---|
| | 45 | |
|---|
| | 46 | for( $i = $nb; $i < $leng; $i++ ) { |
|---|
| | 47 | |
|---|
| | 48 | $page = $_SESSION['HISTORY'][$i]; |
|---|
| | 49 | |
|---|
| | 50 | echo '<li value="'.($i+1).'"'.($i==$nb?' class="first"':($i==$leng-1?' class="end"':'')).'>'; |
|---|
| | 51 | |
|---|
| | 52 | if( $i!=$leng-1 ) |
|---|
| | 53 | echo '<a href="'.jUrl::get($page['action'], $page['params'], jUrl::XMLSTRING).'" '.($page['title']!=''?'title="'.$page['title'].'"':'').'>'; |
|---|
| | 54 | |
|---|
| | 55 | echo $_SESSION['HISTORY'][$i]['label']; |
|---|
| | 56 | |
|---|
| | 57 | if( $i!=$leng-1 ) |
|---|
| | 58 | echo '</a>'; |
|---|
| | 59 | |
|---|
| | 60 | echo ($i==$leng-1?'':$separator).'</li>'; |
|---|
| | 61 | } |
|---|
| | 62 | |
|---|
| | 63 | echo '</ol>'; |
|---|
| | 64 | } |
|---|
| | 65 | } |
|---|
| | 66 | ?> |