| 1 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
class MainLayout extends TTemplateControl
|
|
|
4 |
{
|
|
|
5 |
|
|
|
6 |
public function onLoad($param)
|
|
|
7 |
{
|
|
|
8 |
parent::onLoad($param);
|
|
|
9 |
|
|
|
10 |
$this->languages->DataSource = TPropertyValue::ensureArray($this->Application->Parameters['languages']);
|
|
|
11 |
$this->languages->dataBind();
|
|
|
12 |
}
|
|
|
13 |
|
|
|
14 |
public function languageLinkCreated($sender, $param)
|
|
|
15 |
{
|
|
|
16 |
$item = $param->Item;
|
|
|
17 |
if($item->ItemType == TListItemType::Item || $item->ItemType == TListItemType::AlternatingItem)
|
|
|
18 |
{
|
|
|
19 |
$params = $this->Request->toArray();
|
|
|
20 |
$params['lang'] = $sender->DataKeys[$item->ItemIndex];
|
|
|
21 |
unset($params[$this->Request->ServiceID]);
|
|
|
22 |
$url = $this->Service->ConstructUrl($this->Service->RequestedPagePath, $params);
|
|
|
23 |
$item->link->NavigateUrl = $url;
|
|
|
24 |
if($this->Application->Globalization->Culture == $params['lang'])
|
|
|
25 |
$item->link->CssClass="active";
|
|
|
26 |
}
|
|
|
27 |
}
|
|
|
28 |
}
|
|
|
29 |
|
|
|
30 |
?>
|