Ignore:
Timestamp:
Mar 6, 2023, 1:48:45 AM (21 months ago)
Author:
chronos
Message:
  • Fixed: Class types casting for better type checking.
  • Fixed: XML direct export.
  • Modified: User class instance moved from Core class to ModuleUser class.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/View.php

    r888 r893  
    33class BaseView extends View
    44{
    5   var $Title;
     5  public string $Title;
    66
    77  function ShowLocaleSelector()
     
    99    //$Output .= ' <form action="?setlocale" method="get">';
    1010    $Output = ' <select onchange="window.location=this.value">';
    11     foreach ($this->System->LocaleManager->Available as $Locale)
     11    foreach (Core::Cast($this->System)->LocaleManager->Available as $Locale)
    1212    {
    13       $Remaining = substr($_SERVER["REQUEST_URI"], strlen($this->System->BaseURL));
    14       if (substr($Remaining, 1, strlen($Locale['Code'].'/')) == $this->System->LocaleManager->LangCode.'/')
     13      $Remaining = substr($_SERVER["REQUEST_URI"], strlen(Core::Cast($this->System)->BaseURL));
     14      if (substr($Remaining, 1, strlen($Locale['Code'].'/')) == Core::Cast($this->System)->LocaleManager->LangCode.'/')
    1515        $Remaining = substr($Remaining, strlen('/'.$Locale['Code']));
    16       if ($Locale['Code'] == $this->System->LocaleManager->CurrentLocale->Texts->Code) $Selected = ' selected="selected"';
     16      if ($Locale['Code'] == Core::Cast($this->System)->LocaleManager->CurrentLocale->Texts->Code) $Selected = ' selected="selected"';
    1717        else $Selected = '';
    18       $Remaining = Core::Cast($this->System)->TranslateReverseURL($Remaining, $this->System->LocaleManager->LangCode);
     18      $Remaining = Core::Cast($this->System)->TranslateReverseURL($Remaining, Core::Cast($this->System)->LocaleManager->LangCode);
    1919
    2020      $URL = Core::Cast($this->System)->LinkLocale($Remaining, $Locale['Code']);
     
    2828  function ShowTopBar()
    2929  {
     30    $User = ModuleUser::Cast($this->System->GetModule('User'))->User;
    3031    $Output = '<div class="Menu">';
    31     if (isset($this->System->User))
     32    if (isset($User))
    3233    {
    33       if (!$this->System->User->Licence(LICENCE_USER))
    34         $Output .= '<div class="advert">'.$this->System->Config['Web']['Advertisement'].'</div>';
     34      if (!$User->Licence(LICENCE_USER))
     35        $Output .= '<div class="advert">'.Core::Cast($this->System)->Config['Web']['Advertisement'].'</div>';
    3536    }
    3637    $Output .= '<span class="MenuItem"></span><span class="MenuItem2">';
     
    3839    // Show bars items
    3940    $Bar = '';
    40     foreach ($this->System->Bars['Top'] as $BarItem)
     41    foreach (Core::Cast($this->System)->Bars['Top'] as $BarItem)
    4142      $Bar .= call_user_func($BarItem);
    4243    if (trim($Bar) != '') $Output .= $Bar;
     
    5152  function ShowMainMenu()
    5253  {
     54    $User = ModuleUser::Cast($this->System->GetModule('User'))->User;
    5355    $Output = '<strong>'.T('Menu').':</strong>'.
    5456      '<div class="verticalmenu"><ul>';
    55     foreach ($this->System->Menu as $MenuItem)
     57    foreach (Core::Cast($this->System)->Menu as $MenuItem)
    5658    {
    57       if (!isset($this->System->User) or $this->System->User->Licence($MenuItem['Permission']))
     59      if (!isset($User) or $User->Licence($MenuItem['Permission']))
    5860      {
    5961        if (isset($MenuItem['Click'])) $OnClick = ' onclick="'.$MenuItem['Click'].'"';
     
    7577    '<html>'.
    7678    '<head>'.
    77     '<meta http-equiv="content-type" content="text/html; charset='.$this->System->Config['Web']['Charset'].'" />'.
    78     '<meta name="keywords" content="'.$this->System->Config['Web']['Keywords'].'" />'.
    79     '<meta name="description" content="'.$this->System->Config['Web']['Description'].'" />'.
     79    '<meta http-equiv="content-type" content="text/html; charset='.Core::Cast($this->System)->Config['Web']['Charset'].'" />'.
     80    '<meta name="keywords" content="'.Core::Cast($this->System)->Config['Web']['Keywords'].'" />'.
     81    '<meta name="description" content="'.Core::Cast($this->System)->Config['Web']['Description'].'" />'.
    8082    '<meta name="robots" content="all" />'.
    8183    '<meta name="viewport" content="width=device-width, initial-scale=1">'.
     
    8688    // Show page headers
    8789    $Bar = '';
    88     foreach ($this->System->PageHeaders as $Item)
     90    foreach (Core::Cast($this->System)->PageHeaders as $Item)
     91    {
    8992      $Output .= call_user_func($Item);
     93    }
    9094
    91     $Title = $this->System->Config['Web']['Title'];
     95    $Title = Core::Cast($this->System)->Config['Web']['Title'];
    9296    if ($this->Title != '') $Title = $this->Title.' - '.$Title;
    9397    $Output .= '<title>'.$Title.'</title>'.
     
    101105    // Show bars items
    102106    $Bar = '';
    103     foreach ($this->System->Bars['Left'] as $BarItem)
     107    foreach (Core::Cast($this->System)->Bars['Left'] as $BarItem)
    104108      $Bar .= call_user_func($BarItem);
    105109    if (trim($Bar) != '') $Output .= $Bar;
     
    120124    // Show bars items
    121125    $Bar = '';
    122     foreach ($this->System->Bars['Right'] as $BarItem)
     126    foreach (Core::Cast($this->System)->Bars['Right'] as $BarItem)
    123127      $Bar .= call_user_func($BarItem);
    124128    if (trim($Bar) != '') $Output .= $Bar;
     
    129133      ' &nbsp; <a href="https://app.zdechov.net/wowpreklad/browser/trunk">'.T('Source code').'</a> &nbsp; '.
    130134      '<a href="https://app.zdechov.net/wowpreklad/log/trunk?verbose=on">'.T('Changelog').'</a> &nbsp; '.
    131       $this->System->Config['Web']['WebCounter'];
     135      Core::Cast($this->System)->Config['Web']['WebCounter'];
    132136
    133137    $Output .= '</td></tr>';
    134     if ($this->System->Config['Web']['ShowRuntimeInfo'] == true)
     138    if (Core::Cast($this->System)->Config['Web']['ShowRuntimeInfo'] == true)
    135139      $Output .= '<tr><td colspan="3" style="text-align: center;">'.T('Generating duration').': '.
    136140    $ScriptGenerateDuration.' s / '.ini_get('max_execution_time').' s &nbsp;&nbsp; '.T('Used memory').': '.
     
    146150  {
    147151    $Output = $this->ShowHeader().$Content.$this->ShowFooter();
    148     if ($this->System->Config['Web']['FormatOutput'])
     152    if (Core::Cast($this->System)->Config['Web']['FormatOutput'])
    149153      $Output = $this->FormatOutput($Output);
    150154    return $Output;
Note: See TracChangeset for help on using the changeset viewer.