| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
function jtpl_function_html_jAjaxLink($tpl,$txt, $blockId, $tplName, $tagAttr = array(), $classActive = "", $defaultActiveLink = false){ |
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
$activeTpl = $GLOBALS['gJCoord']->request->getParam($blockId.'activeTpl'); |
|---|
| 28 |
if(($activeTpl == $tplName) || ($activeTpl == '' && $defaultActiveLink)){ |
|---|
| 29 |
$isActiveLink = true; |
|---|
| 30 |
}else{ |
|---|
| 31 |
$isActiveLink = false; |
|---|
| 32 |
} |
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
if($isActiveLink){ |
|---|
| 36 |
if(array_key_exists('class', $tagAttr)){ |
|---|
| 37 |
$tagAttr['class'] = $tagAttr['class'].' '.$classActive; |
|---|
| 38 |
}else{ |
|---|
| 39 |
$tagAttr['class'] = $classActive; |
|---|
| 40 |
} |
|---|
| 41 |
} |
|---|
| 42 |
|
|---|
| 43 |
$pageURL = 'http://'.$_SERVER['HTTP_HOST'].$GLOBALS['gJCoord']->request->urlScript.$GLOBALS['gJCoord']->request->urlPathInfo.'?'; |
|---|
| 44 |
$q = http_build_query(array_merge($_GET, array($blockId.'activeTpl'=> $tplName)), '', '&'); |
|---|
| 45 |
if(strpos($q, '%3A')!==false) |
|---|
| 46 |
$q = str_replace( '%3A', ':', $q); |
|---|
| 47 |
$pageURL .=$q; |
|---|
| 48 |
$tagAttr['href'] = $pageURL; |
|---|
| 49 |
|
|---|
| 50 |
$tagAttr['srcurl'] = jUrl::get('commun~ajax:getZone', array('zone'=>'commun~ajax', 'blockId'=>$blockId, $blockId.'activeTpl'=> $tplName), true); |
|---|
| 51 |
$tagAttr['targetid'] = $blockId; |
|---|
| 52 |
$tagAttr['activeclassname'] = $classActive; |
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 |
echo('<a '); |
|---|
| 56 |
foreach ($tagAttr as $attrName => $attrVal) { |
|---|
| 57 |
echo($attrName."='".$attrVal."' "); |
|---|
| 58 |
} |
|---|
| 59 |
echo('>'.$txt.'</a>'); |
|---|
| 60 |
} |
|---|
| 61 |
?> |
|---|
| 62 |
|
|---|