Changeset 9


Ignore:
Timestamp:
Jun 14, 2012, 12:04:49 AM (12 years ago)
Author:
maron
Message:

přidání odkazu k stránkám, selekce stránek

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/class/Gui.php

    r8 r9  
    1818        $this->Messages = new Messages();
    1919        $this->Language = new Language();
    20         $this->Feedback();
     20       
    2121        $this->InitLinks();
    2222        $this->InitPages();
     23       
     24        //have to be after inicialization of pages
     25        $this->Feedback();
    2326  }
    2427 
     
    3538  }
    3639
     40//gets feedback from post and get
     41  private function Feedback() {
     42        $this->Messages->GetPost();
     43        $this->Messages->GetGet();
     44        $this->ActivePage = $this->Messages->WhichPage($this->Pages);
     45  }       
     46
    3747//shows page concent
    3848  public function ShowPage() {
     
    4555  }
    4656
    47 //gets feedback from post and get
    48   private function Feedback() {
    49         $this->ActivePage = $this->Messages->WhichPage();
    50         $this->Messages->GetPost();
    51         $this->Messages->GetGet();
    52   }
    53          
    5457
    5558//shows header of web page
  • trunk/class/Messages.php

    r7 r9  
    2020
    2121//returns actual page
    22   public function WhichPage() {
    23           return 'home';
     22  public function WhichPage($Pages) {
     23        foreach($Pages as $Key => $Page )
     24    {
     25                if ( isset($_GET[$Page->GetKey()]) ) {
     26                        return $Page->GetKey();
     27                }
     28    }
     29    if ($_GET == array()) return 'home';
     30    return 'notfound';
    2431  }
    2532//returns
  • trunk/class/Page.php

    r8 r9  
    77{
    88  protected $Content = 'ggg';
    9   protected $Title = '';
    109  protected $Language;
     10  protected $Key;
     11  public $Link;
    1112
    12   function __construct($Language)
     13  function __construct($Key,$Language)
    1314  {
    1415          $this->Language = $Language;
    15         print_r($this->Language->Texts);
     16          $Name = $Language->Texts[$Key]['name'];
     17          $Title = $Language->Texts[$Key]['title'];
     18          $Addres = '?'.$Key;
     19          $this->Key = $Key;
     20          $this->Link = new Link($Name,$Addres,$Title); 
    1621  }
    1722
     
    2631  }
    2732
     33//Get key of page
     34  public function GetKey() {
     35        return $this->Key;
     36  } 
     37
    2838//sets title of page
    2939  protected function SetTitle($Title) {
    30         $this->Title = $Title;
     40        $this->Link->Title = $Title;
    3141  }
    3242
  • trunk/class/PageHome.php

    r8 r9  
    88class PageHome extends Page
    99{
    10 /*
    11   function __construct($__)
     10
     11  function __construct($Language)
    1212  {
    13           parent::__construct($__);
     13          parent::__construct('home',$Language);
    1414  }
    15   */
     15 
    1616  protected function Generate() {
    1717        //generation of the page
    18         parent::Generate($this->Language->Texts['home']['content']);
    19         parent::SetTitle($this->Language->Texts['home']['title']);
     18        parent::Generate($this->Language->Texts['home']['content'].' '.$this->Link->Get());
    2019       
    2120  }
  • trunk/cs_lang.php

    r8 r9  
    44
    55        $Texts = array(
    6                 'home' => array(
     6                'home' => array( //key page
    77                        'title' => 'Úvodní stránka',
     8                        'name' => 'Úvodní stránka',
    89                        'content' => 'Toto je úvodní stránka'
    910               
Note: See TracChangeset for help on using the changeset viewer.