. */ abstract class modCore { /** * Custom message * @var string */ public $message; /** * Current mode. Can be used by modules to determine * what to do * @var string */ public $mode; /** * smDatabase object * @var object */ protected $db; /** * smTemplate object * @var object */ protected $tpl; /** * Template Id that should be added to the main template * @var string * @see setTemplateId() getTemplateId() */ protected $tpl_id; function __construct() { global $db; $this->db = ($db) ? $db : new smDatabase(); $this->tpl = new smTemplate(); } /** * Create the HTML code for the module. * First the createHTMLLabels() will be called to add all labels to the template, * Then the tpl_id set in $this->getTemplateId() will be added to the main template automatically */ public function createHTML() { // add JS and CSS files $this->tpl->addJS('monitor.js'); $this->tpl->addCSS('monitor.css'); if(sm_get_conf('show_update')) { // user wants updates, lets see what we can do $this->createHTMLUpdateAvailable(); } $this->createHTMLLabels(); // add the module's custom template to the main template to get some content $this->tpl->addTemplatedata( 'main', array( 'content' => $this->tpl->getTemplate($this->getTemplateId()), 'message' => ($this->message == '') ? ' ' : $this->message, ) ); // display main template echo $this->tpl->display('main'); } /** * First check if an update is available, if there is add a message * to the main template */ protected function createHTMLUpdateAvailable() { // check for updates? if(sm_check_updates()) { // yay, new update available =D $this->tpl->addTemplateData( 'main', array( 'update_available' => '