Created
August 27, 2010 10:35
-
-
Save kritik/553162 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 | |
/** | |
* 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