I would like to create a little dialog on publishing-events on an item of my self-developed component.
For example: Item gets published
- the item's controller is called and rund method publish
with $task
publish
.
But now I would like to interrupt publishing-process: The user shall answer a question - for example:
Are you sure? Yes (publish)
or No (exit)
This is the source of my controller so far:
/**
* publish function.
*
* @access public
* @return void
*/
public function publish()
{
$app = JFactory::getApplication();
$jinput = JFactory::getApplication()->input;
$ids = $jinput->get('cid', '', 'array');
$task = $this->getTask();
$date = JFactory::getDate();
$modelitem = $this->getModel('Item');
foreach($ids as $id)
{
switch($task)
{
case 'publish' : // do stuff
break;
case 'unpublish': // do stuff
break;
case 'archive' : // do stuff
break;
case 'trash' : // do stuff
break;
}
}
$publish = $modelitem->publish($id, $state);
$this->setRedirect('index.php?option=com_bestia&view=items', false);
return true;
}