/** * Save changes to the current menu array after a drag event occurs * @return bool */ public function SaveDrag() { global $langmessage; $this->CacheSettings(); if (is_null($this->curr_menu_array)) { msg($langmessage['OOPS'] . '(1)'); return false; } $key = $_POST['drag_key']; if (!isset($this->curr_menu_array[$key])) { msg($langmessage['OOPS'] . ' (Unknown menu key)'); return false; } $moved = $this->RmMoved($key); if (!$moved) { msg($langmessage['OOPS'] . '(3)'); return false; } // if prev (sibling) set if (!empty($_POST['prev'])) { $inserted = $this->MenuInsert_After($moved, $_POST['prev']); // if parent is set } elseif (!empty($_POST['parent'])) { $inserted = $this->MenuInsert_Child($moved, $_POST['parent']); // if no siblings, no parent then it's the root } else { $inserted = $this->MenuInsert_Before($moved, false); } if (!$inserted) { $this->RestoreSettings(); msg($langmessage['OOPS'] . '(4)'); return; } if (!$this->SaveMenu(false)) { $this->RestoreSettings(); \gp\tool::AjaxWarning(); return false; } }