summaryrefslogtreecommitdiff
path: root/demos/blog-tutorial/protected/layout
diff options
context:
space:
mode:
Diffstat (limited to 'demos/blog-tutorial/protected/layout')
-rw-r--r--demos/blog-tutorial/protected/layout/MainLayout.php25
-rw-r--r--demos/blog-tutorial/protected/layout/MainLayout.tpl12
2 files changed, 35 insertions, 2 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
diff --git a/demos/blog-tutorial/protected/layout/MainLayout.tpl b/demos/blog-tutorial/protected/layout/MainLayout.tpl
index 1ee83bae..f2bc1f96 100644
--- a/demos/blog-tutorial/protected/layout/MainLayout.tpl
+++ b/demos/blog-tutorial/protected/layout/MainLayout.tpl
@@ -24,7 +24,17 @@
<com:TopicList ID="TopicPanel" />
</td>
<td valign="top">
-
+<com:TRepeater ID="languages" OnItemCreated="languageLinkCreated">
+ <prop:HeaderTemplate>
+ <div class="languages">Available Languages: <ul>
+ </prop:HeaderTemplate>
+ <prop:ItemTemplate>
+ <li><com:THyperLink ID="link" Text=<%# $this->DataItem %> /></li>
+ </prop:ItemTemplate>
+ <prop:FooterTemplate>
+ </ul></div>
+ </prop:FooterTemplate>
+</com:TRepeater>
<div id="content">
<com:TContentPlaceHolder ID="Main" />
</div>