Admin Controller

It is a method to save the submitted ordering values for records.

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

// Get the input
$pks = $this->input->post->get('cid', array(), 'array');
$order = $this->input->post->get('order', array(), 'array');

// Sanitize the input
$pks = ArrayHelper::toInteger($pks);
$order = ArrayHelper::toInteger($order);

// Get the model
$model = $this->getModel();

// Save the ordering
$return = $model->saveorder($pks, $order);

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.
$this->setMessage(\JText::_('JLIB_APPLICATION_SUCCESS_ORDERING_SAVED'));
$this->setRedirect(\JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false));

return true;
}
}