/** * Manage position in ajax */ public function ajaxProcessUpdatePositions() { $way = (int) Tools::getValue('way'); $id_now_block_presentation = (int) Tools::getValue('id'); $positions = Tools::getValue($this->table); foreach ($positions as $position => $value) { $pos = explode('_', $value); if (isset($pos[2]) && (int) $pos[2] === $id_now_block_presentation) { if ($oNowBlockPresentation = new NowBlockPresentation((int) $pos[2])) { if (isset($position) && $oNowBlockPresentation->updatePosition($way, $position)) { echo 'ok position ' . (int) $position . ' for bloc presentation ' . (int) $pos[1] . '\\r\\n'; } else { echo '{"hasError" : true, "errors" : "Can not update bloc presentation ' . (int) $id_now_block_presentation . ' to position ' . (int) $position . ' "}'; } } else { echo '{"hasError" : true, "errors" : "This bloc presentation (' . (int) $id_now_block_presentation . ') can t be loaded"}'; } break; } } }