Admin Controller

It changes the order of one or more records.

  • return boolean - True on success
public function reorder()
{
// Check for request forgeries.
$this->checkToken();

$ids = $this->input->post->get('cid', array(), 'array');
$inc = $this->getTask() === 'orderup' ? -1 : 1;

$model = $this->getModel();
$return = $model->reorder($ids, $inc);

if ($return === false)
{
// Reorder failed.
$message = \JText::sprintf('JLIB_APPLICATION_ERROR_REORDER_FAILED', $model->getError());
$this->setRedirect(\JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false), $message, 'error');

return false;
}
else
{
// Reorder succeeded.
$message = \JText::_('JLIB_APPLICATION_SUCCESS_ITEM_REORDERED');
$this->setRedirect(\JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false), $message);

return true;
}
}