id = $id;
$this->moduleClass = (($moduleClass=="")?get_class($this):$moduleClass);
$this->stylesheet = (($moduleClass!="")?$moduleClass.".css":"");
$this->title = $title;
$this->preContent = "";
$this->imageUrl = $image;
if( !$this->titleBarSuffix ) $this->titleBarSuffix = "";
$this->scripts = array();
$this->columnWidth = 100;
// Add the RSS-feed button to the module automatically if this module has a feed.
if($this->hasFeed()){
$feedButton = "";
$feedButton.= "
";
$this->appendTitleBarSuffix($feedButton);
}
// Helps for including external resources relative to where on the server the app was put.
$this->codePath = getCodePath();
}
public function setStylesheet($styleFile){$this->stylesheet = $styleFile;}
abstract public function getContent();
public function getImage(){
$retVal = "";
if($this->imageUrl != ""){
$title = str_replace("'", "'", $this->title);
$retVal = "";
}
return $retVal;
}
public function getImageUrl(){return $this->imageUrl;}
public function getTitle(){return $this->title;}
public function getStylesheet(){ return $this->stylesheet; }
public function addScript($scriptFile){$this->scripts[] = $scriptFile;}
public function getScripts(){return $this->scripts;}
public function getModuleClass(){return $this->moduleClass;}
public function getId(){ return $this->id; }
public function getHtmlId(){ return "module_$this->moduleClass".(($this->id==="")?"":"_$this->id"); }
public function hasFeed(){return false;}
public function getFeedUrl(){return "http://".$_SERVER['SERVER_NAME'];}
public function getFeedTitle(){return "RSS Feed";}
public function setTitle($title){$this->title = $title;}
public function setTitleBarSuffix($suffix){$this->titleBarSuffix = $suffix;}
public function appendTitleBarSuffix($suffix){$this->titleBarSuffix .= $suffix;}
public function setId($id){ $this->id = $id; }
public function setImage($img){$this->imageUrl = $img;}
public function setPreContent($code){$this->preContent = $code;}
public function addPreContent($code){$this->preContent.= $code;}
public function setColumnWidth( $columnWidth ){$this->columnWidth = $columnWidth;}
protected function getTop(){
$title = str_replace('"', "'", $this->title); // allows title to have single or double quotes without breaking
return "