Changeset 618 for trunk/includes/system.php
- Timestamp:
- Dec 4, 2013, 12:39:55 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/system.php
r610 r618 23 23 function Init() 24 24 { 25 global $Config ;25 global $Config, $LocaleManager; 26 26 27 27 $this->Config = $Config; … … 35 35 //$this->Database->LogSQLQuery = $this->Config['Web']['LogSQLQuery']; 36 36 $this->ModuleManager = new AppModuleManager(); 37 37 38 $this->PathItems = ProcessURL(); 39 // Initialize locale 40 $LocaleManager = new LocaleManager($this); 41 $LocaleManager->Dir = dirname(dirname(__FILE__)).'/locale'; 42 $LocaleManager->Available = array( 43 'cs' => array('Code' => 'cs', 'Title' => 'Česky'), 44 'en' => array('Code' => 'en', 'Title' => 'English'), 45 ); 46 $Code = $Config['Web']['Locale']; 47 if(array_key_exists('Locale', $_SESSION)) $Code = $_SESSION['Locale']; 48 if(array_key_exists('locale', $_GET)) $Code = $_GET['locale']; 49 //echo(phpinfo()); 50 if(!array_key_exists($Code, $LocaleManager->Available)) $Code = 'en'; 51 $_SESSION['Locale'] = $Code; 52 $LocaleManager->LoadLocale($Code); 53 38 54 $this->Menu = array 39 55 ( … … 141 157 if($this->DoNotShowPage == false) 142 158 { 143 $this->PathItems = ProcessURL();144 159 $this->ShowPage(); 145 160 } … … 229 244 function ShowTopBar() 230 245 { 246 global $LocaleManager; 247 231 248 $Output = '<div class="Menu">'; 232 249 if(!$this->System->User->Licence(LICENCE_USER)) 233 250 $Output .= '<div class="advert">'.$this->System->Config['Web']['Advertisement'].'</div>'; 234 $Output .= '<span class="MenuItem"></span> ';251 $Output .= '<span class="MenuItem"></span><span class="MenuItem2">'; 235 252 if($this->System->User->Licence(LICENCE_USER)) 236 253 { … … 238 255 //$Team = $DbResult->fetch_assoc(); 239 256 //$Output .= ''<span class="MenuItem">Moje překlady: <a href="">Dokončené</a> <a href="">Rozpracované</a> <a href="">Exporty</a> Tým: <a href="">'.$Team['name'].'</a></span>'; 240 $Output .= '<span class="MenuItem2">'.$this->System->User->Name.' <a href="'.$this->System->Link('/?action=logout').'">'.T('Logout').'</a>'.257 $Output .= $this->System->User->Name.' <a href="'.$this->System->Link('/?action=logout').'">'.T('Logout').'</a>'. 241 258 ' <a href="'.$this->System->Link('/user.php?user='.$this->System->User->Id).'">'.T('My page').'</a>'. 242 259 ' <a href="'.$this->System->Link('/Options.php').'">'.T('Options').'</a>'. … … 245 262 ' <a title="Vaše rozpracované text" href="'.$this->System->Link('/TranslationList.php?user='. 246 263 $this->System->User->Id.'&group=0&state=3&text=&entry=').'">'.T('Unfinished').'</a>'. 247 ' <a title="Nikým nepřeložené texty" href="'. $this->System->Link('/TranslationList.php?user=0&group=0&state=1&text=&entry=').'">'.T('Untranslated').'</a>'.248 '</span>';264 ' <a title="Nikým nepřeložené texty" href="'. 265 $this->System->Link('/TranslationList.php?user=0&group=0&state=1&text=&entry=').'">'.T('Untranslated').'</a>'; 249 266 } else 250 267 { 251 $Output .= '< span class="MenuItem2"><form action="'.$this->System->Link('/?action=login').'" method="post"> '.268 $Output .= '<form action="'.$this->System->Link('/?action=login').'" method="post"> '. 252 269 'Jméno: <input type="text" name="LoginUser" size="8 " /> '. 253 270 'Heslo: <td><input type="password" name="LoginPass" size="8" /> '. 254 271 '<input type="submit" value="'.T('Login').'" /></form> '. 255 '<a href="'.$this->System->Link('/registrace.php').'">'.T('Registration').'</a> </span>';272 '<a href="'.$this->System->Link('/registrace.php').'">'.T('Registration').'</a>'; 256 273 } 257 $Output .= '</div>'; 274 $Output .= ' <form action="?setlocale" method="get">'; 275 $Output .= '<select onchange="window.location=\'?locale=\'+this.value">'; 276 foreach($LocaleManager->Available as $Locale) 277 { 278 if($Locale['Code'] == $LocaleManager->CurrentLocale->Texts->Code) $Selected = ' selected="selected"'; 279 else $Selected = ''; 280 $Output .= '<option title="" value="'.$Locale['Code'].'"'.$Selected.' onchange="this.form.submit()">'.$Locale['Title'].'</option>'; 281 } 282 $Output .= '</select><noscript><input type="submit" value="Submit"></noscript></form>'; 283 $Output .= '</span></div>'; 258 284 return($Output); 259 285 }
Note:
See TracChangeset
for help on using the changeset viewer.