| version 1.126, 2004/03/20 21:00:12 |
version 1.127, 2004/03/31 15:00:39 |
|
|
| * http://platon.sk/projects/phpMyEdit/ |
* http://platon.sk/projects/phpMyEdit/ |
| */ |
*/ |
| |
|
| /* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.125 2004/03/20 11:47:19 nepto Exp $ */ |
/* $Platon: phpMyEdit/phpMyEdit.class.php,v 1.126 2004/03/20 21:00:12 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. |
|
|
| |
|
| function create_join_clause() /* {{{ */ |
function create_join_clause() /* {{{ */ |
| { |
{ |
| $tbs[] = $this->tb; |
$tbs[] = $this->tb; |
| $join = $this->tb.' AS PMEtable0'; |
$main_table = 'PMEtable0'; |
| for ($k = 0,$numfds = sizeof($this->fds); $k<$numfds; $k++) { |
$join_clause = $this->tb." AS $main_table"; |
| $field = $this->fds[$k]; |
for ($k = 0, $numfds = sizeof($this->fds); $k < $numfds; $k++) { |
| if($this->fdd[$field]['values']['db']) { |
$main_column = $this->fds[$k]; |
| |
if($this->fdd[$main_column]['values']['db']) { |
| $db = $this->fdd[$field]['values']['db']; |
$db = $this->fdd[$field]['values']['db']; |
| } else { |
} else { |
| $db = $this->db; |
$db = $this->db; |
| } |
} |
| $table = $this->fdd[$field]['values']['table']; |
$table = @$this->fdd[$main_column]['values']['table']; |
| $id = $this->fdd[$field]['values']['column']; |
$join_column = @$this->fdd[$main_column]['values']['column']; |
| $desc = $this->fdd[$field]['values']['description']; |
$join_desc = @$this->fdd[$main_column]['values']['description']; |
| if ($desc != '' && $id != '') { |
if ($join_desc != '' && $join_column != '') { |
| $alias = 'PMEjoin'.$k; |
$join_table = 'PMEjoin'.$k; |
| if (!in_array($alias,$tbs)) { |
if (! in_array($join_table, $tbs)) { |
| $join .= " LEFT OUTER JOIN $db.$table AS $alias"; |
$ar = array( |
| $join .= " ON $alias.$id = PMEtable0.$field"; |
'main_table' => $main_table, |
| $tbs[]=$alias; |
'main_column' => $main_column, |
| |
'join_table' => $join_table, |
| |
'join_column' => $join_column, |
| |
'join_description' => $join_desc); |
| |
$join_clause .= " LEFT OUTER JOIN $db.$table AS $join_table ON "; |
| |
$join_clause .= isset($this->fdd[$field]['values']['join']) |
| |
? $this->substituteVars($this->fdd[$field]['values']['join'], $ar) |
| |
: "$join_table.$join_column = $main_table.$main_column"; |
| |
$tbs[] = $join_table; |
| } |
} |
| } |
} |
| } |
} |