Alcune Action per i moduli del LybraFramework:
questa action va inserita in un file denominato aggiungi.php e salvato nella directory del modulo, grazie ad essa sarà possibile inserire, cancellare e modificare i dati nel db relativi al modulo.
if (eregi('aggiungi.php', $PHP_SELF)) {
die ("You can't access this file directly...");
}
$$modulo = new $dataObjectClass;
if (isset($_REQUEST['id']))
{
$$modulo->get($_REQUEST['id']);
}
$formBuilder = & new DB_DataObject_FormBuilder($$modulo);
if ($_REQUEST['action'] != 'visual') {
if (isset($_REQUEST['id']))
{
$label = "Modifica Dati";
} else {
$label = "Inserimento Dati";
}
} else {
$label = "Visualizza Dati Salvati";
if ( ( isset($_REQUEST['id'])) && ($_REQUEST['id']!= '') && ($$modulo->id != '') )
$formBuilder->_do->createSubmit = false;
$menu = "
<div class='float-box'>
<a href='{$_SERVER['PHP_SELF']}?modulo=$modulo&menu=aggiungi&id={$$modulo->id}' title='modifica'>modifica</a><br/>
<a href='{$_SERVER['PHP_SELF']}?modulo=$modulo&menu=cancella&id={$$modulo->id}' title='cancella' onclick='return askData(\"Vuoi veramente cancellare i dati?\")' >cancella</a>
</div>";
$content['dati'] .= $menu;
}
$formBuilder->form_header_text = $label;
$form =& $formBuilder->getForm();
$form->addElement('hidden', 'modulo', $modulo);
$form->addElement('hidden', 'menu', 'aggiungi');
$form->addElement('hidden', 'action', 'visual');
if ($form->validate()) {
$form->process(array($formBuilder, 'processForm'), false);
}
if ( (isset($_REQUEST['id']) != '') && ($_REQUEST['action'] == 'visual')) {
$form->freeze();
}
$content['debug'] .= "<pre class='small'><b>POST:</b>".print_r($$modulo,true). "</pre>";
$content['dati'] .= $form->toHtml();
if (eregi('cancella', $PHP_SELF)) {
die ("You can't access this file directly...");
}
$content['titolo'] .= ' / Cancella';
$$modulo = new $dataObjectClass;
if (isset($_REQUEST['id']))
{
$$modulo->get($_REQUEST['id']);
$$modulo->delete();
}
$content['dati'] .= "<div>Il dato è stato cancellato con successo</div>";
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