/** * Saves the order of the given ids. * */ public function saveorderAction() { $ids = $this->_getParam('ids'); if (!strlen($ids)) { $this->flash("Invalid IDs specified"); $this->renderView('error.php'); } $ids = split(',', $ids); if (count($ids)) { $feature = null; for ($i = 0, $c = count($ids); $i < $c; $i++) { $id = str_replace('featurelist_', '', $ids[$i]); $feature = $this->projectService->getFeature($id); /* @var $feature Feature */ if (!$feature) { continue; } $feature->sortorder = $i; $this->log->debug("Setting order for {$feature->title} to {$i}"); $this->projectService->saveFeature($feature); } if (!$this->_getParam('_ajax')) { $this->redirect('project', 'view', array('id' => $feature->projectid, '#features')); } } }