| version 1.16, 2002/10/20 22:04:19 |
version 1.17, 2002/10/21 21:30:41 |
|
|
| * http://www.platon.sk/projects/phpMyEdit/ |
* http://www.platon.sk/projects/phpMyEdit/ |
| */ |
*/ |
| |
|
| /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.15 2002/10/18 20:58:11 nepto Exp $ */ |
/* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.16 2002/10/20 22:04:19 nepto Exp $ */ |
| |
|
| /* phpMyEdit intro {{{ */ |
/* phpMyEdit intro {{{ */ |
| /* |
/* |
|
|
| function view_enabled() { return stristr($this->options, 'V'); } |
function view_enabled() { return stristr($this->options, 'V'); } |
| function copy_enabled() { return stristr($this->options, 'P') && $this->add_enabled(); } |
function copy_enabled() { return stristr($this->options, 'P') && $this->add_enabled(); } |
| function hidden($k) { return stristr($this->fdd[$k]['options'],'H'); } |
function hidden($k) { return stristr($this->fdd[$k]['options'],'H'); } |
| function password($k) { return stristr($this->fdd[$k]['options'],'P'); } |
function password($k) { return stristr($this->fdd[$k]['options'],'W'); } |
| function readonly($k) { return stristr($this->fdd[$k]['options'],'R') || $this->fdd[$k]['expression']; } |
function readonly($k) { return stristr($this->fdd[$k]['options'],'R') || $this->fdd[$k]['expression']; } |
| |
|
| function add_operation() { return $this->operation == $this->labels['Add'] && $this->add_enabled(); } |
function add_operation() { return $this->operation == $this->labels['Add'] && $this->add_enabled(); } |
| function change_operation() { return $this->operation == $this->labels['Change'] && $this->change_enabled(); } |
function change_operation() { return $this->operation == $this->labels['Change'] && $this->change_enabled(); } |
| function copy_operation() { return $this->operation == $this->labels['Copy'] && $this->add_enabled(); } |
function copy_operation() { return $this->operation == $this->labels['Copy'] && $this->copy_enabled(); } |
| function delete_operation() { return $this->operation == $this->labels['Delete'] && $this->delete_enabled(); } |
function delete_operation() { return $this->operation == $this->labels['Delete'] && $this->delete_enabled(); } |
| function view_operation() { return $this->operation == $this->labels['View'] && $this->view_enabled(); } |
function view_operation() { return $this->operation == $this->labels['View'] && $this->view_enabled(); } |
| function filter_operation() { return $this->fl && $this->filter_enabled(); } |
function filter_operation() { return $this->fl && $this->filter_enabled(); } |
|
|
| } |
} |
| $options = $this->fdd[$k]['options']; |
$options = $this->fdd[$k]['options']; |
| |
|
| return empty($options) || |
return ! isset($options) || |
| (! $this->hidden($k) && ( |
(! $this->hidden($k) && ( |
| ($this->add_operation() && stristr($options,'A')) || |
($this->add_operation() && stristr($options, 'A')) || |
| ($this->view_operation() && stristr($options,'V')) || |
($this->view_operation() && stristr($options, 'V')) || |
| ($this->change_operation() && stristr($options,'C')) || |
($this->change_operation() && stristr($options, 'C')) || |
| ($this->delete_operation() && stristr($options,'D')) || |
($this->copy_operation() && stristr($options, 'P')) || |
| ($this->filter_operation() && stristr($options,'F')) || |
($this->delete_operation() && stristr($options, 'D')) || |
| |
($this->filter_operation() && stristr($options, 'F')) || |
| (stristr($options,'L') && |
(stristr($options,'L') && |
| ! $this->add_operation() && |
! $this->add_operation() && |
| ! $this->view_operation() && |
! $this->view_operation() && |
| ! $this->change_operation() && |
! $this->change_operation() && |
| |
! $this->copy_operation() && |
| ! $this->delete_operation() && |
! $this->delete_operation() && |
| ! $this->filter_operation()) |
! $this->filter_operation()) |
| )); |
)); |
|
|
| for ($k = 0; $k < $this->num_fds; $k++) { |
for ($k = 0; $k < $this->num_fds; $k++) { |
| if ($this->copy_operation()) { |
if ($this->copy_operation()) { |
| if ($this->displayed[$k]) { |
if ($this->displayed[$k]) { |
| echo ' <tr>'; |
echo '<tr>'; |
| echo ' <td>'.$this->fdd[$k]['name'].'</td>'."\n"; |
echo '<td>'.$this->fdd[$k]['name'].'</td>'."\n"; |
| if ($this->readonly($k)) { |
if ($this->readonly($k)) { |
| echo $this->display_delete_field($row, $k); |
echo $this->display_delete_field($row, $k); |
| } elseif ($this->password($k)) { |
} elseif ($this->password($k)) { |
| echo ' <td><input type="password" name="'.$this->fds[$k] |
echo '<td><input type="password" name="'.$this->fds[$k] |
| .'" value="'.$this->htmlDisplay($this->fdd[$k], $row["qf$k"], false) |
.'" value="'.$this->htmlDisplay($this->fdd[$k], $row["qf$k"], false) |
| .'" /></td>'; |
.'" /></td>'; |
| } else { |
} else { |
|
|
| } |
} |
| if ($this->guidance) { |
if ($this->guidance) { |
| if ($this->fdd[$k]['help']) |
if ($this->fdd[$k]['help']) |
| echo ' <td>'.$this->fdd[$k]['help'].'</td>'."\n"; |
echo '<td>'.$this->fdd[$k]['help'].'</td>'."\n"; |
| else |
else |
| echo ' <td> </td>'."\n"; |
echo '<td> </td>'."\n"; |
| } |
} |
| echo ' </tr>'."\n"; |
echo '</tr>'."\n"; |
| } // if field displayed |
} // if field displayed |
| elseif ($this->hidden($k)) { |
elseif ($this->hidden($k)) { |
| if ($k != $this->key_num) { |
if ($k != $this->key_num) { |
|
|
| .'" value="'.$this->htmlDisplay($this->fdd[$k], $row["qf$k"], false) |
.'" value="'.$this->htmlDisplay($this->fdd[$k], $row["qf$k"], false) |
| .'" />'."\n"; |
.'" />'."\n"; |
| } elseif ($this->displayed[$k]) { |
} elseif ($this->displayed[$k]) { |
| echo ' <tr>'."\n"; |
echo '<tr>'."\n"; |
| echo ' <td>'.$this->fdd[$k]['name'].'</td>'."\n"; |
echo '<td>'.$this->fdd[$k]['name'].'</td>'."\n"; |
| $this->display_change_field($row, $k); |
$this->display_change_field($row, $k); |
| if ($this->guidance) { |
if ($this->guidance) { |
| if ($this->fdd[$k]['help']) |
if ($this->fdd[$k]['help']) |
| echo ' <td>'.$this->fdd[$k]['help'].'</td>'."\n"; |
echo '<td>'.$this->fdd[$k]['help'].'</td>'."\n"; |
| else |
else |
| echo ' <td> </td>'."\n"; |
echo '<td> </td>'."\n"; |
| } |
} |
| echo ' </tr>'."\n"; |
echo '</tr>'."\n"; |
| } |
} |
| } elseif ($this->delete_operation() || $this->view_operation()) { |
} elseif ($this->delete_operation() || $this->view_operation()) { |
| if ($this->displayed[$k]) { |
if ($this->displayed[$k]) { |
| echo ' <tr>'."\n"; |
echo '<tr>'."\n"; |
| echo ' <td>'.$this->fdd[$k]['name'].'</td>'."\n"; |
echo '<td>'.$this->fdd[$k]['name'].'</td>'."\n"; |
| $this->display_delete_field($row, $k); |
$this->display_delete_field($row, $k); |
| if ($this->guidance) |
if ($this->guidance) |
| if ($this->fdd[$k]['help']) |
if ($this->fdd[$k]['help']) |
| echo ' <td>'.$this->fdd[$k]['help'].'</td>'."\n"; |
echo '<td>'.$this->fdd[$k]['help'].'</td>'."\n"; |
| else |
else |
| echo ' <td> </td>'."\n"; |
echo '<td> </td>'."\n"; |
| echo ' </tr>'."\n"; |
echo '</tr>'."\n"; |
| } |
} |
| } |
} |
| } // for |
} // for |
|
|
| } |
} |
| |
|
| echo '<table width="100%" border="1" cellpadding="1" cellspacing="0" summary="'.$this->tb.'">'."\n"; |
echo '<table width="100%" border="1" cellpadding="1" cellspacing="0" summary="'.$this->tb.'">'."\n"; |
| echo '<input type="hidden" name="rec" value="'.($this->copy_operation()?'':$this->rec).'" />'."\n"; |
echo '<input type="hidden" name="rec" value="'.($this->copy_operation()?'':$this->rec).'">'."\n"; |
| echo '<input type="hidden" name="fm" value="'.$this->fm.'" />'."\n"; |
echo '<input type="hidden" name="fm" value="'.$this->fm.'">'."\n"; |
| echo '<input type="hidden" name="sfn" value="'.$this->sfn.'" />'."\n"; |
echo '<input type="hidden" name="sfn" value="'.($this->sort_asc?'':'-').$this->sfn.'">'."\n"; |
| echo '<input type="hidden" name="fl" value="'.$this->fl.'" />'."\n"; |
echo '<input type="hidden" name="fl" value="'.$this->fl.'">'."\n"; |
| echo $this->get_qf_hidden_fields(); |
echo $this->get_qf_hidden_fields(); |
| echo '<input type="hidden" name="qfn" value="'.htmlspecialchars($this->qfn).'" />'."\n"; |
echo '<input type="hidden" name="qfn" value="'.htmlspecialchars($this->qfn).'">'."\n"; |
| /* |
/* |
| $this->qfn = ''; |
$this->qfn = ''; |
| for ($k = 0; $k < $this->num_fds; $k++) { |
for ($k = 0; $k < $this->num_fds; $k++) { |
| Line 2786 echo '<h5>'.mysql_affected_rows ().' '.$ |
|
| Line 2788 echo '<h5>'.mysql_affected_rows ().' '.$ |
|
| $aval['help'] && $this->guidance = true; |
$aval['help'] && $this->guidance = true; |
| $field_num++; |
$field_num++; |
| } |
} |
| |
if (0) { |
| |
echo '<b>Displayed array:</b><pre>'; |
| |
var_dump($this->displayed); |
| |
echo '</pre><hr>'; |
| |
} |
| |
|
| $this->num_fds = $field_num; |
$this->num_fds = $field_num; |
| $this->num_fields_displayed = $num_fields_displayed; |
$this->num_fields_displayed = $num_fields_displayed; |