Revision 1835
Added by Luisehahne over 13 years ago
| move_to.php | ||
|---|---|---|
| 63 | 63 |
$table = TABLE_PREFIX.'pages'; |
| 64 | 64 |
} |
| 65 | 65 |
} |
| 66 |
$bModified = ($id_field == 'page_id') ? $bModified : false; |
|
| 66 | 67 |
|
| 67 | 68 |
$iPageId = intval($_GET['page_id']); |
| 68 | 69 |
// Get current index |
| 69 |
$sql = 'SELECT `'.$common_field.'`,`position`,`page_id` FROM `'.$table.'` WHERE `'.$id_field.'` ='.(int)$id; //.' AND page_id='.$iPageId;
|
|
| 70 |
$sql = 'SELECT `'.$common_field.'`,`position` FROM `'.$table.'` WHERE `'.$id_field.'` ='.(int)$id; //.' AND page_id='.$iPageId; |
|
| 70 | 71 |
if($oRes=$database->query($sql)) {
|
| 71 | 72 |
if($aPage = $oRes->fetchRow(MYSQL_ASSOC)){
|
| 72 | 73 |
$common_id = intval($aPage[$common_field]); |
| 73 | 74 |
$old_position = intval($aPage['position']); |
| 74 |
$iPageId = intval($aPage['page_id']); |
|
| 75 | 75 |
} |
| 76 | 76 |
} |
| 77 | 77 |
|
| ... | ... | |
| 90 | 90 |
if($old_position == $position) |
| 91 | 91 |
return; |
| 92 | 92 |
*/ |
| 93 |
|
|
| 93 | 94 |
// all echos with <pre> coded for looking in firebug console |
| 94 | 95 |
$sSqlModify = ($bModified == true) ? ',`modified_when` = '.time().',`modified_by` = '.$admin->get_user_id().' ' : ''; |
| 95 | 96 |
if($old_position != $position) {
|
| 97 |
} |
|
| 96 | 98 |
echo $output = ($bDebug == false) ? "\n" : "<pre>$sql</pre>\n"; |
| 97 | 99 |
// Build query to update affected rows |
| 98 | 100 |
if($old_position < $position) |
| ... | ... | |
| 116 | 118 |
EOT; |
| 117 | 119 |
echo $output = ($bDebug == false) ? "\n" : "<pre>$sql</pre>\n"; |
| 118 | 120 |
$database->query($sql); |
| 119 |
} |
|
| 121 |
if(!class_exists('order', false)){ include(WB_PATH.'/framework/class.order.php'); }
|
|
| 122 |
$order = new order($table, 'position', $id_field, $common_field); |
|
| 123 |
$order->clean($common_id); |
|
| 124 |
echo $output = ($bDebug == false) ? "\n" : "<pre>$table,'position','$id_field','$common_field'</pre>\n"; |
|
| 125 |
echo $output = ($bDebug == false) ? "\n" : "<pre>$common_id</pre>\n"; |
|
| 126 |
|
|
| 120 | 127 |
} else {
|
| 121 | 128 |
die("Missing parameters");
|
| 122 | 129 |
header("Location: index.php");
|
Also available in: Unified diff
! update dragdrop reorder positions of a page tree