public function ajaxReorder() { if (!$this->request()->postVariables()) { $response = ['result' => false]; $response = new Response($response); $response->addHeader('Content-Type', 'application/json'); return $response; } foreach ($this->request()->postVariables('order') as $order => $cid) { $campaign = new Campaign($cid); $campaign->sortOrder = $order; $campaign->saveChanges(); } $response = ['result' => true]; $response = new Response($response); $response->addHeader('Content-Type', 'application/json'); return $response; }
public function ajaxReorder() { if (!$this->request()->postVariables()) { return; } $processors = $this->_campaign->processors; $newProcessors = []; foreach ($this->request()->postVariables('order') as $pid) { $newProcessors[] = $processors[$pid]; } $this->_campaign->processors = $newProcessors; $response = ['result' => $this->_campaign->saveChanges()]; $response = new Response($response); $response->addHeader('Content-Type', 'application/json'); return $response; }