Created
March 9, 2012 14:50
-
-
Save prestarocket/2006825 to your computer and use it in GitHub Desktop.
Prestashop : base module
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 | |
/* | |
www.prestarocket.com | |
Twitter : @prestarocket | |
*/ | |
if ( !defined( '_PS_VERSION_' ) ) | |
exit; | |
class MyModule extends Module | |
{ | |
public function __construct() | |
{ | |
$this->name = 'mymodule'; | |
$this->tab = 'Test'; | |
$this->version = 1.0; | |
$this->author = 'Firstname Lastname'; | |
$this->need_instance = 0; | |
parent::__construct(); | |
$this->displayName = $this->l( 'My module' ); | |
$this->description = $this->l( 'Description of my module.' ); | |
$this->confirmUninstall = $this->l('Are you sure you want to delete mymodule ?'); | |
} | |
public function install() | |
{ | |
if (!parent::install() OR !$this->registerHook('leftColumn')) | |
return false; | |
return true; | |
} | |
public function uninstall() | |
{ | |
if (!parent::uninstall()) | |
return false; | |
return true; | |
} | |
public function hookLeftColumn( $params ) | |
{ | |
global $smarty; | |
return $this->display( __FILE__, 'mymodule.tpl' ); | |
} | |
public function getContent() | |
{ | |
$output = '<h2>'.$this->displayName.'</h2>'; | |
return $output.$this->displayForm(); | |
} | |
private function displayForm() | |
{ | |
return ' | |
<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post"> | |
<fieldset> | |
<center><input type="submit" name="submitMymoule" value="'.$this->l('Save').'" class="button" /></center> | |
</fieldset> | |
</form>'; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment