summaryrefslogtreecommitdiff
path: root/demos/blog-tutorial/protected/layout/MainLayout.php
diff options
context:
space:
mode:
Diffstat (limited to 'demos/blog-tutorial/protected/layout/MainLayout.php')
-rw-r--r--demos/blog-tutorial/protected/layout/MainLayout.php25
1 files changed, 24 insertions, 1 deletions
diff --git a/demos/blog-tutorial/protected/layout/MainLayout.php b/demos/blog-tutorial/protected/layout/MainLayout.php
index 253d6c03..4b5890de 100644
--- a/demos/blog-tutorial/protected/layout/MainLayout.php
+++ b/demos/blog-tutorial/protected/layout/MainLayout.php
@@ -1,7 +1,30 @@
<?php
class MainLayout extends TTemplateControl
-{
+{
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+
+ $this->languages->DataSource = TPropertyValue::ensureArray($this->Application->Parameters['languages']);
+ $this->languages->dataBind();
+ }
+
+ public function languageLinkCreated($sender, $param)
+ {
+ $item = $param->Item;
+ if($item->ItemType == TListItemType::Item || $item->ItemType == TListItemType::AlternatingItem)
+ {
+ $params = $this->Request->toArray();
+ $params['lang'] = $sender->DataKeys[$item->ItemIndex];
+ unset($params[$this->Request->ServiceID]);
+ $url = $this->Service->ConstructUrl($this->Service->RequestedPagePath, $params);
+ $item->link->NavigateUrl = $url;
+ if($this->Application->Globalization->Culture == $params['lang'])
+ $item->link->CssClass="active";
+ }
+ }
}
?> \ No newline at end of file