Un esempio (quasi) completo di come si modifica la classe DataObject della tabella selezionata. E' stato aggiunta (a mano) anche la funzione preGenerateForm
/**
* Table Definition for utenti
*/
require_once 'DB/DataObject.php';
class DataObjects_Lybra_Utenti extends DB_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
var $__table = 'lybra_utenti'; // table name
var $id; // int(6) not_null primary_key auto_increment
var $login; // string(12) not_null unique_key
var $password; // blob(65535) not_null blob
var $nome; // string(40) not_null
var $cognome; // string(40) not_null
var $email; // string(40) not_null
var $url; // string(128)
var $telefono_casa; // string(20) not_null
var $telefono_uff; // string(20) not_null
var $telefono_cell; // string(20) not_null
var $telefono_fax; // string(20) not_null
var $lastlogin; // timestamp(14) not_null unsigned zerofill timestamp
var $admin; // int(1) not_null
/* ZE2 compatibility trick*/
function __clone() { return $this;}
/* Static get */
function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('DataObjects_Utenti',$k,$v); }
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
function preGenerateForm(&$fg)
{
$this->textFields = array('indirizzo');
/*
* utilizzo preDefElements per associare particolari campi alle tabelle
* del db
*/
$formChange = array();
$formChange['admin'] =& HTML_QuickForm::createElement('checkbox','admin', 'Amministratore');
$this->preDefElements = $formChange;
$this->fieldLabels = array(
'id' => 'ID',
'login' => 'Nome Utente',
'password' => 'Password',
'nome' => 'Nome',
'cognome' => 'Cognome',
'email' => 'E-Mail',
'url' => 'Sito personale',
'telefono_casa' => 'Telefono Casa',
'telefono_uff' => 'Telefono Ufficio',
'telefono_cell' => 'Telefono Cellulare',
'telefono_fax' => 'Numero Fax',
'lastlogin' => 'Ultima Login',
'admin' => 'Amministratore' );
}
}
lib/WikiUser.php:59: Notice[8]: Only variables should be assigned by reference
lib/Template.php:112: Notice[8]: Only variables should be assigned by reference
lib/Template.php:114: Notice[8]: Only variables should be assigned by reference
lib/Template.php (In template 'html'):112: Notice[8]: Only variables should be assigned by reference
lib/Template.php (In template 'html'):114: Notice[8]: Only variables should be assigned by reference
lib/Template.php (In template 'html'):112: Notice[8]: Only variables should be assigned by reference
lib/Template.php (In template 'html'):114: Notice[8]: Only variables should be assigned by reference
lib/Template.php (In template 'body') (In template 'html'):112: Notice[8]: Only variables should be assigned by reference
lib/Template.php (In template 'body') (In template 'html'):114: Notice[8]: Only variables should be assigned by reference
lib/Template.php (In template 'top') (In template 'body') (In template 'html'):112: Notice[8]: Only variables should be assigned by reference
lib/Template.php (In template 'top') (In template 'body') (In template 'html'):114: Notice[8]: Only variables should be assigned by reference
lib/Template.php (In template 'body') (In template 'html'):112: Notice[8]: Only variables should be assigned by reference
lib/Template.php (In template 'body') (In template 'html'):114: Notice[8]: Only variables should be assigned by reference
lib/CachedMarkup.php (In template 'browse') (In template 'body') (In template 'html'):427: Notice[8]: Only variables should be assigned by reference