version 1.110, 2004/01/02 18:53:45 |
version 1.111, 2004/01/03 02:27:31 |
|
|
* http://platon.sk/projects/phpMyEdit/ |
* http://platon.sk/projects/phpMyEdit/ |
*/ |
*/ |
|
|
/* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.109 2004/01/02 18:51:36 nepto Exp $ */ |
/* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.110 2004/01/02 18:53:45 nepto Exp $ */ |
|
|
/* This is a generic table editing program. The table and fields to be |
/* This is a generic table editing program. The table and fields to be |
edited are defined in the calling program. |
edited are defined in the calling program. |
|
|
var $moreadd; |
var $moreadd; |
var $savechange; |
var $savechange; |
var $savedelete; |
var $savedelete; |
|
var $canceladd; |
|
var $cancelview; |
|
var $cancelchange; |
|
var $canceldelete; |
|
|
// Additional features |
// Additional features |
var $labels; // multilingual labels |
var $labels; // multilingual labels |
|
|
function prev_operation() { return $this->prev == $this->labels['Prev']; } |
function prev_operation() { return $this->prev == $this->labels['Prev']; } |
function clear_operation() { return $this->sw == $this->labels['Clear']; } |
function clear_operation() { return $this->sw == $this->labels['Clear']; } |
|
|
|
function add_canceled() { return $this->canceladd == $this->labels['Cancel']; } |
|
function view_canceled() { return $this->cancelview == $this->labels['Cancel']; } |
|
function change_canceled() { return $this->cancelchange == $this->labels['Cancel']; } |
|
function delete_canceled() { return $this->canceldelete == $this->labels['Cancel']; } |
|
|
function is_values2($k, $val = 'X') /* {{{ */ |
function is_values2($k, $val = 'X') /* {{{ */ |
{ |
{ |
return $val === null || |
return $val === null || |
Line 1547 function phpMyEdit_form_control(theForm) |
|
Line 1556 function phpMyEdit_form_control(theForm) |
|
echo 'next=',$this->next,' '; |
echo 'next=',$this->next,' '; |
echo 'saveadd=',$this->saveadd,' '; |
echo 'saveadd=',$this->saveadd,' '; |
echo 'moreadd=',$this->moreadd,' '; |
echo 'moreadd=',$this->moreadd,' '; |
|
echo 'canceladd=',$this->canceladd,' '; |
echo 'savechange=',$this->savechange,' '; |
echo 'savechange=',$this->savechange,' '; |
echo 'morechange=',$this->morechange,' '; |
echo 'morechange=',$this->morechange,' '; |
|
echo 'cancelchange=',$this->cancelchange,' '; |
echo 'savedelete=',$this->savedelete,' '; |
echo 'savedelete=',$this->savedelete,' '; |
|
echo 'canceldelete=',$this->canceldelete,' '; |
|
echo 'cancelview=',$this->cancelview,' '; |
echo 'operation=',$this->operation,' '; |
echo 'operation=',$this->operation,' '; |
echo "\n"; |
echo "\n"; |
} /* }}} */ |
} /* }}} */ |
Line 1654 function phpMyEdit_form_control(theForm) |
|
Line 1667 function phpMyEdit_form_control(theForm) |
|
*/ |
*/ |
function list_table() /* {{{ */ |
function list_table() /* {{{ */ |
{ |
{ |
|
// Cancel Triggers |
|
if ($this->add_canceled() && isset($this->triggers['insert']['cancel'])) { |
|
include($this->triggers['insert']['cancel']); |
|
} |
|
if ($this->view_canceled() && isset($this->triggers['select']['cancel'])) { |
|
include($this->triggers['select']['cancel']); |
|
} |
|
if ($this->change_canceled() && isset($this->triggers['update']['cancel'])) { |
|
include($this->triggers['update']['cancel']); |
|
} |
|
if ($this->delete_canceled() && isset($this->triggers['delete']['cancel'])) { |
|
include($this->triggers['delete']['cancel']); |
|
} |
if ($this->fm == '') { |
if ($this->fm == '') { |
$this->fm = 0; |
$this->fm = 0; |
} |
} |
Line 2156 function phpMyEdit_form_control(theForm) |
|
Line 2182 function phpMyEdit_form_control(theForm) |
|
|
|
function display_record() /* {{{ */ |
function display_record() /* {{{ */ |
{ |
{ |
|
// PRE Triggers |
|
$ret = true; |
|
if ($this->change_operation() && isset($this->triggers['update']['pre'])) { |
|
$ret = include($this->triggers['update']['pre']); |
|
// if PRE update fails, then back to view operation |
|
if (! $ret) { |
|
$this->operation = $this->labels['View']; |
|
} |
|
} |
|
if (($this->add_operation() || $this->copy_operation()) |
|
&& isset($this->triggers['insert']['pre'])) { |
|
$ret = include($this->triggers['insert']['pre']); |
|
} |
|
if ($this->view_operation() && isset($this->triggers['select']['pre'])) { |
|
$ret = include($this->triggers['select']['pre']); |
|
} |
|
if ($this->delete_operation() && isset($this->triggers['delete']['pre'])) { |
|
$ret = include($this->triggers['delete']['pre']); |
|
} |
|
// if PRE insert/view/delete fail, then back to the list |
|
if ($ret == false) { |
|
$this->operation = ''; |
|
$this->list_table(); |
|
return; |
|
} |
$this->form_begin(); |
$this->form_begin(); |
if ($this->cgi['persist'] != '') { |
if ($this->cgi['persist'] != '') { |
echo $this->get_origvars_html($this->cgi['persist']); |
echo $this->get_origvars_html($this->cgi['persist']); |
Line 2830 function phpMyEdit_form_control(theForm) |
|
Line 2881 function phpMyEdit_form_control(theForm) |
|
$this->sfn = array_merge($this->sfn, $opts['sort_field']); |
$this->sfn = array_merge($this->sfn, $opts['sort_field']); |
$this->sfn[] = '0'; // this last entry will be replaced in recreate_displayed() |
$this->sfn[] = '0'; // this last entry will be replaced in recreate_displayed() |
// Form variables all around |
// Form variables all around |
$this->operation = $this->get_cgi_var('operation'); |
$this->fl = intval($this->get_cgi_var('fl')); |
$this->fl = intval($this->get_cgi_var('fl')); |
$this->fm = intval($this->get_cgi_var('fm')); |
$this->fm = intval($this->get_cgi_var('fm')); |
$this->qfn = $this->get_cgi_var('qfn'); |
$this->qfn = $this->get_cgi_var('qfn'); |
$this->sw = $this->get_cgi_var('sw'); |
$this->sw = $this->get_cgi_var('sw'); |
$this->rec = $this->get_cgi_var('rec', ''); |
$this->rec = $this->get_cgi_var('rec', ''); |
$this->prev = $this->get_cgi_var('prev'); |
$this->prev = $this->get_cgi_var('prev'); |
$this->next = $this->get_cgi_var('next'); |
$this->next = $this->get_cgi_var('next'); |
$this->operation = $this->get_cgi_var('operation'); |
$this->saveadd = $this->get_cgi_var('saveadd'); |
$this->saveadd = $this->get_cgi_var('saveadd'); |
$this->moreadd = $this->get_cgi_var('moreadd'); |
$this->moreadd = $this->get_cgi_var('moreadd'); |
$this->savechange = $this->get_cgi_var('savechange'); |
$this->canceladd = $this->get_cgi_var('canceladd'); |
$this->morechange = $this->get_cgi_var('morechange'); |
$this->savechange = $this->get_cgi_var('savechange'); |
$this->savedelete = $this->get_cgi_var('savedelete'); |
$this->morechange = $this->get_cgi_var('morechange'); |
|
$this->cancelchange = $this->get_cgi_var('cancelchange'); |
|
$this->savedelete = $this->get_cgi_var('savedelete'); |
|
$this->canceldelete = $this->get_cgi_var('canceldelete'); |
|
$this->cancelview = $this->get_cgi_var('cancelview'); |
// Filter setting |
// Filter setting |
if (isset($this->sw)) { |
if (isset($this->sw)) { |
$this->sw == $this->labels['Search'] && $this->fl = 1; |
$this->sw == $this->labels['Search'] && $this->fl = 1; |