Created
July 4, 2012 18:31
-
-
Save rvsjoen/3048787 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class BaseController extends JControllerForm | |
{ | |
public function delete() | |
{ | |
// Do shit | |
$this->setRedirect(JRoute::_($this->getRedirectToList(), false)); | |
} | |
protected function getRedirectToList() | |
{ | |
$link = 'index.php?option='.$this->option; | |
$input = JFactory::getApplication()->input; | |
if($id = $input->get('Itemid')){ | |
$link .= '&Itemid='.$id; | |
} else { | |
$link .= '&view='.$this->view_list; | |
} | |
return $link; | |
} | |
protected function getRedirectToItem() | |
{ | |
$link = 'index.php?option='.$this->option.'&view='.$this->view_item; | |
return $link; | |
} | |
} | |
class ItemController extends BaseController | |
{ | |
public function task1() // A task that should redirect back to the item view | |
{ | |
$link = JRoute::_($this->getRedirectToItem().'&id='.$state->get('item.id'), false); | |
$this->setRedirect($link, $msg); | |
} | |
public function task2() // A task that should redirect back to the list view | |
{ | |
$link = JRoute::_($this->getRedirectToList().$this->getRedirectToListAppend(), false); | |
$this->setRedirect($link, $msg); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment