-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit
- Loading branch information
Showing
10 changed files
with
1,227 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
<? | ||
|
||
require_once('GenericEventObject.php'); | ||
|
||
class CustomEventClass extends GenericEventClass { | ||
|
||
|
||
private $FOnCustomBeginShow = ''; | ||
private $FOnCustomShowValue = ''; | ||
private $FOnCustomEndShow = ''; | ||
private $Value; | ||
|
||
function __construct($aValue) { | ||
$this->Value = $aValue; | ||
} | ||
|
||
function __destruct() { } | ||
|
||
function setOnCustomBeginShow($aValue) { | ||
|
||
if (is_string($aValue)) { | ||
$this->FOnCustomBeginShow = $aValue; | ||
} | ||
|
||
} | ||
|
||
function setOnCustomEndShow($aValue) { | ||
|
||
if (is_string($aValue)) { | ||
$this->FOnCustomEndShow = $aValue; | ||
} | ||
|
||
} | ||
|
||
|
||
function setOnCustomShowValue($aValue) { | ||
|
||
if (is_string($aValue)) { | ||
$this->FOnCustomShowValue = $aValue; | ||
} | ||
|
||
} | ||
|
||
function Show() { | ||
|
||
$this->DispachEvent($this->FOnCustomBeginShow); | ||
|
||
$this->DispachEvent($this->FOnCustomShowValue,$this->Value); | ||
|
||
$this->DispachEvent($this->FOnCustomEndShow); | ||
|
||
} | ||
|
||
|
||
} | ||
|
||
|
||
class MyCustomClass extends CustomEventClass { | ||
|
||
|
||
function __construct($aValue) { | ||
|
||
parent::__construct($aValue); | ||
$this->setOnCustomBeginShow('CustomBeginShow'); | ||
$this->setOnCustomShowValue('CustomShowValue'); | ||
$this->setOnCustomEndShow('CustomEndShow'); | ||
} | ||
|
||
|
||
function CustomBeginShow() { | ||
echo 'Il valore della proprietà è: <b><i>'; | ||
} | ||
|
||
function CustomShowValue($aValue) { | ||
echo $aValue; | ||
} | ||
|
||
function CustomEndShow() { | ||
echo '</b></i><br>Fine della visualizzazione'; | ||
} | ||
|
||
} | ||
|
||
function MyBeginShow() { | ||
echo 'Il valore della proprietà è: <b>'; | ||
} | ||
|
||
|
||
function MyShowValue($self,$aValue) { | ||
echo $aValue; | ||
} | ||
|
||
function MyEndShow() { | ||
echo '</b><br>Fine della visualizzazione<br/>'; | ||
|
||
} | ||
|
||
|
||
echo '<html>'; | ||
echo '<body>'; | ||
|
||
|
||
$MyCustomEventObject = new CustomEventClass(123); | ||
$MyCustomEventObject->setOnCustomBeginShow('MyBeginShow'); | ||
$MyCustomEventObject->setOnCustomEndShow('MyEndShow'); | ||
$MyCustomEventObject->setOnCustomShowValue('MyShowValue'); | ||
|
||
|
||
$MyCustomEventObject->Show(); | ||
|
||
|
||
$MyCustomObject = new MyCustomClass(456); | ||
$MyCustomObject->Show(); | ||
|
||
echo '</body>'; | ||
echo '</html>'; | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
<? | ||
|
||
require_once('GenericDbViewer.php'); | ||
require_once('GenericDataViewer.php'); | ||
|
||
|
||
|
||
|
||
class CustomTableViewer extends GenericDataViewer { | ||
|
||
function __construct() { | ||
|
||
parent::__construct('localhost','test','test','TEST'); | ||
$this->setOnPrepareData('CustomOnPrepareData'); | ||
$this->setOnBeginData('CustomOnBeginData'); | ||
$this->setOnShowData('CustomOnShowData'); | ||
$this->setOnEndData('CustomOnEndData'); | ||
$this->setOnEmptyData('CustomOnEmptyData'); | ||
} | ||
|
||
function CustomOnPrepareData() { | ||
return $this->db->sqlSelect("SELECT * FROM utenti"); | ||
} | ||
|
||
function CustomOnBeginData() { | ||
echo '<table border="1" cellpadding="4" cellspacing="2">'; | ||
echo '<thead>'; | ||
echo '<tr>'; | ||
echo '<th>Nome</th>'; | ||
echo '<th>Cognome</th>'; | ||
echo '<th>Valore</th>'; | ||
echo '</tr>'; | ||
echo '</thead>'; | ||
echo '<tbody>'; | ||
} | ||
|
||
function CustomOnShowData($P_Utente,$Nome,$Cognome,$Valore,$Cancellato) { | ||
|
||
echo '<tr>'; | ||
echo '<td>';echo $Nome;echo '</td>'; | ||
echo '<td>';echo $Cognome;echo '</td>'; | ||
echo '<td>';echo $Valore;echo '</td>'; | ||
echo '</tr>'; | ||
} | ||
|
||
function CustomOnEndData() { | ||
|
||
echo '</tbody>'; | ||
echo '</table>'; | ||
|
||
} | ||
|
||
function CustomOnEmptyData() { | ||
|
||
echo '<p>Non ci sono dati</p>'; | ||
|
||
} | ||
|
||
function __destruct() { | ||
|
||
} | ||
|
||
} | ||
|
||
|
||
class CustomListViewer extends GenericDataViewer { | ||
|
||
function __construct() { | ||
|
||
parent::__construct('localhost','test','test','TEST'); | ||
$this->setOnPrepareData('CustomOnPrepareData'); | ||
$this->setOnBeginData('CustomOnBeginData'); | ||
$this->setOnShowData('CustomOnShowData'); | ||
$this->setOnEndData('CustomOnEndData'); | ||
$this->setOnEmptyData('CustomOnEmptyData'); | ||
} | ||
|
||
function CustomOnPrepareData() { | ||
return $this->db->sqlSelect("SELECT * FROM utenti"); | ||
} | ||
|
||
function CustomOnBeginData() { | ||
|
||
echo '<ul>'; | ||
|
||
} | ||
|
||
function CustomOnShowData($P_Utente,$Nome,$Cognome,$Valore,$Cancellato) { | ||
|
||
echo '<li>'; | ||
echo '<p>';echo $Nome;echo '</p>'; | ||
echo '<p>';echo $Cognome;echo '</p>'; | ||
echo '<p>';echo $Valore;echo '</p>'; | ||
echo '</li>'; | ||
} | ||
|
||
function CustomOnEndData() { | ||
|
||
echo '</ul>'; | ||
|
||
} | ||
|
||
function CustomOnEmptyData() { | ||
|
||
echo '<p>Non ci sono dati</p>'; | ||
|
||
} | ||
|
||
function __destruct() { | ||
|
||
} | ||
|
||
} | ||
|
||
|
||
$MyCustomTableViewer = new CustomTableViewer(); | ||
$MyCustomTableViewer->Show(); | ||
|
||
$MyCustomListViewer = new CustomListViewer(); | ||
$MyCustomListViewer->Show(); | ||
|
||
|
||
/* | ||
$db = new GenericDbViewer('localhost','test','test','TEST'); | ||
$rs = $db->sqlSelect("SELECT * FROM utenti"); | ||
if ($rs) { | ||
echo '<table border="1" cellpadding="4" cellspacing="2">'; | ||
echo '<thead>'; | ||
echo '<tr>'; | ||
echo '<th>Nome</th>'; | ||
echo '<th>Cognome</th>'; | ||
echo '<th>Valore</th>'; | ||
echo '</tr>'; | ||
echo '</thead>'; | ||
echo '<tbody>'; | ||
do { | ||
echo '<tr>'; | ||
echo '<td>';echo $rs['Nome'];echo '</td>'; | ||
echo '<td>';echo $rs['Cognome'];echo '</td>'; | ||
echo '<td>';echo $rs['Valore'];echo '</td>'; | ||
echo '</tr>'; | ||
} while ($rs = $db->sqlFetch()); | ||
echo '</tbody>'; | ||
echo '</table>'; | ||
} else { | ||
echo '<p>Non ci sono dati</p>'; | ||
} | ||
*/ | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<? | ||
|
||
require_once('GenericEventListener.php'); | ||
|
||
class CustomEventListener extends GenericEventListener { | ||
|
||
|
||
function handler_MSG_CUSTOM($aString,$aNumber) { | ||
echo "<p>"; | ||
echo "function ".__FUNCTION__." handled with params: "; | ||
var_dump(func_get_args()); | ||
echo "<br>"; | ||
$this->PostMessage('MSG_DEFAULT','handler_MSG_DEFAULT',array('stringa2',321)); | ||
echo "</p>"; | ||
} | ||
|
||
|
||
function handler_MSG_DEFAULT($aString,$aNumber) { | ||
echo "<p>"; | ||
echo "function ".__FUNCTION__." handled with params: "; | ||
var_dump(func_get_args()); | ||
echo "<br>"; | ||
echo "</p>"; | ||
} | ||
|
||
} | ||
|
||
|
||
$CustomEventListener = new CustomEventListener(); | ||
|
||
$CustomEventListener->PostMessage('MSG_CUSTOM','handler_MSG_CUSTOM',array('stringa',1)); | ||
|
||
|
||
$CustomEventListener->ProcessMessages(); | ||
|
||
?> |
Oops, something went wrong.