| 1 |
lars |
1 |
<?php
|
|
|
2 |
// $Id: Home.php 2474 2008-07-03 17:28:20Z mikl $
|
|
|
3 |
class Home extends TPage
|
|
|
4 |
{
|
|
|
5 |
public function suggestNames($sender,$param) {
|
|
|
6 |
// Get the token
|
|
|
7 |
$token=$param->getToken();
|
|
|
8 |
// Sender is the Suggestions repeater
|
|
|
9 |
$sender->DataSource=$this->getDummyData($token);
|
|
|
10 |
$sender->dataBind();
|
|
|
11 |
}
|
|
|
12 |
|
|
|
13 |
public function suggestionSelected1($sender,$param) {
|
|
|
14 |
$id=$sender->Suggestions->DataKeys[ $param->selectedIndex ];
|
|
|
15 |
$this->Selection1->Text='Selected ID: '.$id;
|
|
|
16 |
}
|
|
|
17 |
|
|
|
18 |
public function suggestionSelected2($sender,$param) {
|
|
|
19 |
$id=$sender->Suggestions->DataKeys[ $param->selectedIndex ];
|
|
|
20 |
$this->Selection2->Text='Selected ID: '.$id;
|
|
|
21 |
}
|
|
|
22 |
|
|
|
23 |
public function getDummyData($token) {
|
|
|
24 |
// You would look for matches to the given token here
|
|
|
25 |
return array(
|
|
|
26 |
array('id'=>1, 'name'=>'John'),
|
|
|
27 |
array('id'=>2, 'name'=>'Paul'),
|
|
|
28 |
array('id'=>3, 'name'=>'George'),
|
|
|
29 |
array('id'=>4, 'name'=>'Ringo')
|
|
|
30 |
);
|
|
|
31 |
}
|
|
|
32 |
}
|
|
|
33 |
|
|
|
34 |
?>
|