Changeset 6


Ignore:
Timestamp:
Jun 13, 2012, 10:16:46 PM (13 years ago)
Author:
maron
Message:

třídy odkazů, stránek

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/class/Database.php

    r5 r6  
    1515  var $ShowSQLError = false;
    1616
    17   function __construct($Config)
     17  function __construct()
    1818  {
    19     include_once('Config.php');
    20     $this->Config = $Config;
     19    $this->Config = new Config();
    2120    $this->Database->HostName = $this->Config->Database['Host'];
    2221    $this->Database->UserName = $this->Config->Database['User'];
  • trunk/class/Gui.php

    r5 r6  
    22
    33// Grafic user interface class
    4 // Date: 2012-06-12
     4// Date: 2012-06-13
    55
    66class Gui
    77{
    8   var $Config;
    9   var $Links = array(
    10         'SourceCode' => 'http://svn.zdechov.net/svn/phpvpsadmin/',
    11   );
    12   var $LinksNames = array(
    13         'SourceCode' => 'Zdrojové kódy',
    14   );
     8  private $Config;
     9  private $Messages;
     10  private $ActivePage = 'home';
     11  private $Links = array();
     12  private $Pages = array();
    1513
    16   function __construct($Config)
     14  function __construct()
    1715  {
    18     include_once('Config.php');
    19     $this->Config = $Config;   
     16    $this->Config = new Config(); 
     17        $this->Messages = new Messages();
     18        $this->Feedback();
     19        $this->InitLinks();
     20        $this->InitPages();
     21  }
     22 
     23//init links
     24  private function InitLinks() {
     25          $this->Links['SourceCode'] = new Link('Zdrojové kódy','http://svn.zdechov.net/svn/phpvpsadmin/',''); 
     26         
    2027  }
    2128
    22   function Link($key) {
    23         return '<a href="'.$this->Links[$key].'">'.$this->LinksNames[$key].'</a>';
    24         return '<a href="'.$this->Links[$key].'">'.$this->LinksNames[$key].'</a>';
     29//init Pages
     30  private function InitPages() {
     31          $this->Pages['home'] = new PageHome(); 
     32         
    2533  }
    2634
    27 function ShowHeader()
    28 {
     35//shows page concent
     36  public function ShowPage() {
     37        $this->ShowHeader();
     38       
     39        //generate and shows active page
     40        $this->Pages[$this->ActivePage]->Show();
     41       
     42        $this->ShowFooter();
     43  }
     44
     45//gets feedback from post and get
     46  private function Feedback() {
     47        $this->ActivePage = $this->Messages->WhichPage();
     48        $this->Messages->GetPost();
     49        $this->Messages->GetGet();
     50  }
     51         
     52
     53//shows header of web page
     54  private function ShowHeader()
     55  {
    2956 
    3057  echo('<?xml version="1.0" encoding="'.$this->Config->Web['Charset'].'"?>
     
    4168  echo('<title>'.$this->Config->Web['Title'].'</title></head><body><table><tr><td>');
    4269
    43 }
     70  }
    4471
    45 function ShowFooter()
    46 {
     72//shows footer of webpage
     73  private function ShowFooter()
     74  {
    4775    echo('</td>'.
    4876  '</tr><tr>'.
    49   '<td colspan="4" class="page-bottom">Autoři: '.$this->Config->Web['Authors'].' &nbsp; '.$this->Link('SourceCode').' &nbsp; '.
    50   '<a href="http://wowpreklad.zdechov.net/trac/wowpreklad/log/trunk?verbose=on">Novinky</a> &nbsp; ');
     77  '<td colspan="4" class="page-bottom">Autoři: '.$this->Config->Web['Authors'].' &nbsp; '.$this->Links['SourceCode']->Get().'');
    5178
    5279    echo('</td></tr>');
     
    5481      '</body>'.
    5582      '</html>');
    56 }
     83  }
    5784
    5885}
  • trunk/index.php

    r5 r6  
    1616        }
    1717
    18         include_once('class/Config.php');
    19         $Config = new Config();
    20         $Database = new Database($Config);
    21         $Gui = new Gui($Config);
     18        $Database = new Database();
     19        $Gui = new Gui();
    2220       
    23         $Gui->ShowHeader();
    24         $Gui->ShowFooter();
     21        $Gui->ShowPage();
    2522       
    26         echo 'hello world!';
     23       
    2724?>
Note: See TracChangeset for help on using the changeset viewer.