summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages/Fundamentals/Samples/Hangman/Home.php
diff options
context:
space:
mode:
authorjrags <>2006-03-06 02:38:22 +0000
committerjrags <>2006-03-06 02:38:22 +0000
commitb423ccc70198d2a73f991fc5a55f089d9e195082 (patch)
treed19d9c058cb8c0c22475b085b863c3b50ed3285c /demos/quickstart/protected/pages/Fundamentals/Samples/Hangman/Home.php
parent9bca357865376660fb53c2f4df72ca409345e777 (diff)
Updated Hangman to use view controls
Diffstat (limited to 'demos/quickstart/protected/pages/Fundamentals/Samples/Hangman/Home.php')
-rw-r--r--demos/quickstart/protected/pages/Fundamentals/Samples/Hangman/Home.php27
1 files changed, 11 insertions, 16 deletions
diff --git a/demos/quickstart/protected/pages/Fundamentals/Samples/Hangman/Home.php b/demos/quickstart/protected/pages/Fundamentals/Samples/Hangman/Home.php
index cbbd1c56..1d78186d 100644
--- a/demos/quickstart/protected/pages/Fundamentals/Samples/Hangman/Home.php
+++ b/demos/quickstart/protected/pages/Fundamentals/Samples/Hangman/Home.php
@@ -1,7 +1,12 @@
<?php
-
class Home extends TPage
{
+ public function onLoad($param)
+ {
+ if (!$this->IsPostBack)
+ $this->GameMultiView->ActiveView=$this->IntroView;
+ }
+
public function selectLevel($sender,$param)
{
if(($selection=$this->LevelSelection->SelectedValue)==='')
@@ -10,11 +15,11 @@ class Home extends TPage
return;
}
else
- $this->Level=TPropertyValue::ensureInteger($selection);
+ $this->Level=TPropertyValue::ensureInteger($selection);
$this->Word=$this->generateWord();
$this->GuessWord=str_repeat('_',strlen($this->Word));
$this->Misses=0;
- $this->showPanel('GuessPanel');
+ $this->GameMultiView->ActiveView=$this->GuessView;
}
public function guessWord($sender,$param)
@@ -35,7 +40,7 @@ class Home extends TPage
{
$this->GuessWord=$guessWord;
if($guessWord===$word)
- $this->showPanel('WinPanel');
+ $this->GameMultiView->ActiveView=$this->WinView;
}
else
{
@@ -47,12 +52,12 @@ class Home extends TPage
public function giveUp($sender,$param)
{
- $this->showPanel('LosePanel');
+ $this->GameMultiView->ActiveView=$this->LoseView;
}
public function startAgain($sender,$param)
{
- $this->showPanel('IntroPanel');
+ $this->GameMultiView->ActiveView=$this->IntroView;
$this->LevelError->Visible=false;
for($letter=65;$letter<=90;++$letter)
{
@@ -73,15 +78,6 @@ class Home extends TPage
return strtoupper($word);
}
- protected function showPanel($panelID)
- {
- $this->IntroPanel->Visible=false;
- $this->GuessPanel->Visible=false;
- $this->WinPanel->Visible=false;
- $this->LosePanel->Visible=false;
- $this->$panelID->Visible=true;
- }
-
public function setLevel($value)
{
$this->setViewState('Level',$value,0);
@@ -122,5 +118,4 @@ class Home extends TPage
return $this->getViewState('Misses',0);
}
}
-
?> \ No newline at end of file