Left: | ||
Right: |
OLD | NEW |
---|---|
1 <?php | 1 <?php |
2 | 2 |
3 class AnwTemplateOverride_action_view extends AnwTemplateDefault_action_view | 3 class AnwTemplateOverride_action_view extends AnwTemplateDefault_action_view |
4 { | 4 { |
5 function viewPage($sContentHtmlDir, $sCss, $title, $content, $editiontime, $ao Translations) | 5 function viewPage($sContentHtmlDir, $sCss, $title, $content, $editiontime, $ao Translations) |
6 { | 6 { |
7 $HTML = <<<EOF | 7 $HTML = <<<EOF |
8 | 8 |
9 {$this->pageTranslations($aoTranslations)} | 9 {$this->pageTranslations($aoTranslations)} |
Felix Dahlke
2013/01/09 13:20:26
How about replacing this with {} and removing the
Wladimir Palant
2013/01/09 13:32:12
Oops, didn't realize that we override the caller a
| |
10 | 10 |
11 <div class="$sCss" dir="$sContentHtmlDir"> | 11 <div class="$sCss" dir="$sContentHtmlDir"> |
12 $content | 12 $content |
13 </div> | 13 </div> |
14 EOF; | 14 EOF; |
15 return $HTML; | 15 return $HTML; |
16 } | 16 } |
17 | 17 |
18 function pageTranslations($aoTranslations) | 18 function pageTranslations($aoTranslations) |
19 { | 19 { |
20 $languages = $this->getLanguages($aoTranslations); | 20 return ""; |
21 $currentLanguage = array_shift($languages); | |
22 $currentLang = $currentLanguage['lang']; | |
23 $currentText = $currentLanguage['text']; | |
24 | |
25 $HTML = <<<EOF | |
26 | |
27 {{#LANGUAGESELECTION}} | |
28 <li id="language"> | |
29 <div id="current-language"> | |
30 <div id="flag-$currentLang" class="flag sprite"></div><span>$currentText</sp an> | |
31 <span id="language-arrow" class="sprite"></span> | |
32 </div> | |
33 <ul id="language-selector"> | |
34 EOF; | |
35 | |
36 foreach ($languages as $language) | |
37 { | |
38 $url = $language['url']; | |
39 $linkStyle = $language['linkStyle']; | |
40 $lang = $language['lang']; | |
41 $text = $language['text']; | |
42 | |
43 $HTML .= <<<EOF | |
44 | |
45 <li class="language-entry"><a href="$url" style="$linkStyle"><div id="flag-$ lang" class="flag sprite"></div>$text</a></li> | |
46 EOF; | |
47 } | |
48 | |
49 $HTML .= <<<EOF | |
50 | |
51 </ul> | |
52 </li> | |
53 {{/LANGUAGESELECTION}} | |
54 EOF; | |
55 return $HTML; | |
56 } | |
57 | |
58 private function getLanguages($aoTranslations) | |
59 { | |
60 $languages = array(); | |
61 | |
62 foreach ($aoTranslations as $amInfo) | |
63 { | |
64 $oPage = $amInfo['page']; | |
65 $bCurrent = $amInfo['current']; | |
66 $sLang = $this->xQuote($oPage->getLang()); | |
67 $sLinkStyle = $amInfo['online'] ? '' : ' text-decoration:line-through;'; | |
68 $sText = $this->xText(self::g_('lang_' . $sLang, array(), | |
69 AnwAction::getActionLang())); | |
70 | |
71 $entry = array("lang" => $sLang, "linkStyle" => $sLinkStyle, | |
72 "text" => $sText); | |
73 | |
74 if ($bCurrent) | |
75 array_unshift($languages, $entry); | |
76 else | |
77 { | |
78 $asParams = $_GET; | |
79 unset($asParams[AnwActionPage::GET_PAGENAME]); //avoid loop | |
80 unset($asParams['browser']); | |
81 $sUrl = AnwUtils::link($oPage, "view", $asParams); | |
82 $entry['url'] = $this->xQuote($sUrl); | |
83 array_push($languages, $entry); | |
84 } | |
85 } | |
86 | |
87 return $languages; | |
88 } | 21 } |
89 } | 22 } |
90 | 23 |
91 ?> | 24 ?> |
OLD | NEW |