Skip to content

Instantly share code, notes, and snippets.

@kritik
Created August 27, 2010 10:35
Show Gist options
  • Save kritik/553162 to your computer and use it in GitHub Desktop.
Save kritik/553162 to your computer and use it in GitHub Desktop.
<?php
/**
* Hello Controller for Hello World Component
*
* @package VladimirKrylov
* @subpackage Components
* @license GNU/GPL
*/
// No direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
/**
* Hello Hello Controller
*
* @package Joomla.Tutorials
* @subpackage Components
*/
class GisesControllerGis extends GisesController
{
/**
* constructor (registers additional tasks to methods)
* @return void
*/
function __construct()
{
parent::__construct();
// Register Extra tasks
$this->registerTask( 'add' , 'edit' );
}
/**
* display the edit form
* @return void
*/
function edit()
{
JRequest::setVar( 'view', 'gis' );
JRequest::setVar( 'layout', 'form' );
JRequest::setVar('hidemainmenu', 1);
parent::display();
}
/**
* save a record (and redirect to main page)
* @return void
*/
function save()
{
$model = $this->getModel('gis');
if ($model->store($post)) {
$msg = JText::_( 'Shop Saved!' );
} else {
$msg = JText::_( 'Error Saving Greeting' );
}
// Check the table in so it can be edited.... we are done with it anyway
$link = 'index.php?option=com_gis';
$this->setRedirect($link, $msg);
}
/**
* remove record(s)
* @return void
*/
function remove()
{
$model = $this->getModel('gis');
if(!$model->delete()) {
$msg = JText::_( 'Error: One or More Shops Could not be Deleted' );
} else {
$msg = JText::_( 'Shop(s) Deleted' );
}
$this->setRedirect( 'index.php?option=com_gis', $msg );
}
/**
* cancel editing a record
* @return void
*/
function cancel()
{
$msg = JText::_( 'Operation Cancelled' );
$this->setRedirect( 'index.php?option=com_gis', $msg );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment