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 = "$title"; } 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 "
\n". "
\n". "
 
 
\n". "
 
 
\n". "
\n". "
".$this->getImage()."$this->title 
". "
 $this->titleBarSuffix
". "
\n". "
\n"; } protected function getPreContent(){ return $this->preContent; } protected function getBottom(){ return "
\n". "
 
 
\n". "
 
 
\n". "
\n". "
\n". "
\n"; } public function getHTML(){ return $this->getTop()."
\n".$this->getPreContent()."\n".$this->getContent()."
\n".$this->getBottom(); } // Added in doItLater... not in original Pedlr code. This function will just output the module's code. public function display(){ print $this->getHTML(); } } // end class Module ?>